primitive-admin 1.0.54 → 1.0.56

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 (110) hide show
  1. package/assets/skill/skills/primitive-platform/SKILL.md +230 -2
  2. package/dist/bin/primitive.js +3 -1
  3. package/dist/bin/primitive.js.map +1 -1
  4. package/dist/src/commands/apps.js +54 -2
  5. package/dist/src/commands/apps.js.map +1 -1
  6. package/dist/src/commands/database-types.js +4 -4
  7. package/dist/src/commands/database-types.js.map +1 -1
  8. package/dist/src/commands/databases.js +35 -14
  9. package/dist/src/commands/databases.js.map +1 -1
  10. package/dist/src/commands/documents.js +77 -0
  11. package/dist/src/commands/documents.js.map +1 -1
  12. package/dist/src/commands/guides.d.ts +15 -12
  13. package/dist/src/commands/guides.js +22 -15
  14. package/dist/src/commands/guides.js.map +1 -1
  15. package/dist/src/commands/metadata.js +48 -3
  16. package/dist/src/commands/metadata.js.map +1 -1
  17. package/dist/src/commands/scripts.d.ts +18 -0
  18. package/dist/src/commands/scripts.js +59 -5
  19. package/dist/src/commands/scripts.js.map +1 -1
  20. package/dist/src/commands/settings.d.ts +15 -0
  21. package/dist/src/commands/settings.js +102 -0
  22. package/dist/src/commands/settings.js.map +1 -0
  23. package/dist/src/commands/sync-app-settings.d.ts +115 -0
  24. package/dist/src/commands/sync-app-settings.js +379 -0
  25. package/dist/src/commands/sync-app-settings.js.map +1 -0
  26. package/dist/src/commands/sync.d.ts +134 -19
  27. package/dist/src/commands/sync.js +1949 -600
  28. package/dist/src/commands/sync.js.map +1 -1
  29. package/dist/src/commands/workflows.js +54 -15
  30. package/dist/src/commands/workflows.js.map +1 -1
  31. package/dist/src/lib/api-client.d.ts +29 -1
  32. package/dist/src/lib/api-client.js +31 -2
  33. package/dist/src/lib/api-client.js.map +1 -1
  34. package/dist/src/lib/app-settings-descriptor.d.ts +108 -0
  35. package/dist/src/lib/app-settings-descriptor.js +254 -0
  36. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  37. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +36 -0
  38. package/dist/src/lib/codegen-shared/generatedFiles.js +67 -10
  39. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  40. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  41. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  42. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  43. package/dist/src/lib/db-codegen/dbGenerator.d.ts +11 -83
  44. package/dist/src/lib/db-codegen/dbGenerator.js +96 -556
  45. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  46. package/dist/src/lib/db-codegen/dbNaming.d.ts +20 -7
  47. package/dist/src/lib/db-codegen/dbNaming.js +31 -13
  48. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  49. package/dist/src/lib/db-codegen/dbTemplates.d.ts +70 -4
  50. package/dist/src/lib/db-codegen/dbTemplates.js +244 -70
  51. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  52. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +13 -22
  53. package/dist/src/lib/db-codegen/dbTsTypes.js +33 -28
  54. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  55. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  56. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  57. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  58. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  59. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  60. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  61. package/dist/src/lib/generated-allowlist.js +7 -0
  62. package/dist/src/lib/generated-allowlist.js.map +1 -1
  63. package/dist/src/lib/platform-owned.d.ts +37 -0
  64. package/dist/src/lib/platform-owned.js +46 -0
  65. package/dist/src/lib/platform-owned.js.map +1 -0
  66. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
  67. package/dist/src/lib/swift-codegen/dbGenerator.js +682 -0
  68. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  69. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  70. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  71. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  72. package/dist/src/lib/swift-codegen/generator.d.ts +85 -0
  73. package/dist/src/lib/swift-codegen/generator.js +266 -0
  74. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  75. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  76. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  77. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  78. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
  79. package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
  80. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  81. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  82. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  83. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  84. package/dist/src/lib/sync-resource-types.d.ts +437 -0
  85. package/dist/src/lib/sync-resource-types.js +781 -0
  86. package/dist/src/lib/sync-resource-types.js.map +1 -0
  87. package/dist/src/lib/template.d.ts +1 -1
  88. package/dist/src/lib/template.js +6 -3
  89. package/dist/src/lib/template.js.map +1 -1
  90. package/dist/src/lib/toml-metadata-config.js +18 -0
  91. package/dist/src/lib/toml-metadata-config.js.map +1 -1
  92. package/dist/src/lib/workflow-apply.js +12 -2
  93. package/dist/src/lib/workflow-apply.js.map +1 -1
  94. package/dist/src/lib/workflow-codegen/generator.d.ts +27 -5
  95. package/dist/src/lib/workflow-codegen/generator.js +214 -68
  96. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  97. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
  98. package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
  99. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  100. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +17 -1
  101. package/dist/src/lib/workflow-codegen/schemaToTs.js +59 -38
  102. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -1
  103. package/dist/src/lib/workflow-payload.d.ts +19 -0
  104. package/dist/src/lib/workflow-payload.js +21 -0
  105. package/dist/src/lib/workflow-payload.js.map +1 -1
  106. package/dist/src/lib/workflow-toml-validator.d.ts +30 -0
  107. package/dist/src/lib/workflow-toml-validator.js +206 -0
  108. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  109. package/dist/src/types/index.d.ts +1 -0
  110. package/package.json +5 -2
@@ -6,28 +6,19 @@
6
6
  * then either (a) writes them, or (b) compares them against on-disk for
7
7
  * `--check`. No commander dependency, no `process.exit`.
8
8
  *
9
- * Reuses the codegen-v2 machinery:
10
- * - `loadSchemaFromTomlString` (the shared `[models.*]` parser) for record
11
- * interfaces — the database-type `[models.*]` blocks round-trip through
12
- * the same loader and the same `FieldType` vocabulary.
13
- * - The banner + fingerprint header pattern and stale-output cleanup.
14
- *
15
- * Adds the OPERATIONS half (op-params interfaces + per-op result aliases)
16
- * that codegen-v2 has no analog for. A result alias is derived from `op.type`
17
- * and, where the shape is derivable, the op's parsed `definition`: a query op's
18
- * `projection` (#1439), a mutation op's step kinds (#1438), and a pipeline op's
19
- * `return` step (#1437). This file resolves those into the small descriptors
20
- * the templates consume; the templates stay pure string-emitters.
9
+ * The op/record RESOLUTION (parse, schema load, required-ness inference, op
10
+ * params, and per-op result descriptors) lives in the shared, naming-neutral
11
+ * `describeDbType` IR (`dbTypeIR.ts`) — the SAME source the Swift renderer
12
+ * (`swift-codegen/dbGenerator.ts`) consumes (issue #1547 binding 5). This file
13
+ * is now purely the TS *rendering* half: it applies TS identifier naming
14
+ * (`resolveRecordInterfaceName`, `opParamsInterfaceName`, …) to that IR and
15
+ * emits `*.generated.ts` via the pure `dbTemplates` string-emitters. The
16
+ * emitted bytes are unchanged from the former inline implementation.
21
17
  */
22
18
  import { type GeneratedFileMismatch } from "../codegen-shared/generatedFiles.js";
23
- export interface DbCodegenInput {
24
- /** Database type name (drives the output filename). */
25
- databaseType: string;
26
- /** Path to the source `database-types/<type>.toml` file. */
27
- tomlPath: string;
28
- /** Raw TOML content (already read from disk). */
29
- tomlContent: string;
30
- }
19
+ import { type DbCodegenInput } from "./dbTypeIR.js";
20
+ export type { DbCodegenInput } from "./dbTypeIR.js";
21
+ export { inferArrayParamElementTypes, inferRequiredRecordFields, type InferredRecordModelInfo, } from "./dbTypeIR.js";
31
22
  export interface GenerateDbTypesOptions {
32
23
  /** One entry per database-type TOML file to generate from. */
33
24
  inputs: DbCodegenInput[];
@@ -68,69 +59,6 @@ export type DbCheckMismatch = GeneratedFileMismatch;
68
59
  * TOML. Exported so tests can assert on the rendered string directly.
69
60
  */
70
61
  export declare function renderDbTypeFile(input: DbCodegenInput): string;
71
- /**
72
- * Infer the scalar element TS type for op params consumed by a `$in`/`$nin`
73
- * filter operator (#1488, Phase 1). Codegen-only: a param compared with
74
- * `$in`/`$nin` against a model field is definitionally an array, so the
75
- * typed-ops factory (#1441) should emit `<elem>[]` rather than widening an
76
- * untyped/object param to `Record<string, unknown>` (which `string[]` is not
77
- * assignable to).
78
- *
79
- * Kept a small local helper next to {@link inferRequiredRecordFields} rather
80
- * than a shared cross-runtime analysis pass (sponsor decision on #1488).
81
- *
82
- * Returns a map of param name → element TS type. The `"unknown"` sentinel means
83
- * "emit `unknown[]`" — used when the compared field is missing from the model
84
- * schema (or the op has no resolvable model), when the same param is bound to
85
- * fields of differing element types, or when the param is also used as a scalar
86
- * elsewhere (conservative widen, mirroring #845's disagreement rule / #1488
87
- * Fork 4). A param absent from the map is not consumed by any array operator
88
- * and keeps its declared-type mapping (inference never widens such a param).
89
- */
90
- export declare function inferArrayParamElementTypes(op: any, fieldTypesByModel: Map<string, Map<string, string>>): Map<string, string>;
91
- /**
92
- * Per-model result of {@link inferRequiredRecordFields}. Shaped as an object
93
- * (rather than a bare `Set`) so it can grow additional inferred metadata later
94
- * without changing the call-site contract — e.g. future alignment with #845's
95
- * server-side op-params analysis. For now it carries only the set of record
96
- * fields the operation params prove are always supplied at create time.
97
- */
98
- export interface InferredRecordModelInfo {
99
- /** Record field names promoted to non-optional by op-params inference. */
100
- fields: Set<string>;
101
- }
102
- /**
103
- * Infer which record fields are always supplied at create time, by reading the
104
- * `save` operation params (issue #842).
105
- *
106
- * A field is promoted to required for a model only if:
107
- * - at least one `save` (create) op writes it from a bare `$params.X`
108
- * binding, AND
109
- * - EVERY `save` op that writes the field binds it to a param declared
110
- * `required: true` (the "ALL writers agree" rule).
111
- *
112
- * Deliberately conservative:
113
- * - `patch` (and every non-`save` inner op) is excluded — partial updates
114
- * don't guarantee creation-time presence.
115
- * - whole-object saves (`data = "$params.X"`, a string rather than a
116
- * per-field map) carry no field-level mapping, so no field can be promoted
117
- * from them (Q4 skip).
118
- * - only an EXACT top-level bare `$params.X` value counts (the whole binding
119
- * value must match `^\$params\.X$`, and `X` must be a declared top-level
120
- * param). A literal, computed, partially-interpolated value, or a nested
121
- * path (`$params.obj.sub`) never promotes a field — a nested sub-property
122
- * may be absent even when the top-level object param is required. This is
123
- * deliberately stricter than the CLI's lenient `collectParamRefs`
124
- * first-segment rule, which is fine for its validation use but would
125
- * wrongly promote nested bindings here.
126
- * - inner ops are matched to the record model by the inner op's own
127
- * `modelName` when present, falling back to the enclosing operation's
128
- * `modelName`.
129
- *
130
- * Pure: no I/O, no mutation of the input. The caller OR's the result with the
131
- * schema-level `required` flag, so inference only ever ADDS requiredness.
132
- */
133
- export declare function inferRequiredRecordFields(operations: any[]): Map<string, InferredRecordModelInfo>;
134
62
  /**
135
63
  * Run codegen end-to-end across one or more database-type TOML inputs. The
136
64
  * disk lifecycle (write / `--check` / stale cleanup) is delegated to the