primitive-admin 1.0.49 → 1.0.51

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.
Files changed (153) hide show
  1. package/README.md +129 -10
  2. package/assets/skill/skills/primitive-platform/SKILL.md +85 -30
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +66 -1
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +25 -27
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/apps.d.ts +2 -0
  11. package/dist/src/commands/apps.js +28 -0
  12. package/dist/src/commands/apps.js.map +1 -1
  13. package/dist/src/commands/auth.d.ts +2 -0
  14. package/dist/src/commands/blob-buckets.d.ts +2 -0
  15. package/dist/src/commands/blob-buckets.js +30 -26
  16. package/dist/src/commands/blob-buckets.js.map +1 -1
  17. package/dist/src/commands/catalog.d.ts +2 -0
  18. package/dist/src/commands/catalog.js +17 -18
  19. package/dist/src/commands/catalog.js.map +1 -1
  20. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  21. package/dist/src/commands/collection-type-configs.js +9 -9
  22. package/dist/src/commands/collection-type-configs.js.map +1 -1
  23. package/dist/src/commands/collections.d.ts +2 -0
  24. package/dist/src/commands/collections.js +33 -36
  25. package/dist/src/commands/collections.js.map +1 -1
  26. package/dist/src/commands/comparisons.d.ts +2 -0
  27. package/dist/src/commands/cron-triggers.d.ts +2 -0
  28. package/dist/src/commands/cron-triggers.js +8 -15
  29. package/dist/src/commands/cron-triggers.js.map +1 -1
  30. package/dist/src/commands/database-types.d.ts +2 -0
  31. package/dist/src/commands/database-types.js +17 -18
  32. package/dist/src/commands/database-types.js.map +1 -1
  33. package/dist/src/commands/databases.d.ts +2 -0
  34. package/dist/src/commands/databases.js +72 -45
  35. package/dist/src/commands/databases.js.map +1 -1
  36. package/dist/src/commands/documents.d.ts +2 -0
  37. package/dist/src/commands/documents.js +17 -18
  38. package/dist/src/commands/documents.js.map +1 -1
  39. package/dist/src/commands/email-templates.d.ts +2 -0
  40. package/dist/src/commands/email-templates.js +9 -9
  41. package/dist/src/commands/email-templates.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +12 -0
  43. package/dist/src/commands/group-type-configs.d.ts +2 -0
  44. package/dist/src/commands/group-type-configs.js +9 -9
  45. package/dist/src/commands/group-type-configs.js.map +1 -1
  46. package/dist/src/commands/groups.d.ts +2 -0
  47. package/dist/src/commands/groups.js +17 -18
  48. package/dist/src/commands/groups.js.map +1 -1
  49. package/dist/src/commands/guides.d.ts +84 -0
  50. package/dist/src/commands/guides.js +201 -24
  51. package/dist/src/commands/guides.js.map +1 -1
  52. package/dist/src/commands/init.d.ts +17 -0
  53. package/dist/src/commands/init.js +63 -25
  54. package/dist/src/commands/init.js.map +1 -1
  55. package/dist/src/commands/integrations.d.ts +2 -0
  56. package/dist/src/commands/integrations.js +39 -23
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/llm.d.ts +2 -0
  59. package/dist/src/commands/llm.js +4 -2
  60. package/dist/src/commands/llm.js.map +1 -1
  61. package/dist/src/commands/prompts.d.ts +2 -0
  62. package/dist/src/commands/prompts.js +33 -36
  63. package/dist/src/commands/prompts.js.map +1 -1
  64. package/dist/src/commands/rule-sets.d.ts +2 -0
  65. package/dist/src/commands/rule-sets.js +9 -9
  66. package/dist/src/commands/rule-sets.js.map +1 -1
  67. package/dist/src/commands/secrets.d.ts +2 -0
  68. package/dist/src/commands/skill.d.ts +2 -0
  69. package/dist/src/commands/sync.d.ts +99 -0
  70. package/dist/src/commands/sync.js +437 -31
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.d.ts +2 -0
  73. package/dist/src/commands/tokens.js +113 -10
  74. package/dist/src/commands/tokens.js.map +1 -1
  75. package/dist/src/commands/users.d.ts +2 -0
  76. package/dist/src/commands/users.js +41 -45
  77. package/dist/src/commands/users.js.map +1 -1
  78. package/dist/src/commands/waitlist.d.ts +2 -0
  79. package/dist/src/commands/waitlist.js +10 -10
  80. package/dist/src/commands/waitlist.js.map +1 -1
  81. package/dist/src/commands/webhooks.d.ts +2 -0
  82. package/dist/src/commands/webhooks.js +9 -9
  83. package/dist/src/commands/webhooks.js.map +1 -1
  84. package/dist/src/commands/workflows.d.ts +49 -0
  85. package/dist/src/commands/workflows.js +136 -57
  86. package/dist/src/commands/workflows.js.map +1 -1
  87. package/dist/src/lib/api-client.d.ts +1229 -0
  88. package/dist/src/lib/api-client.js +44 -11
  89. package/dist/src/lib/api-client.js.map +1 -1
  90. package/dist/src/lib/auth-flow.d.ts +8 -0
  91. package/dist/src/lib/cli-manifest.d.ts +60 -0
  92. package/dist/src/lib/cli-manifest.js +70 -0
  93. package/dist/src/lib/cli-manifest.js.map +1 -0
  94. package/dist/src/lib/config.d.ts +37 -0
  95. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  96. package/dist/src/lib/confirm-prompt.js +110 -0
  97. package/dist/src/lib/confirm-prompt.js.map +1 -0
  98. package/dist/src/lib/constants.d.ts +2 -0
  99. package/dist/src/lib/crash-handlers.d.ts +20 -0
  100. package/dist/src/lib/crash-handlers.js +49 -0
  101. package/dist/src/lib/crash-handlers.js.map +1 -0
  102. package/dist/src/lib/credentials-store.d.ts +79 -0
  103. package/dist/src/lib/csv.d.ts +48 -0
  104. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  105. package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
  106. package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
  107. package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
  108. package/dist/src/lib/db-codegen/dbTemplates.js +31 -10
  109. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  110. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
  111. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  112. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  113. package/dist/src/lib/env-resolver.d.ts +62 -0
  114. package/dist/src/lib/fetch.d.ts +5 -0
  115. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  116. package/dist/src/lib/generated-allowlist.js +181 -0
  117. package/dist/src/lib/generated-allowlist.js.map +1 -0
  118. package/dist/src/lib/init-config.d.ts +46 -0
  119. package/dist/src/lib/init-config.js +7 -0
  120. package/dist/src/lib/init-config.js.map +1 -1
  121. package/dist/src/lib/migration-nag.d.ts +49 -0
  122. package/dist/src/lib/output.d.ts +49 -0
  123. package/dist/src/lib/output.js +25 -1
  124. package/dist/src/lib/output.js.map +1 -1
  125. package/dist/src/lib/paginate.d.ts +33 -0
  126. package/dist/src/lib/project-config.d.ts +97 -0
  127. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  128. package/dist/src/lib/resolve-platform.d.ts +45 -0
  129. package/dist/src/lib/resolve-platform.js +43 -0
  130. package/dist/src/lib/resolve-platform.js.map +1 -0
  131. package/dist/src/lib/skill-installer.d.ts +23 -0
  132. package/dist/src/lib/snapshots.d.ts +99 -0
  133. package/dist/src/lib/snapshots.js +357 -0
  134. package/dist/src/lib/snapshots.js.map +1 -0
  135. package/dist/src/lib/sync-paths.d.ts +72 -0
  136. package/dist/src/lib/sync-paths.js +29 -1
  137. package/dist/src/lib/sync-paths.js.map +1 -1
  138. package/dist/src/lib/template.d.ts +93 -0
  139. package/dist/src/lib/token-inject.d.ts +56 -0
  140. package/dist/src/lib/token-inject.js +204 -0
  141. package/dist/src/lib/token-inject.js.map +1 -0
  142. package/dist/src/lib/toml-database-config.d.ts +132 -0
  143. package/dist/src/lib/toml-params-validator.d.ts +95 -0
  144. package/dist/src/lib/version-check.d.ts +10 -0
  145. package/dist/src/lib/workflow-fragments.d.ts +41 -0
  146. package/dist/src/lib/workflow-toml-validator.d.ts +95 -0
  147. package/dist/src/lib/workflow-toml-validator.js +71 -130
  148. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  149. package/dist/src/types/index.d.ts +513 -0
  150. package/dist/src/validators.d.ts +64 -0
  151. package/dist/src/validators.js +63 -0
  152. package/dist/src/validators.js.map +1 -0
  153. package/package.json +10 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Pure string templates for the `databases codegen` generator (issue #814).
3
+ *
4
+ * Mirrors the codegen-v2 template style
5
+ * (`packages/js-bao/src/cli/v2/templates.ts`): total functions (no I/O, no
6
+ * hidden state), an auto-generated banner + fingerprint header, and
7
+ * deterministic ordering so `--check` can compare byte-for-byte.
8
+ *
9
+ * Diverges from codegen-v2 in two ways:
10
+ * 1. Database-DO records are schemaless documents, NOT `BaseModel` ORM
11
+ * classes — so we emit plain `export interface` types with no class
12
+ * shell, no barrel registration, and `import type` only.
13
+ * 2. We add an OPERATIONS half codegen-v2 has no analog for: per-op
14
+ * input-params interfaces + per-op result aliases keyed off `op.type`.
15
+ */
16
+ /** A field on a record interface (read shape). */
17
+ export interface RecordField {
18
+ name: string;
19
+ /** TOML field type (`string|number|boolean|date|id|stringset`). */
20
+ type: string;
21
+ /** Required props render as `name: T`; otherwise `name?: T`. */
22
+ required: boolean;
23
+ /**
24
+ * Allowed-value set for a `string` field (#843). When non-empty, the field
25
+ * renders a TS string-literal union (`"a" | "b"`) instead of bare `string`.
26
+ */
27
+ enum?: string[];
28
+ }
29
+ export interface RenderRecordInterfaceInput {
30
+ /** PascalCase interface name (e.g. `Account`). */
31
+ interfaceName: string;
32
+ /** TOML model name (e.g. `accounts`). */
33
+ modelName: string;
34
+ fields: RecordField[];
35
+ /**
36
+ * Server-stamped field names (timestamps + auto-populated fields) that
37
+ * appear on the READ record interface as OPTIONAL props, and only if not
38
+ * already declared in `fields`.
39
+ */
40
+ stampedFields: string[];
41
+ }
42
+ /** One declared param on an op-input interface (write shape). */
43
+ export interface ParamField {
44
+ name: string;
45
+ /** TOML param type (`string|number|boolean|object`). */
46
+ type: string;
47
+ required: boolean;
48
+ /**
49
+ * Allowed-value set for a `string` param → string-literal union (#861).
50
+ * Validated server-side (`validateParams`) at config-push time; the emitter
51
+ * renders the union when present and falls back to the base type otherwise.
52
+ */
53
+ enum?: string[];
54
+ }
55
+ export interface RenderOpParamsInterfaceInput {
56
+ /** PascalCase params interface name (e.g. `SaveAccountParams`). */
57
+ interfaceName: string;
58
+ /** Operation name (e.g. `saveAccount`). */
59
+ opName: string;
60
+ params: ParamField[];
61
+ }
62
+ export interface RenderOpResultAliasInput {
63
+ /** Per-op result alias name (e.g. `SaveAccountResult`). */
64
+ aliasName: string;
65
+ /** Operation name (e.g. `saveAccount`). */
66
+ opName: string;
67
+ /** Operation type (`query|mutation|count|aggregate|pipeline|applyToQuery`). */
68
+ opType: string;
69
+ /**
70
+ * For `query` ops, the record interface name the result is generic over
71
+ * (`QueryResult<Account>`). Null when the op's model has no record
72
+ * interface (e.g. pipeline) — falls back to `QueryResult<Record<string, unknown>>`.
73
+ */
74
+ recordInterfaceName: string | null;
75
+ }
76
+ /** The shared generic result aliases, keyed off `op.type`. */
77
+ export declare const RESULT_ALIASES_BLOCK = "// Generic per-op result shapes, keyed off the operation type. The op\n// return contract is NOT stored in the TOML \u2014 these mirror the runtime\n// result shapes produced by the database-operations controller.\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/** `mutation` ops return per-step results. */\nexport interface MutationResult {\n results: unknown[];\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
+ /**
79
+ * Render the header (banner + regen hint + fingerprint).
80
+ */
81
+ export declare function renderHeader(fingerprint: string): string;
82
+ /**
83
+ * Render a single record interface (read shape). Stamped fields
84
+ * (`createdAt`, `modifiedAt`, `ownerId`, …) are appended as OPTIONAL props
85
+ * if not already present in `fields`.
86
+ */
87
+ export declare function renderRecordInterface(input: RenderRecordInterfaceInput): string;
88
+ /**
89
+ * Render a single op-input-params interface (write shape). `required: true`
90
+ * params are non-optional; others are optional. `object` params render as
91
+ * `Record<string, any>`.
92
+ */
93
+ export declare function renderOpParamsInterface(input: RenderOpParamsInterfaceInput): string;
94
+ /**
95
+ * Render a per-op result alias keyed off `op.type`.
96
+ */
97
+ export declare function renderOpResultAlias(input: RenderOpResultAliasInput): string;
@@ -22,7 +22,7 @@ export const RESULT_ALIASES_BLOCK = `// Generic per-op result shapes, keyed off
22
22
  // result shapes produced by the database-operations controller.
23
23
 
24
24
  /** \`query\` ops return a page of records. */
25
- export interface QueryResult<T = Record<string, any>> {
25
+ export interface QueryResult<T = Record<string, unknown>> {
26
26
  data: T[];
27
27
  hasMore?: boolean;
28
28
  nextCursor?: string;
@@ -30,7 +30,7 @@ export interface QueryResult<T = Record<string, any>> {
30
30
 
31
31
  /** \`mutation\` ops return per-step results. */
32
32
  export interface MutationResult {
33
- results: any[];
33
+ results: unknown[];
34
34
  }
35
35
 
36
36
  /** \`count\` ops return a single count. */
@@ -40,7 +40,7 @@ export interface CountResult {
40
40
 
41
41
  /** \`aggregate\` ops return a single result object. */
42
42
  export interface AggregateResult {
43
- result: Record<string, any>;
43
+ result: Record<string, unknown>;
44
44
  }
45
45
 
46
46
  /** \`applyToQuery\` ops return match/affect/fail counts. */
@@ -48,12 +48,12 @@ export interface ApplyToQueryResult {
48
48
  matched: number;
49
49
  affected: number;
50
50
  failed: number;
51
- sample?: any[];
51
+ sample?: unknown[];
52
52
  }
53
53
 
54
54
  /** \`pipeline\` ops return per-step results keyed by step name. */
55
55
  export interface PipelineResult {
56
- steps: Record<string, any>;
56
+ steps: Record<string, unknown>;
57
57
  }
58
58
  `;
59
59
  /**
@@ -73,13 +73,12 @@ export function renderHeader(fingerprint) {
73
73
  */
74
74
  export function renderRecordInterface(input) {
75
75
  const { interfaceName, fields, stampedFields } = input;
76
- const lines = [];
77
- lines.push(`export interface ${interfaceName} {`);
76
+ const memberLines = [];
78
77
  const declared = new Set();
79
78
  for (const f of fields) {
80
79
  declared.add(f.name);
81
80
  const optional = f.required ? "" : "?";
82
- lines.push(` ${f.name}${optional}: ${tsTypeForDbField(f.type, f.enum)};`);
81
+ memberLines.push(` ${f.name}${optional}: ${tsTypeForDbField(f.type, f.enum)};`);
83
82
  }
84
83
  // Server-stamped fields appear on the read interface as optional —
85
84
  // the runtime populates them, but a freshly-built object may not have
@@ -88,8 +87,23 @@ export function renderRecordInterface(input) {
88
87
  if (declared.has(stamped))
89
88
  continue;
90
89
  declared.add(stamped);
91
- lines.push(` ${stamped}?: string;`);
90
+ memberLines.push(` ${stamped}?: string;`);
91
+ }
92
+ // A record with no fields and no stamped fields would render an empty
93
+ // `interface X {}`, which trips `@typescript-eslint/no-empty-object-type`.
94
+ // Emit a `Record<string, unknown>` type alias instead. Database-DO records
95
+ // are SCHEMALESS — arbitrary runtime keys can exist — so the empty-schema
96
+ // shape must stay OPEN (`Record<string, unknown>`), NOT `Record<string,
97
+ // never>`. `Record<string, never>` forbids every key, which would make real
98
+ // returned records unassignable to `QueryResult<X>` and unusable in TS.
99
+ // (Contrast with the no-param-op case in `renderOpParamsInterface`, where
100
+ // `Record<string, never>` is correct: it means "no params allowed".)
101
+ if (memberLines.length === 0) {
102
+ return `export type ${interfaceName} = Record<string, unknown>;`;
92
103
  }
104
+ const lines = [];
105
+ lines.push(`export interface ${interfaceName} {`);
106
+ lines.push(...memberLines);
93
107
  lines.push(`}`);
94
108
  return lines.join("\n");
95
109
  }
@@ -100,6 +114,13 @@ export function renderRecordInterface(input) {
100
114
  */
101
115
  export function renderOpParamsInterface(input) {
102
116
  const { interfaceName, params } = input;
117
+ // An op with no declared params has no input shape. Emitting an empty
118
+ // `interface X {}` trips `@typescript-eslint/no-empty-object-type`, so
119
+ // render a `Record<string, never>` type alias instead — it types "no
120
+ // params allowed" and stays call-site compatible (`op({})`).
121
+ if (params.length === 0) {
122
+ return `export type ${interfaceName} = Record<string, never>;`;
123
+ }
103
124
  const lines = [];
104
125
  lines.push(`export interface ${interfaceName} {`);
105
126
  for (const p of params) {
@@ -116,7 +137,7 @@ export function renderOpResultAlias(input) {
116
137
  const { aliasName, opType, recordInterfaceName } = input;
117
138
  switch (opType) {
118
139
  case "query": {
119
- const generic = recordInterfaceName ?? "Record<string, any>";
140
+ const generic = recordInterfaceName ?? "Record<string, unknown>";
120
141
  return `export type ${aliasName} = QueryResult<${generic}>;`;
121
142
  }
122
143
  case "mutation":
@@ -1 +1 @@
1
- {"version":3,"file":"dbTemplates.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbTemplates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,aAAa,GACjB,2DAA2D,CAAC;AAC9D,MAAM,iBAAiB,GACrB,qEAAqE,CAAC;AAmExE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCnC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO;QACL,aAAa;QACb,iBAAiB;QACjB,mBAAmB,WAAW,EAAE;KACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAiC;IAEjC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACvD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,oBAAoB,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+B;IACjE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IACzD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,OAAO,GAAG,mBAAmB,IAAI,yBAAyB,CAAC;YACjE,OAAO,eAAe,SAAS,kBAAkB,OAAO,IAAI,CAAC;QAC/D,CAAC;QACD,KAAK,UAAU;YACb,OAAO,eAAe,SAAS,oBAAoB,CAAC;QACtD,KAAK,OAAO;YACV,OAAO,eAAe,SAAS,iBAAiB,CAAC;QACnD,KAAK,WAAW;YACd,OAAO,eAAe,SAAS,qBAAqB,CAAC;QACvD,KAAK,cAAc;YACjB,OAAO,eAAe,SAAS,wBAAwB,CAAC;QAC1D,KAAK,UAAU;YACb,OAAO,eAAe,SAAS,oBAAoB,CAAC;QACtD;YACE,kEAAkE;YAClE,4DAA4D;YAC5D,OAAO,eAAe,SAAS,aAAa,CAAC;IACjD,CAAC;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Map database-type TOML field/param types → TypeScript types for the
3
+ * `databases codegen` generator (issue #814).
4
+ *
5
+ * The record-interface half reuses the SAME `FieldType` vocabulary that
6
+ * powers the document-model codegen-v2 generator
7
+ * (`packages/js-bao/src/cli/v2/tsTypes.ts`): the database-type
8
+ * `[models.<m>.fields.<f>]` blocks round-trip through the same
9
+ * `loadSchemaFromTomlString` loader, so the field→TS mapping is identical
10
+ * (`string|id|date → string`, `number → number`, `boolean → boolean`,
11
+ * `stringset → StringSet`).
12
+ *
13
+ * The op-params half maps the operation `params.{type}` vocabulary
14
+ * (`string|number|boolean|object`, validated server-side in
15
+ * `database-type-operations-controller.ts`). `object` has no field-type
16
+ * analog and carries no nested schema, so it renders as `Record<string, unknown>`.
17
+ *
18
+ * NOTE (#842 — infer required record fields from operation params): when that
19
+ * issue is scheduled, the op-params analysis it needs (which fields a `$params.X`
20
+ * binding writes, and whether the param is `required`) already exists in
21
+ * `inferParamFieldTypes(op)` in
22
+ * `src/app-api/controllers/database-type-config-controller.ts` (issue #845 /
23
+ * #812 Phase 2). Its return shape was deliberately made growable (it can carry
24
+ * a `requiredInThisOp` flag) so it can be lifted into a shared `analyzeOpParams`
25
+ * pass consumed by BOTH the scaffold (#845, field *type*) and codegen (#842,
26
+ * field *required-ness*). Lift it rather than re-walking the ops here.
27
+ */
28
+ /**
29
+ * Field types accepted in a database-type `[models.*]` schema. Mirrors
30
+ * `FieldType` in `packages/js-bao/src/types/ormTypes.ts`. Declared locally
31
+ * (rather than imported from `js-bao`) because `FieldType` is not part of
32
+ * the published `js-bao` entry point and the CLI does not depend on the
33
+ * library's internal type paths.
34
+ */
35
+ export type DbFieldType = "string" | "number" | "boolean" | "date" | "id" | "stringset";
36
+ /** Param types accepted in an `[[operations]]` `params` block. */
37
+ export type DbParamType = "string" | "number" | "boolean" | "object";
38
+ /**
39
+ * Returns the TS type expression for a record field type. Unknown types
40
+ * fall back to `unknown` rather than throwing: the database-type TOML is
41
+ * author-curated and may legitimately carry a field type the CLI's vendored
42
+ * vocabulary predates, and a hard throw would block codegen for the whole
43
+ * file over one unrecognized field.
44
+ */
45
+ export declare function tsTypeForDbFieldType(fieldType: string): string;
46
+ /**
47
+ * Render a TypeScript string-literal union from an `enum` allowed-value set
48
+ * (e.g. `["a", "b"]` → `"a" | "b"`). Each value is emitted via
49
+ * `JSON.stringify` so quotes, backslashes, and other special characters are
50
+ * properly escaped into a valid TS string literal.
51
+ *
52
+ * Shared enum vocabulary with the doc-model v2 codegen
53
+ * (`packages/js-bao/src/cli/v2/tsTypes.ts`). The `enum` array is validated
54
+ * upstream by the TOML loader (`parseFieldOptions`): non-empty, all-string,
55
+ * string-field-only. This renderer assumes that contract has held.
56
+ */
57
+ export declare function tsUnionFromEnum(values: string[]): string;
58
+ /**
59
+ * Returns the TS type expression for a record field, honoring an optional
60
+ * string `enum` allowed-value set (#843). A non-empty `enum` on a `string`
61
+ * field renders a string-literal union; otherwise falls back to the base
62
+ * `tsTypeForDbFieldType` mapping.
63
+ */
64
+ export declare function tsTypeForDbField(fieldType: string, enumValues?: string[]): string;
65
+ /**
66
+ * Returns the TS type expression for an op param, honoring an optional string
67
+ * `enum` allowed-value set (#861). A non-empty `enum` on a `string` param
68
+ * renders a string-literal union (`"a" | "b"`); otherwise falls back to the
69
+ * base param-type mapping below. Mirrors `tsTypeForDbField` (the record-field
70
+ * sibling) and reuses `tsUnionFromEnum` for a single escaping implementation.
71
+ *
72
+ * Unlike the record-field path (validated upstream by `parseFieldOptions`,
73
+ * which throws), op-param enum *shape* is validated server-side in
74
+ * `validateParams` at config-push time. So this renderer just falls back to
75
+ * the base type for a non-string param or an empty enum rather than throwing —
76
+ * the server is the source of truth for rejecting a malformed param `enum`.
77
+ */
78
+ export declare function tsTypeForDbParamType(paramType: string, enumValues?: string[]): string;
@@ -13,7 +13,7 @@
13
13
  * The op-params half maps the operation `params.{type}` vocabulary
14
14
  * (`string|number|boolean|object`, validated server-side in
15
15
  * `database-type-operations-controller.ts`). `object` has no field-type
16
- * analog and carries no nested schema, so it renders as `Record<string, any>`.
16
+ * analog and carries no nested schema, so it renders as `Record<string, unknown>`.
17
17
  *
18
18
  * NOTE (#842 — infer required record fields from operation params): when that
19
19
  * issue is scheduled, the op-params analysis it needs (which fields a `$params.X`
@@ -104,7 +104,7 @@ export function tsTypeForDbParamType(paramType, enumValues) {
104
104
  case "boolean":
105
105
  return "boolean";
106
106
  case "object":
107
- return "Record<string, any>";
107
+ return "Record<string, unknown>";
108
108
  default:
109
109
  return "unknown";
110
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dbTsTypes.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbTsTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAoBH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,QAAQ,SAAS,EAAE,CAAC;QAClB,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ACzB,UAAU,CAAC,MAAM,GAAG,CAAC,EACrB,CAAC;QACD,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IACD,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,yBAAyB,CAAC;QACnC;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Environment resolution.
3
+ *
4
+ * Decides which named environment the CLI is currently targeting. The
5
+ * resolution order is:
6
+ *
7
+ * 1. Explicit --env <name> flag (set via setCurrentEnvName from bin/primitive.ts)
8
+ * 2. PRIMITIVE_ENV environment variable
9
+ * 3. The project config's defaultEnvironment
10
+ * 4. If the project has exactly one environment, that one
11
+ * 5. null (legacy mode — fall back to ~/.primitive/credentials.json)
12
+ *
13
+ * Commands read the resolved environment once via getCurrentEnvironment().
14
+ * The resolution is cached for the lifetime of the process.
15
+ */
16
+ import { type ProjectConfig, type ProjectEnvironment } from "./project-config.js";
17
+ export interface ResolvedEnvironment {
18
+ /** The environment name (e.g. "dev", "prod"). */
19
+ name: string;
20
+ /** The config entry for this environment. */
21
+ config: ProjectEnvironment;
22
+ /** Absolute path to .primitive/config.json. */
23
+ projectConfigPath: string;
24
+ /** Absolute path to the project root (the parent of .primitive/). */
25
+ projectRoot: string;
26
+ }
27
+ /**
28
+ * Called by bin/primitive.ts when the user passes --env <name> on the command
29
+ * line. Must be called before any command code runs so subsequent calls to
30
+ * getCurrentEnvironment() see the override.
31
+ */
32
+ export declare function setCurrentEnvName(name: string | null): void;
33
+ /**
34
+ * Forces the resolver to re-read the project config on the next call.
35
+ * Used by tests and by commands that mutate the project config.
36
+ */
37
+ export declare function resetEnvResolver(): void;
38
+ /**
39
+ * Loads and caches the project config. Returns null if no
40
+ * .primitive/config.json is present. Throws ProjectConfigError on a broken config.
41
+ */
42
+ export declare function getProjectConfig(): ProjectConfig | null;
43
+ /**
44
+ * Resolves the current environment, or returns null if we're running in
45
+ * legacy mode (no .primitive/config.json present).
46
+ *
47
+ * This never throws for a missing project config — that's legitimate
48
+ * "legacy mode" usage. It DOES throw if the project config exists but the
49
+ * requested environment doesn't.
50
+ */
51
+ export declare function getCurrentEnvironment(): ResolvedEnvironment | null;
52
+ /**
53
+ * Returns the current environment name for display purposes (e.g. in status
54
+ * headers). Returns null in legacy mode. Swallows resolution errors so the
55
+ * header never crashes the CLI.
56
+ */
57
+ export declare function getCurrentEnvNameSafe(): string | null;
58
+ /**
59
+ * Returns the explicit name set via setCurrentEnvName(), for commands that
60
+ * need to know whether the user passed --env vs. relying on defaults.
61
+ */
62
+ export declare function getExplicitEnvName(): string | null;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Custom fetch that accepts self-signed certificates for localhost.
3
+ * Used for local development with HTTPS.
4
+ */
5
+ export declare function fetchWithTLS(url: string, options?: RequestInit): Promise<Response>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Source of truth: the server step runners in `src/workflows/steps/*.ts` and
5
+ * the universal `BaseStepDefinition` shape in
6
+ * `src/workflows/runner/types.ts`.
7
+ *
8
+ * Regenerate with:
9
+ * node cli/scripts/gen-allowlist.mjs (runs automatically at CLI prebuild)
10
+ *
11
+ * A CI freshness guard (`cli/scripts/gen-allowlist.mjs --check`, also asserted
12
+ * by `cli/tests/unit/workflow-toml-validator-drift-guard.test.ts`) fails if this
13
+ * committed artifact does not match a fresh scan — see issue #998.
14
+ *
15
+ * Two exports:
16
+ * - `GENERATED_ALLOWLISTED_FIELDS` — the union of universal step fields,
17
+ * per-kind fields each runner READS (not what the type declares), and the
18
+ * `collect` `step` structural pass-through. The validator accepts these as
19
+ * top-level step fields for KNOWN kinds.
20
+ * - `GENERATED_KNOWN_KINDS` — the step kinds the server registers. The
21
+ * validator skips the per-field check for an UNKNOWN kind (an old CLI
22
+ * against a newer server) while still running the kind-agnostic
23
+ * misnested-header footgun detector (#685).
24
+ */
25
+ /** Top-level step fields the validator accepts for a known kind (#998). */
26
+ export declare const GENERATED_ALLOWLISTED_FIELDS: readonly string[];
27
+ /** Step kinds the server registers (`defaultRegistry`). Unknown kinds skip the per-field check (#998). */
28
+ export declare const GENERATED_KNOWN_KINDS: readonly string[];
@@ -0,0 +1,181 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Source of truth: the server step runners in `src/workflows/steps/*.ts` and
5
+ * the universal `BaseStepDefinition` shape in
6
+ * `src/workflows/runner/types.ts`.
7
+ *
8
+ * Regenerate with:
9
+ * node cli/scripts/gen-allowlist.mjs (runs automatically at CLI prebuild)
10
+ *
11
+ * A CI freshness guard (`cli/scripts/gen-allowlist.mjs --check`, also asserted
12
+ * by `cli/tests/unit/workflow-toml-validator-drift-guard.test.ts`) fails if this
13
+ * committed artifact does not match a fresh scan — see issue #998.
14
+ *
15
+ * Two exports:
16
+ * - `GENERATED_ALLOWLISTED_FIELDS` — the union of universal step fields,
17
+ * per-kind fields each runner READS (not what the type declares), and the
18
+ * `collect` `step` structural pass-through. The validator accepts these as
19
+ * top-level step fields for KNOWN kinds.
20
+ * - `GENERATED_KNOWN_KINDS` — the step kinds the server registers. The
21
+ * validator skips the per-field check for an UNKNOWN kind (an old CLI
22
+ * against a newer server) while still running the kind-agnostic
23
+ * misnested-header footgun detector (#685).
24
+ */
25
+ /** Top-level step fields the validator accepts for a known kind (#998). */
26
+ export const GENERATED_ALLOWLISTED_FIELDS = [
27
+ "_testSteps",
28
+ "action",
29
+ "aliasKey",
30
+ "appId",
31
+ "as",
32
+ "asBase64",
33
+ "attachments",
34
+ "blobId",
35
+ "bodyMode",
36
+ "bucketId",
37
+ "bucketKey",
38
+ "cacheTtlSeconds",
39
+ "cases",
40
+ "concurrency",
41
+ "configId",
42
+ "content",
43
+ "contentBase64",
44
+ "contentType",
45
+ "context",
46
+ "continueOnError",
47
+ "cursor",
48
+ "cursorField",
49
+ "data",
50
+ "databaseId",
51
+ "default",
52
+ "description",
53
+ "direction",
54
+ "documentAlias",
55
+ "documentId",
56
+ "dryRun",
57
+ "durationMs",
58
+ "email",
59
+ "events",
60
+ "expiresInSeconds",
61
+ "feature",
62
+ "filename",
63
+ "filter",
64
+ "filters",
65
+ "forEach",
66
+ "groupBy",
67
+ "groupId",
68
+ "groupType",
69
+ "htmlBody",
70
+ "id",
71
+ "includeUserDetails",
72
+ "input",
73
+ "integrationKey",
74
+ "itemsField",
75
+ "iterationName",
76
+ "kind",
77
+ "limit",
78
+ "limits",
79
+ "maxItems",
80
+ "maxPages",
81
+ "message",
82
+ "messages",
83
+ "metrics",
84
+ "model",
85
+ "modelName",
86
+ "modelOverride",
87
+ "ms",
88
+ "multipartFields",
89
+ "name",
90
+ "onConflict",
91
+ "onPartialFailure",
92
+ "operationName",
93
+ "options",
94
+ "output",
95
+ "page",
96
+ "pageSize",
97
+ "params",
98
+ "payload",
99
+ "perUser",
100
+ "plugins",
101
+ "prompt",
102
+ "promptKey",
103
+ "query",
104
+ "queryType",
105
+ "recordId",
106
+ "ref",
107
+ "request",
108
+ "route",
109
+ "runIf",
110
+ "saveAs",
111
+ "scope",
112
+ "selector",
113
+ "sort",
114
+ "source",
115
+ "step",
116
+ "strict",
117
+ "subject",
118
+ "successWhen",
119
+ "tags",
120
+ "temperature",
121
+ "templateType",
122
+ "textBody",
123
+ "thinkingLevel",
124
+ "timeout",
125
+ "to",
126
+ "toUserId",
127
+ "tool_choice",
128
+ "tools",
129
+ "top_p",
130
+ "type",
131
+ "user",
132
+ "userId",
133
+ "userUlid",
134
+ "variables",
135
+ "windowDays",
136
+ "with",
137
+ "workflowKey",
138
+ ];
139
+ /** Step kinds the server registers (`defaultRegistry`). Unknown kinds skip the per-field check (#998). */
140
+ export const GENERATED_KNOWN_KINDS = [
141
+ "analytics.query",
142
+ "analytics.write",
143
+ "blob.download",
144
+ "blob.signedUrl",
145
+ "blob.upload",
146
+ "collect",
147
+ "database.aggregate",
148
+ "database.applyToQuery",
149
+ "database.count",
150
+ "database.mutate",
151
+ "database.pipeline",
152
+ "database.query",
153
+ "delay",
154
+ "document.count",
155
+ "document.delete",
156
+ "document.patch",
157
+ "document.query",
158
+ "document.queryOne",
159
+ "document.resolveAlias",
160
+ "document.save",
161
+ "email.send",
162
+ "event.wait",
163
+ "gemini.countTokens",
164
+ "gemini.generate",
165
+ "gemini.generateRaw",
166
+ "group.addMember",
167
+ "group.checkMembership",
168
+ "group.listMembers",
169
+ "group.listUserMemberships",
170
+ "group.removeMember",
171
+ "integration.call",
172
+ "iterate-users",
173
+ "llm.chat",
174
+ "noop",
175
+ "prompt.execute",
176
+ "script",
177
+ "switch",
178
+ "transform",
179
+ "workflow.call",
180
+ ];
181
+ //# sourceMappingURL=generated-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-allowlist.js","sourceRoot":"","sources":["../../../src/lib/generated-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,QAAQ;IACR,aAAa;IACb,MAAM;IACN,YAAY;IACZ,SAAS;IACT,aAAa;IACb,WAAW;IACX,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,kBAAkB;IAClB,SAAS;IACT,UAAU;IACV,QAAQ;I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oB;IACpB,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,2BAA2B;IAC3B,oBAAoB;IACpB,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,MAAM;IACN,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,eAAe;CAChB,CAAC"}
@@ -0,0 +1,46 @@
1
+ export declare const INIT_CONFIG_FILENAME = ".primitive-init.toml";
2
+ export interface InitConfig {
3
+ /** Whether to create a new app or use an existing one */
4
+ action: "create" | "use-existing";
5
+ /** App name (required for action = "create") */
6
+ app_name?: string;
7
+ /** Existing app ID (required for action = "use-existing") */
8
+ app_id?: string;
9
+ /** Project directory name */
10
+ dir?: string;
11
+ /** Access mode for the app */
12
+ access_mode?: "public" | "domain" | "invite-only";
13
+ /** Port for local dev server */
14
+ dev_port?: number;
15
+ /** Whether to skip npm install */
16
+ skip_install?: boolean;
17
+ /** Custom server URL */
18
+ server?: string;
19
+ /** Email addresses to invite (for invite-only mode) */
20
+ invite_emails?: string[];
21
+ /** Allowed email domains (for domain mode) */
22
+ allowed_domains?: string[];
23
+ /** Whether to overwrite a non-empty target directory (default: false) */
24
+ overwrite?: boolean;
25
+ /** Target platform for the scaffolded app */
26
+ platform?: "web" | "ios";
27
+ }
28
+ export interface ValidationResult {
29
+ valid: boolean;
30
+ errors: string[];
31
+ }
32
+ /**
33
+ * Parses a TOML string into an InitConfig object.
34
+ * Throws if the string contains invalid TOML.
35
+ */
36
+ export declare function parseInitConfigToml(content: string): InitConfig;
37
+ /**
38
+ * Loads and parses a .primitive-init.toml file from the given directory.
39
+ * Returns null if the file does not exist.
40
+ * Throws if the file exists but contains invalid TOML.
41
+ */
42
+ export declare function loadInitConfig(dir: string): InitConfig | null;
43
+ /**
44
+ * Validates an InitConfig object. Returns a ValidationResult with any errors.
45
+ */
46
+ export declare function validateInitConfig(config: InitConfig): ValidationResult;