primitive-admin 1.3.0-alpha.2 → 1.3.0-alpha.3

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 (91) hide show
  1. package/README.md +46 -22
  2. package/dist/bin/primitive.js +11 -4
  3. package/dist/bin/primitive.js.map +1 -1
  4. package/dist/src/commands/apps.d.ts +3 -6
  5. package/dist/src/commands/apps.js +7 -22
  6. package/dist/src/commands/apps.js.map +1 -1
  7. package/dist/src/commands/auth-passkeys.js +1 -1
  8. package/dist/src/commands/auth-passkeys.js.map +1 -1
  9. package/dist/src/commands/auth.js +1 -1
  10. package/dist/src/commands/auth.js.map +1 -1
  11. package/dist/src/commands/blob-buckets.d.ts +8 -0
  12. package/dist/src/commands/blob-buckets.js +23 -8
  13. package/dist/src/commands/blob-buckets.js.map +1 -1
  14. package/dist/src/commands/db3.js +6 -0
  15. package/dist/src/commands/db3.js.map +1 -1
  16. package/dist/src/commands/documents.js +3 -0
  17. package/dist/src/commands/documents.js.map +1 -1
  18. package/dist/src/commands/functions.js +13 -4
  19. package/dist/src/commands/functions.js.map +1 -1
  20. package/dist/src/commands/init.js +11 -0
  21. package/dist/src/commands/init.js.map +1 -1
  22. package/dist/src/commands/rule-sets.d.ts +1 -1
  23. package/dist/src/commands/rule-sets.js +0 -1
  24. package/dist/src/commands/rule-sets.js.map +1 -1
  25. package/dist/src/commands/sync.d.ts +27 -13
  26. package/dist/src/commands/sync.js +105 -112
  27. package/dist/src/commands/sync.js.map +1 -1
  28. package/dist/src/commands/usage.d.ts +12 -2
  29. package/dist/src/commands/usage.js +115 -5
  30. package/dist/src/commands/usage.js.map +1 -1
  31. package/dist/src/lib/api-client.d.ts +80 -5
  32. package/dist/src/lib/api-client.js +21 -9
  33. package/dist/src/lib/api-client.js.map +1 -1
  34. package/dist/src/lib/cli-manifest.d.ts +9 -0
  35. package/dist/src/lib/cli-manifest.js +19 -3
  36. package/dist/src/lib/cli-manifest.js.map +1 -1
  37. package/dist/src/lib/config-object-descriptor.js +3 -5
  38. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  39. package/dist/src/lib/db3-export.js +1 -0
  40. package/dist/src/lib/db3-export.js.map +1 -1
  41. package/dist/src/lib/document-ingest.d.ts +7 -1
  42. package/dist/src/lib/document-ingest.js +27 -2
  43. package/dist/src/lib/document-ingest.js.map +1 -1
  44. package/dist/src/lib/function-bundle.d.ts +6 -0
  45. package/dist/src/lib/function-bundle.js +14 -0
  46. package/dist/src/lib/function-bundle.js.map +1 -1
  47. package/dist/src/lib/function-db-types.d.ts +8 -0
  48. package/dist/src/lib/function-db-types.js +15 -0
  49. package/dist/src/lib/function-db-types.js.map +1 -1
  50. package/dist/src/lib/function-log-lines.js +6 -1
  51. package/dist/src/lib/function-log-lines.js.map +1 -1
  52. package/dist/src/lib/function-log-row.d.ts +8 -0
  53. package/dist/src/lib/function-log-row.js +59 -0
  54. package/dist/src/lib/function-log-row.js.map +1 -1
  55. package/dist/src/lib/generated-command-status.js +6 -5
  56. package/dist/src/lib/generated-command-status.js.map +1 -1
  57. package/dist/src/lib/generated-config-surfaces.d.ts +29 -4
  58. package/dist/src/lib/generated-config-surfaces.js +160 -49
  59. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  60. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  61. package/dist/src/lib/generated-sdk-types.js +1 -1
  62. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  63. package/dist/src/lib/log-inspection.d.ts +37 -2
  64. package/dist/src/lib/log-inspection.js +15 -3
  65. package/dist/src/lib/log-inspection.js.map +1 -1
  66. package/dist/src/lib/outside-project.d.ts +49 -0
  67. package/dist/src/lib/outside-project.js +133 -0
  68. package/dist/src/lib/outside-project.js.map +1 -0
  69. package/dist/src/lib/primitive-declaration.d.ts +8 -1
  70. package/dist/src/lib/primitive-declaration.js +40 -8
  71. package/dist/src/lib/primitive-declaration.js.map +1 -1
  72. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +16 -0
  73. package/dist/src/lib/schema-codegen/compiledSpace.js +23 -11
  74. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -1
  75. package/dist/src/lib/schema-codegen/generated-field-table.js +38 -3
  76. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -1
  77. package/dist/src/lib/schema-codegen/generated-schema-refs.js +172 -19
  78. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -1
  79. package/dist/src/lib/schema-codegen/namedRefs.js +8 -2
  80. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -1
  81. package/dist/src/lib/schema-codegen/schemaDocs.js +10 -4
  82. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -1
  83. package/dist/src/lib/schema-codegen/schemaIR.d.ts +12 -2
  84. package/dist/src/lib/schema-codegen/schemaIR.js +26 -2
  85. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -1
  86. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +2 -1
  87. package/dist/src/lib/schema-codegen/schemaToTs.js +8 -5
  88. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
  89. package/dist/src/lib/usage-meters.js +1 -0
  90. package/dist/src/lib/usage-meters.js.map +1 -1
  91. package/package.json +2 -2
@@ -2312,6 +2312,43 @@ export function unknownRequestKeysMessage(keys) {
2312
2312
  `${keys.join(", ")}. This endpoint rejects keys it does not accept rather ` +
2313
2313
  "than ignoring them.");
2314
2314
  }
2315
+ // ── src/config-surface/retired-keys.ts ───────────────────────────────────
2316
+ /**
2317
+ * Keys deliberately RETIRED from a configuration object's write surface.
2318
+ *
2319
+ * A retired key is not an unknown key. The generic hint for an unrecognized
2320
+ * TOML key — "check the spelling, or upgrade the CLI" — is exactly backwards
2321
+ * for one this CLI removed on purpose, and the generic 400 for an unaccepted
2322
+ * request key says only that the key is not allowed, not where the value moved
2323
+ * to. Both surfaces need the same sentence, and neither should invent it.
2324
+ *
2325
+ * So the guidance lives here, next to the definitions, with one entry per
2326
+ * retired key: the TOML wording for `config push` (which can tell the author to
2327
+ * delete a line) and the request wording for the API handlers (which cannot).
2328
+ *
2329
+ * Keyed by the table's TOML path prefix (`integration`, `prompt`, …), because
2330
+ * that is the identifier both consumers already have in hand.
2331
+ *
2332
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
2333
+ */
2334
+ /** The four bucket access presets, the only values `preset` takes. */
2335
+ export const BLOB_BUCKET_ACCESS_PRESETS = [
2336
+ "public",
2337
+ "authenticated",
2338
+ "admin-only",
2339
+ "personal-uploads",
2340
+ ];
2341
+ /**
2342
+ * The one refusal for a bucket rule set, whichever door it comes through: a
2343
+ * `ruleSetId` or `ruleSetName` body key or TOML line, preset `custom`, or a
2344
+ * rule set of resource type `blob_bucket`. It names the four presets and the
2345
+ * function pattern that replaces a rule set.
2346
+ */
2347
+ export const BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE = "Blob buckets no longer take a rule set: a bucket's access is one of the " +
2348
+ "presets `public`, `authenticated`, `admin-only` or `personal-uploads`. " +
2349
+ "For access a preset cannot express, make the bucket `admin-only` and " +
2350
+ "decide in a server function's `authorize`, which returns read URLs " +
2351
+ "made by `ctx.api.blobBuckets.getSignedUrls`.";
2315
2352
  // #3997 — the three type configs author their rule-set reference by name
2316
2353
  // (#2644): an id names a row in one app and resolves to nothing in another, so
2317
2354
  // a copied file failed instead of resolving. One sentence serves all three
@@ -2432,25 +2469,29 @@ export const RETIRED_CONFIG_KEYS = {
2432
2469
  "`admin-only` (app admins; `personal-uploads` is the per-uploader " +
2433
2470
  "preset).",
2434
2471
  },
2435
- // #4283 — #4116 made the bucket author its rule set by name and kept the
2436
- // id spelling as a deprecated key. Its own sentence rather than the type
2437
- // configs' shared one, which says a pulled file already spells the name:
2438
- // a bucket file pulled before #4116 does not. The `request` half is never
2439
- // surfaced, for the reason given at `RULE_SET_ID_RETIRED`.
2472
+ // #6243 — rule sets left buckets: a bucket's access is one of the four
2473
+ // presets, and anything a preset cannot express goes through a function.
2474
+ // Both spellings of the reference are refused on the wire and in TOML
2475
+ // with the one sentence the rule-set routes also answer, so the author
2476
+ // meets the presets and the function pattern whichever door they used.
2440
2477
  ruleSetId: {
2441
- toml: "`ruleSetId` is no longer authored in TOML (#4283). A rule-set id " +
2442
- "names a row in one app and resolves to nothing in another, so the " +
2443
- "reference is authored by name: replace this line with " +
2444
- '`ruleSetName = "<name>"`, where the name is the `name` the rule ' +
2445
- "set's own `rule-sets/<key>.toml` declares, and push again, or " +
2446
- "`config pull` rewrites the file.",
2447
- request: "`ruleSetId` is the live request key on this surface; only its TOML " +
2448
- "spelling is retired (#4283). Send the rule set's id.",
2478
+ toml: "`ruleSetId` is no longer a bucket key (#6243). " +
2479
+ BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE +
2480
+ " Replace the line with `preset = \"admin-only\"` (or another " +
2481
+ "preset) and push again.",
2482
+ request: BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE,
2483
+ },
2484
+ ruleSetName: {
2485
+ toml: "`ruleSetName` is no longer a bucket key (#6243). " +
2486
+ BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE +
2487
+ " Replace the line with `preset = \"admin-only\"` (or another " +
2488
+ "preset) and push again.",
2489
+ request: BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE,
2449
2490
  },
2450
2491
  },
2451
2492
  // #3997 — keyed by each table's TOML prefix. Only `database-type-config`
2452
2493
  // uses `[type]`, so that entry cannot reach another surface. The blob
2453
- // bucket's `[bucket] ruleSetId` has its own entry under `bucket` (#4283).
2494
+ // bucket's `[bucket] ruleSetId` has its own entry under `bucket` (#6243).
2454
2495
  //
2455
2496
  // #3189 — server-functions phase 6 retires database operations, and with
2456
2497
  // them the two type-level CEL keys that existed for operations: the access
@@ -9376,13 +9417,14 @@ export const INTEGRATION_SURFACE = {
9376
9417
  * `blob-buckets/<key>.toml` carries a single `[bucket]` table.
9377
9418
  *
9378
9419
  * `ttlTier` is `writableOn: ["create"]`: the update handler does not read it, so
9379
- * the retention tier is fixed at creation. `preset` and the rule set are the two
9380
- * halves of the access model (#1020), and the only access keys: at most one may
9381
- * change per request, which is the controller's rule and stays there. The rule
9382
- * set is authored by name (`ruleSetName`) and sent as `ruleSetId`, as the type
9383
- * configs do (#4116). The id spelling in TOML (#4283) and the pre-#1020
9384
- * `accessPolicy` spelling (#3996) are retired keys (`retired-keys.ts`).
9385
- */
9420
+ * the retention tier is fixed at creation. `preset` is the bucket's access
9421
+ * (#1020), one of `BLOB_BUCKET_ACCESS_PRESETS`. Rule sets left buckets in
9422
+ * #6243: `ruleSetName` and `ruleSetId` are retired keys (`retired-keys.ts`), as
9423
+ * is the pre-#1020 `accessPolicy` spelling (#3996). Access a preset cannot
9424
+ * express goes through a server function that hands out signed URLs.
9425
+ */
9426
+ // Declared in `retired-keys.ts`, which the CLI's concatenated copy places
9427
+ // first; re-exported here beside the surface they describe.
9386
9428
  const BLOB_BUCKET_HANDLER = "src/app-api/controllers/blob-buckets-controller.ts";
9387
9429
  export const BLOB_BUCKET_SURFACE = {
9388
9430
  label: "blob-bucket",
@@ -9424,22 +9466,10 @@ export const BLOB_BUCKET_SURFACE = {
9424
9466
  type: "string",
9425
9467
  emit: "whenSet",
9426
9468
  writableOn: BOTH,
9427
- // #1020 — the honest access field. A rule-set-backed bucket reports
9428
- // "custom", which is not written back as a preset.
9469
+ // #1020 — the access field, one of the four presets (#6243). A
9470
+ // bucket stored with a rule set reads as `admin-only`.
9429
9471
  validation: handledBy("src/app-api/resource-types/blob-bucket.ts", "resolveBucketPreset", "apply"),
9430
9472
  },
9431
- {
9432
- field: "ruleSetId",
9433
- tomlKey: "ruleSetName",
9434
- type: "string",
9435
- emit: "whenSet",
9436
- writableOn: BOTH,
9437
- // Authored as a name, sent as an id (#4116), so a tree copied into
9438
- // another app binds that app's rule set. Existence-checked against
9439
- // AccessRuleSet; mutually exclusive with a preset change in the same
9440
- // request. The TOML spelling of the id is a retired key (#4283).
9441
- validation: handledBy(BLOB_BUCKET_HANDLER, "BlobBucketsController", "apply"),
9442
- },
9443
9473
  ],
9444
9474
  notExposed: {
9445
9475
  bucketId: {
@@ -9468,6 +9498,14 @@ export const BLOB_BUCKET_SURFACE = {
9468
9498
  "can read a pre-#1020 row; no write path accepts it and no " +
9469
9499
  "serializer emits it.",
9470
9500
  },
9501
+ ruleSetId: {
9502
+ kind: "server-owned",
9503
+ note: "RETIRED from the write surface by #6243: a bucket's access is one " +
9504
+ "of the four presets. The attribute stays declared so a bucket " +
9505
+ "stored with a rule set reads as `admin-only` " +
9506
+ "(`resolveBucketPreset`); no write path accepts it, a preset " +
9507
+ "update clears it, and no serializer emits it.",
9508
+ },
9471
9509
  createdBy: {
9472
9510
  kind: "server-owned",
9473
9511
  note: "User who created the bucket; assigned server-side.",
@@ -9488,11 +9526,17 @@ export const BLOB_BUCKET_SURFACE = {
9488
9526
  "the identity from the file name and attaches `bucketKey` itself.",
9489
9527
  },
9490
9528
  },
9491
- responseOnlyKeys: {},
9529
+ responseOnlyKeys: {
9530
+ convertedFromRuleSet: {
9531
+ kind: "server-owned",
9532
+ note: "Read-only mark (#6243): true for a bucket stored with a rule set, " +
9533
+ "which is served as `admin-only` until an update names a preset.",
9534
+ },
9535
+ },
9492
9536
  },
9493
9537
  ],
9494
- // A bucket file is the `[bucket]` table and nothing else: its access model is
9495
- // a preset or a rule-set reference, both scalars inside that table.
9538
+ // A bucket file is the `[bucket]` table and nothing else: its access is a
9539
+ // preset, a scalar inside that table.
9496
9540
  tomlDocumentKeys: {},
9497
9541
  };
9498
9542
  // ── src/config-surface/email-template.ts ─────────────────────────────────
@@ -9987,6 +10031,11 @@ const RULE_SET_HANDLER = "src/app-api/controllers/rule-sets-controller.ts";
9987
10031
  * `lock` — locks are server-function-only, and the calling function's
9988
10032
  * `authorize` decides who may lock which key. A stored row can still be listed
9989
10033
  * and deleted; nothing evaluates it.
10034
+ *
10035
+ * `blob_bucket` (#6243) — a bucket's access is one of four presets. The type
10036
+ * stays registered (the presets evaluate through it), so the rule-set
10037
+ * listings leave it out; a stored row can still be listed, read and deleted,
10038
+ * and a bucket that pointed at one is served as `admin-only`.
9990
10039
  */
9991
10040
  export const RETIRED_RULE_SET_RESOURCE_TYPES = {
9992
10041
  lock: {
@@ -9997,6 +10046,13 @@ export const RETIRED_RULE_SET_RESOURCE_TYPES = {
9997
10046
  "`rule-sets/<name>.toml` and run `primitive config push --prune` to " +
9998
10047
  "remove this rule set.",
9999
10048
  },
10049
+ blob_bucket: {
10050
+ code: "BLOB_BUCKET_RULE_SET_RETIRED",
10051
+ message: "`blob_bucket` is no longer a rule-set resource type. " +
10052
+ BLOB_BUCKET_RULE_SET_RETIRED_MESSAGE +
10053
+ " Delete `rule-sets/<name>.toml` and run `primitive config push " +
10054
+ "--prune` to remove this rule set.",
10055
+ },
10000
10056
  };
10001
10057
  /** The retirement for `resourceType`, or `null` for a live type. */
10002
10058
  export function retiredRuleSetResourceType(resourceType) {
@@ -11053,8 +11109,14 @@ export const TEST_CASE_SURFACE = {
11053
11109
  * saying that copies of the app from version `from` upward talk to another
11054
11110
  * app id, and optionally another server. The rules here check each step's
11055
11111
  * form, refuse a step naming the app's own id when the caller passes it, and
11056
- * bound the stored size of a policy that carries any step. They check nothing
11057
- * else about the target.
11112
+ * bound the stored size of a policy that carries any step. A step's `apiUrl`
11113
+ * must be written in canonical form (equal to `new URL(value).href`) with
11114
+ * plain characters (#6185), so the server is the only URL parser and every
11115
+ * client reads the same address. They check nothing else about the target.
11116
+ *
11117
+ * A platform's entry may also say `enforce` (#6039): a boolean, legal only
11118
+ * beside a `minRequired`, asking the server to refuse callers that report
11119
+ * that platform and a lower version.
11058
11120
  *
11059
11121
  * Maps are read with own-property iteration only, so a platform named
11060
11122
  * `constructor` is an entry like any other.
@@ -11067,6 +11129,7 @@ export const CLIENT_VERSION_ENTRY_KEYS = [
11067
11129
  "minRecommended",
11068
11130
  "minRequired",
11069
11131
  "updateUrl",
11132
+ "enforce",
11070
11133
  "backendOverrides",
11071
11134
  ];
11072
11135
  /** The keys of an entry that hold a version. */
@@ -11154,7 +11217,7 @@ export function compareClientVersions(a, b) {
11154
11217
  return 0;
11155
11218
  }
11156
11219
  const SCHEME_LIST = "https:, itms-apps:, itms-beta:, macappstore: or market:";
11157
- const KEY_LIST = "latest, minRecommended, minRequired, updateUrl or backendOverrides";
11220
+ const KEY_LIST = "latest, minRecommended, minRequired, updateUrl, enforce or backendOverrides";
11158
11221
  const OVERRIDE_KEY_LIST = "from, appId or apiUrl";
11159
11222
  function versionNumberSentence(value) {
11160
11223
  return (`must be a quoted string such as "1.10": quote it, because an ` +
@@ -11181,12 +11244,55 @@ function checkOverrideApiUrl(key, where, value) {
11181
11244
  if (value.includes("?") || value.includes("#")) {
11182
11245
  return refuse(`must not carry a query or a fragment (got "${value}")`);
11183
11246
  }
11184
- if (url.protocol === "https:")
11185
- return null;
11186
- if (url.protocol === "http:" && BACKEND_OVERRIDE_LOOPBACK_HOSTS.includes(url.hostname)) {
11187
- return null;
11247
+ const schemeAllowed = url.protocol === "https:" ||
11248
+ (url.protocol === "http:" && BACKEND_OVERRIDE_LOOPBACK_HOSTS.includes(url.hostname));
11249
+ if (!schemeAllowed) {
11250
+ return refuse(`must use https:, or http: on localhost, 127.0.0.1 or [::1] (got ${url.protocol}//${url.host})`);
11188
11251
  }
11189
- return refuse(`must use https:, or http: on localhost, 127.0.0.1 or [::1] (got ${url.protocol}//${url.host})`);
11252
+ if (url.href !== value) {
11253
+ return refuse(`must be written in its canonical form "${url.href}" (got "${value}")`);
11254
+ }
11255
+ const plain = firstNonPlainCharacter(url);
11256
+ if (plain !== null) {
11257
+ return refuse(`must use only plain characters: "${plain}" is not allowed (got "${value}"); a host ` +
11258
+ `takes lower-case letters, digits, - . and _, and a path takes letters, digits, ` +
11259
+ `- . _ ~ ! $ & ' ( ) * + , ; = : @ / and %XX escapes`);
11260
+ }
11261
+ return null;
11262
+ }
11263
+ /** A host of the plain set: lower-case ASCII letters, digits, `-`, `.` and `_`. */
11264
+ const PLAIN_HOST_CHARACTER = /[a-z0-9._-]/;
11265
+ /** A bracketed IPv6 address as the URL parser serializes it. */
11266
+ const PLAIN_IPV6_HOST = /^\[[0-9a-f:]+\]$/;
11267
+ /** A path character RFC 3986 allows raw; `%` is checked as an escape. */
11268
+ const PLAIN_PATH_CHARACTER = /[A-Za-z0-9\-._~!$&'()*+,;=:@/]/;
11269
+ /**
11270
+ * The first character of a canonical override URL's host or path outside the
11271
+ * plain set both clients read the same way, or null. Every such URL is then
11272
+ * read the same way by the WHATWG parser and by Foundation.
11273
+ */
11274
+ function firstNonPlainCharacter(url) {
11275
+ const host = url.hostname;
11276
+ if (!PLAIN_IPV6_HOST.test(host)) {
11277
+ for (const ch of host) {
11278
+ if (!PLAIN_HOST_CHARACTER.test(ch))
11279
+ return ch;
11280
+ }
11281
+ }
11282
+ const path = url.pathname;
11283
+ for (let i = 0; i < path.length; i++) {
11284
+ const ch = path[i];
11285
+ if (ch === "%") {
11286
+ if (/^[0-9A-Fa-f]{2}$/.test(path.slice(i + 1, i + 3))) {
11287
+ i += 2;
11288
+ continue;
11289
+ }
11290
+ return ch;
11291
+ }
11292
+ if (!PLAIN_PATH_CHARACTER.test(ch))
11293
+ return ch;
11294
+ }
11295
+ return null;
11190
11296
  }
11191
11297
  function checkBackendOverrides(platform, list, ownAppId) {
11192
11298
  const listKey = `[clients.${platform}].backendOverrides`;
@@ -11285,9 +11391,6 @@ function checkEntry(platform, entry, options) {
11285
11391
  for (const key of keys) {
11286
11392
  if (CLIENT_VERSION_ENTRY_KEYS.includes(key))
11287
11393
  continue;
11288
- if (key === "enforce") {
11289
- return clientVersionsRefusal("enforce-not-accepted", `${table}.enforce`, "is not accepted: this server does not enforce a minimum version");
11290
- }
11291
11394
  return clientVersionsRefusal("unknown-key", `${table}.${key}`, `is not a recognized key: use ${KEY_LIST}`);
11292
11395
  }
11293
11396
  for (const key of CLIENT_VERSION_VALUE_KEYS) {
@@ -11307,6 +11410,14 @@ function checkEntry(platform, entry, options) {
11307
11410
  if (refused)
11308
11411
  return refused;
11309
11412
  }
11413
+ if (hasOwn(entry, "enforce")) {
11414
+ if (typeof entry.enforce !== "boolean") {
11415
+ return clientVersionsRefusal("enforce-not-boolean", `${table}.enforce`, "must be true or false, unquoted");
11416
+ }
11417
+ if (!hasOwn(entry, "minRequired")) {
11418
+ return clientVersionsRefusal("enforce-without-minimum", `${table}.enforce`, "is set but the table sets no minRequired: set minRequired, or remove enforce");
11419
+ }
11420
+ }
11310
11421
  const pairs = [
11311
11422
  ["minRequired", "minRecommended"],
11312
11423
  ["minRequired", "latest"],