Skip to content

Commit

Permalink
Merge branch 'main' into chore/release-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed Sep 17, 2024
2 parents 3a53a56 + f65d5a6 commit 0f4cb1f
Show file tree
Hide file tree
Showing 19 changed files with 102 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- patch
- minor
- major
# - prerelease
- prerelease
# - prepatch
# - preminor
# - premajor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CREATE TABLE `projectSettings` (
`name` text,
`defaultPresets` text,
`configMetadata` text,
`isInitialProject` integer NOT NULL,
`forks` text NOT NULL
);
--> statement-breakpoint
Expand Down
9 changes: 1 addition & 8 deletions drizzle/client/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "41e23fc3-463e-432a-9a5f-7c20366d6294",
"id": "e75103ab-bbcb-4ca9-a0c4-2d9095b63add",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"localDeviceInfo": {
Expand Down Expand Up @@ -176,13 +176,6 @@
"notNull": false,
"autoincrement": false
},
"isInitialProject": {
"name": "isInitialProject",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"forks": {
"name": "forks",
"type": "text",
Expand Down
4 changes: 2 additions & 2 deletions drizzle/client/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1725381616476,
"tag": "0000_chemical_star_brand",
"when": 1726514276007,
"tag": "0000_bumpy_carnage",
"breakpoints": true
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CREATE TABLE `deviceInfo` (
`links` text NOT NULL,
`deleted` integer NOT NULL,
`name` text NOT NULL,
`deviceType` text,
`deviceType` text NOT NULL,
`forks` text NOT NULL
);
--> statement-breakpoint
Expand Down Expand Up @@ -128,7 +128,7 @@ CREATE TABLE `preset` (
`fieldRefs` text NOT NULL,
`iconRef` text,
`terms` text NOT NULL,
`color` text NOT NULL,
`color` text,
`forks` text NOT NULL
);
--> statement-breakpoint
Expand Down Expand Up @@ -186,7 +186,7 @@ CREATE TABLE `translation` (
`docRefType` text NOT NULL,
`propertyRef` text NOT NULL,
`languageCode` text NOT NULL,
`regionCode` text NOT NULL,
`regionCode` text,
`message` text NOT NULL,
`forks` text NOT NULL
);
8 changes: 4 additions & 4 deletions drizzle/project/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "b06de2c5-6a4c-4578-a8f0-d15f9f20e902",
"id": "597b1fb1-5fe9-4601-abab-9cd02b6a77fe",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"coreOwnership_backlink": {
Expand Down Expand Up @@ -236,7 +236,7 @@
"name": "deviceType",
"type": "text",
"primaryKey": false,
"notNull": false,
"notNull": true,
"autoincrement": false
},
"forks": {
Expand Down Expand Up @@ -770,7 +770,7 @@
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"notNull": false,
"autoincrement": false
},
"forks": {
Expand Down Expand Up @@ -1104,7 +1104,7 @@
"name": "regionCode",
"type": "text",
"primaryKey": false,
"notNull": true,
"notNull": false,
"autoincrement": false
},
"message": {
Expand Down
4 changes: 2 additions & 2 deletions drizzle/project/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1725381611574,
"tag": "0000_tan_glorian",
"when": 1726514275142,
"tag": "0000_spooky_lady_ursula",
"breakpoints": true
}
]
Expand Down
52 changes: 39 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@
"url": "git+https://github.com/digidem/mapeo-core.git"
},
"authors": [
"Karissa McKelvey",
"Gregor MacLennan",
"noffle"
"Andrew Chou <[email protected]>",
"Evan Hahn <[email protected]>",
"Gregor MacLennan <[email protected]>",
"Seth Vincent",
"Tomás Ciccola <[email protected]>"
],
"license": "MIT",
"bugs": {
Expand All @@ -106,8 +108,8 @@
"homepage": "https://github.com/digidem/mapeo-core#readme",
"devDependencies": {
"@bufbuild/buf": "^1.26.1",
"@mapeo/default-config": "4.0.0-alpha.8",
"@mapeo/mock-data": "^1.0.3-alpha.5",
"@mapeo/default-config": "4.0.1-alpha.0",
"@mapeo/mock-data": "1.0.3-alpha.7",
"@sinonjs/fake-timers": "^10.0.2",
"@types/b4a": "^1.6.0",
"@types/bogon": "^1.0.2",
Expand Down Expand Up @@ -156,7 +158,7 @@
"@fastify/type-provider-typebox": "^4.0.0",
"@hyperswarm/secret-stream": "^6.1.2",
"@mapeo/crypto": "1.0.0-alpha.10",
"@mapeo/schema": "^3.0.0-next.26",
"@mapeo/schema": "3.0.0-next.28",
"@mapeo/sqlite-indexer": "1.0.0-alpha.9",
"@sinclair/typebox": "^0.29.6",
"b4a": "^1.6.3",
Expand Down
13 changes: 8 additions & 5 deletions src/config-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,14 @@ function translationsForLanguage(warnings) {
*
*/
return function* (lang, languageTranslations) {
const { language: languageCode, region: regionCode } = parseBCP47(lang)
const parsed = parseBCP47(lang)
const { language: languageCode } = parsed
if (!languageCode) {
warnings.push(new Error(`invalid translation language ${lang}`))
return
}
let { region: regionCode } = parsed
regionCode ||= undefined
for (const [
schemaNamePlural,
languageTranslationsForDocType,
Expand Down Expand Up @@ -378,7 +381,7 @@ function schemaNamePluralToDocRefType(schemaNamePlural) {
function translationsForDocType(warnings) {
/** @param {Object} opts
* @param {string} opts.languageCode
* @param {string | null | undefined} opts.regionCode
* @param {string | undefined} opts.regionCode
* @param {import('@mapeo/schema').TranslationValue['docRefType']} opts.docRefType
* @param {Record<ValidDocTypes, unknown>} opts.languageTranslationsForDocType
*/
Expand Down Expand Up @@ -413,7 +416,7 @@ function translationForValue(warnings) {
/**
* @param {Object} opts
* @param {string} opts.languageCode
* @param {string | null | undefined} opts.regionCode
* @param {string | undefined} opts.regionCode
* @param {import('@mapeo/schema').TranslationValue['docRefType']} opts.docRefType
* @param {string} opts.docName
* @param {Record<string,unknown>} opts.fieldsToTranslate
Expand All @@ -430,7 +433,7 @@ function translationForValue(warnings) {
/** @type {'translation'} */
schemaName: 'translation',
languageCode,
regionCode: regionCode || '',
regionCode,
docRefType,
propertyRef: '',
message: '',
Expand Down Expand Up @@ -475,7 +478,7 @@ function translateMessageObject(warnings) {
if (
!validate('translation', {
...value,
docRef: { docId: '', versionId: '' },
docRef: { docId: 'placeholder', versionId: 'placeholder' },
})
) {
warnings.push(new Error(`Invalid translation ${value.message}`))
Expand Down
5 changes: 3 additions & 2 deletions src/discovery/local-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class LocalDiscovery extends TypedEmitter {
return { name: this.#name, port: getAddress(this.#server).port }
}

/** @returns {Promise<void>} */
async #start() {
// Let OS choose port, listen on ip4, all interfaces
this.#server.listen(0, '0.0.0.0')
Expand Down Expand Up @@ -108,6 +109,7 @@ export class LocalDiscovery extends TypedEmitter {
/**
* @param {boolean} isInitiator
* @param {net.Socket} socket
* @returns {void}
*/
#handleTcpConnection(isInitiator, socket) {
socket.off('error', this.#handleSocketError)
Expand Down Expand Up @@ -153,9 +155,9 @@ export class LocalDiscovery extends TypedEmitter {
}

/**
*
* @param {OpenedNetNoiseStream} existing
* @param {OpenedNetNoiseStream} keeping
* @returns {void}
*/
#handleConnectionSwap(existing, keeping) {
let closed = false
Expand All @@ -179,7 +181,6 @@ export class LocalDiscovery extends TypedEmitter {
}

/**
*
* @param {OpenedNetNoiseStream} conn
* @returns {void}
*/
Expand Down
Loading

0 comments on commit 0f4cb1f

Please sign in to comment.