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.
- package/README.md +46 -22
- package/dist/bin/primitive.js +11 -4
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/apps.d.ts +3 -6
- package/dist/src/commands/apps.js +7 -22
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-passkeys.js +1 -1
- package/dist/src/commands/auth-passkeys.js.map +1 -1
- package/dist/src/commands/auth.js +1 -1
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +8 -0
- package/dist/src/commands/blob-buckets.js +23 -8
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/db3.js +6 -0
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.js +3 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +13 -4
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/init.js +11 -0
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +0 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/sync.d.ts +27 -13
- package/dist/src/commands/sync.js +105 -112
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/usage.d.ts +12 -2
- package/dist/src/commands/usage.js +115 -5
- package/dist/src/commands/usage.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +80 -5
- package/dist/src/lib/api-client.js +21 -9
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -0
- package/dist/src/lib/cli-manifest.js +19 -3
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +3 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db3-export.js +1 -0
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +7 -1
- package/dist/src/lib/document-ingest.js +27 -2
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +6 -0
- package/dist/src/lib/function-bundle.js +14 -0
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +8 -0
- package/dist/src/lib/function-db-types.js +15 -0
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-log-lines.js +6 -1
- package/dist/src/lib/function-log-lines.js.map +1 -1
- package/dist/src/lib/function-log-row.d.ts +8 -0
- package/dist/src/lib/function-log-row.js +59 -0
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/generated-command-status.js +6 -5
- package/dist/src/lib/generated-command-status.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +29 -4
- package/dist/src/lib/generated-config-surfaces.js +160 -49
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/log-inspection.d.ts +37 -2
- package/dist/src/lib/log-inspection.js +15 -3
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/outside-project.d.ts +49 -0
- package/dist/src/lib/outside-project.js +133 -0
- package/dist/src/lib/outside-project.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +8 -1
- package/dist/src/lib/primitive-declaration.js +40 -8
- package/dist/src/lib/primitive-declaration.js.map +1 -1
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +16 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +23 -11
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-field-table.js +38 -3
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +172 -19
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -1
- package/dist/src/lib/schema-codegen/namedRefs.js +8 -2
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaDocs.js +10 -4
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +12 -2
- package/dist/src/lib/schema-codegen/schemaIR.js +26 -2
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +2 -1
- package/dist/src/lib/schema-codegen/schemaToTs.js +8 -5
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/usage-meters.js +1 -0
- package/dist/src/lib/usage-meters.js.map +1 -1
- 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
|
-
// #
|
|
2436
|
-
//
|
|
2437
|
-
//
|
|
2438
|
-
//
|
|
2439
|
-
//
|
|
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
|
|
2442
|
-
|
|
2443
|
-
"
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
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` (#
|
|
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`
|
|
9380
|
-
*
|
|
9381
|
-
*
|
|
9382
|
-
*
|
|
9383
|
-
*
|
|
9384
|
-
|
|
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
|
|
9428
|
-
//
|
|
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
|
|
9495
|
-
//
|
|
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.
|
|
11057
|
-
*
|
|
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
|
-
|
|
11185
|
-
|
|
11186
|
-
if (
|
|
11187
|
-
return
|
|
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
|
-
|
|
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"],
|