primitive-admin 1.2.0-alpha.2 → 1.2.0-alpha.4
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/agent-sessions.js +4 -0
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/databases.js +13 -38
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +1 -1
- package/dist/src/commands/documents.js +70 -33
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/prompts.d.ts +7 -0
- package/dist/src/commands/prompts.js +44 -0
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/sync.d.ts +12 -29
- package/dist/src/commands/sync.js +128 -138
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/aggregate-output.d.ts +25 -0
- package/dist/src/lib/aggregate-output.js +53 -0
- package/dist/src/lib/aggregate-output.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +29 -16
- package/dist/src/lib/api-client.js +30 -28
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +14 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +3 -12
- package/dist/src/lib/db-codegen/dbNaming.js +3 -16
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
- package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +1 -1
- package/dist/src/lib/function-sync.d.ts +3 -16
- package/dist/src/lib/function-sync.js +14 -18
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +172 -47
- package/dist/src/lib/generated-config-surfaces.js +599 -90
- 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/prompt-schema-codegen.js +5 -2
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
- package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
- package/dist/src/lib/swift-codegen/generator.js +8 -13
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
- package/dist/src/lib/workflow-codegen/generator.js +16 -23
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
- package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
- package/dist/src/lib/workflow-toml-validator.js +13 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import * as path from "path";
|
|
19
19
|
import { writeOrCheckGeneratedFiles, } from "../codegen-shared/generatedFiles.js";
|
|
20
20
|
import { describeDbType, } from "./dbTypeIR.js";
|
|
21
|
-
import { resolveRecordInterfaceName, opParamsInterfaceName, opResultAliasName,
|
|
21
|
+
import { resolveRecordInterfaceName, opParamsInterfaceName, opResultAliasName, subscriptionsFactoryName, objectPropertyKey, } from "./dbNaming.js";
|
|
22
22
|
import { renderHeader, renderRecordInterface, renderOpParamsInterface, renderOpResultAlias, renderFactories, fieldNameUnion, RESULT_ALIASES_BLOCK, } from "./dbTemplates.js";
|
|
23
23
|
import { atom, generic } from "../codegen-shared/prettierStable.js";
|
|
24
24
|
export { inferArrayParamElementTypes, inferRequiredRecordFields, } from "./dbTypeIR.js";
|
|
@@ -81,21 +81,12 @@ export function renderDbTypeFile(input) {
|
|
|
81
81
|
}));
|
|
82
82
|
}
|
|
83
83
|
// Operation interfaces + result aliases, already sorted by op name in the IR.
|
|
84
|
-
// Descriptors for the typed-ops factory (#1441), collected in the same order.
|
|
85
|
-
const factoryOps = [];
|
|
86
84
|
for (const op of ir.ops) {
|
|
87
85
|
blocks.push(renderOpParamsInterface({
|
|
88
86
|
interfaceName: opParamsInterfaceName(op.opName),
|
|
89
87
|
opName: op.opName,
|
|
90
88
|
params: op.params,
|
|
91
89
|
}));
|
|
92
|
-
factoryOps.push({
|
|
93
|
-
propertyKey: objectPropertyKey(op.opName),
|
|
94
|
-
opName: op.opName,
|
|
95
|
-
paramsInterfaceName: opParamsInterfaceName(op.opName),
|
|
96
|
-
resultAliasName: opResultAliasName(op.opName),
|
|
97
|
-
hasParams: op.hasParams,
|
|
98
|
-
});
|
|
99
90
|
const recordInterfaceName = op.resultModelName
|
|
100
91
|
? recordInterfaceByModel[op.resultModelName] ?? null
|
|
101
92
|
: null;
|
|
@@ -130,15 +121,13 @@ export function renderDbTypeFile(input) {
|
|
|
130
121
|
eventType,
|
|
131
122
|
};
|
|
132
123
|
});
|
|
133
|
-
// Typed-
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
if (
|
|
124
|
+
// Typed-subscriptions factory (#1544 Phase 2). No typed-ops factory: the
|
|
125
|
+
// client door its methods called was retired (#3188). Omitted entirely for
|
|
126
|
+
// a type with no subscriptions.
|
|
127
|
+
if (factorySubscriptions.length > 0) {
|
|
137
128
|
blocks.push(renderFactories({
|
|
138
129
|
databaseType: input.databaseType,
|
|
139
|
-
opsFactoryName: opsFactoryName(input.databaseType),
|
|
140
130
|
subscriptionsFactoryName: subscriptionsFactoryName(input.databaseType),
|
|
141
|
-
ops: factoryOps,
|
|
142
131
|
subscriptions: factorySubscriptions,
|
|
143
132
|
}));
|
|
144
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbGenerator.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,0BAA0B,GAE3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,cAAc,GAGf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"dbGenerator.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,0BAA0B,GAE3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,cAAc,GAGf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,oBAAoB,GAGrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAKpE,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAE1B,MAAM,eAAe,CAAC;AAwCvB,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C;;;GAGG;AACH,SAAS,iBAAiB,CACxB,EAAoB,EACpB,sBAA8C;IAE9C,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO;gBACL,IA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,wBAAwB,EAAE,wBAAwB,CAAC,KAAK,CAAC,YAAY,CAAC;YACtE,aAAa,EAAE,oBAAoB;SACpC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,6DAA6D;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA+B;IAE/B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,MAAM,EACN,GAAG,KAAK,CAAC,YAAY,GAAG,qBAAqB,EAAE,CAChD,CAAC;QACF,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,MAAM,0BAA0B,CAAC;QACtC,SAAS,EAAE,MAAM;QACjB,YAAY;QACZ,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,yEAAyE;QACzE,wEAAwE;QACxE,aAAa,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI;QAC1C,eAAe,EAAE,qBAAqB;KACvC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -29,19 +29,10 @@ export declare function resolveRecordInterfaceName(modelName: string, classNameO
|
|
|
29
29
|
export declare function opParamsInterfaceName(opName: string): string;
|
|
30
30
|
/** `saveAccount` → `SaveAccountResult`. */
|
|
31
31
|
export declare function opResultAliasName(opName: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Name of the generated typed-operations factory for a database type (#1441).
|
|
34
|
-
* `securities-ref` → `securitiesRefOps`, `portfolio` → `portfolioOps`. A type
|
|
35
|
-
* whose camelCased name would start with a digit (e.g. `2fa`) gets a leading
|
|
36
|
-
* `_` so the emitted `export function` name is a valid JS identifier.
|
|
37
|
-
*/
|
|
38
|
-
export declare function opsFactoryName(databaseType: string): string;
|
|
39
32
|
/**
|
|
40
33
|
* Name of the generated typed-subscriptions factory for a database type
|
|
41
|
-
* (#1544 Phase 2)
|
|
42
|
-
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`.
|
|
43
|
-
* separate export from `<type>Ops` (Fork 4 = A): realtime subscriptions are a
|
|
44
|
-
* different surface than HTTP `executeOperation`.
|
|
34
|
+
* (#1544 Phase 2): camelCased with a leading `_` before a digit, so
|
|
35
|
+
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`.
|
|
45
36
|
*/
|
|
46
37
|
export declare function subscriptionsFactoryName(databaseType: string): string;
|
|
47
38
|
/**
|
|
@@ -57,7 +48,7 @@ export declare function camelCase(name: string): string;
|
|
|
57
48
|
* identifier is emitted bare (`getX:`); anything else — a hyphen, a leading
|
|
58
49
|
* digit, or a reserved word — is emitted as a quoted key (`"get-x":`,
|
|
59
50
|
* `"delete":`) so the factory stays valid TypeScript. The original name string
|
|
60
|
-
* passed to `
|
|
51
|
+
* passed to `subscribe` is always the exact original name.
|
|
61
52
|
*
|
|
62
53
|
* `__proto__` is a special case. The factory return value is a *runtime* object
|
|
63
54
|
* literal, and in that position both the bare `__proto__:` form AND the quoted
|
|
@@ -44,23 +44,10 @@ export function opParamsInterfaceName(opName) {
|
|
|
44
44
|
export function opResultAliasName(opName) {
|
|
45
45
|
return `${pascalCase(opName)}Result`;
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Name of the generated typed-operations factory for a database type (#1441).
|
|
49
|
-
* `securities-ref` → `securitiesRefOps`, `portfolio` → `portfolioOps`. A type
|
|
50
|
-
* whose camelCased name would start with a digit (e.g. `2fa`) gets a leading
|
|
51
|
-
* `_` so the emitted `export function` name is a valid JS identifier.
|
|
52
|
-
*/
|
|
53
|
-
export function opsFactoryName(databaseType) {
|
|
54
|
-
const base = camelCase(databaseType);
|
|
55
|
-
const safe = /^[0-9]/.test(base) ? `_${base}` : base;
|
|
56
|
-
return `${safe}Ops`;
|
|
57
|
-
}
|
|
58
47
|
/**
|
|
59
48
|
* Name of the generated typed-subscriptions factory for a database type
|
|
60
|
-
* (#1544 Phase 2)
|
|
61
|
-
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`.
|
|
62
|
-
* separate export from `<type>Ops` (Fork 4 = A): realtime subscriptions are a
|
|
63
|
-
* different surface than HTTP `executeOperation`.
|
|
49
|
+
* (#1544 Phase 2): camelCased with a leading `_` before a digit, so
|
|
50
|
+
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`.
|
|
64
51
|
*/
|
|
65
52
|
export function subscriptionsFactoryName(databaseType) {
|
|
66
53
|
const base = camelCase(databaseType);
|
|
@@ -98,7 +85,7 @@ const RESERVED_WORDS = new Set([
|
|
|
98
85
|
* identifier is emitted bare (`getX:`); anything else — a hyphen, a leading
|
|
99
86
|
* digit, or a reserved word — is emitted as a quoted key (`"get-x":`,
|
|
100
87
|
* `"delete":`) so the factory stays valid TypeScript. The original name string
|
|
101
|
-
* passed to `
|
|
88
|
+
* passed to `subscribe` is always the exact original name.
|
|
102
89
|
*
|
|
103
90
|
* `__proto__` is a special case. The factory return value is a *runtime* object
|
|
104
91
|
* literal, and in that position both the bare `__proto__:` form AND the quoted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbNaming.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbNaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAiB,EACjB,iBAAqC;IAErC,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,G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AC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,QAAQ;SACZ,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACxD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -154,7 +154,7 @@ export interface RenderOpResultAliasInput {
|
|
|
154
154
|
* controller; per-op aliases point at them (and, where the definition makes the
|
|
155
155
|
* shape derivable, at a narrowed form — see `renderOpResultAlias`).
|
|
156
156
|
*/
|
|
157
|
-
export declare const RESULT_ALIASES_BLOCK = "// Generic per-op result shapes. These mirror the runtime result shapes\n// produced by the database-operations controller; per-op aliases reference\n// them (or a narrowed form when the op definition makes the shape derivable).\n\n/** `query` ops return a page of records. */\nexport interface QueryResult<T = Record<string, unknown>> {\n data: T[];\n hasMore?: boolean;\n nextCursor?: string;\n}\n\n/**\n * One step's result inside a `mutation` op's uniform response (#1458).\n * `op` is the step kind; `id` is the record id (the resolved canonical id for\n * `upsertOn` saves). `values` carries an `increment` step's post-increment\n * counters; `error` a per-step failure string.\n */\nexport interface MutationStepResult {\n op: \"save\" | \"patch\" | \"delete\" | \"increment\" | \"addToSet\" | \"removeFromSet\";\n success: boolean;\n id: string;\n values?: Record<string, number>;\n error?: string;\n}\n\n/**\n * Every `mutation` op returns a uniform `{ results: MutationStepResult[] }`\n * in DEFINITION-STEP order \u2014 one entry per step, tagged with its `op` kind and\n * record `id` (#1458). This is a SUCCESS-PATH guarantee: a step that fails at\n * the HTTP level surfaces as an error, and committed sibling writes in the same\n * op are not reported (the ops are not yet executed atomically \u2014 see #1478).\n */\nexport interface MutationResult {\n results: MutationStepResult[];\n}\n\n/** `count` ops return a single count. */\nexport interface CountResult {\n count: number;\n}\n\n/** `aggregate` ops return
|
|
157
|
+
export declare const RESULT_ALIASES_BLOCK = "// Generic per-op result shapes. These mirror the runtime result shapes\n// produced by the database-operations controller; per-op aliases reference\n// them (or a narrowed form when the op definition makes the shape derivable).\n\n/** `query` ops return a page of records. */\nexport interface QueryResult<T = Record<string, unknown>> {\n data: T[];\n hasMore?: boolean;\n nextCursor?: string;\n}\n\n/**\n * One step's result inside a `mutation` op's uniform response (#1458).\n * `op` is the step kind; `id` is the record id (the resolved canonical id for\n * `upsertOn` saves). `values` carries an `increment` step's post-increment\n * counters; `error` a per-step failure string.\n */\nexport interface MutationStepResult {\n op: \"save\" | \"patch\" | \"delete\" | \"increment\" | \"addToSet\" | \"removeFromSet\";\n success: boolean;\n id: string;\n values?: Record<string, number>;\n error?: string;\n}\n\n/**\n * Every `mutation` op returns a uniform `{ results: MutationStepResult[] }`\n * in DEFINITION-STEP order \u2014 one entry per step, tagged with its `op` kind and\n * record `id` (#1458). This is a SUCCESS-PATH guarantee: a step that fails at\n * the HTTP level surfaces as an error, and committed sibling writes in the same\n * op are not reported (the ops are not yet executed atomically \u2014 see #1478).\n */\nexport interface MutationResult {\n results: MutationStepResult[];\n}\n\n/** `count` ops return a single count. */\nexport interface CountResult {\n count: number;\n}\n\n/** `aggregate` ops return one row per group: `{ group, ...operationValues }`. */\nexport interface AggregateResult {\n result: Array<{\n group: Record<string, unknown>;\n [operationKey: string]: unknown;\n }>;\n}\n\n/** `applyToQuery` ops return match/affect/fail counts. */\nexport interface ApplyToQueryResult {\n matched: number;\n affected: number;\n failed: number;\n sample?: unknown[];\n}\n\n/** `pipeline` ops return per-step results keyed by step name. */\nexport interface PipelineResult {\n steps: Record<string, unknown>;\n}\n";
|
|
158
158
|
/**
|
|
159
159
|
* Render the header (banner + regen hint + fingerprint).
|
|
160
160
|
*/
|
|
@@ -183,46 +183,6 @@ export declare function fieldNameUnion(fields: string[]): TypeNode;
|
|
|
183
183
|
* no-return / unresolvable keep the generic `PipelineResult`.
|
|
184
184
|
*/
|
|
185
185
|
export declare function renderOpResultAlias(input: RenderOpResultAliasInput): string;
|
|
186
|
-
/** One operation the typed-ops factory exposes as a method (#1441). */
|
|
187
|
-
export interface OpsFactoryOp {
|
|
188
|
-
/**
|
|
189
|
-
* Object-literal property key for the method — bare (`getX`) for a plain JS
|
|
190
|
-
* identifier, or a quoted string (`"get-x"`, `"delete"`) for a hyphenated /
|
|
191
|
-
* reserved-word / leading-digit op name. Produced by `objectPropertyKey`.
|
|
192
|
-
*/
|
|
193
|
-
propertyKey: string;
|
|
194
|
-
/** Exact operation name passed as the `executeOperation` string argument. */
|
|
195
|
-
opName: string;
|
|
196
|
-
/** The op's `<Op>Params` interface name (write shape). */
|
|
197
|
-
paramsInterfaceName: string;
|
|
198
|
-
/** The op's `<Op>Result` alias name (read shape). */
|
|
199
|
-
resultAliasName: string;
|
|
200
|
-
/**
|
|
201
|
-
* Whether the op declares any params. A param-less op yields a method callable
|
|
202
|
-
* with no arguments (`ops.foo()`); its only arg is the optional `options`.
|
|
203
|
-
*/
|
|
204
|
-
hasParams: boolean;
|
|
205
|
-
}
|
|
206
|
-
export interface RenderOpsFactoryInput {
|
|
207
|
-
/** Factory function name (e.g. `securitiesRefOps`). */
|
|
208
|
-
factoryName: string;
|
|
209
|
-
/** Database type name, for the doc comment. */
|
|
210
|
-
databaseType: string;
|
|
211
|
-
/** Operations to expose, in deterministic (name-sorted) order. */
|
|
212
|
-
ops: OpsFactoryOp[];
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Render the typed-operations factory (#1441): an inlined structural client
|
|
216
|
-
* interface + a shared call-options type + the `export function <type>Ops`
|
|
217
|
-
* factory. Each method pairs an op's `<Op>Params` input with its `<Op>Result`
|
|
218
|
-
* output and calls `client.databases.executeOperation<<Op>Result>(...)`, so the
|
|
219
|
-
* generated code carries no `as` cast and no import — the real `JsBaoClient`
|
|
220
|
-
* satisfies the structural `OpsClient` param.
|
|
221
|
-
*
|
|
222
|
-
* Returns "" for a database type with no operations, so the caller can omit the
|
|
223
|
-
* factory entirely rather than emit an empty function.
|
|
224
|
-
*/
|
|
225
|
-
export declare function renderOpsFactory(input: RenderOpsFactoryInput): string;
|
|
226
186
|
/** One subscription the typed-subscriptions factory exposes as a method. */
|
|
227
187
|
export interface SubscriptionFactoryEntry {
|
|
228
188
|
/**
|
|
@@ -246,27 +206,18 @@ export interface SubscriptionFactoryEntry {
|
|
|
246
206
|
export interface RenderFactoriesInput {
|
|
247
207
|
/** Database type name, for the doc comments. */
|
|
248
208
|
databaseType: string;
|
|
249
|
-
/** Name of the `<type>Ops` factory function. */
|
|
250
|
-
opsFactoryName: string;
|
|
251
209
|
/** Name of the `<type>Subscriptions` factory function. */
|
|
252
210
|
subscriptionsFactoryName: string;
|
|
253
|
-
/** Operations to expose, in deterministic (name-sorted) order. */
|
|
254
|
-
ops: OpsFactoryOp[];
|
|
255
211
|
/** Subscriptions to expose, in deterministic (key-sorted) order. */
|
|
256
212
|
subscriptions: SubscriptionFactoryEntry[];
|
|
257
213
|
}
|
|
258
214
|
/**
|
|
259
|
-
* Render the typed-
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* every existing generated file (none of which has subscriptions) is unchanged.
|
|
265
|
-
* When subscriptions exist, the shared `OpsClient` gains a `subscribe<T>`
|
|
266
|
-
* member, the inlined subscribe types are emitted once, and a separate
|
|
267
|
-
* `<type>Subscriptions` factory follows the ops factory. The file stays
|
|
268
|
-
* import-free (behavior 10).
|
|
215
|
+
* Render the typed-subscriptions factory (#1544 Phase 2) for one database type,
|
|
216
|
+
* behind the structural `OpsClient` interface it calls through. No `<type>Ops`
|
|
217
|
+
* factory is emitted: the client door its methods called was retired (#3188).
|
|
218
|
+
* The per-op `<Op>Params` / `<Op>Result` types stay, describing the operations
|
|
219
|
+
* a server function runs. The file stays import-free (behavior 10).
|
|
269
220
|
*
|
|
270
|
-
* Returns "" when the type has
|
|
221
|
+
* Returns "" when the type has no subscriptions.
|
|
271
222
|
*/
|
|
272
223
|
export declare function renderFactories(input: RenderFactoriesInput): string;
|
|
@@ -78,9 +78,12 @@ export interface CountResult {
|
|
|
78
78
|
count: number;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/** \`aggregate\` ops return
|
|
81
|
+
/** \`aggregate\` ops return one row per group: \`{ group, ...operationValues }\`. */
|
|
82
82
|
export interface AggregateResult {
|
|
83
|
-
result:
|
|
83
|
+
result: Array<{
|
|
84
|
+
group: Record<string, unknown>;
|
|
85
|
+
[operationKey: string]: unknown;
|
|
86
|
+
}>;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
/** \`applyToQuery\` ops return match/affect/fail counts. */
|
|
@@ -261,22 +264,6 @@ export function renderOpResultAlias(input) {
|
|
|
261
264
|
return alias(atom("unknown"));
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
|
-
// The `databases.executeOperation<R>` member on the structural client shape.
|
|
265
|
-
// `object` (not `Record<string, unknown>`) so a strict generated `<Op>Params`
|
|
266
|
-
// interface — which has no index signature — is still assignable here.
|
|
267
|
-
const EXECUTE_OPERATION_MEMBER = [
|
|
268
|
-
" executeOperation<R>(",
|
|
269
|
-
" databaseId: string,",
|
|
270
|
-
" name: string,",
|
|
271
|
-
" options?: {",
|
|
272
|
-
" params?: object;",
|
|
273
|
-
" limit?: number;",
|
|
274
|
-
" cursor?: string;",
|
|
275
|
-
" direction?: 1 | -1;",
|
|
276
|
-
" timing?: boolean;",
|
|
277
|
-
" },",
|
|
278
|
-
" ): Promise<R>;",
|
|
279
|
-
];
|
|
280
267
|
// The `databases.subscribe<T>` member on the structural client shape
|
|
281
268
|
// (#1544 Phase 2). Mirrors the client's `subscribe<T, P>` closely enough that
|
|
282
269
|
// the real `JsBaoClient` satisfies it structurally; `P` defaults there so the
|
|
@@ -288,17 +275,6 @@ const SUBSCRIBE_MEMBER = [
|
|
|
288
275
|
" options: SubscribeOptions<T>,",
|
|
289
276
|
" ): () => void;",
|
|
290
277
|
];
|
|
291
|
-
// Non-param options (pagination + diagnostics) each ops factory method accepts.
|
|
292
|
-
const OPS_CALL_OPTIONS_BLOCK = [
|
|
293
|
-
"// Non-param options (pagination + diagnostics) each factory method accepts",
|
|
294
|
-
"// alongside its params, passed straight through to `executeOperation`.",
|
|
295
|
-
"interface OpsCallOptions {",
|
|
296
|
-
" limit?: number;",
|
|
297
|
-
" cursor?: string;",
|
|
298
|
-
" direction?: 1 | -1;",
|
|
299
|
-
" timing?: boolean;",
|
|
300
|
-
"}",
|
|
301
|
-
].join("\n");
|
|
302
278
|
// Inlined structural subscribe types (#1544 Phase 2) — import-free mirrors of
|
|
303
279
|
// the client's `DatabaseSubscribeOptions` / `DatabaseChangePayload` /
|
|
304
280
|
// `DatabaseChangeEvent`. `T` is the record type bound to each change; a
|
|
@@ -329,78 +305,23 @@ const SUBSCRIBE_TYPES_BLOCK = [
|
|
|
329
305
|
"}",
|
|
330
306
|
].join("\n");
|
|
331
307
|
/**
|
|
332
|
-
* The inlined structural client shape
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
308
|
+
* The inlined structural client shape: the one `subscribe<T>` member the
|
|
309
|
+
* `<type>Subscriptions` factory calls. The file carries no operation factory —
|
|
310
|
+
* the client door a `<type>Ops` method called was retired (#3188), and an
|
|
311
|
+
* operation is reached from a server function instead.
|
|
336
312
|
*/
|
|
337
|
-
function renderClientInterface(
|
|
313
|
+
function renderClientInterface() {
|
|
338
314
|
return [
|
|
339
315
|
"// Minimal structural client shape — inlined so this file stays import-free",
|
|
340
316
|
"// and carries no runtime dependency on the client package. The real",
|
|
341
317
|
"// `JsBaoClient` satisfies it structurally.",
|
|
342
318
|
"interface OpsClient {",
|
|
343
319
|
" databases: {",
|
|
344
|
-
...
|
|
345
|
-
" };",
|
|
346
|
-
"}",
|
|
347
|
-
].join("\n");
|
|
348
|
-
}
|
|
349
|
-
/** One factory method per op, pairing `<Op>Params` in with `<Op>Result` out. */
|
|
350
|
-
function opsMethodLines(ops) {
|
|
351
|
-
return ops.map((op) => {
|
|
352
|
-
const nameLiteral = JSON.stringify(op.opName);
|
|
353
|
-
// No declared params: the method takes only the optional options object, so
|
|
354
|
-
// it stays callable with no arguments (`ops.foo()`).
|
|
355
|
-
const params = op.hasParams
|
|
356
|
-
? [`params: ${op.paramsInterfaceName}`, "options?: OpsCallOptions"]
|
|
357
|
-
: ["options?: OpsCallOptions"];
|
|
358
|
-
return renderArrowProperty({
|
|
359
|
-
level: 2,
|
|
360
|
-
key: op.propertyKey,
|
|
361
|
-
params,
|
|
362
|
-
signatureTail: `: Promise<${op.resultAliasName}> =>`,
|
|
363
|
-
callee: generic("client.databases.executeOperation", [
|
|
364
|
-
atom(op.resultAliasName),
|
|
365
|
-
]),
|
|
366
|
-
leadingArgs: ["databaseId", nameLiteral],
|
|
367
|
-
objectMembers: op.hasParams ? ["params", "...options"] : ["...options"],
|
|
368
|
-
tail: ",",
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
/** The `export function <type>Ops(...)` factory body. */
|
|
373
|
-
function opsFactoryBlock(factoryName, databaseType, ops) {
|
|
374
|
-
return [
|
|
375
|
-
`/** Typed accessor for \`${databaseType}\` operations. */`,
|
|
376
|
-
renderParenList(`export function ${factoryName}`, ["client: OpsClient", "databaseId: string"], " {", 0),
|
|
377
|
-
" return {",
|
|
378
|
-
...opsMethodLines(ops),
|
|
320
|
+
...SUBSCRIBE_MEMBER,
|
|
379
321
|
" };",
|
|
380
322
|
"}",
|
|
381
323
|
].join("\n");
|
|
382
324
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Render the typed-operations factory (#1441): an inlined structural client
|
|
385
|
-
* interface + a shared call-options type + the `export function <type>Ops`
|
|
386
|
-
* factory. Each method pairs an op's `<Op>Params` input with its `<Op>Result`
|
|
387
|
-
* output and calls `client.databases.executeOperation<<Op>Result>(...)`, so the
|
|
388
|
-
* generated code carries no `as` cast and no import — the real `JsBaoClient`
|
|
389
|
-
* satisfies the structural `OpsClient` param.
|
|
390
|
-
*
|
|
391
|
-
* Returns "" for a database type with no operations, so the caller can omit the
|
|
392
|
-
* factory entirely rather than emit an empty function.
|
|
393
|
-
*/
|
|
394
|
-
export function renderOpsFactory(input) {
|
|
395
|
-
const { factoryName, databaseType, ops } = input;
|
|
396
|
-
if (ops.length === 0)
|
|
397
|
-
return "";
|
|
398
|
-
return [
|
|
399
|
-
renderClientInterface(EXECUTE_OPERATION_MEMBER),
|
|
400
|
-
OPS_CALL_OPTIONS_BLOCK,
|
|
401
|
-
opsFactoryBlock(factoryName, databaseType, ops),
|
|
402
|
-
].join("\n\n");
|
|
403
|
-
}
|
|
404
325
|
/**
|
|
405
326
|
* The `export function <type>Subscriptions(...)` factory body.
|
|
406
327
|
*
|
|
@@ -438,43 +359,22 @@ function subscriptionsFactoryBlock(factoryName, databaseType, subscriptions) {
|
|
|
438
359
|
].join("\n");
|
|
439
360
|
}
|
|
440
361
|
/**
|
|
441
|
-
* Render the typed-
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
* every existing generated file (none of which has subscriptions) is unchanged.
|
|
447
|
-
* When subscriptions exist, the shared `OpsClient` gains a `subscribe<T>`
|
|
448
|
-
* member, the inlined subscribe types are emitted once, and a separate
|
|
449
|
-
* `<type>Subscriptions` factory follows the ops factory. The file stays
|
|
450
|
-
* import-free (behavior 10).
|
|
362
|
+
* Render the typed-subscriptions factory (#1544 Phase 2) for one database type,
|
|
363
|
+
* behind the structural `OpsClient` interface it calls through. No `<type>Ops`
|
|
364
|
+
* factory is emitted: the client door its methods called was retired (#3188).
|
|
365
|
+
* The per-op `<Op>Params` / `<Op>Result` types stay, describing the operations
|
|
366
|
+
* a server function runs. The file stays import-free (behavior 10).
|
|
451
367
|
*
|
|
452
|
-
* Returns "" when the type has
|
|
368
|
+
* Returns "" when the type has no subscriptions.
|
|
453
369
|
*/
|
|
454
370
|
export function renderFactories(input) {
|
|
455
|
-
const { databaseType,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
const hasOps = ops.length > 0;
|
|
466
|
-
const members = [
|
|
467
|
-
...(hasOps ? EXECUTE_OPERATION_MEMBER : []),
|
|
468
|
-
...SUBSCRIBE_MEMBER,
|
|
469
|
-
];
|
|
470
|
-
const blocks = [renderClientInterface(members)];
|
|
471
|
-
if (hasOps)
|
|
472
|
-
blocks.push(OPS_CALL_OPTIONS_BLOCK);
|
|
473
|
-
blocks.push(SUBSCRIBE_TYPES_BLOCK);
|
|
474
|
-
if (hasOps) {
|
|
475
|
-
blocks.push(opsFactoryBlock(input.opsFactoryName, databaseType, ops));
|
|
476
|
-
}
|
|
477
|
-
blocks.push(subscriptionsFactoryBlock(input.subscriptionsFactoryName, databaseType, subscriptions));
|
|
478
|
-
return blocks.join("\n\n");
|
|
371
|
+
const { databaseType, subscriptions } = input;
|
|
372
|
+
if (subscriptions.length === 0)
|
|
373
|
+
return "";
|
|
374
|
+
return [
|
|
375
|
+
renderClientInterface(),
|
|
376
|
+
SUBSCRIBE_TYPES_BLOCK,
|
|
377
|
+
subscriptionsFactoryBlock(input.subscriptionsFactoryName, databaseType, subscriptions),
|
|
378
|
+
].join("\n\n");
|
|
479
379
|
}
|
|
480
380
|
//# sourceMappingURL=dbTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbTemplates.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbTemplates.ts"],"names":[],"mappings":"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AAY;YACZ,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC;YACpC,SAAS;SACV;QACD,IAAI,EAAE,GAAG;KACV,CAAC,CACH,CAAC;IACF,OAAO;QACL,4BAA4B,YAAY,+BAA+B;QACvE,eAAe,CACb,mBAAmB,WAAW,EAAE,EAChC,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,EAC3C,IAAI,EACJ,CAAC,CACF;QACD,YAAY;QACZ,GAAG,WAAW;QACd,MAAM;QACN,GAAG;KACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC9C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1C,OAAO;QACL,qBAAqB,EAAE;QACvB,qBAAqB;QACrB,yBAAyB,CACvB,KAAK,CAAC,wBAAwB,EAC9B,YAAY,EACZ,aAAa,CACd;KACF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -60,7 +60,7 @@ export interface DbRecordIR {
|
|
|
60
60
|
}
|
|
61
61
|
/** One operation on a database type, naming-neutral. */
|
|
62
62
|
export interface DbOpIR {
|
|
63
|
-
/** Exact operation name
|
|
63
|
+
/** Exact operation name, as the database type declares it. */
|
|
64
64
|
opName: string;
|
|
65
65
|
/** Operation type (`query|mutation|count|aggregate|pipeline|applyToQuery`). */
|
|
66
66
|
opType: string;
|
|
@@ -96,19 +96,6 @@ export interface FunctionConfigPush {
|
|
|
96
96
|
*/
|
|
97
97
|
documentSchema?: string;
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
* The retired runtime keys a `functions/<key>.toml` still carries — #3482.
|
|
101
|
-
*
|
|
102
|
-
* NOT a refusal. Through phase 4 `mode`, `durable` and a cron entry's `mode`
|
|
103
|
-
* are accepted and ignored, with one warning each and every other key of the
|
|
104
|
-
* file applied; phase 5 (#3188) refuses them. The sentences come from the one
|
|
105
|
-
* vendored scanner, so the warning `config push` prints is the sentence the
|
|
106
|
-
* server answers with.
|
|
107
|
-
*/
|
|
108
|
-
export declare function functionTomlIgnoredKeyWarnings(options: {
|
|
109
|
-
functionKey: string;
|
|
110
|
-
tomlData: any;
|
|
111
|
-
}): string[];
|
|
112
99
|
/**
|
|
113
100
|
* Everything about one `functions/<key>.toml` that `config push` can decide
|
|
114
101
|
* from the file alone (#3320).
|
|
@@ -290,9 +277,9 @@ export declare function functionDiffEntity(tomlData: any): Record<string, any>;
|
|
|
290
277
|
*
|
|
291
278
|
* ── Three jobs, kept apart ────────────────────────────────────────────────
|
|
292
279
|
*
|
|
293
|
-
* The PARSE decides what is removed and what is reported: `
|
|
294
|
-
* is the very scanner `config push`
|
|
295
|
-
* exactly what a push
|
|
280
|
+
* The PARSE decides what is removed and what is reported: `refusedFunctionKeys`
|
|
281
|
+
* is the very scanner `config push` refuses with, so what a pull takes out is
|
|
282
|
+
* exactly what a push would have refused, whatever spelling the author used.
|
|
296
283
|
* TOML has several — `["function"]`, `function . mode = …`, an inline
|
|
297
284
|
* `triggers.cron = [ { mode = … } ]` — and a scan that reads the SOURCE has to
|
|
298
285
|
* know every one of them or it silently leaves a key behind (CR3482-002).
|
|
@@ -36,7 +36,7 @@ import { dirname, isAbsolute, join, posix as posixPath, relative, resolve, sep,
|
|
|
36
36
|
import { parseConfigToml, stringifyConfigToml } from "./config-toml.js";
|
|
37
37
|
import { DOCUMENT_SCHEMA_TREE_FILE, resolveDocumentSchema, } from "./function-document-types.js";
|
|
38
38
|
import { SERVER_FUNCTION_TABLE } from "./config-surface.js";
|
|
39
|
-
import { checkCronTriggerEntry, hasDeclaredTriggers, hasRetiredDatabaseTriggerBlock,
|
|
39
|
+
import { checkCronTriggerEntry, hasDeclaredTriggers, hasRetiredDatabaseTriggerBlock, refusedFunctionKeys, refusedFunctionKeyMessages, retiredDatabaseTriggerTypes, normalizeTriggerDeclaration, RETIRED_FUNCTION_RUNTIME_KEYS, TriggerDeclarationError, validateSigningSecretDeclaration, } from "./generated-config-surfaces.js";
|
|
40
40
|
import { canonicalJsonStringify } from "./canonical-json.js";
|
|
41
41
|
import { writePulledFile } from "./pull-write.js";
|
|
42
42
|
import { buildPayloadFromToml, projectRecordToToml, tomlOwned } from "./config-payload.js";
|
|
@@ -98,18 +98,6 @@ export function normalizeFunctionTriggers(functionTable) {
|
|
|
98
98
|
return null;
|
|
99
99
|
return declaration;
|
|
100
100
|
}
|
|
101
|
-
/**
|
|
102
|
-
* The retired runtime keys a `functions/<key>.toml` still carries — #3482.
|
|
103
|
-
*
|
|
104
|
-
* NOT a refusal. Through phase 4 `mode`, `durable` and a cron entry's `mode`
|
|
105
|
-
* are accepted and ignored, with one warning each and every other key of the
|
|
106
|
-
* file applied; phase 5 (#3188) refuses them. The sentences come from the one
|
|
107
|
-
* vendored scanner, so the warning `config push` prints is the sentence the
|
|
108
|
-
* server answers with.
|
|
109
|
-
*/
|
|
110
|
-
export function functionTomlIgnoredKeyWarnings(options) {
|
|
111
|
-
return ignoredFunctionKeyWarnings(`functions/${options.functionKey}.toml`, options.tomlData?.function);
|
|
112
|
-
}
|
|
113
101
|
/** The `entry` refusal, or null. One spelling, two readers. */
|
|
114
102
|
function functionEntryError(functionKey, table) {
|
|
115
103
|
if (String(table?.entry ?? "").trim())
|
|
@@ -144,6 +132,14 @@ export function functionTomlPreflightErrors(options) {
|
|
|
144
132
|
const { functionKey, tomlData } = options;
|
|
145
133
|
const table = tomlData?.function ?? {};
|
|
146
134
|
const errors = [];
|
|
135
|
+
// #3188 — the retired runtime keys, refused (phase 5 ends #3482's grace).
|
|
136
|
+
// One message per key, first, so an author reads them in the order their
|
|
137
|
+
// file carries them; `config pull` strips them, so a pulled tree never
|
|
138
|
+
// meets this. A loop rather than a spread: #3375's reachability walk reads
|
|
139
|
+
// `...name(` as a property access and would not see the rule as reached.
|
|
140
|
+
for (const message of refusedFunctionKeyMessages(`function '${functionKey}'`, table)) {
|
|
141
|
+
errors.push(message);
|
|
142
|
+
}
|
|
147
143
|
const entryError = functionEntryError(functionKey, table);
|
|
148
144
|
if (entryError)
|
|
149
145
|
errors.push(entryError);
|
|
@@ -548,9 +544,9 @@ const MULTILINE_DELIMITERS = ['"""', "'''"];
|
|
|
548
544
|
*
|
|
549
545
|
* ── Three jobs, kept apart ────────────────────────────────────────────────
|
|
550
546
|
*
|
|
551
|
-
* The PARSE decides what is removed and what is reported: `
|
|
552
|
-
* is the very scanner `config push`
|
|
553
|
-
* exactly what a push
|
|
547
|
+
* The PARSE decides what is removed and what is reported: `refusedFunctionKeys`
|
|
548
|
+
* is the very scanner `config push` refuses with, so what a pull takes out is
|
|
549
|
+
* exactly what a push would have refused, whatever spelling the author used.
|
|
554
550
|
* TOML has several — `["function"]`, `function . mode = …`, an inline
|
|
555
551
|
* `triggers.cron = [ { mode = … } ]` — and a scan that reads the SOURCE has to
|
|
556
552
|
* know every one of them or it silently leaves a key behind (CR3482-002).
|
|
@@ -587,7 +583,7 @@ export function stripRetiredFunctionKeys(toml, label = "") {
|
|
|
587
583
|
return { toml, removals: [] };
|
|
588
584
|
}
|
|
589
585
|
const functionTable = before.function;
|
|
590
|
-
const ignored =
|
|
586
|
+
const ignored = refusedFunctionKeys(functionTable);
|
|
591
587
|
// PRESENCE, not entry count (CR3483-001). `database = []` names no type, and
|
|
592
588
|
// deciding by the list's length left that line in the pulled file — which
|
|
593
589
|
// the next push then refused, because the refusal reads presence. The two
|
|
@@ -698,7 +694,7 @@ function saysExactly(text, want) {
|
|
|
698
694
|
try {
|
|
699
695
|
const parsed = parseConfigToml(text);
|
|
700
696
|
const fn = parsed.function;
|
|
701
|
-
if (
|
|
697
|
+
if (refusedFunctionKeys(fn).length)
|
|
702
698
|
return false;
|
|
703
699
|
if (hasRetiredDatabaseTriggerBlock(fn))
|
|
704
700
|
return false;
|