primitive-admin 1.1.0-alpha.87 → 1.1.0
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/dist/src/commands/database-types.js +313 -13
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/llm.js +6 -9
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/lib/migration-nag.d.ts +2 -2
- package/dist/src/lib/migration-nag.js +3 -4
- package/dist/src/lib/migration-nag.js.map +1 -1
- package/dist/src/lib/sync-dir-selector.d.ts +1 -1
- package/dist/src/lib/sync-dir-selector.js +1 -1
- package/package.json +2 -2
- package/dist/src/commands/settings.d.ts +0 -18
- package/dist/src/commands/settings.js +0 -54
- package/dist/src/commands/settings.js.map +0 -1
- package/dist/src/lib/app-match-guard.d.ts +0 -44
- package/dist/src/lib/app-match-guard.js +0 -72
- package/dist/src/lib/app-match-guard.js.map +0 -1
- package/dist/src/lib/function-triggers.d.ts +0 -66
- package/dist/src/lib/function-triggers.js +0 -285
- package/dist/src/lib/function-triggers.js.map +0 -1
- package/dist/src/lib/generated-workflow-model-fields.d.ts +0 -20
- package/dist/src/lib/generated-workflow-model-fields.js +0 -53
- package/dist/src/lib/generated-workflow-model-fields.js.map +0 -1
- package/dist/src/lib/google-client-secret-status.d.ts +0 -35
- package/dist/src/lib/google-client-secret-status.js +0 -56
- package/dist/src/lib/google-client-secret-status.js.map +0 -1
- package/dist/src/lib/workflow-field-descriptor.d.ts +0 -91
- package/dist/src/lib/workflow-field-descriptor.js +0 -153
- package/dist/src/lib/workflow-field-descriptor.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `primitive settings` — the app-settings READER (issue #1033, Phase 2;
|
|
3
|
-
* narrowed to a reader by #2645).
|
|
4
|
-
*
|
|
5
|
-
* App settings are authored in `app.toml` and applied with `sync push`, so
|
|
6
|
-
* this group carries the one thing the file cannot answer: what the server is
|
|
7
|
-
* actually running. `settings get` renders the server-effective settings —
|
|
8
|
-
* `get` rather than `show`, so the read verb is the same word on every
|
|
9
|
-
* configuration surface.
|
|
10
|
-
*
|
|
11
|
-
* `settings pull`, `settings diff` and `settings push` are gone. They operated
|
|
12
|
-
* on the same `app.toml` and the same `entities.app` hash `sync` owns, so they
|
|
13
|
-
* were a second pathway to one piece of state; `sync pull|diff|push --only app`
|
|
14
|
-
* is the single one. The remaining command logic lives in
|
|
15
|
-
* `sync-app-settings.ts`, shared with `sync`.
|
|
16
|
-
*/
|
|
17
|
-
import { ApiClient } from "../lib/api-client.js";
|
|
18
|
-
import { resolveAppId } from "../lib/config.js";
|
|
19
|
-
import { showAppSettings } from "./sync-app-settings.js";
|
|
20
|
-
export function registerSettingsCommands(program) {
|
|
21
|
-
const settings = program
|
|
22
|
-
.command("settings")
|
|
23
|
-
.description("View the app settings the server is running")
|
|
24
|
-
.addHelpText("after", `
|
|
25
|
-
Examples:
|
|
26
|
-
$ primitive settings get # Render current server settings
|
|
27
|
-
$ primitive settings get --json # Machine-readable
|
|
28
|
-
$ primitive sync pull --only app # Write server settings to app.toml
|
|
29
|
-
$ primitive config set app app.baseUrl=https://example.com
|
|
30
|
-
$ primitive sync diff --only app # Show local app.toml vs server
|
|
31
|
-
$ primitive sync push --only app # Apply app.toml edits to the server
|
|
32
|
-
|
|
33
|
-
app.toml is the ONLY way to manage app configuration (issue #2645): a full
|
|
34
|
-
\`sync push\` applies it, and \`sync push --only app\` applies it alone.
|
|
35
|
-
\`primitive config fields app\` lists its keys, types and defaults. The Google OAuth
|
|
36
|
-
client secret is an ordinary [auth] key holding a reference into the app's
|
|
37
|
-
secret store, never the secret itself: store the value with
|
|
38
|
-
'primitive secrets set GOOGLE_CLIENT_SECRET --value <secret>', then set
|
|
39
|
-
googleClientSecret = "{{secrets.GOOGLE_CLIENT_SECRET}}" in app.toml. A literal
|
|
40
|
-
secret there is rejected by the server.
|
|
41
|
-
`);
|
|
42
|
-
// settings get
|
|
43
|
-
settings
|
|
44
|
-
.command("get")
|
|
45
|
-
.description("Show the current server-effective app settings")
|
|
46
|
-
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
47
|
-
.option("--app <app-id>", "App ID")
|
|
48
|
-
.option("--json", "Output as JSON")
|
|
49
|
-
.action(async (appId, options) => {
|
|
50
|
-
const resolvedAppId = resolveAppId(appId, options);
|
|
51
|
-
await showAppSettings(new ApiClient(), resolvedAppId, options);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/commands/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,6CAA6C,CAAC;SAC1D,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;CAiBL,CACI,CAAC;IAEJ,eAAe;IACf,QAAQ;SACL,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,gDAAgD,CAAC;SAC7D,QAAQ,CAAC,UAAU,EAAE,4CAA4C,CAAC;SAClE,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC;SAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC/B,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,eAAe,CAAC,IAAI,SAAS,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `--app` must name the environment's own app on every tree command (#3153, F1).
|
|
3
|
-
*
|
|
4
|
-
* Before the move, `--app B` on `config pull` merely wrote into a different
|
|
5
|
-
* slot: the tree path carried the app id, so app B's configuration landed in
|
|
6
|
-
* app B's directory and nothing was corrupted. The move removes that segment —
|
|
7
|
-
* an environment names exactly one app (#3152), so the path says the
|
|
8
|
-
* environment and nothing else. `config pull --app B` while environment A is
|
|
9
|
-
* selected would therefore fetch app B's configuration INTO environment A's
|
|
10
|
-
* committed tree, and the next push would apply it to app A.
|
|
11
|
-
*
|
|
12
|
-
* So the mismatch is refused, before any file is read or written and before any
|
|
13
|
-
* request is sent. A value that matches is accepted and inert. Removing the
|
|
14
|
-
* flags outright is #3154's (intent criterion 4); the guard has to land with
|
|
15
|
-
* the path change that creates the hazard.
|
|
16
|
-
*/
|
|
17
|
-
import { type ResolvedEnvironment } from "./env-resolver.js";
|
|
18
|
-
/**
|
|
19
|
-
* Throws when `provided` names an app other than the resolved environment's.
|
|
20
|
-
*
|
|
21
|
-
* No-ops when nothing was provided (the environment answers), and when there is
|
|
22
|
-
* no resolved environment (legacy bare-directory mode, which #3154 removes —
|
|
23
|
-
* there is no environment tree to corrupt there).
|
|
24
|
-
*/
|
|
25
|
-
export declare function assertAppMatchesEnvironment(provided: string | undefined | null, env: ResolvedEnvironment | null, commandLabel: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Whether `appId` is the app the resolved environment names — the question a
|
|
28
|
-
* command asks before reading the auto-resolved tree on behalf of an app it was
|
|
29
|
-
* handed rather than one it resolved.
|
|
30
|
-
*
|
|
31
|
-
* True when there is no resolved environment (legacy bare-directory mode) or
|
|
32
|
-
* the environment cannot be resolved at all: there is no environment tree to
|
|
33
|
-
* confuse in either case.
|
|
34
|
-
*/
|
|
35
|
-
export declare function environmentNamesApp(appId: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The command-facing form: resolve the environment, apply the guard, and stop
|
|
38
|
-
* the process with the CLI's usual non-zero exit when it does not hold.
|
|
39
|
-
*
|
|
40
|
-
* Called at the TOP of every tree command, before the config directory is
|
|
41
|
-
* resolved and before the API client is built, so a refusal costs no file read
|
|
42
|
-
* and no request.
|
|
43
|
-
*/
|
|
44
|
-
export declare function assertTreeApp(provided: string | undefined | null, commandLabel: string): void;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `--app` must name the environment's own app on every tree command (#3153, F1).
|
|
3
|
-
*
|
|
4
|
-
* Before the move, `--app B` on `config pull` merely wrote into a different
|
|
5
|
-
* slot: the tree path carried the app id, so app B's configuration landed in
|
|
6
|
-
* app B's directory and nothing was corrupted. The move removes that segment —
|
|
7
|
-
* an environment names exactly one app (#3152), so the path says the
|
|
8
|
-
* environment and nothing else. `config pull --app B` while environment A is
|
|
9
|
-
* selected would therefore fetch app B's configuration INTO environment A's
|
|
10
|
-
* committed tree, and the next push would apply it to app A.
|
|
11
|
-
*
|
|
12
|
-
* So the mismatch is refused, before any file is read or written and before any
|
|
13
|
-
* request is sent. A value that matches is accepted and inert. Removing the
|
|
14
|
-
* flags outright is #3154's (intent criterion 4); the guard has to land with
|
|
15
|
-
* the path change that creates the hazard.
|
|
16
|
-
*/
|
|
17
|
-
import { getCurrentEnvironment } from "./env-resolver.js";
|
|
18
|
-
/**
|
|
19
|
-
* Throws when `provided` names an app other than the resolved environment's.
|
|
20
|
-
*
|
|
21
|
-
* No-ops when nothing was provided (the environment answers), and when there is
|
|
22
|
-
* no resolved environment (legacy bare-directory mode, which #3154 removes —
|
|
23
|
-
* there is no environment tree to corrupt there).
|
|
24
|
-
*/
|
|
25
|
-
export function assertAppMatchesEnvironment(provided, env, commandLabel) {
|
|
26
|
-
if (!provided || !env)
|
|
27
|
-
return;
|
|
28
|
-
const wanted = env.config.appId;
|
|
29
|
-
if (provided === wanted)
|
|
30
|
-
return;
|
|
31
|
-
throw new Error(`--app ${provided} does not match environment "${env.name}", which names app ${wanted}. ` +
|
|
32
|
-
`${commandLabel} reads and writes primitive/${env.name}/, the committed tree for that ` +
|
|
33
|
-
`environment, so running it for another app would put that app's configuration in this ` +
|
|
34
|
-
`environment's tree. Select the other app's environment with --env <name> instead.`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Whether `appId` is the app the resolved environment names — the question a
|
|
38
|
-
* command asks before reading the auto-resolved tree on behalf of an app it was
|
|
39
|
-
* handed rather than one it resolved.
|
|
40
|
-
*
|
|
41
|
-
* True when there is no resolved environment (legacy bare-directory mode) or
|
|
42
|
-
* the environment cannot be resolved at all: there is no environment tree to
|
|
43
|
-
* confuse in either case.
|
|
44
|
-
*/
|
|
45
|
-
export function environmentNamesApp(appId) {
|
|
46
|
-
let env;
|
|
47
|
-
try {
|
|
48
|
-
env = getCurrentEnvironment();
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
return !env || env.config.appId === appId;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* The command-facing form: resolve the environment, apply the guard, and stop
|
|
57
|
-
* the process with the CLI's usual non-zero exit when it does not hold.
|
|
58
|
-
*
|
|
59
|
-
* Called at the TOP of every tree command, before the config directory is
|
|
60
|
-
* resolved and before the API client is built, so a refusal costs no file read
|
|
61
|
-
* and no request.
|
|
62
|
-
*/
|
|
63
|
-
export function assertTreeApp(provided, commandLabel) {
|
|
64
|
-
try {
|
|
65
|
-
assertAppMatchesEnvironment(provided, getCurrentEnvironment(), commandLabel);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
console.error(err.message);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=app-match-guard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-match-guard.js","sourceRo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1
|
-
/**
|
|
2
|
-
* `[function.triggers.*]`, read and checked locally (#3181).
|
|
3
|
-
*
|
|
4
|
-
* The SERVER is the authority: it derives the declaration from the TOML bytes
|
|
5
|
-
* inside the version envelope and validates it there, so a direct API push
|
|
6
|
-
* cannot ship a trigger the authored file does not declare (D3181-005). What
|
|
7
|
-
* this file buys is the other half of the `entry` dual-validation shape #3179
|
|
8
|
-
* established — an author who mistypes a key hears about it against their own
|
|
9
|
-
* file, by name, before a request is made.
|
|
10
|
-
*
|
|
11
|
-
* It is deliberately a VENDORED copy of the shape rules in
|
|
12
|
-
* `src/server-functions/trigger-declaration.ts` rather than an import: the CLI
|
|
13
|
-
* compiles with `rootDir: "."` and cannot reach the worker sources, which is
|
|
14
|
-
* the same constraint that made `generated-config-surfaces.ts` a vendored
|
|
15
|
-
* artifact. `cli/tests/unit/function-triggers-3181.test.ts` drives both copies
|
|
16
|
-
* from one fixture list so they cannot drift apart silently.
|
|
17
|
-
*
|
|
18
|
-
* Everything that needs the APP's state stays on the server: whether a
|
|
19
|
-
* referenced secret exists, whether the scheme-specific config is valid under
|
|
20
|
-
* this environment's JWKS policy, whether the app is at its webhook or cron
|
|
21
|
-
* cap, whether a standalone webhook holds the key. A local copy of those would
|
|
22
|
-
* be a preflight that can give a false all-clear.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* The resolved mode the declaration is checked against (#3281): the caller
|
|
26
|
-
* resolves `mode`/`durable` once through the vendored `resolveDeclaredMode`
|
|
27
|
-
* and hands the answer here, so this copy never reads the alias itself.
|
|
28
|
-
*/
|
|
29
|
-
export interface TriggerModeOptions {
|
|
30
|
-
mode?: "request" | "task";
|
|
31
|
-
}
|
|
32
|
-
export interface WebhookTriggerDeclaration {
|
|
33
|
-
verificationScheme: string;
|
|
34
|
-
signingSecret?: string;
|
|
35
|
-
toleranceSeconds?: number;
|
|
36
|
-
deduplicationEnabled?: boolean;
|
|
37
|
-
deduplicationWindowMs?: number;
|
|
38
|
-
maxBodyBytes?: number;
|
|
39
|
-
secretGracePeriodMs?: number;
|
|
40
|
-
verification?: Record<string, unknown>;
|
|
41
|
-
}
|
|
42
|
-
export interface CronTriggerDeclaration {
|
|
43
|
-
name: string;
|
|
44
|
-
cron: string;
|
|
45
|
-
timezone?: string;
|
|
46
|
-
overlapPolicy?: string;
|
|
47
|
-
rootInput?: unknown;
|
|
48
|
-
}
|
|
49
|
-
/** One `[[function.triggers.database]]` entry, normalized (#3184). */
|
|
50
|
-
export interface DatabaseTriggerDeclaration {
|
|
51
|
-
type: string;
|
|
52
|
-
}
|
|
53
|
-
export interface TriggerDeclaration {
|
|
54
|
-
webhook: WebhookTriggerDeclaration | null;
|
|
55
|
-
cron: CronTriggerDeclaration[];
|
|
56
|
-
databases: DatabaseTriggerDeclaration[];
|
|
57
|
-
}
|
|
58
|
-
export declare const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
|
|
59
|
-
export declare const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
|
|
60
|
-
export declare class TriggerDeclarationError extends Error {
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Normalize (and check) the `triggers` table of a parsed `[function]` table.
|
|
64
|
-
* Returns null when nothing is declared, so a caller can skip the work.
|
|
65
|
-
*/
|
|
66
|
-
export declare function normalizeFunctionTriggers(functionTable: any, options?: TriggerModeOptions): TriggerDeclaration | null;
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `[function.triggers.*]`, read and checked locally (#3181).
|
|
3
|
-
*
|
|
4
|
-
* The SERVER is the authority: it derives the declaration from the TOML bytes
|
|
5
|
-
* inside the version envelope and validates it there, so a direct API push
|
|
6
|
-
* cannot ship a trigger the authored file does not declare (D3181-005). What
|
|
7
|
-
* this file buys is the other half of the `entry` dual-validation shape #3179
|
|
8
|
-
* established — an author who mistypes a key hears about it against their own
|
|
9
|
-
* file, by name, before a request is made.
|
|
10
|
-
*
|
|
11
|
-
* It is deliberately a VENDORED copy of the shape rules in
|
|
12
|
-
* `src/server-functions/trigger-declaration.ts` rather than an import: the CLI
|
|
13
|
-
* compiles with `rootDir: "."` and cannot reach the worker sources, which is
|
|
14
|
-
* the same constraint that made `generated-config-surfaces.ts` a vendored
|
|
15
|
-
* artifact. `cli/tests/unit/function-triggers-3181.test.ts` drives both copies
|
|
16
|
-
* from one fixture list so they cannot drift apart silently.
|
|
17
|
-
*
|
|
18
|
-
* Everything that needs the APP's state stays on the server: whether a
|
|
19
|
-
* referenced secret exists, whether the scheme-specific config is valid under
|
|
20
|
-
* this environment's JWKS policy, whether the app is at its webhook or cron
|
|
21
|
-
* cap, whether a standalone webhook holds the key. A local copy of those would
|
|
22
|
-
* be a preflight that can give a false all-clear.
|
|
23
|
-
*/
|
|
24
|
-
export const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
|
|
25
|
-
export const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
|
|
26
|
-
const CRON_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
27
|
-
/** The charset the grant grammar already uses for a database type key. */
|
|
28
|
-
const DATABASE_TYPE_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
29
|
-
const DATABASE_KEYS = ["type"];
|
|
30
|
-
const WEBHOOK_KEYS = [
|
|
31
|
-
"verificationScheme",
|
|
32
|
-
"signingSecret",
|
|
33
|
-
"toleranceSeconds",
|
|
34
|
-
"deduplicationEnabled",
|
|
35
|
-
"deduplicationWindowMs",
|
|
36
|
-
"maxBodyBytes",
|
|
37
|
-
"secretGracePeriodMs",
|
|
38
|
-
"verification",
|
|
39
|
-
];
|
|
40
|
-
const CRON_KEYS = ["name", "cron", "timezone", "overlapPolicy", "rootInput"];
|
|
41
|
-
const VALID_OVERLAP_POLICIES = ["skip", "allow"];
|
|
42
|
-
export class TriggerDeclarationError extends Error {
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Normalize (and check) the `triggers` table of a parsed `[function]` table.
|
|
46
|
-
* Returns null when nothing is declared, so a caller can skip the work.
|
|
47
|
-
*/
|
|
48
|
-
export function normalizeFunctionTriggers(functionTable, options = {}) {
|
|
49
|
-
const triggers = functionTable?.triggers;
|
|
50
|
-
if (triggers === undefined || triggers === null)
|
|
51
|
-
return null;
|
|
52
|
-
if (typeof triggers !== "object" || Array.isArray(triggers)) {
|
|
53
|
-
throw new TriggerDeclarationError("[function.triggers] must be a table declaring `webhook` and/or `cron`");
|
|
54
|
-
}
|
|
55
|
-
for (const key of Object.keys(triggers)) {
|
|
56
|
-
if (key !== "webhook" && key !== "cron" && key !== "database") {
|
|
57
|
-
throw new TriggerDeclarationError(`unknown trigger kind '${key}' under [function.triggers]: the kinds are ` +
|
|
58
|
-
"`webhook`, `cron` and `database`");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const webhook = normalizeWebhook(triggers.webhook, options);
|
|
62
|
-
const cron = normalizeCron(triggers.cron, options);
|
|
63
|
-
const databases = normalizeDatabases(triggers.database, options);
|
|
64
|
-
if (!webhook && cron.length === 0 && databases.length === 0)
|
|
65
|
-
return null;
|
|
66
|
-
return { webhook, cron, databases };
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* `[[function.triggers.database]]` — one accepted key, `type` (#3184).
|
|
70
|
-
*
|
|
71
|
-
* Sync mode only, permanently: a database-change fire runs inside the write
|
|
72
|
-
* request with no run row, and there is no durable shape for that.
|
|
73
|
-
*/
|
|
74
|
-
function normalizeDatabases(raw, options) {
|
|
75
|
-
if (raw === undefined || raw === null)
|
|
76
|
-
return [];
|
|
77
|
-
const entries = Array.isArray(raw) ? raw : [raw];
|
|
78
|
-
if (entries.length === 0)
|
|
79
|
-
return [];
|
|
80
|
-
if (options.mode === "task") {
|
|
81
|
-
throw new TriggerDeclarationError("database triggers require request mode: set `mode = \"request\"` (or " +
|
|
82
|
-
"remove `mode = \"task\"`), or remove the [[function.triggers.database]] " +
|
|
83
|
-
"entries");
|
|
84
|
-
}
|
|
85
|
-
if (entries.length > MAX_DATABASE_TRIGGERS_PER_FUNCTION) {
|
|
86
|
-
throw new TriggerDeclarationError(`a function may watch at most ${MAX_DATABASE_TRIGGERS_PER_FUNCTION} database ` +
|
|
87
|
-
`types, and this one declares ${entries.length}`);
|
|
88
|
-
}
|
|
89
|
-
const seen = new Set();
|
|
90
|
-
const normalized = [];
|
|
91
|
-
for (const entry of entries) {
|
|
92
|
-
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
93
|
-
throw new TriggerDeclarationError("each [[function.triggers.database]] entry must be a table");
|
|
94
|
-
}
|
|
95
|
-
const table = entry;
|
|
96
|
-
for (const key of Object.keys(table)) {
|
|
97
|
-
if (!DATABASE_KEYS.includes(key)) {
|
|
98
|
-
throw new TriggerDeclarationError(`unknown key '${key}' in a [[function.triggers.database]] entry: the ` +
|
|
99
|
-
`only accepted key is ${DATABASE_KEYS.join(", ")}`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const type = String(table.type ?? "").trim();
|
|
103
|
-
if (!type) {
|
|
104
|
-
throw new TriggerDeclarationError("each [[function.triggers.database]] entry needs a `type`: it names the " +
|
|
105
|
-
"database type whose writes fire the function");
|
|
106
|
-
}
|
|
107
|
-
if (!DATABASE_TYPE_PATTERN.test(type)) {
|
|
108
|
-
throw new TriggerDeclarationError(`database trigger type '${type}' must contain only letters, digits, ` +
|
|
109
|
-
"'-' or '_'");
|
|
110
|
-
}
|
|
111
|
-
if (seen.has(type)) {
|
|
112
|
-
throw new TriggerDeclarationError(`duplicate database trigger type '${type}': a function fires once per ` +
|
|
113
|
-
"write request, so each type is declared once");
|
|
114
|
-
}
|
|
115
|
-
seen.add(type);
|
|
116
|
-
normalized.push({ type });
|
|
117
|
-
}
|
|
118
|
-
// Sorted, matching the server, so `config diff` compares the same canonical
|
|
119
|
-
// shape whichever order the file lists its blocks in.
|
|
120
|
-
normalized.sort((a, b) => a.type.localeCompare(b.type));
|
|
121
|
-
return normalized;
|
|
122
|
-
}
|
|
123
|
-
function normalizeWebhook(raw, options) {
|
|
124
|
-
if (raw === undefined || raw === null)
|
|
125
|
-
return null;
|
|
126
|
-
if (Array.isArray(raw)) {
|
|
127
|
-
throw new TriggerDeclarationError("[function.triggers.webhook] is a single table: one webhook trigger per " +
|
|
128
|
-
'function (the intent, "Webhook trigger URL and scheme?")');
|
|
129
|
-
}
|
|
130
|
-
if (typeof raw !== "object") {
|
|
131
|
-
throw new TriggerDeclarationError("[function.triggers.webhook] must be a table");
|
|
132
|
-
}
|
|
133
|
-
const table = raw;
|
|
134
|
-
for (const key of Object.keys(table)) {
|
|
135
|
-
if (!WEBHOOK_KEYS.includes(key)) {
|
|
136
|
-
throw new TriggerDeclarationError(`unknown key '${key}' under [function.triggers.webhook]: accepted keys ` +
|
|
137
|
-
`are ${WEBHOOK_KEYS.join(", ")}`);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (options.mode === "task") {
|
|
141
|
-
throw new TriggerDeclarationError("webhook triggers require request mode: set `mode = \"request\"` (or " +
|
|
142
|
-
"remove `mode = \"task\"`), or remove [function.triggers.webhook]");
|
|
143
|
-
}
|
|
144
|
-
const scheme = String(table.verificationScheme ?? "").trim();
|
|
145
|
-
if (!scheme) {
|
|
146
|
-
throw new TriggerDeclarationError("[function.triggers.webhook] verificationScheme is required");
|
|
147
|
-
}
|
|
148
|
-
if (scheme === "none") {
|
|
149
|
-
throw new TriggerDeclarationError("verification scheme 'none' is not allowed for function triggers: an " +
|
|
150
|
-
"unauthenticated caller could run the function");
|
|
151
|
-
}
|
|
152
|
-
const declaration = { verificationScheme: scheme };
|
|
153
|
-
if (table.signingSecret !== undefined) {
|
|
154
|
-
declaration.signingSecret = String(table.signingSecret);
|
|
155
|
-
}
|
|
156
|
-
for (const key of [
|
|
157
|
-
"toleranceSeconds",
|
|
158
|
-
"deduplicationWindowMs",
|
|
159
|
-
"maxBodyBytes",
|
|
160
|
-
"secretGracePeriodMs",
|
|
161
|
-
]) {
|
|
162
|
-
if (table[key] === undefined)
|
|
163
|
-
continue;
|
|
164
|
-
const value = Number(table[key]);
|
|
165
|
-
if (!Number.isFinite(value)) {
|
|
166
|
-
throw new TriggerDeclarationError(`[function.triggers.webhook] ${key} must be a number`);
|
|
167
|
-
}
|
|
168
|
-
declaration[key] = value;
|
|
169
|
-
}
|
|
170
|
-
if (table.deduplicationEnabled !== undefined) {
|
|
171
|
-
if (typeof table.deduplicationEnabled !== "boolean") {
|
|
172
|
-
throw new TriggerDeclarationError("[function.triggers.webhook] deduplicationEnabled must be a boolean");
|
|
173
|
-
}
|
|
174
|
-
declaration.deduplicationEnabled = table.deduplicationEnabled;
|
|
175
|
-
}
|
|
176
|
-
if (table.verification !== undefined) {
|
|
177
|
-
const verification = table.verification;
|
|
178
|
-
if (verification === null ||
|
|
179
|
-
typeof verification !== "object" ||
|
|
180
|
-
Array.isArray(verification)) {
|
|
181
|
-
throw new TriggerDeclarationError("[function.triggers.webhook.verification] must be a table");
|
|
182
|
-
}
|
|
183
|
-
declaration.verification = jsonSafe(verification);
|
|
184
|
-
}
|
|
185
|
-
return declaration;
|
|
186
|
-
}
|
|
187
|
-
function normalizeCron(raw, options) {
|
|
188
|
-
if (raw === undefined || raw === null)
|
|
189
|
-
return [];
|
|
190
|
-
const entries = Array.isArray(raw) ? raw : [raw];
|
|
191
|
-
if (entries.length === 0)
|
|
192
|
-
return [];
|
|
193
|
-
if (options.mode === "task") {
|
|
194
|
-
throw new TriggerDeclarationError("cron triggers require request mode: set `mode = \"request\"` (or " +
|
|
195
|
-
"remove `mode = \"task\"`), or remove the [[function.triggers.cron]] " +
|
|
196
|
-
"entries — a cron trigger on a task function is not available in this " +
|
|
197
|
-
"release");
|
|
198
|
-
}
|
|
199
|
-
if (entries.length > MAX_CRON_TRIGGERS_PER_FUNCTION) {
|
|
200
|
-
throw new TriggerDeclarationError(`a function may declare at most ${MAX_CRON_TRIGGERS_PER_FUNCTION} cron ` +
|
|
201
|
-
`trigger entries, and this one declares ${entries.length}`);
|
|
202
|
-
}
|
|
203
|
-
const seen = new Set();
|
|
204
|
-
const normalized = [];
|
|
205
|
-
for (const entry of entries) {
|
|
206
|
-
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
207
|
-
throw new TriggerDeclarationError("each [[function.triggers.cron]] entry must be a table");
|
|
208
|
-
}
|
|
209
|
-
const table = entry;
|
|
210
|
-
for (const key of Object.keys(table)) {
|
|
211
|
-
if (!CRON_KEYS.includes(key)) {
|
|
212
|
-
throw new TriggerDeclarationError(`unknown key '${key}' in a [[function.triggers.cron]] entry: accepted ` +
|
|
213
|
-
`keys are ${CRON_KEYS.join(", ")}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
const name = String(table.name ?? "").trim();
|
|
217
|
-
if (!name) {
|
|
218
|
-
throw new TriggerDeclarationError("each [[function.triggers.cron]] entry needs a `name`: it is required " +
|
|
219
|
-
"because it is half of the trigger's key, `<functionKey>:<name>`");
|
|
220
|
-
}
|
|
221
|
-
if (!CRON_NAME_PATTERN.test(name)) {
|
|
222
|
-
throw new TriggerDeclarationError(`cron trigger name '${name}' must start with a letter or digit and ` +
|
|
223
|
-
"contain only letters, digits, '-' or '_'");
|
|
224
|
-
}
|
|
225
|
-
if (seen.has(name)) {
|
|
226
|
-
throw new TriggerDeclarationError(`duplicate cron trigger name '${name}': names are the trigger's key ` +
|
|
227
|
-
"within the function, so each must appear once");
|
|
228
|
-
}
|
|
229
|
-
seen.add(name);
|
|
230
|
-
const cron = String(table.cron ?? "").trim();
|
|
231
|
-
if (!cron) {
|
|
232
|
-
throw new TriggerDeclarationError(`cron trigger '${name}' needs a \`cron\` expression`);
|
|
233
|
-
}
|
|
234
|
-
// Shape only. The full grammar is the server's `parseCron` — the CLI
|
|
235
|
-
// refuses the mistake that is obvious from the text and leaves the
|
|
236
|
-
// authority where the DO's own parser is.
|
|
237
|
-
if (cron.trim().split(/\s+/).length !== 5) {
|
|
238
|
-
throw new TriggerDeclarationError(`cron trigger '${name}': a cron expression has exactly 5 fields, and ` +
|
|
239
|
-
`'${cron}' has ${cron.trim().split(/\s+/).length}`);
|
|
240
|
-
}
|
|
241
|
-
const declaration = { name, cron };
|
|
242
|
-
if (table.timezone !== undefined) {
|
|
243
|
-
declaration.timezone = String(table.timezone);
|
|
244
|
-
}
|
|
245
|
-
if (table.overlapPolicy !== undefined) {
|
|
246
|
-
const policy = String(table.overlapPolicy);
|
|
247
|
-
if (!VALID_OVERLAP_POLICIES.includes(policy)) {
|
|
248
|
-
throw new TriggerDeclarationError(`cron trigger '${name}': overlapPolicy must be one of ` +
|
|
249
|
-
VALID_OVERLAP_POLICIES.join(", "));
|
|
250
|
-
}
|
|
251
|
-
declaration.overlapPolicy = policy;
|
|
252
|
-
}
|
|
253
|
-
if (table.rootInput !== undefined) {
|
|
254
|
-
declaration.rootInput = jsonSafe(table.rootInput);
|
|
255
|
-
}
|
|
256
|
-
normalized.push(declaration);
|
|
257
|
-
}
|
|
258
|
-
// Sorted by name, matching the server, so `config diff` compares the same
|
|
259
|
-
// canonical shape whichever order the file lists its entries in.
|
|
260
|
-
normalized.sort((a, b) => a.name.localeCompare(b.name));
|
|
261
|
-
return normalized;
|
|
262
|
-
}
|
|
263
|
-
function jsonSafe(value) {
|
|
264
|
-
if (value === null || value === undefined)
|
|
265
|
-
return value;
|
|
266
|
-
if (typeof value === "bigint")
|
|
267
|
-
return Number(value);
|
|
268
|
-
if (value instanceof Date)
|
|
269
|
-
return value.toISOString();
|
|
270
|
-
if (Array.isArray(value))
|
|
271
|
-
return value.map(jsonSafe);
|
|
272
|
-
if (typeof value === "object") {
|
|
273
|
-
const anyValue = value;
|
|
274
|
-
if (typeof anyValue.toISOString === "function") {
|
|
275
|
-
return String(anyValue.toISOString());
|
|
276
|
-
}
|
|
277
|
-
const out = {};
|
|
278
|
-
for (const [key, child] of Object.entries(anyValue)) {
|
|
279
|
-
out[key] = jsonSafe(child);
|
|
280
|
-
}
|
|
281
|
-
return out;
|
|
282
|
-
}
|
|
283
|
-
return value;
|
|
284
|
-
}
|
|
285
|
-
//# sourceMappingURL=function-triggers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-triggers.js","sourceRoot":"","sources":["../../../src/lib/function-triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAyCH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAEpD,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD,0EAA0E;AAC1E,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,CAAC;AAE/B,MAAM,YAAY,GAAG;IACnB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,sBAAsB;IACtB,uBAAuB;IACvB,cAAc;IACd,qBAAqB;IACrB,cAAc;CACf,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAE7E,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,OAAO,uBAAwB,SAAQ,KAAK;CAAG;AAErD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,aAAkB,EAClB,UAA8B,EAAE;IAEhC,MAAM,QAAQ,GAAG,aAAa,EAAE,QAAQ,CAAC;IACzC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC7D,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,uBAAuB,CAC/B,uEAAuE,CACxE,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,MAAM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C,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAY,CAAC;QAC9B,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
-
*
|
|
4
|
-
* Source of truth: the `WorkflowDefinition` model in the repo-root
|
|
5
|
-
* `models.yaml` — the one statically-parseable server anchor for the
|
|
6
|
-
* `[workflow]`-level config surface (issue #2326, Phase 1 of #1976).
|
|
7
|
-
*
|
|
8
|
-
* Regenerate with:
|
|
9
|
-
* node cli/scripts/gen-workflow-fields.mjs (runs automatically at CLI prebuild)
|
|
10
|
-
*
|
|
11
|
-
* A CI freshness guard (`cli/scripts/gen-workflow-fields.mjs --check`, also
|
|
12
|
-
* asserted by `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts`)
|
|
13
|
-
* fails if this committed artifact does not match a fresh parse of
|
|
14
|
-
* `models.yaml`. The same test asserts every field below is classified in
|
|
15
|
-
* `cli/src/lib/workflow-field-descriptor.ts` as synced, structural, or
|
|
16
|
-
* internal — so a new server-side workflow field cannot be silently ignored by
|
|
17
|
-
* the CLI.
|
|
18
|
-
*/
|
|
19
|
-
/** Every `WorkflowDefinition` field, in `models.yaml` declaration order (#2326). */
|
|
20
|
-
export declare const GENERATED_WORKFLOW_MODEL_FIELDS: readonly string[];
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
-
*
|
|
4
|
-
* Source of truth: the `WorkflowDefinition` model in the repo-root
|
|
5
|
-
* `models.yaml` — the one statically-parseable server anchor for the
|
|
6
|
-
* `[workflow]`-level config surface (issue #2326, Phase 1 of #1976).
|
|
7
|
-
*
|
|
8
|
-
* Regenerate with:
|
|
9
|
-
* node cli/scripts/gen-workflow-fields.mjs (runs automatically at CLI prebuild)
|
|
10
|
-
*
|
|
11
|
-
* A CI freshness guard (`cli/scripts/gen-workflow-fields.mjs --check`, also
|
|
12
|
-
* asserted by `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts`)
|
|
13
|
-
* fails if this committed artifact does not match a fresh parse of
|
|
14
|
-
* `models.yaml`. The same test asserts every field below is classified in
|
|
15
|
-
* `cli/src/lib/workflow-field-descriptor.ts` as synced, structural, or
|
|
16
|
-
* internal — so a new server-side workflow field cannot be silently ignored by
|
|
17
|
-
* the CLI.
|
|
18
|
-
*/
|
|
19
|
-
/** Every `WorkflowDefinition` field, in `models.yaml` declaration order (#2326). */
|
|
20
|
-
export const GENERATED_WORKFLOW_MODEL_FIELDS = [
|
|
21
|
-
"workflowId",
|
|
22
|
-
"appId",
|
|
23
|
-
"workflowKey",
|
|
24
|
-
"name",
|
|
25
|
-
"status",
|
|
26
|
-
"latestRevision",
|
|
27
|
-
"description",
|
|
28
|
-
"stepsR2Key",
|
|
29
|
-
"draftStepsR2Key",
|
|
30
|
-
"draftInputSchema",
|
|
31
|
-
"draftOutputSchema",
|
|
32
|
-
"draftModifiedAt",
|
|
33
|
-
"activeConfigId",
|
|
34
|
-
"inputSchema",
|
|
35
|
-
"outputSchema",
|
|
36
|
-
"perUserMaxRunning",
|
|
37
|
-
"perUserMaxQueued",
|
|
38
|
-
"perAppMaxRunning",
|
|
39
|
-
"perAppMaxQueued",
|
|
40
|
-
"queueTtlSeconds",
|
|
41
|
-
"dequeueOrder",
|
|
42
|
-
"requiresClientApply",
|
|
43
|
-
"syncCallable",
|
|
44
|
-
"accessRule",
|
|
45
|
-
"metadataManifest",
|
|
46
|
-
"runAs",
|
|
47
|
-
"lock",
|
|
48
|
-
"capabilities",
|
|
49
|
-
"createdBy",
|
|
50
|
-
"createdAt",
|
|
51
|
-
"modifiedAt",
|
|
52
|
-
];
|
|
53
|
-
//# sourceMappingURL=generated-workflow-model-fields.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-workflow-model-fields.js","sourceRoot":"","sources":["../../../src/lib/generated-workflow-model-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,+BAA+B,GAAsB;IAChE,YAAY;IACZ,OAAO;IACP,aAAa;IACb,MAAM;IACN,QAAQ;IACR,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,qBAAqB;IACrB,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,OAAO;IACP,MAAM;IACN,cAAc;IACd,WAAW;IACX,WAAW;IACX,YAAY;CACb,CAAC"}
|