@hot-updater/plugin-core 1.2.0-rc.4 → 1.2.0-rc.41

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 (41) hide show
  1. package/dist/coreApi.d.cts +204 -9
  2. package/dist/coreApi.d.mts +204 -9
  3. package/dist/engine/core/schema.cjs +171 -3
  4. package/dist/engine/core/schema.d.cts +115 -1
  5. package/dist/engine/core/schema.d.mts +115 -1
  6. package/dist/engine/core/schema.mjs +171 -3
  7. package/dist/engine/createEngine.cjs +1 -2
  8. package/dist/engine/createEngine.d.cts +1 -6
  9. package/dist/engine/createEngine.d.mts +1 -6
  10. package/dist/engine/createEngine.mjs +1 -2
  11. package/dist/engine/database/aggregateBatching.cjs +24 -116
  12. package/dist/engine/database/aggregateBatching.mjs +24 -116
  13. package/dist/engine/database/database.cjs +1 -4
  14. package/dist/engine/database/database.mjs +1 -4
  15. package/dist/engine/database/resolveSchema.cjs +6 -3
  16. package/dist/engine/database/resolveSchema.mjs +6 -3
  17. package/dist/index.cjs +1 -7
  18. package/dist/index.d.cts +5 -6
  19. package/dist/index.d.mts +5 -6
  20. package/dist/index.mjs +2 -3
  21. package/dist/serverPlugin/definitions.d.cts +4 -0
  22. package/dist/serverPlugin/definitions.d.mts +4 -0
  23. package/dist/serverPlugin/schema.d.cts +4 -0
  24. package/dist/serverPlugin/schema.d.mts +4 -0
  25. package/dist/types/databaseConfig.d.cts +8 -19
  26. package/dist/types/databaseConfig.d.mts +8 -19
  27. package/dist/types/databaseRows.d.cts +70 -2
  28. package/dist/types/databaseRows.d.mts +70 -2
  29. package/dist/types/index.cjs +3 -0
  30. package/dist/types/index.d.cts +118 -60
  31. package/dist/types/index.d.mts +118 -60
  32. package/dist/types/index.mjs +3 -1
  33. package/dist/types/models.d.cts +9 -1
  34. package/dist/types/models.d.mts +9 -1
  35. package/dist/types/public.d.cts +3 -3
  36. package/dist/types/public.d.mts +3 -3
  37. package/package.json +3 -9
  38. package/dist/remoteBundleSigning.cjs +0 -357
  39. package/dist/remoteBundleSigning.d.cts +0 -38
  40. package/dist/remoteBundleSigning.d.mts +0 -38
  41. package/dist/remoteBundleSigning.mjs +0 -352
@@ -16,7 +16,10 @@ const CHANNEL_ID = {
16
16
  * every database's migrator creates missing tables and then records the
17
17
  * version, and none of them changes an existing table, so changing one
18
18
  * needs a migration step of its own first. The schema fence answers 503 on
19
- * a database whose row differs, until it runs.
19
+ * a database whose row differs, until it runs. Before a version is released,
20
+ * its tables change in place in its own migration, and a database one of its
21
+ * prereleases migrated takes the same change by hand: the fence compares this
22
+ * row, not columns, so nothing reports it.
20
23
  */
21
24
  const HOT_UPDATER_SCHEMA_VERSION = "1.2.0";
22
25
  const bundles = require_schema.defineTable({
@@ -270,7 +273,10 @@ const channels = require_schema.defineTable({
270
273
  /**
271
274
  * The native builds `native-build android` and `native-build ios` track, newest first
272
275
  * in each scope: a platform, a channel, and the fingerprint or app version
273
- * the build compiled in. `min_bundle_id` names the build's built-in bundle,
276
+ * the build compiled in. A sandbox build's scope has no channel: its app ID,
277
+ * URL scheme, artifact kind and distribution in its place, so pull requests
278
+ * reuse it across channels, while `channel_id` still names the channel it
279
+ * embeds. `min_bundle_id` names the build's built-in bundle,
274
280
  * a `bundles` row no release publishes. Its references keep no counters, so
275
281
  * adding this table changes no existing one; a channel with builds is
276
282
  * refused deletion through `byChannel`. `build_key` is the native build key
@@ -280,6 +286,27 @@ const channels = require_schema.defineTable({
280
286
  * or `versionCode`. `submitted_to`, `submitted_at_ms` and
281
287
  * `submitted_version` record the store track a build went to, when, and
282
288
  * the store's label of the build; they stay null for a build no store took.
289
+ * `is_store_build` is true on the build a person or a job says the store
290
+ * sells, and false on every other: deploys patch from it over the scope's
291
+ * newest build. The engine copies the scope key into `store_build_scope_key`
292
+ * for that build alone, so `byStoreBuild` holds one entry per scope at most,
293
+ * on every store, while any number of a scope's builds hold none.
294
+ * `is_sandbox` is true on a sandbox build, set from its artifact when it
295
+ * registers and never changed, and `sandbox_url_scheme` is the URL scheme its artifact registers,
296
+ * which its preview links open; null on any other build, and on a sandbox
297
+ * build registered before the column, which registered the derived one.
298
+ * `export_method` is how an `.ipa` was exported, read from its profile when
299
+ * it registers and never changed; null on any other artifact, on an `.ipa`
300
+ * whose profile couldn't be read, and on one registered before the column.
301
+ * `native_app_version` is the app version the artifact itself reports, its
302
+ * `CFBundleShortVersionString` or `versionName`, read from the artifact when
303
+ * it registers and never changed, whatever the update strategy; `app_version`
304
+ * stays the version OTAs target, null on a fingerprint build. It is null
305
+ * when the artifact's can't be read, and on a build registered before the
306
+ * column.
307
+ * Boolean columns follow one rule: `is_*` for a fact about the row or
308
+ * `should_*` for an instruction to the client, never null; a unique index over
309
+ * the rows where one is true keys a derived slot, not the boolean.
283
310
  */
284
311
  const nativeBuilds = require_schema.defineTable({
285
312
  id: {
@@ -356,9 +383,34 @@ const nativeBuilds = require_schema.defineTable({
356
383
  type: "string",
357
384
  maxLength: 255,
358
385
  required: false
386
+ },
387
+ is_store_build: { type: "boolean" },
388
+ is_sandbox: { type: "boolean" },
389
+ sandbox_url_scheme: {
390
+ type: "string",
391
+ maxLength: 255,
392
+ ascii: true,
393
+ required: false
394
+ },
395
+ export_method: {
396
+ type: "string",
397
+ maxLength: 16,
398
+ required: false
399
+ },
400
+ native_app_version: {
401
+ type: "string",
402
+ required: false
359
403
  }
360
404
  }, {
361
405
  key: ["id"],
406
+ derived: {
407
+ /** The scope this build is the store build of; null on every other. */
408
+ store_build_scope_key: {
409
+ type: "string",
410
+ maxLength: 2048,
411
+ ascii: true,
412
+ compute: (row) => row.is_store_build ? row.scope_key : null
413
+ } },
362
414
  indexes: {
363
415
  byScope: {
364
416
  eq: ["scope_key"],
@@ -368,6 +420,11 @@ const nativeBuilds = require_schema.defineTable({
368
420
  eq: ["scope_key", "build_key"],
369
421
  sort: ["id"]
370
422
  },
423
+ byStoreBuild: {
424
+ eq: ["store_build_scope_key"],
425
+ sort: [],
426
+ unique: true
427
+ },
371
428
  byChannel: {
372
429
  eq: ["channel_id"],
373
430
  sort: ["id"],
@@ -379,6 +436,115 @@ const nativeBuilds = require_schema.defineTable({
379
436
  }
380
437
  }
381
438
  });
439
+ /**
440
+ * The iPhones a team asks to install ad hoc builds on. A row decides what the
441
+ * CLI registers with Apple, not what an export includes: Xcode's automatic ad
442
+ * hoc profile lists every device the Apple account has enabled. `status` is
443
+ * `pending` until someone approves it, `approved` until a build or
444
+ * `native-build devices add` registers it with Apple, then `registered`;
445
+ * declining or removing one deletes its row. `udid` is the UDID in lower case.
446
+ * `apple_issuer_id` is the App Store Connect issuer whose key registered it,
447
+ * set once: a build signed by another account never registers these rows.
448
+ * `apple_error` is Apple's refusal of the device, or why it stopped counting
449
+ * it, cleared by the next success. `build_id` is the newest native build whose
450
+ * .ipa the CLI checked lists it; deleting that build never touches the row.
451
+ * It holds personal data: a UDID, a name, and the emails of who asked and who
452
+ * approved, null for the CLI.
453
+ */
454
+ const iosDevices = require_schema.defineTable({
455
+ id: {
456
+ type: "string",
457
+ maxLength: 36
458
+ },
459
+ udid: {
460
+ type: "string",
461
+ maxLength: 40,
462
+ ascii: true,
463
+ unique: true
464
+ },
465
+ name: {
466
+ type: "string",
467
+ maxLength: 100
468
+ },
469
+ status: {
470
+ type: "string",
471
+ maxLength: 16
472
+ },
473
+ requested_by: {
474
+ type: "string",
475
+ maxLength: 320,
476
+ required: false
477
+ },
478
+ created_at_ms: { type: "integer" },
479
+ approved_by: {
480
+ type: "string",
481
+ maxLength: 320,
482
+ required: false
483
+ },
484
+ approved_at_ms: {
485
+ type: "integer",
486
+ required: false
487
+ },
488
+ registered_at_ms: {
489
+ type: "integer",
490
+ required: false
491
+ },
492
+ apple_issuer_id: {
493
+ type: "string",
494
+ maxLength: 64,
495
+ ascii: true,
496
+ required: false
497
+ },
498
+ apple_error: {
499
+ type: "string",
500
+ maxLength: 512,
501
+ required: false
502
+ },
503
+ build_id: {
504
+ type: "string",
505
+ maxLength: 36,
506
+ required: false
507
+ }
508
+ }, {
509
+ key: ["id"],
510
+ indexes: {
511
+ byStatus: {
512
+ eq: ["status"],
513
+ sort: ["id"]
514
+ },
515
+ all: {
516
+ eq: [],
517
+ sort: ["id"]
518
+ }
519
+ }
520
+ });
521
+ /**
522
+ * The Apple account the iOS device registry belongs to: one row, keyed
523
+ * `registry`, holding the App Store Connect issuer that first registered a
524
+ * device. A build claims it before it sends Apple anything, and its key makes
525
+ * the claim atomic on every store, so two builds of two accounts can't both
526
+ * spend a slot; another account's build then registers nothing. Removing
527
+ * devices never releases it.
528
+ */
529
+ const iosDeviceAccount = require_schema.defineTable({
530
+ id: {
531
+ type: "string",
532
+ maxLength: 16,
533
+ ascii: true
534
+ },
535
+ apple_issuer_id: {
536
+ type: "string",
537
+ maxLength: 64,
538
+ ascii: true
539
+ },
540
+ claimed_at_ms: { type: "integer" }
541
+ }, {
542
+ key: ["id"],
543
+ indexes: { all: {
544
+ eq: [],
545
+ sort: ["id"]
546
+ } }
547
+ });
382
548
  const coreSchema = {
383
549
  bundles,
384
550
  bundle_patches: bundlePatches,
@@ -396,7 +562,9 @@ const coreSchema = {
396
562
  sort: []
397
563
  } }
398
564
  }),
399
- native_builds: nativeBuilds
565
+ native_builds: nativeBuilds,
566
+ ios_devices: iosDevices,
567
+ ios_device_account: iosDeviceAccount
400
568
  };
401
569
  /** Core's module: always installed, never a plugin. */
402
570
  const coreModule = {
@@ -385,7 +385,30 @@ declare const coreSchema: {
385
385
  readonly maxLength: 255;
386
386
  readonly required: false;
387
387
  };
388
- }, {}, {
388
+ readonly is_store_build: {
389
+ readonly type: "boolean";
390
+ };
391
+ readonly is_sandbox: {
392
+ readonly type: "boolean";
393
+ };
394
+ readonly sandbox_url_scheme: {
395
+ readonly type: "string";
396
+ readonly maxLength: 255;
397
+ readonly ascii: true;
398
+ readonly required: false;
399
+ };
400
+ readonly export_method: {
401
+ readonly type: "string";
402
+ readonly maxLength: 16;
403
+ readonly required: false;
404
+ };
405
+ readonly native_app_version: {
406
+ readonly type: "string";
407
+ readonly required: false;
408
+ };
409
+ }, {
410
+ store_build_scope_key: "string";
411
+ }, {
389
412
  readonly byScope: {
390
413
  readonly eq: readonly ["scope_key"];
391
414
  readonly sort: readonly ["id"];
@@ -394,6 +417,11 @@ declare const coreSchema: {
394
417
  readonly eq: readonly ["scope_key", "build_key"];
395
418
  readonly sort: readonly ["id"];
396
419
  };
420
+ readonly byStoreBuild: {
421
+ readonly eq: readonly ["store_build_scope_key"];
422
+ readonly sort: readonly [];
423
+ readonly unique: true;
424
+ };
397
425
  readonly byChannel: {
398
426
  readonly eq: readonly ["channel_id"];
399
427
  readonly sort: readonly ["id"];
@@ -406,6 +434,92 @@ declare const coreSchema: {
406
434
  readonly sort: readonly ["id"];
407
435
  };
408
436
  }, readonly ["id"]>;
437
+ readonly ios_devices: TableDefinition<{
438
+ readonly id: {
439
+ readonly type: "string";
440
+ readonly maxLength: 36;
441
+ };
442
+ readonly udid: {
443
+ readonly type: "string";
444
+ readonly maxLength: 40;
445
+ readonly ascii: true;
446
+ readonly unique: true;
447
+ };
448
+ readonly name: {
449
+ readonly type: "string";
450
+ readonly maxLength: 100;
451
+ };
452
+ readonly status: {
453
+ readonly type: "string";
454
+ readonly maxLength: 16;
455
+ };
456
+ readonly requested_by: {
457
+ readonly type: "string";
458
+ readonly maxLength: 320;
459
+ readonly required: false;
460
+ };
461
+ readonly created_at_ms: {
462
+ readonly type: "integer";
463
+ };
464
+ readonly approved_by: {
465
+ readonly type: "string";
466
+ readonly maxLength: 320;
467
+ readonly required: false;
468
+ };
469
+ readonly approved_at_ms: {
470
+ readonly type: "integer";
471
+ readonly required: false;
472
+ };
473
+ readonly registered_at_ms: {
474
+ readonly type: "integer";
475
+ readonly required: false;
476
+ };
477
+ readonly apple_issuer_id: {
478
+ readonly type: "string";
479
+ readonly maxLength: 64;
480
+ readonly ascii: true;
481
+ readonly required: false;
482
+ };
483
+ readonly apple_error: {
484
+ readonly type: "string";
485
+ readonly maxLength: 512;
486
+ readonly required: false;
487
+ };
488
+ readonly build_id: {
489
+ readonly type: "string";
490
+ readonly maxLength: 36;
491
+ readonly required: false;
492
+ };
493
+ }, {}, {
494
+ readonly byStatus: {
495
+ readonly eq: readonly ["status"];
496
+ readonly sort: readonly ["id"];
497
+ };
498
+ readonly all: {
499
+ readonly eq: readonly [];
500
+ readonly sort: readonly ["id"];
501
+ };
502
+ }, readonly ["id"]>;
503
+ readonly ios_device_account: TableDefinition<{
504
+ readonly id: {
505
+ readonly type: "string";
506
+ readonly maxLength: 16;
507
+ readonly ascii: true;
508
+ };
509
+ readonly apple_issuer_id: {
510
+ readonly type: "string";
511
+ readonly maxLength: 64;
512
+ readonly ascii: true;
513
+ };
514
+ readonly claimed_at_ms: {
515
+ readonly type: "integer";
516
+ };
517
+ }, {}, {
518
+ readonly all: {
519
+ readonly eq: readonly [];
520
+ readonly sort: readonly ["id"];
521
+ };
522
+ }, readonly ["id"]>;
409
523
  };
410
524
  /**
411
525
  * Core's tables as the engine types them: the type of `createEngine`'s
@@ -385,7 +385,30 @@ declare const coreSchema: {
385
385
  readonly maxLength: 255;
386
386
  readonly required: false;
387
387
  };
388
- }, {}, {
388
+ readonly is_store_build: {
389
+ readonly type: "boolean";
390
+ };
391
+ readonly is_sandbox: {
392
+ readonly type: "boolean";
393
+ };
394
+ readonly sandbox_url_scheme: {
395
+ readonly type: "string";
396
+ readonly maxLength: 255;
397
+ readonly ascii: true;
398
+ readonly required: false;
399
+ };
400
+ readonly export_method: {
401
+ readonly type: "string";
402
+ readonly maxLength: 16;
403
+ readonly required: false;
404
+ };
405
+ readonly native_app_version: {
406
+ readonly type: "string";
407
+ readonly required: false;
408
+ };
409
+ }, {
410
+ store_build_scope_key: "string";
411
+ }, {
389
412
  readonly byScope: {
390
413
  readonly eq: readonly ["scope_key"];
391
414
  readonly sort: readonly ["id"];
@@ -394,6 +417,11 @@ declare const coreSchema: {
394
417
  readonly eq: readonly ["scope_key", "build_key"];
395
418
  readonly sort: readonly ["id"];
396
419
  };
420
+ readonly byStoreBuild: {
421
+ readonly eq: readonly ["store_build_scope_key"];
422
+ readonly sort: readonly [];
423
+ readonly unique: true;
424
+ };
397
425
  readonly byChannel: {
398
426
  readonly eq: readonly ["channel_id"];
399
427
  readonly sort: readonly ["id"];
@@ -406,6 +434,92 @@ declare const coreSchema: {
406
434
  readonly sort: readonly ["id"];
407
435
  };
408
436
  }, readonly ["id"]>;
437
+ readonly ios_devices: TableDefinition<{
438
+ readonly id: {
439
+ readonly type: "string";
440
+ readonly maxLength: 36;
441
+ };
442
+ readonly udid: {
443
+ readonly type: "string";
444
+ readonly maxLength: 40;
445
+ readonly ascii: true;
446
+ readonly unique: true;
447
+ };
448
+ readonly name: {
449
+ readonly type: "string";
450
+ readonly maxLength: 100;
451
+ };
452
+ readonly status: {
453
+ readonly type: "string";
454
+ readonly maxLength: 16;
455
+ };
456
+ readonly requested_by: {
457
+ readonly type: "string";
458
+ readonly maxLength: 320;
459
+ readonly required: false;
460
+ };
461
+ readonly created_at_ms: {
462
+ readonly type: "integer";
463
+ };
464
+ readonly approved_by: {
465
+ readonly type: "string";
466
+ readonly maxLength: 320;
467
+ readonly required: false;
468
+ };
469
+ readonly approved_at_ms: {
470
+ readonly type: "integer";
471
+ readonly required: false;
472
+ };
473
+ readonly registered_at_ms: {
474
+ readonly type: "integer";
475
+ readonly required: false;
476
+ };
477
+ readonly apple_issuer_id: {
478
+ readonly type: "string";
479
+ readonly maxLength: 64;
480
+ readonly ascii: true;
481
+ readonly required: false;
482
+ };
483
+ readonly apple_error: {
484
+ readonly type: "string";
485
+ readonly maxLength: 512;
486
+ readonly required: false;
487
+ };
488
+ readonly build_id: {
489
+ readonly type: "string";
490
+ readonly maxLength: 36;
491
+ readonly required: false;
492
+ };
493
+ }, {}, {
494
+ readonly byStatus: {
495
+ readonly eq: readonly ["status"];
496
+ readonly sort: readonly ["id"];
497
+ };
498
+ readonly all: {
499
+ readonly eq: readonly [];
500
+ readonly sort: readonly ["id"];
501
+ };
502
+ }, readonly ["id"]>;
503
+ readonly ios_device_account: TableDefinition<{
504
+ readonly id: {
505
+ readonly type: "string";
506
+ readonly maxLength: 16;
507
+ readonly ascii: true;
508
+ };
509
+ readonly apple_issuer_id: {
510
+ readonly type: "string";
511
+ readonly maxLength: 64;
512
+ readonly ascii: true;
513
+ };
514
+ readonly claimed_at_ms: {
515
+ readonly type: "integer";
516
+ };
517
+ }, {}, {
518
+ readonly all: {
519
+ readonly eq: readonly [];
520
+ readonly sort: readonly ["id"];
521
+ };
522
+ }, readonly ["id"]>;
409
523
  };
410
524
  /**
411
525
  * Core's tables as the engine types them: the type of `createEngine`'s