primitive-admin 1.0.53 → 1.0.55
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 +38 -10
- package/dist/bin/primitive.js +8 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/apps.js +54 -2
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.js +16 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +84 -7
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/catalog.js +3 -3
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collections.js +12 -9
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/databases.js +220 -82
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +77 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/group-type-configs.js +1 -9
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/groups.js +12 -6
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +161 -0
- package/dist/src/commands/guides.js +502 -84
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/integrations.js +2 -2
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +344 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -0
- package/dist/src/commands/rule-sets.js +25 -3
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +2 -0
- package/dist/src/commands/scripts.js +667 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/settings.d.ts +15 -0
- package/dist/src/commands/settings.js +102 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +105 -0
- package/dist/src/commands/sync-app-settings.js +339 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +204 -9
- package/dist/src/commands/sync.js +1706 -371
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +110 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/webhooks.js +17 -3
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +30 -0
- package/dist/src/commands/workflows.js +667 -59
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +122 -18
- package/dist/src/lib/api-client.js +131 -2
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +108 -0
- package/dist/src/lib/app-settings-descriptor.js +250 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +76 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +144 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +16 -0
- package/dist/src/lib/config.js +41 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/constants.d.ts +9 -0
- package/dist/src/lib/constants.js +9 -0
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/csv.d.ts +1 -2
- package/dist/src/lib/csv.js +3 -8
- package/dist/src/lib/csv.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +21 -65
- package/dist/src/lib/db-codegen/dbGenerator.js +117 -321
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +37 -0
- package/dist/src/lib/db-codegen/dbNaming.js +70 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +165 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +292 -16
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +7 -3
- package/dist/src/lib/db-codegen/dbTsTypes.js +23 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +101 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +200 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/generated-allowlist.js +43 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.js +2 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +25 -5
- package/dist/src/lib/output.js +32 -4
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +68 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +380 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +84 -0
- package/dist/src/lib/swift-codegen/generator.js +178 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +225 -0
- package/dist/src/lib/sync-resource-types.js +394 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +10 -19
- package/dist/src/lib/toml-database-config.js +28 -59
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +147 -0
- package/dist/src/lib/toml-metadata-config.js +463 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +34 -0
- package/dist/src/lib/toml-params-validator.js +118 -3
- package/dist/src/lib/toml-params-validator.js.map +1 -1
- package/dist/src/lib/workflow-apply.d.ts +86 -0
- package/dist/src/lib/workflow-apply.js +127 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +87 -0
- package/dist/src/lib/workflow-codegen/generator.js +290 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +85 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +64 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +282 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-fragments.js +3 -3
- package/dist/src/lib/workflow-fragments.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +68 -0
- package/dist/src/lib/workflow-payload.js +150 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +37 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +11 -0
- package/dist/src/validators.d.ts +4 -3
- package/dist/src/validators.js +6 -5
- package/dist/src/validators.js.map +1 -1
- package/package.json +7 -3
|
@@ -29,6 +29,43 @@ 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
|
+
/**
|
|
40
|
+
* Name of the generated typed-subscriptions factory for a database type
|
|
41
|
+
* (#1544 Phase 2). Same casing + leading-digit guard as {@link opsFactoryName}:
|
|
42
|
+
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`. Kept a
|
|
43
|
+
* separate export from `<type>Ops` (Fork 4 = A): realtime subscriptions are a
|
|
44
|
+
* different surface than HTTP `executeOperation`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function subscriptionsFactoryName(databaseType: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* camelCase an identifier: splits on non-alphanumeric separators, lower-cases
|
|
49
|
+
* the first segment's first char and PascalCases the rest
|
|
50
|
+
* (`securities-ref` → `securitiesRef`, `save_account` → `saveAccount`). Existing
|
|
51
|
+
* internal casing after the first char is preserved.
|
|
52
|
+
*/
|
|
53
|
+
export declare function camelCase(name: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Render a name (an operation name #1441, or a subscription key #1544 Phase 2)
|
|
56
|
+
* as an object-literal property key. A name that is a plain, non-reserved JS
|
|
57
|
+
* identifier is emitted bare (`getX:`); anything else — a hyphen, a leading
|
|
58
|
+
* digit, or a reserved word — is emitted as a quoted key (`"get-x":`,
|
|
59
|
+
* `"delete":`) so the factory stays valid TypeScript. The original name string
|
|
60
|
+
* passed to `executeOperation` / `subscribe` is always the exact original name.
|
|
61
|
+
*
|
|
62
|
+
* `__proto__` is a special case. The factory return value is a *runtime* object
|
|
63
|
+
* literal, and in that position both the bare `__proto__:` form AND the quoted
|
|
64
|
+
* `"__proto__":` form set the object's prototype instead of defining an own
|
|
65
|
+
* method — silently dropping that operation. Only a computed key
|
|
66
|
+
* (`["__proto__"]:`) defines a normal own property, so emit that form.
|
|
67
|
+
*/
|
|
68
|
+
export declare function objectPropertyKey(name: string): string;
|
|
32
69
|
/**
|
|
33
70
|
* Convert a snake_case plural model name (`user_prefs`, `categories`) into a
|
|
34
71
|
* PascalCase singular interface name (`UserPref`, `Category`). Returns null
|
|
@@ -43,6 +43,76 @@ export function opParamsInterfaceName(opName) {
|
|
|
43
43
|
export function opResultAliasName(opName) {
|
|
44
44
|
return `${pascalCase(opName)}Result`;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Name of the generated typed-operations factory for a database type (#1441).
|
|
48
|
+
* `securities-ref` → `securitiesRefOps`, `portfolio` → `portfolioOps`. A type
|
|
49
|
+
* whose camelCased name would start with a digit (e.g. `2fa`) gets a leading
|
|
50
|
+
* `_` so the emitted `export function` name is a valid JS identifier.
|
|
51
|
+
*/
|
|
52
|
+
export function opsFactoryName(databaseType) {
|
|
53
|
+
const base = camelCase(databaseType);
|
|
54
|
+
const safe = /^[0-9]/.test(base) ? `_${base}` : base;
|
|
55
|
+
return `${safe}Ops`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Name of the generated typed-subscriptions factory for a database type
|
|
59
|
+
* (#1544 Phase 2). Same casing + leading-digit guard as {@link opsFactoryName}:
|
|
60
|
+
* `tasks-db` → `tasksDbSubscriptions`, `2fa` → `_2faSubscriptions`. Kept a
|
|
61
|
+
* separate export from `<type>Ops` (Fork 4 = A): realtime subscriptions are a
|
|
62
|
+
* different surface than HTTP `executeOperation`.
|
|
63
|
+
*/
|
|
64
|
+
export function subscriptionsFactoryName(databaseType) {
|
|
65
|
+
const base = camelCase(databaseType);
|
|
66
|
+
const safe = /^[0-9]/.test(base) ? `_${base}` : base;
|
|
67
|
+
return `${safe}Subscriptions`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* camelCase an identifier: splits on non-alphanumeric separators, lower-cases
|
|
71
|
+
* the first segment's first char and PascalCases the rest
|
|
72
|
+
* (`securities-ref` → `securitiesRef`, `save_account` → `saveAccount`). Existing
|
|
73
|
+
* internal casing after the first char is preserved.
|
|
74
|
+
*/
|
|
75
|
+
export function camelCase(name) {
|
|
76
|
+
const pascal = pascalCase(name);
|
|
77
|
+
if (pascal.length === 0)
|
|
78
|
+
return pascal;
|
|
79
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* JS reserved words. Used as object-literal property keys these are actually
|
|
83
|
+
* legal unquoted, but quoting them keeps the generated output unambiguous and
|
|
84
|
+
* matches the "non-identifier op name -> quoted key" behavior (#1441).
|
|
85
|
+
*/
|
|
86
|
+
const RESERVED_WORDS = new Set([
|
|
87
|
+
"break", "case", "catch", "class", "const", "continue", "debugger",
|
|
88
|
+
"default", "delete", "do", "else", "enum", "export", "extends", "false",
|
|
89
|
+
"finally", "for", "function", "if", "import", "in", "instanceof", "new",
|
|
90
|
+
"null", "return", "super", "switch", "this", "throw", "true", "try",
|
|
91
|
+
"typeof", "var", "void", "while", "with", "yield", "let", "static",
|
|
92
|
+
"implements", "interface", "package", "private", "protected", "public",
|
|
93
|
+
]);
|
|
94
|
+
/**
|
|
95
|
+
* Render a name (an operation name #1441, or a subscription key #1544 Phase 2)
|
|
96
|
+
* as an object-literal property key. A name that is a plain, non-reserved JS
|
|
97
|
+
* identifier is emitted bare (`getX:`); anything else — a hyphen, a leading
|
|
98
|
+
* digit, or a reserved word — is emitted as a quoted key (`"get-x":`,
|
|
99
|
+
* `"delete":`) so the factory stays valid TypeScript. The original name string
|
|
100
|
+
* passed to `executeOperation` / `subscribe` is always the exact original name.
|
|
101
|
+
*
|
|
102
|
+
* `__proto__` is a special case. The factory return value is a *runtime* object
|
|
103
|
+
* literal, and in that position both the bare `__proto__:` form AND the quoted
|
|
104
|
+
* `"__proto__":` form set the object's prototype instead of defining an own
|
|
105
|
+
* method — silently dropping that operation. Only a computed key
|
|
106
|
+
* (`["__proto__"]:`) defines a normal own property, so emit that form.
|
|
107
|
+
*/
|
|
108
|
+
export function objectPropertyKey(name) {
|
|
109
|
+
if (name === "__proto__")
|
|
110
|
+
return `[${JSON.stringify(name)}]`;
|
|
111
|
+
const isPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
|
|
112
|
+
if (isPlainIdentifier && !RESERVED_WORDS.has(name))
|
|
113
|
+
return name;
|
|
114
|
+
return JSON.stringify(name);
|
|
115
|
+
}
|
|
46
116
|
/**
|
|
47
117
|
* Convert a snake_case plural model name (`user_prefs`, `categories`) into a
|
|
48
118
|
* PascalCase singular interface name (`UserPref`, `Category`). Returns null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbNaming.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbNaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAiB,EACjB,iBAAqC;IAErC,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,MAAM,QAAQ,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IACvC,0EAA0E;IAC1E,oDAAoD;IACpD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,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C,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"}
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
* classes — so we emit plain `export interface` types with no class
|
|
12
12
|
* shell, no barrel registration, and `import type` only.
|
|
13
13
|
* 2. We add an OPERATIONS half codegen-v2 has no analog for: per-op
|
|
14
|
-
* input-params interfaces + per-op result aliases
|
|
14
|
+
* input-params interfaces + per-op result aliases. The alias for an op
|
|
15
|
+
* is derived from `op.type` AND, where it matters, the op's parsed
|
|
16
|
+
* `definition`: a query op's `projection` (#1439), a mutation op's step
|
|
17
|
+
* kinds (#1438), and a pipeline op's `return` step (#1437). The generator
|
|
18
|
+
* resolves those into the small descriptors below; the templates stay pure
|
|
19
|
+
* string-emitters.
|
|
15
20
|
*/
|
|
16
21
|
/** A field on a record interface (read shape). */
|
|
17
22
|
export interface RecordField {
|
|
@@ -42,7 +47,7 @@ export interface RenderRecordInterfaceInput {
|
|
|
42
47
|
/** One declared param on an op-input interface (write shape). */
|
|
43
48
|
export interface ParamField {
|
|
44
49
|
name: string;
|
|
45
|
-
/** TOML param type (`string|number|boolean|object`). */
|
|
50
|
+
/** TOML param type (`string|number|boolean|object|array`). */
|
|
46
51
|
type: string;
|
|
47
52
|
required: boolean;
|
|
48
53
|
/**
|
|
@@ -51,6 +56,13 @@ export interface ParamField {
|
|
|
51
56
|
* renders the union when present and falls back to the base type otherwise.
|
|
52
57
|
*/
|
|
53
58
|
enum?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Scalar element type for an `array` param (#1488), either declared
|
|
61
|
+
* (`type = "array"` + `items = "..."`) or inferred from a `$in`/`$nin`
|
|
62
|
+
* binding. Undefined on a non-array param, or on an array whose element type
|
|
63
|
+
* could not be resolved (renders `unknown[]`).
|
|
64
|
+
*/
|
|
65
|
+
items?: string;
|
|
54
66
|
}
|
|
55
67
|
export interface RenderOpParamsInterfaceInput {
|
|
56
68
|
/** PascalCase params interface name (e.g. `SaveAccountParams`). */
|
|
@@ -59,6 +71,49 @@ export interface RenderOpParamsInterfaceInput {
|
|
|
59
71
|
opName: string;
|
|
60
72
|
params: ParamField[];
|
|
61
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* How a query op's static `projection` narrows its record type (#1439). The
|
|
76
|
+
* generator resolves the projection against the model's record fields (guarding
|
|
77
|
+
* unknown / nested keys) and hands the template one of these; the template only
|
|
78
|
+
* assembles the `Pick`/`Partial` string.
|
|
79
|
+
* - `full` → `QueryResult<M>` (no projection, empty `{}`, or no schema).
|
|
80
|
+
* - `pick` → `QueryResult<Pick<M, ...fields>>` (inclusion; `id` folded in).
|
|
81
|
+
* - `omit` → `QueryResult<Omit<M, ...fields>>` (static all-exclusion over
|
|
82
|
+
* known schema fields, minus `id`/`type`). The DO strips excluded
|
|
83
|
+
* fields server-side (#1493 / issue #1456), so the excluded fields
|
|
84
|
+
* are genuinely absent from the result and `Omit` is truthful.
|
|
85
|
+
* - `partial` → `QueryResult<Partial<M>>` (dynamic / mixed / unknown-key /
|
|
86
|
+
* nested-key exclusion — the honest fallback when the excluded set
|
|
87
|
+
* can't be resolved to known members; #1439/Codex-P2).
|
|
88
|
+
*/
|
|
89
|
+
export type ProjectionClassification = {
|
|
90
|
+
kind: "full";
|
|
91
|
+
} | {
|
|
92
|
+
kind: "pick";
|
|
93
|
+
fields: string[];
|
|
94
|
+
} | {
|
|
95
|
+
kind: "omit";
|
|
96
|
+
fields: string[];
|
|
97
|
+
} | {
|
|
98
|
+
kind: "partial";
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A `pipeline` op's resolved `return` step (#1437). The runtime flattens a
|
|
102
|
+
* returning pipeline to the returned step's shape, so codegen types it as that
|
|
103
|
+
* step's result. `return: "all"`, no `return`, or any step the generator can't
|
|
104
|
+
* resolve fall back to `opaque` → the generic `PipelineResult`.
|
|
105
|
+
*/
|
|
106
|
+
export type PipelineReturnDescriptor = {
|
|
107
|
+
kind: "query";
|
|
108
|
+
recordInterfaceName: string | null;
|
|
109
|
+
projection?: ProjectionClassification;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "count";
|
|
112
|
+
} | {
|
|
113
|
+
kind: "aggregate";
|
|
114
|
+
} | {
|
|
115
|
+
kind: "opaque";
|
|
116
|
+
};
|
|
62
117
|
export interface RenderOpResultAliasInput {
|
|
63
118
|
/** Per-op result alias name (e.g. `SaveAccountResult`). */
|
|
64
119
|
aliasName: string;
|
|
@@ -72,9 +127,24 @@ export interface RenderOpResultAliasInput {
|
|
|
72
127
|
* interface (e.g. pipeline) — falls back to `QueryResult<Record<string, unknown>>`.
|
|
73
128
|
*/
|
|
74
129
|
recordInterfaceName: string | null;
|
|
130
|
+
/**
|
|
131
|
+
* For `query` ops (#1439), how the op's `projection` narrows the record type.
|
|
132
|
+
* Absent → treated as `full`.
|
|
133
|
+
*/
|
|
134
|
+
projection?: ProjectionClassification;
|
|
135
|
+
/**
|
|
136
|
+
* For `pipeline` ops (#1437), the resolved `return`-step descriptor. Absent
|
|
137
|
+
* or `opaque` → the generic `PipelineResult`.
|
|
138
|
+
*/
|
|
139
|
+
pipelineReturn?: PipelineReturnDescriptor;
|
|
75
140
|
}
|
|
76
|
-
/**
|
|
77
|
-
|
|
141
|
+
/**
|
|
142
|
+
* The shared generic result shapes referenced by the per-op aliases. These
|
|
143
|
+
* mirror the runtime result shapes produced by the database-operations
|
|
144
|
+
* controller; per-op aliases point at them (and, where the definition makes the
|
|
145
|
+
* shape derivable, at a narrowed form — see `renderOpResultAlias`).
|
|
146
|
+
*/
|
|
147
|
+
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 a single result object. */\nexport interface AggregateResult {\n result: Record<string, unknown>;\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";
|
|
78
148
|
/**
|
|
79
149
|
* Render the header (banner + regen hint + fingerprint).
|
|
80
150
|
*/
|
|
@@ -92,6 +162,96 @@ export declare function renderRecordInterface(input: RenderRecordInterfaceInput)
|
|
|
92
162
|
*/
|
|
93
163
|
export declare function renderOpParamsInterface(input: RenderOpParamsInterfaceInput): string;
|
|
94
164
|
/**
|
|
95
|
-
* Render a per-op result alias
|
|
165
|
+
* Render a per-op result alias. The alias is derived from `op.type` and, where
|
|
166
|
+
* the shape is derivable from the parsed op definition, a narrowed form:
|
|
167
|
+
* - `query` → `QueryResult<M>`, narrowed by the op `projection` (#1439).
|
|
168
|
+
* - `mutation` → `MutationResult` — every mutation op returns the uniform
|
|
169
|
+
* `{ results: MutationStepResult[] }` in definition order (#1458).
|
|
170
|
+
* - `pipeline` → the returned step's result type (#1437); `return: "all"` /
|
|
171
|
+
* no-return / unresolvable keep the generic `PipelineResult`.
|
|
96
172
|
*/
|
|
97
173
|
export declare function renderOpResultAlias(input: RenderOpResultAliasInput): string;
|
|
174
|
+
/** One operation the typed-ops factory exposes as a method (#1441). */
|
|
175
|
+
export interface OpsFactoryOp {
|
|
176
|
+
/**
|
|
177
|
+
* Object-literal property key for the method — bare (`getX`) for a plain JS
|
|
178
|
+
* identifier, or a quoted string (`"get-x"`, `"delete"`) for a hyphenated /
|
|
179
|
+
* reserved-word / leading-digit op name. Produced by `objectPropertyKey`.
|
|
180
|
+
*/
|
|
181
|
+
propertyKey: string;
|
|
182
|
+
/** Exact operation name passed as the `executeOperation` string argument. */
|
|
183
|
+
opName: string;
|
|
184
|
+
/** The op's `<Op>Params` interface name (write shape). */
|
|
185
|
+
paramsInterfaceName: string;
|
|
186
|
+
/** The op's `<Op>Result` alias name (read shape). */
|
|
187
|
+
resultAliasName: string;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the op declares any params. A param-less op yields a method callable
|
|
190
|
+
* with no arguments (`ops.foo()`); its only arg is the optional `options`.
|
|
191
|
+
*/
|
|
192
|
+
hasParams: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface RenderOpsFactoryInput {
|
|
195
|
+
/** Factory function name (e.g. `securitiesRefOps`). */
|
|
196
|
+
factoryName: string;
|
|
197
|
+
/** Database type name, for the doc comment. */
|
|
198
|
+
databaseType: string;
|
|
199
|
+
/** Operations to expose, in deterministic (name-sorted) order. */
|
|
200
|
+
ops: OpsFactoryOp[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Render the typed-operations factory (#1441): an inlined structural client
|
|
204
|
+
* interface + a shared call-options type + the `export function <type>Ops`
|
|
205
|
+
* factory. Each method pairs an op's `<Op>Params` input with its `<Op>Result`
|
|
206
|
+
* output and calls `client.databases.executeOperation<<Op>Result>(...)`, so the
|
|
207
|
+
* generated code carries no `as` cast and no import — the real `JsBaoClient`
|
|
208
|
+
* satisfies the structural `OpsClient` param.
|
|
209
|
+
*
|
|
210
|
+
* Returns "" for a database type with no operations, so the caller can omit the
|
|
211
|
+
* factory entirely rather than emit an empty function.
|
|
212
|
+
*/
|
|
213
|
+
export declare function renderOpsFactory(input: RenderOpsFactoryInput): string;
|
|
214
|
+
/** One subscription the typed-subscriptions factory exposes as a method. */
|
|
215
|
+
export interface SubscriptionFactoryEntry {
|
|
216
|
+
/**
|
|
217
|
+
* Object-literal property key for the method — bare (`myTasks`) or a quoted /
|
|
218
|
+
* computed key for a non-identifier subscription key. Produced by
|
|
219
|
+
* `objectPropertyKey`.
|
|
220
|
+
*/
|
|
221
|
+
propertyKey: string;
|
|
222
|
+
/** Exact subscription key string passed to `subscribe`. */
|
|
223
|
+
subscriptionKey: string;
|
|
224
|
+
/**
|
|
225
|
+
* The record type bound to the change payload — a record interface name
|
|
226
|
+
* (`Task`) or a projection (`Pick<Task, "id" | "name">`) when the
|
|
227
|
+
* subscription declares `select`.
|
|
228
|
+
*/
|
|
229
|
+
eventType: string;
|
|
230
|
+
}
|
|
231
|
+
export interface RenderFactoriesInput {
|
|
232
|
+
/** Database type name, for the doc comments. */
|
|
233
|
+
databaseType: string;
|
|
234
|
+
/** Name of the `<type>Ops` factory function. */
|
|
235
|
+
opsFactoryName: string;
|
|
236
|
+
/** Name of the `<type>Subscriptions` factory function. */
|
|
237
|
+
subscriptionsFactoryName: string;
|
|
238
|
+
/** Operations to expose, in deterministic (name-sorted) order. */
|
|
239
|
+
ops: OpsFactoryOp[];
|
|
240
|
+
/** Subscriptions to expose, in deterministic (key-sorted) order. */
|
|
241
|
+
subscriptions: SubscriptionFactoryEntry[];
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Render the typed-ops factory (#1441) and the typed-subscriptions factory
|
|
245
|
+
* (#1544 Phase 2) for one database type, sharing a single structural `OpsClient`
|
|
246
|
+
* interface (Fork 4 = A).
|
|
247
|
+
*
|
|
248
|
+
* With no subscriptions this is byte-identical to {@link renderOpsFactory}, so
|
|
249
|
+
* every existing generated file (none of which has subscriptions) is unchanged.
|
|
250
|
+
* When subscriptions exist, the shared `OpsClient` gains a `subscribe<T>`
|
|
251
|
+
* member, the inlined subscribe types are emitted once, and a separate
|
|
252
|
+
* `<type>Subscriptions` factory follows the ops factory. The file stays
|
|
253
|
+
* import-free (behavior 10).
|
|
254
|
+
*
|
|
255
|
+
* Returns "" when the type has neither ops nor subscriptions.
|
|
256
|
+
*/
|
|
257
|
+
export declare function renderFactories(input: RenderFactoriesInput): string;
|