primitive-admin 1.3.0-alpha.0 → 1.3.0-alpha.2
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 +45 -0
- package/dist/src/commands/admins.js +91 -0
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/auth-passkeys.d.ts +7 -0
- package/dist/src/commands/auth-passkeys.js +99 -0
- package/dist/src/commands/auth-passkeys.js.map +1 -0
- package/dist/src/commands/auth-sessions.js +7 -28
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +32 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +27 -0
- package/dist/src/commands/db3-types.js +288 -2
- package/dist/src/commands/db3-types.js.map +1 -1
- package/dist/src/commands/db3.d.ts +16 -2
- package/dist/src/commands/db3.js +614 -5
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.js +7 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +8 -3
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/hosting.js +177 -14
- package/dist/src/commands/hosting.js.map +1 -1
- package/dist/src/commands/metadata.js +14 -6
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/secrets.d.ts +38 -0
- package/dist/src/commands/secrets.js +102 -4
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/spent-tokens.d.ts +19 -0
- package/dist/src/commands/spent-tokens.js +79 -0
- package/dist/src/commands/spent-tokens.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +145 -0
- package/dist/src/commands/sync-app-settings.js +341 -8
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +62 -15
- package/dist/src/commands/sync.js +437 -48
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/usage.d.ts +24 -0
- package/dist/src/commands/usage.js +54 -0
- package/dist/src/commands/usage.js.map +1 -1
- package/dist/src/commands/users.js +41 -1
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/lib/admin-login-tables.d.ts +31 -0
- package/dist/src/lib/admin-login-tables.js +75 -0
- package/dist/src/lib/admin-login-tables.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +241 -0
- package/dist/src/lib/api-client.js +203 -10
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +42 -3
- package/dist/src/lib/app-settings-descriptor.js +114 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-flow.d.ts +13 -0
- package/dist/src/lib/auth-flow.js +23 -2
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/command-groups.js +2 -0
- package/dist/src/lib/command-groups.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +6 -1
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +19 -0
- package/dist/src/lib/credentials-store.js +66 -2
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +2 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +3 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +20 -1
- package/dist/src/lib/db-type-records.js +17 -4
- package/dist/src/lib/db-type-records.js.map +1 -1
- package/dist/src/lib/db3-export.d.ts +43 -8
- package/dist/src/lib/db3-export.js +133 -13
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-json-fields.d.ts +49 -0
- package/dist/src/lib/db3-json-fields.js +195 -0
- package/dist/src/lib/db3-json-fields.js.map +1 -0
- package/dist/src/lib/db3-type-archive.d.ts +59 -0
- package/dist/src/lib/db3-type-archive.js +95 -0
- package/dist/src/lib/db3-type-archive.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +15 -1
- package/dist/src/lib/db3-type-models.js +147 -16
- package/dist/src/lib/db3-type-models.js.map +1 -1
- package/dist/src/lib/document-export-record-log.d.ts +7 -0
- package/dist/src/lib/document-export-record-log.js +9 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +6 -0
- package/dist/src/lib/document-ingest-artifact.js +20 -1
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/function-authorize-check.js +5 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -1
- package/dist/src/lib/function-authorize-view.d.ts +9 -0
- package/dist/src/lib/function-authorize-view.js +27 -4
- package/dist/src/lib/function-authorize-view.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +28 -0
- package/dist/src/lib/function-collect.js +129 -2
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.js +31 -2
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-grants-preflight.d.ts +99 -0
- package/dist/src/lib/function-grants-preflight.js +154 -2
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +29 -1
- package/dist/src/lib/function-lint.js +208 -0
- package/dist/src/lib/function-lint.js.map +1 -1
- package/dist/src/lib/function-sync.d.ts +73 -0
- package/dist/src/lib/function-sync.js +107 -2
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/generated-command-status.js +46 -8
- package/dist/src/lib/generated-command-status.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +351 -9
- package/dist/src/lib/generated-config-surfaces.js +1009 -24
- 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/hosting-trust-step.d.ts +67 -0
- package/dist/src/lib/hosting-trust-step.js +279 -0
- package/dist/src/lib/hosting-trust-step.js.map +1 -0
- package/dist/src/lib/hosting-trust.d.ts +77 -0
- package/dist/src/lib/hosting-trust.js +194 -0
- package/dist/src/lib/hosting-trust.js.map +1 -0
- package/dist/src/lib/primitive-declaration.js +89 -10
- package/dist/src/lib/primitive-declaration.js.map +1 -1
- package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
- package/dist/src/lib/refresh-admin-credentials.js +85 -29
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/refresh-stored-login.d.ts +85 -0
- package/dist/src/lib/refresh-stored-login.js +233 -0
- package/dist/src/lib/refresh-stored-login.js.map +1 -0
- package/dist/src/lib/row-field-rename.d.ts +18 -0
- package/dist/src/lib/row-field-rename.js +32 -0
- package/dist/src/lib/row-field-rename.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +13 -2
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +24 -1
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -1
- package/dist/src/lib/schema-defs-module.d.ts +29 -0
- package/dist/src/lib/schema-defs-module.js +103 -0
- package/dist/src/lib/schema-defs-module.js.map +1 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +6 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +74 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -1
- package/dist/src/lib/toml-list-edit.d.ts +33 -0
- package/dist/src/lib/toml-list-edit.js +481 -0
- package/dist/src/lib/toml-list-edit.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
- package/dist/src/lib/toml-scalar-edit.js +67 -1
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/usage-meters.d.ts +16 -0
- package/dist/src/lib/usage-meters.js +52 -0
- package/dist/src/lib/usage-meters.js.map +1 -0
- package/dist/src/types/index.d.ts +9 -0
- package/package.json +2 -2
|
@@ -196,6 +196,21 @@ export interface ConfigField {
|
|
|
196
196
|
* Only for a default the server assigns on CREATE and returns on read.
|
|
197
197
|
*/
|
|
198
198
|
serverDefault?: string | number | boolean;
|
|
199
|
+
/**
|
|
200
|
+
* The field's value is the WHOLE table at its `tomlPath`, keyed by an open
|
|
201
|
+
* set of names: each key of the table is one entry of the map (#6034).
|
|
202
|
+
*
|
|
203
|
+
* `[clients.ios]` and `[clients.web]` are two entries of one field,
|
|
204
|
+
* `clientVersions`, rather than two fields: the names are the author's
|
|
205
|
+
* (platform names), not the definition's. A statement of WHERE the value is
|
|
206
|
+
* authored, like `tomlGroup`, and nothing else: pull writes the map as the
|
|
207
|
+
* table, push reads the table as the map, and the field's handler owns the
|
|
208
|
+
* key set inside each entry. `findBadTableMapDeclarations` holds the table
|
|
209
|
+
* to one such field, with `tomlKey` equal to the table's name.
|
|
210
|
+
*/
|
|
211
|
+
tomlTableMap?: {
|
|
212
|
+
note: string;
|
|
213
|
+
};
|
|
199
214
|
}
|
|
200
215
|
export interface ConfigTable {
|
|
201
216
|
/** TOML path, e.g. ["workflow"] for [workflow], ["configs"] for [[configs]]. */
|
|
@@ -651,6 +666,14 @@ export declare function findUnknownGroupedTomlKeys(tomlTable: unknown, table: Co
|
|
|
651
666
|
* as a decision and is not one.
|
|
652
667
|
*/
|
|
653
668
|
export declare function findBadTomlGroupDeclarations(table: ConfigTable): string[];
|
|
669
|
+
/**
|
|
670
|
+
* Table-map declarations that do not hold together (#6034): a table whose
|
|
671
|
+
* field is the whole table must declare that field alone, no `tomlGroups`
|
|
672
|
+
* and no `tomlOnlyKeys` (the map's keys are the author's names, so no other
|
|
673
|
+
* key can share the table), its `tomlKey` must be the table's own name, and
|
|
674
|
+
* the declaration needs a reason. `[]` means the table is well formed.
|
|
675
|
+
*/
|
|
676
|
+
export declare function findBadTableMapDeclarations(table: ConfigTable): string[];
|
|
654
677
|
/** Top-level TOML keys this object's file accepts: its tables plus the extras. */
|
|
655
678
|
export declare function acceptedTomlDocumentKeys(surface: ConfigObjectSurface): Set<string>;
|
|
656
679
|
/**
|
|
@@ -1286,12 +1309,14 @@ export declare const KEYED_GRANT_FAMILIES: readonly ["integration", "secret"];
|
|
|
1286
1309
|
* and its owner-row change (`db3:transfer`, `db3:setOwnerRow`, the intent's
|
|
1287
1310
|
* `db3-grant` grant) because they move who holds the db3 and its owner row
|
|
1288
1311
|
* (#4800); its app access (`db3:setAppAccess`, the same grant's third string)
|
|
1289
|
-
* because it grants the db3 to every user of the app (#4801)
|
|
1312
|
+
* because it grants the db3 to every user of the app (#4801); its public
|
|
1313
|
+
* access (`db3:setPublicAccess`) because it lets the db3 be served to callers
|
|
1314
|
+
* who hold no sharing level on it (#5842). App deletion
|
|
1290
1315
|
* and secret writes have no app-API route today; they are recorded, not gated,
|
|
1291
1316
|
* and the profile generator refuses to admit a future such route without a row
|
|
1292
1317
|
* here (`HIGH_BLAST_WATCH` in `scripts/lib/function-profile.mjs`).
|
|
1293
1318
|
*/
|
|
1294
|
-
export declare const HIGH_BLAST_CAPABILITIES: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket", "db3:setSync", "db3:transfer", "db3:setOwnerRow", "db3:setAppAccess"];
|
|
1319
|
+
export declare const HIGH_BLAST_CAPABILITIES: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket", "db3:setSync", "db3:transfer", "db3:setOwnerRow", "db3:setAppAccess", "db3:setPublicAccess"];
|
|
1295
1320
|
/**
|
|
1296
1321
|
* The subject grants — #4909.
|
|
1297
1322
|
*
|
|
@@ -1315,9 +1340,20 @@ export declare const HIGH_BLAST_CAPABILITIES: readonly ["databases:create", "dat
|
|
|
1315
1340
|
* those are 1:1 with an operation id, and these name a rule, not an operation.
|
|
1316
1341
|
*/
|
|
1317
1342
|
export declare const SUBJECT_GRANT_CAPABILITIES: readonly ["users:readAny", "users:actAsAny"];
|
|
1318
|
-
/**
|
|
1343
|
+
/**
|
|
1344
|
+
* The gateway-reserved operations a function opts into — #5849.
|
|
1345
|
+
*
|
|
1346
|
+
* `tokens:sign` `ctx.actionTokens.sign`: mint a signed link to a function
|
|
1347
|
+
* of the app (an action token).
|
|
1348
|
+
*
|
|
1349
|
+
* Not high-blast rows: those are 1:1 with an operation id, and these name a
|
|
1350
|
+
* gateway-reserved path with no app-API route. A version declaring one is
|
|
1351
|
+
* write-capable for the public-writer lint and the cache rule.
|
|
1352
|
+
*/
|
|
1353
|
+
export declare const RESERVED_OPERATION_CAPABILITIES: readonly ["tokens:sign"];
|
|
1354
|
+
/** The exact strings: the high-blast list, the subject grants and the reserved operations. */
|
|
1319
1355
|
export declare const EXACT_GRANT_STRINGS: readonly string[];
|
|
1320
|
-
export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets" | "db3";
|
|
1356
|
+
export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets" | "db3" | "tokens";
|
|
1321
1357
|
/**
|
|
1322
1358
|
* The retired FAMILIES (#3279), each with the reason it is gone.
|
|
1323
1359
|
*
|
|
@@ -1529,9 +1565,25 @@ export declare const FUNCTION_MANIFEST_SCHEMA_VERSIONS: readonly [1, 2, 3];
|
|
|
1529
1565
|
*/
|
|
1530
1566
|
export declare const FUNCTION_MANIFEST_AUTHORIZE_SCHEMA_VERSION = 3;
|
|
1531
1567
|
/** The `auth.*` families an `authorize` can read, as the manifest names them. */
|
|
1532
|
-
export declare const AUTH_FAMILIES: readonly ["auth.user", "auth.trigger", "auth.memberships", "auth.collections", "auth.doc", "auth.db", "auth.configVar"];
|
|
1568
|
+
export declare const AUTH_FAMILIES: readonly ["auth.user", "auth.trigger", "auth.memberships", "auth.collections", "auth.doc", "auth.db", "auth.db3", "auth.configVar", "auth.actionToken", "auth.invitation"];
|
|
1569
|
+
/**
|
|
1570
|
+
* The `auth.*` families whose admission is the caller's own — #5849: a token
|
|
1571
|
+
* admits only its holder, so a cached answer must never stand in for it.
|
|
1572
|
+
* `cacheSeconds` on a version whose manifest shows one is refused. Each maps
|
|
1573
|
+
* to the helper its refusal names.
|
|
1574
|
+
*/
|
|
1575
|
+
export declare const UNCACHEABLE_AUTH_FAMILIES: readonly ["auth.actionToken"];
|
|
1533
1576
|
/** The SDK helpers that build an `authorize`, as the manifest names them. */
|
|
1534
|
-
export declare const AUTHORIZE_HELPERS: readonly ["allowAnyone", "allowCallers", "requireSignedIn", "requireRole", "requireMember", "requireCollectionRole", "requireDocumentOwner"];
|
|
1577
|
+
export declare const AUTHORIZE_HELPERS: readonly ["allowAnyone", "allowCallers", "requireSignedIn", "requireRole", "requireMember", "requireCollectionRole", "requireDocumentOwner", "requirePublicDb3", "requireDb3Level", "requireToken", "requireInvitation"];
|
|
1578
|
+
/**
|
|
1579
|
+
* The helpers that admit by a token the caller presents (#5848): what admits
|
|
1580
|
+
* is the token alone, so their answers are never cached, and push refuses
|
|
1581
|
+
* `cacheSeconds` on a version whose manifest shows one. `requireToken` is
|
|
1582
|
+
* refused by its family instead, through {@link UNCACHEABLE_AUTH_FAMILIES}.
|
|
1583
|
+
*/
|
|
1584
|
+
export declare const TOKEN_ADMITTING_HELPERS: readonly string[];
|
|
1585
|
+
/** The `auth.*` families only a token-admitting helper reads (#5848). */
|
|
1586
|
+
export declare const TOKEN_ADMITTING_AUTH_FAMILIES: readonly string[];
|
|
1535
1587
|
/** How many function keys an `allowCallers` block may list. */
|
|
1536
1588
|
export declare const MAX_MANIFEST_CALLER_FUNCTIONS = 200;
|
|
1537
1589
|
/** Bounds, so a manifest cannot be a way to store an unbounded blob. */
|
|
@@ -1681,11 +1733,49 @@ export declare function inputSchemaRootLeftOpen(schema: unknown): boolean;
|
|
|
1681
1733
|
* run time and never written to the header.
|
|
1682
1734
|
*/
|
|
1683
1735
|
export declare function closedObjectSchema(schema: Record<string, unknown>): Record<string, unknown>;
|
|
1736
|
+
/** The `rate` tiers a public function may name under `[function] public`. */
|
|
1737
|
+
export declare const PUBLIC_RATE_TIERS: readonly ["low", "medium", "high"];
|
|
1738
|
+
/** The most seconds `public.cacheSeconds` may name. */
|
|
1739
|
+
export declare const PUBLIC_CACHE_SECONDS_MAX = 300;
|
|
1740
|
+
/**
|
|
1741
|
+
* The normalized options of `[function] public` written as a table. Only the
|
|
1742
|
+
* options the table sets are present; `turnstile = false` is dropped.
|
|
1743
|
+
*/
|
|
1744
|
+
export interface PublicOptions {
|
|
1745
|
+
/** Signed-out answers are cached for this many seconds, 1 to 300. */
|
|
1746
|
+
cacheSeconds?: number;
|
|
1747
|
+
/** Signed-out calls may come from any origin. */
|
|
1748
|
+
cors?: "*";
|
|
1749
|
+
/** Signed-out calls carry a Turnstile token. */
|
|
1750
|
+
turnstile?: true;
|
|
1751
|
+
/** The per-IP tier signed-out calls are held to. */
|
|
1752
|
+
rate?: (typeof PUBLIC_RATE_TIERS)[number];
|
|
1753
|
+
}
|
|
1754
|
+
/** The code every refusal of a malformed `public` answers. */
|
|
1755
|
+
export declare const PUBLIC_OPTIONS_INVALID_CODE = "FUNCTION_PUBLIC_OPTIONS_INVALID";
|
|
1756
|
+
/**
|
|
1757
|
+
* `[function] public`, read from the authored TOML's `[function]` table, with
|
|
1758
|
+
* its options: `true`, `false`, or a table of
|
|
1759
|
+
* `{ cacheSeconds, cors, turnstile, rate }`. A table means public exactly as
|
|
1760
|
+
* `true` does. `options` holds what the table sets, normalized, and is null
|
|
1761
|
+
* when it sets nothing. A value outside the grammar is refused with a
|
|
1762
|
+
* sentence naming the key, the value and what is allowed. Read by the CLI's
|
|
1763
|
+
* preflight and by the server from the envelope's TOML.
|
|
1764
|
+
*/
|
|
1765
|
+
export declare function declaredPublicOptionsOf(functionTable: unknown): {
|
|
1766
|
+
ok: true;
|
|
1767
|
+
declared: boolean;
|
|
1768
|
+
options: PublicOptions | null;
|
|
1769
|
+
} | {
|
|
1770
|
+
ok: false;
|
|
1771
|
+
error: string;
|
|
1772
|
+
code: typeof PUBLIC_OPTIONS_INVALID_CODE;
|
|
1773
|
+
};
|
|
1684
1774
|
/**
|
|
1685
1775
|
* `[function] public`, read from the authored TOML's `[function]` table —
|
|
1686
|
-
* #4730, criterion 13. Absent reads as false;
|
|
1687
|
-
* refused. Read by the CLI's preflight and by the
|
|
1688
|
-
*
|
|
1776
|
+
* #4730, criterion 13. Absent reads as false; a valid table of options reads
|
|
1777
|
+
* as true; anything else is refused. Read by the CLI's preflight and by the
|
|
1778
|
+
* server from the envelope's TOML.
|
|
1689
1779
|
*/
|
|
1690
1780
|
export declare function declaredPublicOf(functionTable: unknown): {
|
|
1691
1781
|
ok: true;
|
|
@@ -1694,6 +1784,18 @@ export declare function declaredPublicOf(functionTable: unknown): {
|
|
|
1694
1784
|
ok: false;
|
|
1695
1785
|
error: string;
|
|
1696
1786
|
};
|
|
1787
|
+
/**
|
|
1788
|
+
* The options string push stores on the version: the normalized options as
|
|
1789
|
+
* JSON, or null when the table sets none (nothing is written then).
|
|
1790
|
+
*/
|
|
1791
|
+
export declare function serializePublicOptions(options: PublicOptions | null): string | null;
|
|
1792
|
+
/**
|
|
1793
|
+
* The options a version stores, read back from its string. Absent reads as
|
|
1794
|
+
* null. A string that is not JSON, not an object, or holds anything push
|
|
1795
|
+
* would not have written throws, so a reader refuses it rather than reading
|
|
1796
|
+
* it as no options.
|
|
1797
|
+
*/
|
|
1798
|
+
export declare function parseStoredPublicOptions(stored: unknown): PublicOptions | null;
|
|
1697
1799
|
/**
|
|
1698
1800
|
* What makes a version write-capable for the public-writer lint — #4730: a
|
|
1699
1801
|
* mutation registration, a family the manifest records a write or send verb
|
|
@@ -1716,6 +1818,50 @@ export declare function publicWriterRefusal(input: {
|
|
|
1716
1818
|
capabilities: readonly string[];
|
|
1717
1819
|
declaredPublic: boolean;
|
|
1718
1820
|
}): string | null;
|
|
1821
|
+
/** The codes {@link publicOptionsRefusal} answers. */
|
|
1822
|
+
export type PublicOptionsRefusalCode = "FUNCTION_PUBLIC_CACHE_WRITE_CAPABLE" | "FUNCTION_PUBLIC_CACHE_WITH_TURNSTILE" | "FUNCTION_PUBLIC_CACHE_TOKEN_ADMITTED" | "FUNCTION_PUBLIC_CACHE_UNCACHEABLE_HELPER";
|
|
1823
|
+
/**
|
|
1824
|
+
* The push rules on `[function] public` options: `cacheSeconds` on a
|
|
1825
|
+
* write-capable version (the public-writer lint's reasons) is refused,
|
|
1826
|
+
* because a cached answer would stand in for a run that writes; and
|
|
1827
|
+
* `cacheSeconds` with `turnstile = true` is refused, because a cached answer
|
|
1828
|
+
* would be served without the check; and `cacheSeconds` on a version whose
|
|
1829
|
+
* manifest shows a token-admitting helper (`requireInvitation`, by helper or
|
|
1830
|
+
* by its `auth.invitation` family) is refused, because its answers are never
|
|
1831
|
+
* cached (#5848); and `cacheSeconds` on a version whose manifest shows an
|
|
1832
|
+
* uncacheable family (#5849: `requireToken`'s `auth.actionToken`) is
|
|
1833
|
+
* refused, because each answer belongs to the caller the helper admitted.
|
|
1834
|
+
* The CLI refuses at preflight and the server at push, from this one rule;
|
|
1835
|
+
* null when the options are fine.
|
|
1836
|
+
*/
|
|
1837
|
+
export declare function publicOptionsRefusal(input: {
|
|
1838
|
+
functionKey: string;
|
|
1839
|
+
options: PublicOptions | null;
|
|
1840
|
+
manifest: FunctionManifest | null;
|
|
1841
|
+
capabilities: readonly string[];
|
|
1842
|
+
}): {
|
|
1843
|
+
code: PublicOptionsRefusalCode;
|
|
1844
|
+
message: string;
|
|
1845
|
+
} | null;
|
|
1846
|
+
/**
|
|
1847
|
+
* Why a push refuses an `authorize` function whose export declares no `input`
|
|
1848
|
+
* list and whose TOML declares no trigger — #6170: every door that could
|
|
1849
|
+
* call it is a caller door, where a version with no list is refused. The CLI
|
|
1850
|
+
* refuses before any request and the server at push, with this sentence.
|
|
1851
|
+
*/
|
|
1852
|
+
export declare function inputListRequiredMessage(functionKey: string): string;
|
|
1853
|
+
/**
|
|
1854
|
+
* The warning a push answers for an `authorize` function with no `input`
|
|
1855
|
+
* list that declares a trigger — #6170: its trigger doors still hand it the
|
|
1856
|
+
* whole body, and its caller-door calls are refused with
|
|
1857
|
+
* `FUNCTION_INPUT_LIST_MISSING`.
|
|
1858
|
+
*/
|
|
1859
|
+
export declare function inputListMissingWarning(functionKey: string): string;
|
|
1860
|
+
/**
|
|
1861
|
+
* What a caller-door call to an `authorize` version that recorded no `input`
|
|
1862
|
+
* list is refused with — #6170. Answered only after `authorize` allowed.
|
|
1863
|
+
*/
|
|
1864
|
+
export declare function inputListMissingCallMessage(functionKey: string): string;
|
|
1719
1865
|
/**
|
|
1720
1866
|
* The runtime keys a `functions/<key>.toml` no longer decides anything with —
|
|
1721
1867
|
* #3482 retired them, and #3188 (project `server-functions` phase 5) refuses
|
|
@@ -2352,6 +2498,62 @@ export declare function checkCronTriggerEntry(entry: {
|
|
|
2352
2498
|
cron: string;
|
|
2353
2499
|
timezone?: string;
|
|
2354
2500
|
}): CronTriggerRuleRefusal | null;
|
|
2501
|
+
/**
|
|
2502
|
+
* App-secret names the platform reserves — #5845, project `public-access`
|
|
2503
|
+
* phase 4 (intent criterion 9).
|
|
2504
|
+
*
|
|
2505
|
+
* `PRIMITIVE_TURNSTILE_SECRET` holds an app's Turnstile secret, which the
|
|
2506
|
+
* signed-out door reads to verify a `turnstile` function's token. An app sets,
|
|
2507
|
+
* replaces and deletes it like any other secret, but no new function
|
|
2508
|
+
* capability, CEL manifest, integration template, webhook trigger or Google
|
|
2509
|
+
* client may reference it, so its value never reaches a function, a rule or a
|
|
2510
|
+
* third party.
|
|
2511
|
+
*
|
|
2512
|
+
* "New" is judged against the stored value a write replaces: a write is
|
|
2513
|
+
* refused when what it submits names a reserved secret and what it replaces
|
|
2514
|
+
* does not. A reference stored before the reservation keeps working, and an
|
|
2515
|
+
* unchanged re-push or re-save answers as before.
|
|
2516
|
+
*
|
|
2517
|
+
* Pure by construction (no models, no `env`), like the rest of
|
|
2518
|
+
* `src/config-surface/`.
|
|
2519
|
+
*/
|
|
2520
|
+
/** The reserved app-secret names. */
|
|
2521
|
+
export declare const RESERVED_APP_SECRETS: readonly string[];
|
|
2522
|
+
/** The code every refusal of a new reserved reference answers. */
|
|
2523
|
+
export declare const RESERVED_SECRET_REFERENCE_CODE = "RESERVED_SECRET_REFERENCE";
|
|
2524
|
+
/** A refusal of a new reserved reference. */
|
|
2525
|
+
export interface ReservedSecretRefusal {
|
|
2526
|
+
code: typeof RESERVED_SECRET_REFERENCE_CODE;
|
|
2527
|
+
message: string;
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* Whether `key` is a reserved app-secret name.
|
|
2531
|
+
*
|
|
2532
|
+
* @param key A secret key.
|
|
2533
|
+
* @returns True for `PRIMITIVE_TURNSTILE_SECRET`.
|
|
2534
|
+
*/
|
|
2535
|
+
export declare function isReservedAppSecret(key: string): boolean;
|
|
2536
|
+
/**
|
|
2537
|
+
* Refuse a write whose submitted value newly references a reserved secret.
|
|
2538
|
+
*
|
|
2539
|
+
* @param input The secret keys the submitted value names, the keys the stored value it replaces names, and what is written (for the message).
|
|
2540
|
+
* @returns The refusal, or null when every reserved key submitted is also stored.
|
|
2541
|
+
*/
|
|
2542
|
+
export declare function reservedSecretRefusal(input: {
|
|
2543
|
+
submittedKeys: Iterable<string>;
|
|
2544
|
+
storedKeys: Iterable<string>;
|
|
2545
|
+
what: string;
|
|
2546
|
+
}): ReservedSecretRefusal | null;
|
|
2547
|
+
/** The `secrets` a CEL manifest declares; empty for anything else. */
|
|
2548
|
+
export declare function manifestSecretKeys(manifest: unknown): string[];
|
|
2549
|
+
/**
|
|
2550
|
+
* Refuse a CEL manifest whose `secrets` newly list a reserved name.
|
|
2551
|
+
*
|
|
2552
|
+
* @param submitted The manifest the write carries (an object or its JSON).
|
|
2553
|
+
* @param stored The manifest it replaces (an object, its JSON, or null for none).
|
|
2554
|
+
* @returns The refusal, or null.
|
|
2555
|
+
*/
|
|
2556
|
+
export declare function manifestReservedSecretRefusal(submitted: unknown, stored: unknown): ReservedSecretRefusal | null;
|
|
2355
2557
|
/**
|
|
2356
2558
|
* The prompt config's reasoning controls, resolved onto each provider's own
|
|
2357
2559
|
* spelling — issue #3358.
|
|
@@ -3593,6 +3795,146 @@ export declare function accessAmbiguousMessage(functionKey: string): string;
|
|
|
3593
3795
|
/** The refusal of a create or update body that carries `access`. */
|
|
3594
3796
|
export declare const FUNCTION_ACCESS_FROZEN_REQUEST: string;
|
|
3595
3797
|
export declare const TEST_CASE_SURFACE: ConfigObjectSurface;
|
|
3798
|
+
/**
|
|
3799
|
+
* The client version policy's rules (#6034, project `client-version-policy`).
|
|
3800
|
+
*
|
|
3801
|
+
* An app states, per platform, which versions of its own client are current,
|
|
3802
|
+
* recommended and required, in `[clients.<platform>]` tables of `app.toml`.
|
|
3803
|
+
* The whole map is ONE `App` field, `clientVersions`. This module decides what
|
|
3804
|
+
* that map may say, and is the one place that does: the server's
|
|
3805
|
+
* `PUT settings` calls `checkClientVersions` before it stores anything, and
|
|
3806
|
+
* the CLI's push preflight runs the same function through the vendored
|
|
3807
|
+
* artifact, so both refuse with the same sentence, in TOML spelling.
|
|
3808
|
+
*
|
|
3809
|
+
* A single-field handler, not a rules module: the checks span the keys of one
|
|
3810
|
+
* field's value, so the file is not named `*-rules.ts` and exports no rule-id
|
|
3811
|
+
* list (the registry's rule ids are keyed by a surface's `crossFieldRules`).
|
|
3812
|
+
* Every refusal is still built through one constructor, `clientVersionsRefusal`.
|
|
3813
|
+
*
|
|
3814
|
+
* A platform's entry may also carry `backendOverrides` (#6183, project
|
|
3815
|
+
* `client-backend-overrides`): a list of `{ from, appId, apiUrl? }` steps
|
|
3816
|
+
* saying that copies of the app from version `from` upward talk to another
|
|
3817
|
+
* app id, and optionally another server. The rules here check each step's
|
|
3818
|
+
* form, refuse a step naming the app's own id when the caller passes it, and
|
|
3819
|
+
* bound the stored size of a policy that carries any step. They check nothing
|
|
3820
|
+
* else about the target.
|
|
3821
|
+
*
|
|
3822
|
+
* Maps are read with own-property iteration only, so a platform named
|
|
3823
|
+
* `constructor` is an entry like any other.
|
|
3824
|
+
*
|
|
3825
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
3826
|
+
*/
|
|
3827
|
+
/** The keys a `[clients.<platform>]` table may carry. */
|
|
3828
|
+
export declare const CLIENT_VERSION_ENTRY_KEYS: readonly ["latest", "minRecommended", "minRequired", "updateUrl", "backendOverrides"];
|
|
3829
|
+
/** One key of a `[clients.<platform>]` table. */
|
|
3830
|
+
export type ClientVersionEntryKey = (typeof CLIENT_VERSION_ENTRY_KEYS)[number];
|
|
3831
|
+
/** A legal platform name: a lowercase identifier of at most 32 characters. */
|
|
3832
|
+
export declare const CLIENT_PLATFORM_NAME_PATTERN: RegExp;
|
|
3833
|
+
/** A legal version: one to three dot-separated parts of one to six digits. */
|
|
3834
|
+
export declare const CLIENT_VERSION_PATTERN: RegExp;
|
|
3835
|
+
/** The schemes an `updateUrl` may use. */
|
|
3836
|
+
export declare const CLIENT_UPDATE_URL_SCHEMES: readonly string[];
|
|
3837
|
+
/** The most platforms one policy may declare. */
|
|
3838
|
+
export declare const MAX_CLIENT_PLATFORMS = 20;
|
|
3839
|
+
/** The longest `updateUrl` accepted, in characters. */
|
|
3840
|
+
export declare const MAX_CLIENT_UPDATE_URL_LENGTH = 2048;
|
|
3841
|
+
/** The keys one backend override may carry, in their stored order. */
|
|
3842
|
+
export declare const BACKEND_OVERRIDE_KEYS: readonly ["from", "appId", "apiUrl"];
|
|
3843
|
+
/** The most backend overrides one platform may declare. */
|
|
3844
|
+
export declare const MAX_BACKEND_OVERRIDES = 16;
|
|
3845
|
+
/** The longest override `appId` accepted, in characters. */
|
|
3846
|
+
export declare const MAX_BACKEND_OVERRIDE_APP_ID_LENGTH = 128;
|
|
3847
|
+
/** The hosts an override `apiUrl` may reach over plain `http:`. */
|
|
3848
|
+
export declare const BACKEND_OVERRIDE_LOOPBACK_HOSTS: readonly string[];
|
|
3849
|
+
/**
|
|
3850
|
+
* The largest stored form, in UTF-8 bytes, of a policy that carries at least
|
|
3851
|
+
* one backend override. A policy with none is not measured.
|
|
3852
|
+
*/
|
|
3853
|
+
export declare const MAX_CLIENT_VERSIONS_BYTES = 65536;
|
|
3854
|
+
/**
|
|
3855
|
+
* One backend override: copies at version `from` or above use `appId`, and
|
|
3856
|
+
* `apiUrl` when it is set (else the server the copy already uses).
|
|
3857
|
+
*/
|
|
3858
|
+
export interface BackendOverride {
|
|
3859
|
+
from: string;
|
|
3860
|
+
appId: string;
|
|
3861
|
+
apiUrl?: string;
|
|
3862
|
+
}
|
|
3863
|
+
/** One platform's entry, as stored and served. */
|
|
3864
|
+
export interface ClientVersionsEntry {
|
|
3865
|
+
latest?: string;
|
|
3866
|
+
minRecommended?: string;
|
|
3867
|
+
minRequired?: string;
|
|
3868
|
+
updateUrl?: string;
|
|
3869
|
+
backendOverrides?: BackendOverride[];
|
|
3870
|
+
}
|
|
3871
|
+
/** The whole policy: platform name to entry. */
|
|
3872
|
+
export type ClientVersionsMap = Record<string, ClientVersionsEntry>;
|
|
3873
|
+
/** Why a policy was refused. */
|
|
3874
|
+
type ClientVersionsRefusalCode = "not-a-map" | "too-many-platforms" | "platform-name" | "entry-not-a-table" | "entry-empty" | "unknown-key" | "enforce-not-accepted" | "version-not-a-string" | "version-format" | "update-url" | "order" | "overrides-not-a-list" | "overrides-empty" | "too-many-overrides" | "override-not-a-table" | "override-unknown-key" | "override-from" | "override-app-id" | "override-own-app" | "override-api-url" | "override-duplicate-from" | "policy-too-large";
|
|
3875
|
+
/** What the caller knows about the app the policy belongs to. */
|
|
3876
|
+
export interface CheckClientVersionsOptions {
|
|
3877
|
+
/**
|
|
3878
|
+
* The app's own id. When set, an override naming it is refused; when
|
|
3879
|
+
* absent, that rule is skipped.
|
|
3880
|
+
*/
|
|
3881
|
+
appId?: string;
|
|
3882
|
+
}
|
|
3883
|
+
/** A refused policy: what was wrong and the sentence that says so. */
|
|
3884
|
+
export interface ClientVersionsRefusal {
|
|
3885
|
+
code: ClientVersionsRefusalCode;
|
|
3886
|
+
/** The TOML spelling of the table or key, `[clients.ios].latest`. */
|
|
3887
|
+
key: string;
|
|
3888
|
+
message: string;
|
|
3889
|
+
}
|
|
3890
|
+
/**
|
|
3891
|
+
* A version's numeric parts, padded to three with zeros, or null when the
|
|
3892
|
+
* value is not a legal version string.
|
|
3893
|
+
*/
|
|
3894
|
+
export declare function parseClientVersion(value: unknown): [number, number, number] | null;
|
|
3895
|
+
/**
|
|
3896
|
+
* Compare two legal versions numerically, missing parts zero: -1 when `a` is
|
|
3897
|
+
* lower, 0 when equal, 1 when higher. A value that is not a legal version
|
|
3898
|
+
* compares as `0.0.0`.
|
|
3899
|
+
*/
|
|
3900
|
+
export declare function compareClientVersions(a: string, b: string): -1 | 0 | 1;
|
|
3901
|
+
/**
|
|
3902
|
+
* The first refusal of a client version policy, or null when it may be
|
|
3903
|
+
* stored. `null` and an empty map are legal: they clear the policy. Pass the
|
|
3904
|
+
* app's own id as `options.appId` to refuse an override that names it.
|
|
3905
|
+
*/
|
|
3906
|
+
export declare function checkClientVersions(value: unknown, options?: CheckClientVersionsOptions): ClientVersionsRefusal | null;
|
|
3907
|
+
/** A stored minimum a policy change lowers or removes. */
|
|
3908
|
+
export interface LoweredClientMinimum {
|
|
3909
|
+
platform: string;
|
|
3910
|
+
key: "minRequired" | "minRecommended";
|
|
3911
|
+
from: string;
|
|
3912
|
+
/** The new value, or null when the key or its table is removed. */
|
|
3913
|
+
to: string | null;
|
|
3914
|
+
}
|
|
3915
|
+
/**
|
|
3916
|
+
* Every stored `minRequired` and `minRecommended` that `next` lowers
|
|
3917
|
+
* numerically, removes, or drops with its table — what `config push` asks the
|
|
3918
|
+
* developer to confirm. A stored value that is not a map reads as no policy.
|
|
3919
|
+
* Ordered by platform name, then `minRequired` before `minRecommended`.
|
|
3920
|
+
*/
|
|
3921
|
+
export declare function loweredClientMinimums(stored: unknown, next: unknown): LoweredClientMinimum[];
|
|
3922
|
+
/** A backend override that applies to versions already released. */
|
|
3923
|
+
export interface ReleasedBackendOverride {
|
|
3924
|
+
platform: string;
|
|
3925
|
+
from: string;
|
|
3926
|
+
/** The platform's `latest`, which `from` is at or below. */
|
|
3927
|
+
latest: string;
|
|
3928
|
+
appId: string;
|
|
3929
|
+
apiUrl?: string;
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* Every backend override in `next` whose `from` is at or below its platform's
|
|
3933
|
+
* legal `latest` — what `config push` asks the developer to confirm, because
|
|
3934
|
+
* copies already released would switch backend. Platforms in name order,
|
|
3935
|
+
* overrides in file order; anything unreadable is skipped.
|
|
3936
|
+
*/
|
|
3937
|
+
export declare function releasedBackendOverrides(next: unknown): ReleasedBackendOverride[];
|
|
3596
3938
|
export declare const APP_SETTINGS_SURFACE: ConfigObjectSurface;
|
|
3597
3939
|
/**
|
|
3598
3940
|
* The `user-properties` configuration object's definition (#5385, project
|