@hot-updater/plugin-core 1.2.0-rc.21 → 1.2.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coreApi.d.cts +7 -1
- package/dist/coreApi.d.mts +7 -1
- package/dist/engine/core/schema.cjs +20 -9
- package/dist/engine/core/schema.d.cts +8 -4
- package/dist/engine/core/schema.d.mts +8 -4
- package/dist/engine/core/schema.mjs +20 -9
- package/dist/engine/database/resolveSchema.cjs +6 -3
- package/dist/engine/database/resolveSchema.mjs +6 -3
- package/dist/serverPlugin/definitions.d.cts +4 -0
- package/dist/serverPlugin/definitions.d.mts +4 -0
- package/dist/serverPlugin/schema.d.cts +4 -0
- package/dist/serverPlugin/schema.d.mts +4 -0
- package/dist/types/databaseRows.d.cts +9 -3
- package/dist/types/databaseRows.d.mts +9 -3
- package/package.json +2 -2
package/dist/coreApi.d.cts
CHANGED
|
@@ -88,6 +88,12 @@ type NativeBuildRegistration = NativeBuildScope & {
|
|
|
88
88
|
* `versionCode`, or null (or left out) when it can't be read.
|
|
89
89
|
*/
|
|
90
90
|
readonly buildNumber?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the artifact is a sandbox build; left out, it isn't. It must agree
|
|
93
|
+
* with the channel: a sandbox build registers on a reserved `sandbox-*`
|
|
94
|
+
* channel, and only a sandbox build does.
|
|
95
|
+
*/
|
|
96
|
+
readonly isSandbox?: boolean;
|
|
91
97
|
readonly artifact: {
|
|
92
98
|
readonly kind: NativeBuildArtifactKind;
|
|
93
99
|
readonly storageUri: string;
|
|
@@ -227,7 +233,7 @@ interface HotUpdaterCoreApi {
|
|
|
227
233
|
/**
|
|
228
234
|
* Marks a build as what the store sells, replacing its scope's mark in one
|
|
229
235
|
* write, or clears the mark it holds. Running it again changes nothing. Null
|
|
230
|
-
* for an unknown ID. A sandbox
|
|
236
|
+
* for an unknown ID. A sandbox build can't be marked.
|
|
231
237
|
*/
|
|
232
238
|
markNativeBuild(id: string, mark: {
|
|
233
239
|
readonly storeBuild: boolean;
|
package/dist/coreApi.d.mts
CHANGED
|
@@ -88,6 +88,12 @@ type NativeBuildRegistration = NativeBuildScope & {
|
|
|
88
88
|
* `versionCode`, or null (or left out) when it can't be read.
|
|
89
89
|
*/
|
|
90
90
|
readonly buildNumber?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the artifact is a sandbox build; left out, it isn't. It must agree
|
|
93
|
+
* with the channel: a sandbox build registers on a reserved `sandbox-*`
|
|
94
|
+
* channel, and only a sandbox build does.
|
|
95
|
+
*/
|
|
96
|
+
readonly isSandbox?: boolean;
|
|
91
97
|
readonly artifact: {
|
|
92
98
|
readonly kind: NativeBuildArtifactKind;
|
|
93
99
|
readonly storageUri: string;
|
|
@@ -227,7 +233,7 @@ interface HotUpdaterCoreApi {
|
|
|
227
233
|
/**
|
|
228
234
|
* Marks a build as what the store sells, replacing its scope's mark in one
|
|
229
235
|
* write, or clears the mark it holds. Running it again changes nothing. Null
|
|
230
|
-
* for an unknown ID. A sandbox
|
|
236
|
+
* for an unknown ID. A sandbox build can't be marked.
|
|
231
237
|
*/
|
|
232
238
|
markNativeBuild(id: string, mark: {
|
|
233
239
|
readonly storeBuild: boolean;
|
|
@@ -283,10 +283,15 @@ const channels = require_schema.defineTable({
|
|
|
283
283
|
* or `versionCode`. `submitted_to`, `submitted_at_ms` and
|
|
284
284
|
* `submitted_version` record the store track a build went to, when, and
|
|
285
285
|
* the store's label of the build; they stay null for a build no store took.
|
|
286
|
-
* `
|
|
287
|
-
* and
|
|
288
|
-
*
|
|
289
|
-
*
|
|
286
|
+
* `is_store_build` is true on the build a person or a job says the store
|
|
287
|
+
* sells, and false on every other: deploys patch from it over the scope's
|
|
288
|
+
* newest build. The engine copies the scope key into `store_build_scope_key`
|
|
289
|
+
* for that build alone, so `byStoreBuild` holds one entry per scope at most,
|
|
290
|
+
* on every store, while any number of a scope's builds hold none.
|
|
291
|
+
* `is_sandbox` is true on a sandbox build, set when it registers and never
|
|
292
|
+
* changed. Boolean columns follow one rule: `is_*` for a fact about the row or
|
|
293
|
+
* `should_*` for an instruction to the client, never null; a unique index over
|
|
294
|
+
* the rows where one is true keys a derived slot, not the boolean.
|
|
290
295
|
*/
|
|
291
296
|
const nativeBuilds = require_schema.defineTable({
|
|
292
297
|
id: {
|
|
@@ -364,12 +369,18 @@ const nativeBuilds = require_schema.defineTable({
|
|
|
364
369
|
maxLength: 255,
|
|
365
370
|
required: false
|
|
366
371
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
required: false
|
|
370
|
-
}
|
|
372
|
+
is_store_build: { type: "boolean" },
|
|
373
|
+
is_sandbox: { type: "boolean" }
|
|
371
374
|
}, {
|
|
372
375
|
key: ["id"],
|
|
376
|
+
derived: {
|
|
377
|
+
/** The scope this build is the store build of; null on every other. */
|
|
378
|
+
store_build_scope_key: {
|
|
379
|
+
type: "string",
|
|
380
|
+
maxLength: 2048,
|
|
381
|
+
ascii: true,
|
|
382
|
+
compute: (row) => row.is_store_build ? row.scope_key : null
|
|
383
|
+
} },
|
|
373
384
|
indexes: {
|
|
374
385
|
byScope: {
|
|
375
386
|
eq: ["scope_key"],
|
|
@@ -380,7 +391,7 @@ const nativeBuilds = require_schema.defineTable({
|
|
|
380
391
|
sort: ["id"]
|
|
381
392
|
},
|
|
382
393
|
byStoreBuild: {
|
|
383
|
-
eq: ["
|
|
394
|
+
eq: ["store_build_scope_key"],
|
|
384
395
|
sort: [],
|
|
385
396
|
unique: true
|
|
386
397
|
},
|
|
@@ -385,11 +385,15 @@ declare const coreSchema: {
|
|
|
385
385
|
readonly maxLength: 255;
|
|
386
386
|
readonly required: false;
|
|
387
387
|
};
|
|
388
|
-
readonly
|
|
388
|
+
readonly is_store_build: {
|
|
389
389
|
readonly type: "boolean";
|
|
390
|
-
readonly required: false;
|
|
391
390
|
};
|
|
392
|
-
|
|
391
|
+
readonly is_sandbox: {
|
|
392
|
+
readonly type: "boolean";
|
|
393
|
+
};
|
|
394
|
+
}, {
|
|
395
|
+
store_build_scope_key: "string";
|
|
396
|
+
}, {
|
|
393
397
|
readonly byScope: {
|
|
394
398
|
readonly eq: readonly ["scope_key"];
|
|
395
399
|
readonly sort: readonly ["id"];
|
|
@@ -399,7 +403,7 @@ declare const coreSchema: {
|
|
|
399
403
|
readonly sort: readonly ["id"];
|
|
400
404
|
};
|
|
401
405
|
readonly byStoreBuild: {
|
|
402
|
-
readonly eq: readonly ["
|
|
406
|
+
readonly eq: readonly ["store_build_scope_key"];
|
|
403
407
|
readonly sort: readonly [];
|
|
404
408
|
readonly unique: true;
|
|
405
409
|
};
|
|
@@ -385,11 +385,15 @@ declare const coreSchema: {
|
|
|
385
385
|
readonly maxLength: 255;
|
|
386
386
|
readonly required: false;
|
|
387
387
|
};
|
|
388
|
-
readonly
|
|
388
|
+
readonly is_store_build: {
|
|
389
389
|
readonly type: "boolean";
|
|
390
|
-
readonly required: false;
|
|
391
390
|
};
|
|
392
|
-
|
|
391
|
+
readonly is_sandbox: {
|
|
392
|
+
readonly type: "boolean";
|
|
393
|
+
};
|
|
394
|
+
}, {
|
|
395
|
+
store_build_scope_key: "string";
|
|
396
|
+
}, {
|
|
393
397
|
readonly byScope: {
|
|
394
398
|
readonly eq: readonly ["scope_key"];
|
|
395
399
|
readonly sort: readonly ["id"];
|
|
@@ -399,7 +403,7 @@ declare const coreSchema: {
|
|
|
399
403
|
readonly sort: readonly ["id"];
|
|
400
404
|
};
|
|
401
405
|
readonly byStoreBuild: {
|
|
402
|
-
readonly eq: readonly ["
|
|
406
|
+
readonly eq: readonly ["store_build_scope_key"];
|
|
403
407
|
readonly sort: readonly [];
|
|
404
408
|
readonly unique: true;
|
|
405
409
|
};
|
|
@@ -283,10 +283,15 @@ const channels = defineTable({
|
|
|
283
283
|
* or `versionCode`. `submitted_to`, `submitted_at_ms` and
|
|
284
284
|
* `submitted_version` record the store track a build went to, when, and
|
|
285
285
|
* the store's label of the build; they stay null for a build no store took.
|
|
286
|
-
* `
|
|
287
|
-
* and
|
|
288
|
-
*
|
|
289
|
-
*
|
|
286
|
+
* `is_store_build` is true on the build a person or a job says the store
|
|
287
|
+
* sells, and false on every other: deploys patch from it over the scope's
|
|
288
|
+
* newest build. The engine copies the scope key into `store_build_scope_key`
|
|
289
|
+
* for that build alone, so `byStoreBuild` holds one entry per scope at most,
|
|
290
|
+
* on every store, while any number of a scope's builds hold none.
|
|
291
|
+
* `is_sandbox` is true on a sandbox build, set when it registers and never
|
|
292
|
+
* changed. Boolean columns follow one rule: `is_*` for a fact about the row or
|
|
293
|
+
* `should_*` for an instruction to the client, never null; a unique index over
|
|
294
|
+
* the rows where one is true keys a derived slot, not the boolean.
|
|
290
295
|
*/
|
|
291
296
|
const nativeBuilds = defineTable({
|
|
292
297
|
id: {
|
|
@@ -364,12 +369,18 @@ const nativeBuilds = defineTable({
|
|
|
364
369
|
maxLength: 255,
|
|
365
370
|
required: false
|
|
366
371
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
required: false
|
|
370
|
-
}
|
|
372
|
+
is_store_build: { type: "boolean" },
|
|
373
|
+
is_sandbox: { type: "boolean" }
|
|
371
374
|
}, {
|
|
372
375
|
key: ["id"],
|
|
376
|
+
derived: {
|
|
377
|
+
/** The scope this build is the store build of; null on every other. */
|
|
378
|
+
store_build_scope_key: {
|
|
379
|
+
type: "string",
|
|
380
|
+
maxLength: 2048,
|
|
381
|
+
ascii: true,
|
|
382
|
+
compute: (row) => row.is_store_build ? row.scope_key : null
|
|
383
|
+
} },
|
|
373
384
|
indexes: {
|
|
374
385
|
byScope: {
|
|
375
386
|
eq: ["scope_key"],
|
|
@@ -380,7 +391,7 @@ const nativeBuilds = defineTable({
|
|
|
380
391
|
sort: ["id"]
|
|
381
392
|
},
|
|
382
393
|
byStoreBuild: {
|
|
383
|
-
eq: ["
|
|
394
|
+
eq: ["store_build_scope_key"],
|
|
384
395
|
sort: [],
|
|
385
396
|
unique: true
|
|
386
397
|
},
|
|
@@ -40,7 +40,8 @@ const fieldProblems = (definition, add) => {
|
|
|
40
40
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
41
41
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
44
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
44
45
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
45
46
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
46
47
|
}
|
|
@@ -157,11 +158,13 @@ const resolveSchema = (modules) => {
|
|
|
157
158
|
...maxLength === void 0 ? {} : { maxLength },
|
|
158
159
|
...ascii ? { ascii } : {}
|
|
159
160
|
}));
|
|
160
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
161
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
161
162
|
name: field,
|
|
162
163
|
type,
|
|
163
164
|
nullable: true,
|
|
164
|
-
...multi ? { multi } : {}
|
|
165
|
+
...multi ? { multi } : {},
|
|
166
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
167
|
+
...ascii ? { ascii } : {}
|
|
165
168
|
});
|
|
166
169
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
167
170
|
name: metric,
|
|
@@ -40,7 +40,8 @@ const fieldProblems = (definition, add) => {
|
|
|
40
40
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
41
41
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
44
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
44
45
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
45
46
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
46
47
|
}
|
|
@@ -157,11 +158,13 @@ const resolveSchema = (modules) => {
|
|
|
157
158
|
...maxLength === void 0 ? {} : { maxLength },
|
|
158
159
|
...ascii ? { ascii } : {}
|
|
159
160
|
}));
|
|
160
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
161
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
161
162
|
name: field,
|
|
162
163
|
type,
|
|
163
164
|
nullable: true,
|
|
164
|
-
...multi ? { multi } : {}
|
|
165
|
+
...multi ? { multi } : {},
|
|
166
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
167
|
+
...ascii ? { ascii } : {}
|
|
165
168
|
});
|
|
166
169
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
167
170
|
name: metric,
|
|
@@ -36,6 +36,10 @@ interface DerivedShape {
|
|
|
36
36
|
readonly type: FieldType;
|
|
37
37
|
/** Up to 16 values; the row is indexed once per value. */
|
|
38
38
|
readonly multi?: true;
|
|
39
|
+
/** Strings: the maximum length; unbounded text when absent. */
|
|
40
|
+
readonly maxLength?: number;
|
|
41
|
+
/** Strings: ASCII only, so a long key fits MySQL's 3,072-byte index limit. */
|
|
42
|
+
readonly ascii?: true;
|
|
39
43
|
/** Null, or an empty list, leaves the row out of indexes on this field. */
|
|
40
44
|
compute(row: never): unknown;
|
|
41
45
|
}
|
|
@@ -36,6 +36,10 @@ interface DerivedShape {
|
|
|
36
36
|
readonly type: FieldType;
|
|
37
37
|
/** Up to 16 values; the row is indexed once per value. */
|
|
38
38
|
readonly multi?: true;
|
|
39
|
+
/** Strings: the maximum length; unbounded text when absent. */
|
|
40
|
+
readonly maxLength?: number;
|
|
41
|
+
/** Strings: ASCII only, so a long key fits MySQL's 3,072-byte index limit. */
|
|
42
|
+
readonly ascii?: true;
|
|
39
43
|
/** Null, or an empty list, leaves the row out of indexes on this field. */
|
|
40
44
|
compute(row: never): unknown;
|
|
41
45
|
}
|
|
@@ -21,6 +21,10 @@ interface DerivedDefinition<TRow = never, TType extends FieldType = FieldType> {
|
|
|
21
21
|
readonly type: TType;
|
|
22
22
|
/** Up to 16 values; the row is indexed once per value. */
|
|
23
23
|
readonly multi?: true;
|
|
24
|
+
/** Strings: the maximum length; unbounded text when absent. */
|
|
25
|
+
readonly maxLength?: number;
|
|
26
|
+
/** Strings: ASCII only, so a long key fits MySQL's 3,072-byte index limit. */
|
|
27
|
+
readonly ascii?: true;
|
|
24
28
|
/** Null, or an empty list, leaves the row out of indexes on this field. */
|
|
25
29
|
compute(row: TRow): FieldValue<TType> | null | readonly FieldValue<TType>[];
|
|
26
30
|
}
|
|
@@ -21,6 +21,10 @@ interface DerivedDefinition<TRow = never, TType extends FieldType = FieldType> {
|
|
|
21
21
|
readonly type: TType;
|
|
22
22
|
/** Up to 16 values; the row is indexed once per value. */
|
|
23
23
|
readonly multi?: true;
|
|
24
|
+
/** Strings: the maximum length; unbounded text when absent. */
|
|
25
|
+
readonly maxLength?: number;
|
|
26
|
+
/** Strings: ASCII only, so a long key fits MySQL's 3,072-byte index limit. */
|
|
27
|
+
readonly ascii?: true;
|
|
24
28
|
/** Null, or an empty list, leaves the row out of indexes on this field. */
|
|
25
29
|
compute(row: TRow): FieldValue<TType> | null | readonly FieldValue<TType>[];
|
|
26
30
|
}
|
|
@@ -106,10 +106,16 @@ interface NativeBuildRow {
|
|
|
106
106
|
*/
|
|
107
107
|
readonly submitted_version: string | null;
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
* over the scope's newest build
|
|
109
|
+
* Whether the build is marked as what the store sells, which deploys patch
|
|
110
|
+
* from over the scope's newest build. A scope has one at most.
|
|
111
111
|
*/
|
|
112
|
-
readonly
|
|
112
|
+
readonly is_store_build: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Whether the build is a sandbox build, one built from a scheme with
|
|
115
|
+
* `sandbox: true` or imported with the sandbox layer. Set when the build
|
|
116
|
+
* registers and never changed. A sandbox build is never the store build.
|
|
117
|
+
*/
|
|
118
|
+
readonly is_sandbox: boolean;
|
|
113
119
|
}
|
|
114
120
|
//#endregion
|
|
115
121
|
export { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow };
|
|
@@ -106,10 +106,16 @@ interface NativeBuildRow {
|
|
|
106
106
|
*/
|
|
107
107
|
readonly submitted_version: string | null;
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
* over the scope's newest build
|
|
109
|
+
* Whether the build is marked as what the store sells, which deploys patch
|
|
110
|
+
* from over the scope's newest build. A scope has one at most.
|
|
111
111
|
*/
|
|
112
|
-
readonly
|
|
112
|
+
readonly is_store_build: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Whether the build is a sandbox build, one built from a scheme with
|
|
115
|
+
* `sandbox: true` or imported with the sandbox layer. Set when the build
|
|
116
|
+
* registers and never changed. A sandbox build is never the store build.
|
|
117
|
+
*/
|
|
118
|
+
readonly is_sandbox: boolean;
|
|
113
119
|
}
|
|
114
120
|
//#endregion
|
|
115
121
|
export { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"mime": "^4.0.4",
|
|
47
47
|
"verkit": "0.4.0",
|
|
48
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
48
|
+
"@hot-updater/protocol": "1.2.0-rc.22"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@electric-sql/pglite": "0.4.1",
|