@hot-updater/plugin-core 1.2.0-rc.6 → 1.2.0-rc.60

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.
Files changed (95) hide show
  1. package/dist/coreApi.d.cts +277 -10
  2. package/dist/coreApi.d.mts +277 -10
  3. package/dist/database/adapter.d.cts +24 -0
  4. package/dist/database/adapter.d.mts +24 -0
  5. package/dist/databaseRows.cjs +4 -2
  6. package/dist/databaseRows.mjs +4 -2
  7. package/dist/engine/core/schema.cjs +253 -6
  8. package/dist/engine/core/schema.d.cts +154 -1
  9. package/dist/engine/core/schema.d.mts +154 -1
  10. package/dist/engine/core/schema.mjs +252 -7
  11. package/dist/engine/createEngine.cjs +1 -2
  12. package/dist/engine/createEngine.d.cts +1 -6
  13. package/dist/engine/createEngine.d.mts +1 -6
  14. package/dist/engine/createEngine.mjs +1 -2
  15. package/dist/engine/database/aggregateBatching.cjs +87 -129
  16. package/dist/engine/database/aggregateBatching.mjs +87 -129
  17. package/dist/engine/database/database.cjs +1 -4
  18. package/dist/engine/database/database.mjs +1 -4
  19. package/dist/engine/database/engineTransaction.cjs +26 -2
  20. package/dist/engine/database/engineTransaction.d.cts +5 -1
  21. package/dist/engine/database/engineTransaction.d.mts +5 -1
  22. package/dist/engine/database/engineTransaction.mjs +26 -2
  23. package/dist/engine/database/fence.cjs +24 -2
  24. package/dist/engine/database/fence.d.cts +4 -1
  25. package/dist/engine/database/fence.d.mts +4 -1
  26. package/dist/engine/database/fence.mjs +24 -3
  27. package/dist/engine/database/kv/kvAdapter.cjs +80 -4
  28. package/dist/engine/database/kv/kvAdapter.mjs +80 -4
  29. package/dist/engine/database/resolveSchema.cjs +6 -3
  30. package/dist/engine/database/resolveSchema.mjs +6 -3
  31. package/dist/engine/database/sql/sqlAdapter.cjs +36 -12
  32. package/dist/engine/database/sql/sqlAdapter.mjs +37 -13
  33. package/dist/engine/database/sql/sqlSchema.cjs +24 -6
  34. package/dist/engine/database/sql/sqlSchema.d.cts +1 -1
  35. package/dist/engine/database/sql/sqlSchema.d.mts +1 -1
  36. package/dist/engine/database/sql/sqlSchema.mjs +24 -6
  37. package/dist/engine/db/coreDatabase.cjs +10 -5
  38. package/dist/engine/db/coreDatabase.d.cts +2 -1
  39. package/dist/engine/db/coreDatabase.d.mts +2 -1
  40. package/dist/engine/db/coreDatabase.mjs +10 -5
  41. package/dist/engine/db/engineMigrator.cjs +45 -17
  42. package/dist/engine/db/engineMigrator.mjs +46 -18
  43. package/dist/engine/db/engineSql.cjs +25 -0
  44. package/dist/engine/db/engineSql.d.cts +13 -1
  45. package/dist/engine/db/engineSql.d.mts +13 -1
  46. package/dist/engine/db/engineSql.mjs +26 -2
  47. package/dist/engine/db/engineSqlMigrator.cjs +60 -21
  48. package/dist/engine/db/engineSqlMigrator.d.cts +2 -0
  49. package/dist/engine/db/engineSqlMigrator.d.mts +2 -0
  50. package/dist/engine/db/engineSqlMigrator.mjs +62 -23
  51. package/dist/engine/db/schemaSettings.cjs +56 -5
  52. package/dist/engine/db/schemaSettings.d.cts +5 -2
  53. package/dist/engine/db/schemaSettings.d.mts +5 -2
  54. package/dist/engine/db/schemaSettings.mjs +55 -6
  55. package/dist/engine/db/settingsMigrator.cjs +113 -15
  56. package/dist/engine/db/settingsMigrator.d.cts +18 -8
  57. package/dist/engine/db/settingsMigrator.d.mts +18 -8
  58. package/dist/engine/db/settingsMigrator.mjs +111 -17
  59. package/dist/engine/db/sqlSchemaState.cjs +136 -0
  60. package/dist/engine/db/sqlSchemaState.mjs +131 -0
  61. package/dist/engine/db/types.d.cts +6 -0
  62. package/dist/engine/db/types.d.mts +6 -0
  63. package/dist/index.cjs +4 -8
  64. package/dist/index.d.cts +7 -8
  65. package/dist/index.d.mts +7 -8
  66. package/dist/index.mjs +5 -6
  67. package/dist/releaseCatalogCompiler.cjs +89 -7
  68. package/dist/releaseCatalogCompiler.d.cts +12 -1
  69. package/dist/releaseCatalogCompiler.d.mts +12 -1
  70. package/dist/releaseCatalogCompiler.mjs +89 -8
  71. package/dist/releaseCatalogMutation.d.cts +8 -2
  72. package/dist/releaseCatalogMutation.d.mts +8 -2
  73. package/dist/serverPlugin/coreReads.d.cts +10 -1
  74. package/dist/serverPlugin/coreReads.d.mts +10 -1
  75. package/dist/serverPlugin/definitions.d.cts +4 -0
  76. package/dist/serverPlugin/definitions.d.mts +4 -0
  77. package/dist/serverPlugin/schema.d.cts +4 -0
  78. package/dist/serverPlugin/schema.d.mts +4 -0
  79. package/dist/types/databaseConfig.d.cts +10 -20
  80. package/dist/types/databaseConfig.d.mts +10 -20
  81. package/dist/types/databaseRows.d.cts +77 -2
  82. package/dist/types/databaseRows.d.mts +77 -2
  83. package/dist/types/index.cjs +3 -0
  84. package/dist/types/index.d.cts +114 -56
  85. package/dist/types/index.d.mts +114 -56
  86. package/dist/types/index.mjs +3 -1
  87. package/dist/types/models.d.cts +9 -1
  88. package/dist/types/models.d.mts +9 -1
  89. package/dist/types/public.d.cts +3 -3
  90. package/dist/types/public.d.mts +3 -3
  91. package/package.json +3 -9
  92. package/dist/remoteBundleSigning.cjs +0 -357
  93. package/dist/remoteBundleSigning.d.cts +0 -38
  94. package/dist/remoteBundleSigning.d.mts +0 -38
  95. package/dist/remoteBundleSigning.mjs +0 -352
@@ -90,7 +90,8 @@ function rangeToIntervals(range) {
90
90
  throw new ReleaseCatalogCompilationError("INVALID_TARGET_RANGE", `Invalid target app-version range: ${range}`);
91
91
  }
92
92
  }
93
- function releaseDescriptor(release) {
93
+ /** A release's descriptor; its label only when it has one and `labels`. */
94
+ function releaseDescriptor(release, labels) {
94
95
  return {
95
96
  releaseId: release.id,
96
97
  kind: release.kind,
@@ -98,7 +99,8 @@ function releaseDescriptor(release) {
98
99
  rolloutCohortCount: release.rolloutCohortCount,
99
100
  targetCohorts: [...new Set(release.targetCohorts)].sort(),
100
101
  shouldForceUpdate: release.shouldForceUpdate,
101
- message: release.message
102
+ message: release.message,
103
+ ...labels && typeof release.label === "number" ? { label: release.label } : {}
102
104
  };
103
105
  }
104
106
  function validateReleases(releases, strategy) {
@@ -306,17 +308,96 @@ function canonicalStringify(value) {
306
308
  const record = value;
307
309
  return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(",")}}`;
308
310
  }
311
+ const BOUND_SHAPE = {
312
+ inclusive: null,
313
+ version: null
314
+ };
315
+ /**
316
+ * Every key this release's compiler writes in a catalog payload, where it
317
+ * writes it: the envelope's, a segment's and its bounds', and a release
318
+ * descriptor's. A key outside it was written by a later release.
319
+ */
320
+ const COMPILED_CATALOG_SHAPE = {
321
+ fallbackPolicy: null,
322
+ schemaVersion: null,
323
+ strategy: null,
324
+ releaseIndexes: null,
325
+ rollbackReleaseIndexes: null,
326
+ segments: {
327
+ lower: BOUND_SHAPE,
328
+ upper: BOUND_SHAPE,
329
+ releaseIndexes: null,
330
+ rollbackReleaseIndexes: null
331
+ },
332
+ releaseDescriptors: {
333
+ releaseId: null,
334
+ kind: null,
335
+ bundleId: null,
336
+ rolloutCohortCount: null,
337
+ targetCohorts: null,
338
+ shouldForceUpdate: null,
339
+ message: null,
340
+ label: null
341
+ }
342
+ };
343
+ /**
344
+ * A stored catalog payload as this release reads it: canonical, with the
345
+ * keys a later release added left out, and whether it had any, a later
346
+ * schema version included. Server core compares a catalog by the fields
347
+ * its compiler writes, and refuses to rewrite one a later release wrote,
348
+ * which would drop what that release added.
349
+ */
350
+ function readCompiledCatalogPayload(payload) {
351
+ let fromLaterRelease = false;
352
+ const known = (value, shape) => {
353
+ if (Array.isArray(value)) return value.map((item) => known(item, shape));
354
+ if (value === null || typeof value !== "object") return value;
355
+ const entries = Object.entries(value).filter(([key]) => {
356
+ if (Object.hasOwn(shape, key)) return true;
357
+ fromLaterRelease = true;
358
+ return false;
359
+ });
360
+ return Object.fromEntries(entries.map(([key, entry]) => {
361
+ const inner = shape[key];
362
+ return [key, inner === null ? entry : known(entry, inner)];
363
+ }));
364
+ };
365
+ let parsed;
366
+ try {
367
+ parsed = JSON.parse(payload);
368
+ } catch {
369
+ parsed = null;
370
+ }
371
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {
372
+ canonicalPayload: payload,
373
+ fromLaterRelease: false
374
+ };
375
+ if ("schemaVersion" in parsed && typeof parsed.schemaVersion === "number" && parsed.schemaVersion > _hot_updater_protocol.RELEASE_CATALOG_SCHEMA_VERSION) fromLaterRelease = true;
376
+ return {
377
+ canonicalPayload: canonicalStringify(known(parsed, COMPILED_CATALOG_SHAPE)),
378
+ fromLaterRelease
379
+ };
380
+ }
309
381
  async function compileReleaseCatalog(input) {
310
382
  const releases = validateReleases(input.releases, input.strategy);
311
383
  const targetCohorts = new Set(releases.flatMap((release) => release.targetCohorts));
312
384
  if (targetCohorts.size > _hot_updater_protocol.MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE) throw new ReleaseCatalogCompilationError("DISTINCT_TARGET_COHORT_LIMIT", `Scope exceeds ${_hot_updater_protocol.MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE} distinct target cohorts`);
313
385
  const { envelope, retainedReleases } = input.strategy === "APP_VERSION" ? compileAppVersion(releases) : compileFingerprint(releases);
314
- const payload = {
315
- ...envelope,
316
- releaseDescriptors: retainedReleases.map(releaseDescriptor)
386
+ const compile = (labels) => {
387
+ const payload = {
388
+ ...envelope,
389
+ releaseDescriptors: retainedReleases.map((release) => releaseDescriptor(release, labels))
390
+ };
391
+ const canonicalPayload = canonicalStringify(payload);
392
+ return {
393
+ payload,
394
+ canonicalPayload,
395
+ byteSize: new TextEncoder().encode(canonicalPayload).byteLength
396
+ };
317
397
  };
318
- const canonicalPayload = canonicalStringify(payload);
319
- const byteSize = new TextEncoder().encode(canonicalPayload).byteLength;
398
+ let compiled = compile(true);
399
+ if (compiled.byteSize > _hot_updater_protocol.MAX_COMPILED_CATALOG_BYTES && retainedReleases.some((release) => typeof release.label === "number")) compiled = compile(false);
400
+ const { payload, canonicalPayload, byteSize } = compiled;
320
401
  if (byteSize > _hot_updater_protocol.MAX_COMPILED_CATALOG_BYTES) throw new ReleaseCatalogCompilationError("CATALOG_OVERSIZE", `Compiled Release catalog is ${byteSize} bytes; maximum is ${_hot_updater_protocol.MAX_COMPILED_CATALOG_BYTES}`);
321
402
  return {
322
403
  byteSize,
@@ -379,4 +460,5 @@ Object.defineProperty(exports, "canonicalizeAppVersion", {
379
460
  exports.compileReleaseCatalog = compileReleaseCatalog;
380
461
  exports.projectCompiledCatalog = projectCompiledCatalog;
381
462
  exports.projectCompiledRollbackCatalog = projectCompiledRollbackCatalog;
463
+ exports.readCompiledCatalogPayload = readCompiledCatalogPayload;
382
464
  exports.referenceCompatibleReleases = referenceCompatibleReleases;
@@ -42,6 +42,17 @@ declare class ReleaseCatalogCompilationError extends Error {
42
42
  readonly code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE";
43
43
  constructor(code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE", message: string);
44
44
  }
45
+ /**
46
+ * A stored catalog payload as this release reads it: canonical, with the
47
+ * keys a later release added left out, and whether it had any, a later
48
+ * schema version included. Server core compares a catalog by the fields
49
+ * its compiler writes, and refuses to rewrite one a later release wrote,
50
+ * which would drop what that release added.
51
+ */
52
+ declare function readCompiledCatalogPayload(payload: string): {
53
+ readonly canonicalPayload: string;
54
+ readonly fromLaterRelease: boolean;
55
+ };
45
56
  declare function compileReleaseCatalog(input: {
46
57
  readonly strategy: ReleaseStrategy;
47
58
  readonly releases: readonly Release[];
@@ -50,4 +61,4 @@ declare function projectCompiledCatalog(catalog: CompiledReleaseCatalog, appVers
50
61
  declare function projectCompiledRollbackCatalog(catalog: CompiledReleaseCatalog, appVersion?: string): readonly ReleaseCatalogDescriptor[];
51
62
  declare function referenceCompatibleReleases(releases: readonly Release[], appVersion: string): readonly Release[];
52
63
  //#endregion
53
- export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
64
+ export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
@@ -42,6 +42,17 @@ declare class ReleaseCatalogCompilationError extends Error {
42
42
  readonly code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE";
43
43
  constructor(code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE", message: string);
44
44
  }
45
+ /**
46
+ * A stored catalog payload as this release reads it: canonical, with the
47
+ * keys a later release added left out, and whether it had any, a later
48
+ * schema version included. Server core compares a catalog by the fields
49
+ * its compiler writes, and refuses to rewrite one a later release wrote,
50
+ * which would drop what that release added.
51
+ */
52
+ declare function readCompiledCatalogPayload(payload: string): {
53
+ readonly canonicalPayload: string;
54
+ readonly fromLaterRelease: boolean;
55
+ };
45
56
  declare function compileReleaseCatalog(input: {
46
57
  readonly strategy: ReleaseStrategy;
47
58
  readonly releases: readonly Release[];
@@ -50,4 +61,4 @@ declare function projectCompiledCatalog(catalog: CompiledReleaseCatalog, appVers
50
61
  declare function projectCompiledRollbackCatalog(catalog: CompiledReleaseCatalog, appVersion?: string): readonly ReleaseCatalogDescriptor[];
51
62
  declare function referenceCompatibleReleases(releases: readonly Release[], appVersion: string): readonly Release[];
52
63
  //#endregion
53
- export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
64
+ export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
@@ -91,7 +91,8 @@ function rangeToIntervals(range) {
91
91
  throw new ReleaseCatalogCompilationError("INVALID_TARGET_RANGE", `Invalid target app-version range: ${range}`);
92
92
  }
93
93
  }
94
- function releaseDescriptor(release) {
94
+ /** A release's descriptor; its label only when it has one and `labels`. */
95
+ function releaseDescriptor(release, labels) {
95
96
  return {
96
97
  releaseId: release.id,
97
98
  kind: release.kind,
@@ -99,7 +100,8 @@ function releaseDescriptor(release) {
99
100
  rolloutCohortCount: release.rolloutCohortCount,
100
101
  targetCohorts: [...new Set(release.targetCohorts)].sort(),
101
102
  shouldForceUpdate: release.shouldForceUpdate,
102
- message: release.message
103
+ message: release.message,
104
+ ...labels && typeof release.label === "number" ? { label: release.label } : {}
103
105
  };
104
106
  }
105
107
  function validateReleases(releases, strategy) {
@@ -307,17 +309,96 @@ function canonicalStringify(value) {
307
309
  const record = value;
308
310
  return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(",")}}`;
309
311
  }
312
+ const BOUND_SHAPE = {
313
+ inclusive: null,
314
+ version: null
315
+ };
316
+ /**
317
+ * Every key this release's compiler writes in a catalog payload, where it
318
+ * writes it: the envelope's, a segment's and its bounds', and a release
319
+ * descriptor's. A key outside it was written by a later release.
320
+ */
321
+ const COMPILED_CATALOG_SHAPE = {
322
+ fallbackPolicy: null,
323
+ schemaVersion: null,
324
+ strategy: null,
325
+ releaseIndexes: null,
326
+ rollbackReleaseIndexes: null,
327
+ segments: {
328
+ lower: BOUND_SHAPE,
329
+ upper: BOUND_SHAPE,
330
+ releaseIndexes: null,
331
+ rollbackReleaseIndexes: null
332
+ },
333
+ releaseDescriptors: {
334
+ releaseId: null,
335
+ kind: null,
336
+ bundleId: null,
337
+ rolloutCohortCount: null,
338
+ targetCohorts: null,
339
+ shouldForceUpdate: null,
340
+ message: null,
341
+ label: null
342
+ }
343
+ };
344
+ /**
345
+ * A stored catalog payload as this release reads it: canonical, with the
346
+ * keys a later release added left out, and whether it had any, a later
347
+ * schema version included. Server core compares a catalog by the fields
348
+ * its compiler writes, and refuses to rewrite one a later release wrote,
349
+ * which would drop what that release added.
350
+ */
351
+ function readCompiledCatalogPayload(payload) {
352
+ let fromLaterRelease = false;
353
+ const known = (value, shape) => {
354
+ if (Array.isArray(value)) return value.map((item) => known(item, shape));
355
+ if (value === null || typeof value !== "object") return value;
356
+ const entries = Object.entries(value).filter(([key]) => {
357
+ if (Object.hasOwn(shape, key)) return true;
358
+ fromLaterRelease = true;
359
+ return false;
360
+ });
361
+ return Object.fromEntries(entries.map(([key, entry]) => {
362
+ const inner = shape[key];
363
+ return [key, inner === null ? entry : known(entry, inner)];
364
+ }));
365
+ };
366
+ let parsed;
367
+ try {
368
+ parsed = JSON.parse(payload);
369
+ } catch {
370
+ parsed = null;
371
+ }
372
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {
373
+ canonicalPayload: payload,
374
+ fromLaterRelease: false
375
+ };
376
+ if ("schemaVersion" in parsed && typeof parsed.schemaVersion === "number" && parsed.schemaVersion > RELEASE_CATALOG_SCHEMA_VERSION) fromLaterRelease = true;
377
+ return {
378
+ canonicalPayload: canonicalStringify(known(parsed, COMPILED_CATALOG_SHAPE)),
379
+ fromLaterRelease
380
+ };
381
+ }
310
382
  async function compileReleaseCatalog(input) {
311
383
  const releases = validateReleases(input.releases, input.strategy);
312
384
  const targetCohorts = new Set(releases.flatMap((release) => release.targetCohorts));
313
385
  if (targetCohorts.size > MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE) throw new ReleaseCatalogCompilationError("DISTINCT_TARGET_COHORT_LIMIT", `Scope exceeds ${MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE} distinct target cohorts`);
314
386
  const { envelope, retainedReleases } = input.strategy === "APP_VERSION" ? compileAppVersion(releases) : compileFingerprint(releases);
315
- const payload = {
316
- ...envelope,
317
- releaseDescriptors: retainedReleases.map(releaseDescriptor)
387
+ const compile = (labels) => {
388
+ const payload = {
389
+ ...envelope,
390
+ releaseDescriptors: retainedReleases.map((release) => releaseDescriptor(release, labels))
391
+ };
392
+ const canonicalPayload = canonicalStringify(payload);
393
+ return {
394
+ payload,
395
+ canonicalPayload,
396
+ byteSize: new TextEncoder().encode(canonicalPayload).byteLength
397
+ };
318
398
  };
319
- const canonicalPayload = canonicalStringify(payload);
320
- const byteSize = new TextEncoder().encode(canonicalPayload).byteLength;
399
+ let compiled = compile(true);
400
+ if (compiled.byteSize > MAX_COMPILED_CATALOG_BYTES && retainedReleases.some((release) => typeof release.label === "number")) compiled = compile(false);
401
+ const { payload, canonicalPayload, byteSize } = compiled;
321
402
  if (byteSize > MAX_COMPILED_CATALOG_BYTES) throw new ReleaseCatalogCompilationError("CATALOG_OVERSIZE", `Compiled Release catalog is ${byteSize} bytes; maximum is ${MAX_COMPILED_CATALOG_BYTES}`);
322
403
  return {
323
404
  byteSize,
@@ -370,4 +451,4 @@ function referenceCompatibleReleases(releases, appVersion) {
370
451
  return releases.filter((release) => release.enabled && release.targetAppVersion !== null && satisfies(canonicalVersion, release.targetAppVersion));
371
452
  }
372
453
  //#endregion
373
- export { ReleaseCatalogCompilationError, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
454
+ export { ReleaseCatalogCompilationError, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
@@ -17,9 +17,9 @@ interface ReleaseCatalogMutationResult {
17
17
  readonly release: ReleaseRow | null;
18
18
  }
19
19
  declare class ReleaseCatalogMutationError extends Error {
20
- readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
20
+ readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
21
21
  readonly name = "ReleaseCatalogMutationError";
22
- constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
22
+ constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
23
23
  }
24
24
  /** What a release change would write, without writing it. */
25
25
  interface ReleaseCatalogMutationPreflight {
@@ -37,6 +37,12 @@ interface ReleaseCatalogRebuildResult {
37
37
  }
38
38
  interface ReleaseCatalogRebuildPreflight {
39
39
  readonly changed: boolean;
40
+ /**
41
+ * Whether the rebuild would change only release labels: a catalog
42
+ * compiled before its releases had them. A server before labels leaves it
43
+ * out.
44
+ */
45
+ readonly labelsOnly?: boolean;
40
46
  readonly currentCatalog: ReleaseCatalogRow | null;
41
47
  readonly diagnostics: ReleaseCatalogCompilation["diagnostics"];
42
48
  readonly projectedCatalog: ReleaseCatalogRow;
@@ -17,9 +17,9 @@ interface ReleaseCatalogMutationResult {
17
17
  readonly release: ReleaseRow | null;
18
18
  }
19
19
  declare class ReleaseCatalogMutationError extends Error {
20
- readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
20
+ readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
21
21
  readonly name = "ReleaseCatalogMutationError";
22
- constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
22
+ constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
23
23
  }
24
24
  /** What a release change would write, without writing it. */
25
25
  interface ReleaseCatalogMutationPreflight {
@@ -37,6 +37,12 @@ interface ReleaseCatalogRebuildResult {
37
37
  }
38
38
  interface ReleaseCatalogRebuildPreflight {
39
39
  readonly changed: boolean;
40
+ /**
41
+ * Whether the rebuild would change only release labels: a catalog
42
+ * compiled before its releases had them. A server before labels leaves it
43
+ * out.
44
+ */
45
+ readonly labelsOnly?: boolean;
40
46
  readonly currentCatalog: ReleaseCatalogRow | null;
41
47
  readonly diagnostics: ReleaseCatalogCompilation["diagnostics"];
42
48
  readonly projectedCatalog: ReleaseCatalogRow;
@@ -51,7 +51,16 @@ interface CoreReads {
51
51
  latestReleaseId(scopeKey: string): Promise<string | null>;
52
52
  getReleaseCatalogRow(scopeKey: string): Promise<ReleaseCatalogRow | null>;
53
53
  listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
54
- listChannels(): Promise<ChannelRow[]>;
54
+ /**
55
+ * Every channel, by name. With `input`, one keyset page of them, whose
56
+ * cursor is the last channel's name.
57
+ */
58
+ listChannels(input?: KeysetInput): Promise<ChannelRow[]>;
59
+ /**
60
+ * The channels of these IDs, in their order, without the IDs no channel
61
+ * has: one batch read of their keys.
62
+ */
63
+ getChannels(ids: readonly string[]): Promise<ChannelRow[]>;
55
64
  findChannelByName(name: string): Promise<ChannelRow | null>;
56
65
  }
57
66
  //#endregion
@@ -51,7 +51,16 @@ interface CoreReads {
51
51
  latestReleaseId(scopeKey: string): Promise<string | null>;
52
52
  getReleaseCatalogRow(scopeKey: string): Promise<ReleaseCatalogRow | null>;
53
53
  listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
54
- listChannels(): Promise<ChannelRow[]>;
54
+ /**
55
+ * Every channel, by name. With `input`, one keyset page of them, whose
56
+ * cursor is the last channel's name.
57
+ */
58
+ listChannels(input?: KeysetInput): Promise<ChannelRow[]>;
59
+ /**
60
+ * The channels of these IDs, in their order, without the IDs no channel
61
+ * has: one batch read of their keys.
62
+ */
63
+ getChannels(ids: readonly string[]): Promise<ChannelRow[]>;
55
64
  findChannelByName(name: string): Promise<ChannelRow | null>;
56
65
  }
57
66
  //#endregion
@@ -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
  }
@@ -3,28 +3,17 @@ import { RetryOptions } from "../engine/database/engineTransaction.cjs";
3
3
  import { HotUpdaterCoreApi } from "../coreApi.cjs";
4
4
  //#region src/types/databaseConfig.d.ts
5
5
  /**
6
- * How changes to aggregates declared `batched` reach their rows: after the
7
- * transaction that made them commits, merged with other transactions'
8
- * changes into one write per aggregate row. Databases that bill each write
9
- * (DynamoDB, Firestore) batch them.
6
+ * How changes to aggregates declared `batched` reach their rows: each
7
+ * transaction writes its changes as one log row, and a compaction merges
8
+ * pending log rows into one write per aggregate row. Databases that bill each
9
+ * write (DynamoDB, Firestore, Cosmos DB) batch them.
10
10
  */
11
11
  interface AggregateBatching {
12
12
  /**
13
- * `"log"` (the default) writes each transaction's changes as one log row
14
- * in that transaction, and a compaction merges pending log rows into the
15
- * aggregates. It loses nothing and suits every runtime. `"memory"` keeps
16
- * changes in the process until a timer flushes them. It writes no log
17
- * rows, but a crash loses up to one window, and a runtime that freezes
18
- * or drops the process between requests (Lambda, Cloud Functions,
19
- * Workers) loses more, so use it only on a long-lived server.
20
- */
21
- readonly mode?: "log" | "memory";
22
- /**
23
- * How long changes wait before a compaction or a flush: `"log"` compacts
24
- * after a commit once this has passed since the last compaction, 60
25
- * seconds by default, and `"memory"` flushes this often, 15 seconds by
26
- * default. A read that cannot compact (read-only credentials) shows
27
- * aggregates that can leave out up to one window of the latest changes.
13
+ * A commit compacts once this has passed since the last compaction, 60
14
+ * seconds by default. A read compacts first; one that cannot (read-only
15
+ * credentials) shows aggregates that can leave out up to one window of the
16
+ * latest changes.
28
17
  */
29
18
  readonly windowMs?: number;
30
19
  }
@@ -46,7 +35,8 @@ interface EngineDatabase {
46
35
  /**
47
36
  * How a transaction that conflicts with another write runs again. A store
48
37
  * many writers contend on, such as DynamoDB under a burst of events, can
49
- * take more attempts; `onRetry` observes each rerun.
38
+ * take more attempts; `onRetry` observes each rerun. An aggregate write
39
+ * that lost to another writer's commit is resent without spending one.
50
40
  */
51
41
  readonly retry?: RetryOptions;
52
42
  dispose?(): Promise<void>;
@@ -3,28 +3,17 @@ import { RetryOptions } from "../engine/database/engineTransaction.mjs";
3
3
  import { HotUpdaterCoreApi } from "../coreApi.mjs";
4
4
  //#region src/types/databaseConfig.d.ts
5
5
  /**
6
- * How changes to aggregates declared `batched` reach their rows: after the
7
- * transaction that made them commits, merged with other transactions'
8
- * changes into one write per aggregate row. Databases that bill each write
9
- * (DynamoDB, Firestore) batch them.
6
+ * How changes to aggregates declared `batched` reach their rows: each
7
+ * transaction writes its changes as one log row, and a compaction merges
8
+ * pending log rows into one write per aggregate row. Databases that bill each
9
+ * write (DynamoDB, Firestore, Cosmos DB) batch them.
10
10
  */
11
11
  interface AggregateBatching {
12
12
  /**
13
- * `"log"` (the default) writes each transaction's changes as one log row
14
- * in that transaction, and a compaction merges pending log rows into the
15
- * aggregates. It loses nothing and suits every runtime. `"memory"` keeps
16
- * changes in the process until a timer flushes them. It writes no log
17
- * rows, but a crash loses up to one window, and a runtime that freezes
18
- * or drops the process between requests (Lambda, Cloud Functions,
19
- * Workers) loses more, so use it only on a long-lived server.
20
- */
21
- readonly mode?: "log" | "memory";
22
- /**
23
- * How long changes wait before a compaction or a flush: `"log"` compacts
24
- * after a commit once this has passed since the last compaction, 60
25
- * seconds by default, and `"memory"` flushes this often, 15 seconds by
26
- * default. A read that cannot compact (read-only credentials) shows
27
- * aggregates that can leave out up to one window of the latest changes.
13
+ * A commit compacts once this has passed since the last compaction, 60
14
+ * seconds by default. A read compacts first; one that cannot (read-only
15
+ * credentials) shows aggregates that can leave out up to one window of the
16
+ * latest changes.
28
17
  */
29
18
  readonly windowMs?: number;
30
19
  }
@@ -46,7 +35,8 @@ interface EngineDatabase {
46
35
  /**
47
36
  * How a transaction that conflicts with another write runs again. A store
48
37
  * many writers contend on, such as DynamoDB under a burst of events, can
49
- * take more attempts; `onRetry` observes each rerun.
38
+ * take more attempts; `onRetry` observes each rerun. An aggregate write
39
+ * that lost to another writer's commit is resent without spending one.
50
40
  */
51
41
  readonly retry?: RetryOptions;
52
42
  dispose?(): Promise<void>;
@@ -46,6 +46,13 @@ interface ReleaseRow {
46
46
  readonly source_release_id: string | null;
47
47
  readonly created_at_ms: number;
48
48
  readonly updated_at_ms: number;
49
+ /**
50
+ * The release's label, shown `v<label>`: sequential per channel and
51
+ * platform, assigned once and never changed or reused while the channel
52
+ * exists. Null on a row the label fill hasn't reached yet, and left out
53
+ * of a row read through an adapter of an earlier release.
54
+ */
55
+ readonly label?: number | null;
49
56
  }
50
57
  interface ReleaseCatalogRow {
51
58
  readonly scope_key: string;
@@ -69,7 +76,13 @@ interface ChannelRow {
69
76
  /** The kinds of artifact a native build registers. */
70
77
  type NativeBuildArtifactKind = "apk" | "aab" | "ipa" | "app";
71
78
  /** The store track a native build was submitted to. */
72
- type NativeBuildSubmissionDestination = "testflight" | "play-internal";
79
+ type NativeBuildSubmissionDestination = "testflight" | "play-internal" | "play-closed" | "play-open" | "play-production";
80
+ /**
81
+ * How an iOS `.ipa` was exported, as its embedded provisioning profile says:
82
+ * for the App Store (no device list), ad hoc or development (a device list,
83
+ * development's with `get-task-allow`), or enterprise (every device).
84
+ */
85
+ type NativeBuildExportMethod = "app-store" | "ad-hoc" | "development" | "enterprise";
73
86
  /**
74
87
  * A registered native build: its artifact in storage, the scope it serves,
75
88
  * and `min_bundle_id`, the `bundles` row of the bundle built into it.
@@ -105,6 +118,68 @@ interface NativeBuildRow {
105
118
  * by the build number, and a fingerprint build records no app version.
106
119
  */
107
120
  readonly submitted_version: string | null;
121
+ /**
122
+ * Whether the build is marked as what the store sells, which deploys patch
123
+ * from over the scope's newest build. A scope has one at most.
124
+ */
125
+ readonly is_store_build: boolean;
126
+ /**
127
+ * Whether the build is a sandbox build, one built from a scheme with
128
+ * `sandbox: true` or imported with the sandbox layer: set from its artifact
129
+ * when the build registers, on any channel, and never changed. A sandbox
130
+ * build is never the store build.
131
+ */
132
+ readonly is_sandbox: boolean;
133
+ /**
134
+ * The URL scheme a sandbox build's artifact registers, which its preview
135
+ * links open. Null on any other build, and on a sandbox build registered
136
+ * before it was recorded, which registered `hu-sandbox-<app ID>`.
137
+ */
138
+ readonly sandbox_url_scheme: string | null;
139
+ /**
140
+ * How an `.ipa` was exported, read from its profile when it registered and
141
+ * never changed. Null on any other artifact, and on an `.ipa` registered
142
+ * before it was recorded.
143
+ */
144
+ readonly export_method: NativeBuildExportMethod | null;
145
+ /**
146
+ * The app version the artifact itself reports, its
147
+ * `CFBundleShortVersionString` or `versionName`, whatever the update
148
+ * strategy: a fingerprint build has one too, where `app_version`, the
149
+ * version OTAs target, is null. Read from the artifact when it registered
150
+ * and never changed. Null when it couldn't be read, and on a build
151
+ * registered before it was recorded; a server older than it leaves it out.
152
+ */
153
+ readonly native_app_version?: string | null;
154
+ }
155
+ /** Where an iOS device is in the registry: requested, approved, or registered with Apple. */
156
+ type IosDeviceStatus = "pending" | "approved" | "registered";
157
+ /**
158
+ * An iPhone or iPad a team asked to install ad hoc builds on: the device
159
+ * registry the CLI registers with Apple from. Holds personal data: a UDID, a
160
+ * name, and emails.
161
+ */
162
+ interface IosDeviceRow {
163
+ readonly id: string;
164
+ /** The UDID in lower case, in whichever of Apple's two formats it came. */
165
+ readonly udid: string;
166
+ /** The name App Store Connect shows once it is registered. */
167
+ readonly name: string;
168
+ readonly status: IosDeviceStatus;
169
+ /** Who asked for it, or null for the CLI. */
170
+ readonly requested_by: string | null;
171
+ readonly created_at_ms: number;
172
+ /** Who approved it: a Console email, or null for the CLI. */
173
+ readonly approved_by: string | null;
174
+ readonly approved_at_ms: number | null;
175
+ /** When it first counted as registered with Apple. */
176
+ readonly registered_at_ms: number | null;
177
+ /** The App Store Connect issuer of the account that registered it, set once. */
178
+ readonly apple_issuer_id: string | null;
179
+ /** Why Apple didn't take it or stopped counting it, in Apple's words or ours. */
180
+ readonly apple_error: string | null;
181
+ /** The newest native build whose .ipa the CLI checked lists it. */
182
+ readonly build_id: string | null;
108
183
  }
109
184
  //#endregion
110
- export { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow };
185
+ export { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, IosDeviceRow, IosDeviceStatus, NativeBuildArtifactKind, NativeBuildExportMethod, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow };