Skip to content

Commit 1413b44

Browse files
committed
Merge branch 'main' into feat/new-comapeocat-format
* main: chore: remove branch filter on release workflow (#1153) chore: release workflow fixes (#1151) fix: Blocked members only expect auth core for initial sync (#1138) chore: cleanup drizzle types (#1141)
2 parents 950014e + 9770709 commit 1413b44

13 files changed

Lines changed: 405 additions & 250 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,31 @@ on:
1414
- minor
1515
- major
1616
- prerelease
17-
# - prepatch
18-
# - preminor
19-
# - premajor
17+
- prepatch
18+
- preminor
19+
- premajor
2020
pull_request:
2121
types: [closed]
22-
branches: [main]
2322

2423
jobs:
2524
release:
26-
if: ${{github.event_name != 'pull_request' || github.event.pull_request.merged}}
25+
if: >-
26+
${{
27+
(
28+
startsWith(github.event.inputs.semver, 'pre') ||
29+
github.ref == format(
30+
'refs/heads/{0}',
31+
github.event.repository.default_branch
32+
)
33+
) &&
34+
(
35+
github.event_name != 'pull_request' ||
36+
(
37+
github.event.pull_request.merged &&
38+
github.event.pull_request.user.login == 'optic-release-automation[bot]'
39+
)
40+
)
41+
}}
2742
runs-on: ubuntu-latest
2843
permissions:
2944
contents: write
@@ -36,11 +51,11 @@ jobs:
3651
commit-message: 'Release {version}'
3752
sync-semver-tags: false
3853
access: 'public'
39-
# This prefix is added before the prerelease number, e.g. `v3.0.0-alpha.0`
40-
# prerelease-prefix: 'alpha'
54+
# This prefix is added before the prerelease number, e.g. `v3.0.0-next.0`
55+
prerelease-prefix: 'next'
4156
semver: ${{ github.event.inputs.semver }}
42-
# Prereleases are published under the `alpha` npm dist-tag
43-
# npm-tag: ${{ startsWith(github.event.inputs.semver, 'pre') && 'alpha' || 'latest' }}
57+
# Prereleases are published under the `next` npm dist-tag
58+
npm-tag: ${{ startsWith(github.event.inputs.semver, 'pre') && 'next' || 'latest' }}
4459
# Don't notify linked issues
4560
notify-linked-issues: false
4661
publish-mode: oidc

package-lock.json

Lines changed: 102 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index-writer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { decode } from '@comapeo/schema'
22
import SqliteIndexer from '@mapeo/sqlite-indexer'
33
import { getTableConfig } from 'drizzle-orm/sqlite-core'
4-
import { getBacklinkTableName } from '../schema/utils.js'
4+
import { getBacklinkTableName } from '../schema/comapeo-to-drizzle.js'
55
import { discoveryKey } from 'hypercore-crypto'
66
import { Logger } from '../logger.js'
77
/** @import { MapeoDoc, VersionIdObject } from '@comapeo/schema' */

src/mapeo-manager.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,9 @@ export class MapeoManager extends TypedEmitter {
792792
// in the config store - defining the name of the project.
793793
// TODO: Enforce adding a project name in the invite method
794794
const isConfigSynced = configState.want === 0 && configState.have > 0
795+
if (isRoleSynced && ownRole.sync.config === 'blocked' && isAuthSynced) {
796+
return true
797+
}
795798
if (
796799
isRoleSynced &&
797800
isProjectSettingsSynced &&
@@ -803,6 +806,7 @@ export class MapeoManager extends TypedEmitter {
803806
this.#l.log(
804807
'Pending initial sync: role %s, projectSettings %o, auth %o, config %o',
805808
isRoleSynced,
809+
isProjectSettingsSynced,
806810
isAuthSynced,
807811
isConfigSynced
808812
)
@@ -811,12 +815,15 @@ export class MapeoManager extends TypedEmitter {
811815
/** @param {import('./sync/sync-state.js').State} syncState */
812816
const onSyncState = (syncState) => {
813817
clearTimeout(timeoutId)
814-
if (syncState.auth.dataToSync || syncState.config.dataToSync) {
818+
if (
819+
syncState.auth.dataToSync ||
820+
(syncState.config.dataToSync && ownRole.sync.config === 'allowed')
821+
) {
815822
timeoutId = setTimeout(onTimeout, timeoutMs)
816823
return
817824
}
818825
project.$sync[kSyncState].off('state', onSyncState)
819-
resolve(this.#waitForInitialSync(project, { timeoutMs }))
826+
this.#waitForInitialSync(project, { timeoutMs }).then(resolve, reject)
820827
}
821828
const onTimeout = () => {
822829
project.$sync[kSyncState].off('state', onSyncState)

src/schema/client.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
// device
44
import { blob, sqliteTable, text, int } from 'drizzle-orm/sqlite-core'
55
import { dereferencedDocSchemas as schemas } from '@comapeo/schema'
6-
import { jsonSchemaToDrizzleColumns as toColumns } from './schema-to-drizzle.js'
7-
import { backlinkTable } from './utils.js'
6+
import {
7+
comapeoSchemaToDrizzleTable as toDrizzle,
8+
backlinkTable,
9+
} from './comapeo-to-drizzle.js'
810

911
/**
1012
* @import { ProjectSettings } from '@comapeo/schema'
@@ -18,11 +20,8 @@ import { backlinkTable } from './utils.js'
1820
/** @type {ProjectInfo} */
1921
const PROJECT_INFO_DEFAULT_VALUE = { sendStats: false }
2022

21-
export const projectSettingsTable = sqliteTable(
22-
'projectSettings',
23-
toColumns(schemas.projectSettings)
24-
)
25-
export const projectBacklinkTable = backlinkTable(projectSettingsTable)
23+
export const projectSettingsTable = toDrizzle(schemas.projectSettings)
24+
export const projectBacklinkTable = backlinkTable('projectSettings')
2625
export const projectKeysTable = sqliteTable('projectKeys', {
2726
projectId: text('projectId').notNull().primaryKey(),
2827
projectPublicId: text('projectPublicId').notNull(),

0 commit comments

Comments
 (0)