@eide/foir-cli 0.1.35 → 0.1.36

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 (227) hide show
  1. package/dist/cli.js +7467 -42
  2. package/dist/config/types.d.ts +7 -6
  3. package/dist/config/types.js +6 -14
  4. package/dist/generated-CPsQ9jfu.d.ts +195 -0
  5. package/dist/lib/extension-helpers.d.ts +10 -7
  6. package/dist/lib/extension-helpers.js +15 -85
  7. package/dist/lib/hook-helpers.d.ts +9 -6
  8. package/dist/lib/hook-helpers.js +12 -105
  9. package/dist/lib/seed-helpers.d.ts +10 -8
  10. package/dist/lib/seed-helpers.js +18 -124
  11. package/package.json +9 -8
  12. package/dist/auth/credentials.d.ts +0 -31
  13. package/dist/auth/credentials.d.ts.map +0 -1
  14. package/dist/auth/credentials.js +0 -139
  15. package/dist/cli.d.ts +0 -3
  16. package/dist/cli.d.ts.map +0 -1
  17. package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
  18. package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
  19. package/dist/codegen/fetch-customer-profile-schema.js +0 -21
  20. package/dist/codegen/fetch-models.d.ts +0 -58
  21. package/dist/codegen/fetch-models.d.ts.map +0 -1
  22. package/dist/codegen/fetch-models.js +0 -96
  23. package/dist/codegen/field-mapping.d.ts +0 -34
  24. package/dist/codegen/field-mapping.d.ts.map +0 -1
  25. package/dist/codegen/field-mapping.js +0 -250
  26. package/dist/codegen/generators/config.d.ts +0 -5
  27. package/dist/codegen/generators/config.d.ts.map +0 -1
  28. package/dist/codegen/generators/config.js +0 -82
  29. package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
  30. package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
  31. package/dist/codegen/generators/customer-profile-documents.js +0 -42
  32. package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
  33. package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
  34. package/dist/codegen/generators/customer-profile-hooks.js +0 -78
  35. package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
  36. package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
  37. package/dist/codegen/generators/customer-profile-loaders.js +0 -67
  38. package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
  39. package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
  40. package/dist/codegen/generators/customer-profile-operations.js +0 -126
  41. package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
  42. package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
  43. package/dist/codegen/generators/customer-profile-types.js +0 -45
  44. package/dist/codegen/generators/documents.d.ts +0 -12
  45. package/dist/codegen/generators/documents.d.ts.map +0 -1
  46. package/dist/codegen/generators/documents.js +0 -178
  47. package/dist/codegen/generators/field-types.d.ts +0 -5
  48. package/dist/codegen/generators/field-types.d.ts.map +0 -1
  49. package/dist/codegen/generators/field-types.js +0 -346
  50. package/dist/codegen/generators/model-index.d.ts +0 -6
  51. package/dist/codegen/generators/model-index.d.ts.map +0 -1
  52. package/dist/codegen/generators/model-index.js +0 -26
  53. package/dist/codegen/generators/model-types.d.ts +0 -12
  54. package/dist/codegen/generators/model-types.d.ts.map +0 -1
  55. package/dist/codegen/generators/model-types.js +0 -177
  56. package/dist/codegen/generators/public-schema-content.d.ts +0 -14
  57. package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
  58. package/dist/codegen/generators/public-schema-content.js +0 -22
  59. package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
  60. package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
  61. package/dist/codegen/generators/react-hooks-index.js +0 -20
  62. package/dist/codegen/generators/react-hooks.d.ts +0 -7
  63. package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
  64. package/dist/codegen/generators/react-hooks.js +0 -139
  65. package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
  66. package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
  67. package/dist/codegen/generators/remix-loaders-index.js +0 -20
  68. package/dist/codegen/generators/remix-loaders.d.ts +0 -7
  69. package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
  70. package/dist/codegen/generators/remix-loaders.js +0 -107
  71. package/dist/codegen/generators/static-documents.d.ts +0 -14
  72. package/dist/codegen/generators/static-documents.d.ts.map +0 -1
  73. package/dist/codegen/generators/static-documents.js +0 -771
  74. package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
  75. package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
  76. package/dist/codegen/generators/swift-customer-profile.js +0 -152
  77. package/dist/codegen/generators/swift-field-types.d.ts +0 -5
  78. package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
  79. package/dist/codegen/generators/swift-field-types.js +0 -151
  80. package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
  81. package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
  82. package/dist/codegen/generators/swift-model-keys.js +0 -25
  83. package/dist/codegen/generators/swift-types.d.ts +0 -13
  84. package/dist/codegen/generators/swift-types.d.ts.map +0 -1
  85. package/dist/codegen/generators/swift-types.js +0 -188
  86. package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
  87. package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
  88. package/dist/codegen/generators/typed-operations-common.js +0 -84
  89. package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
  90. package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
  91. package/dist/codegen/generators/typed-operations-index.js +0 -22
  92. package/dist/codegen/generators/typed-operations.d.ts +0 -11
  93. package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
  94. package/dist/codegen/generators/typed-operations.js +0 -263
  95. package/dist/codegen/swift-field-mapping.d.ts +0 -30
  96. package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
  97. package/dist/codegen/swift-field-mapping.js +0 -150
  98. package/dist/codegen/write-files.d.ts +0 -15
  99. package/dist/codegen/write-files.d.ts.map +0 -1
  100. package/dist/codegen/write-files.js +0 -36
  101. package/dist/commands/api-keys.d.ts +0 -4
  102. package/dist/commands/api-keys.d.ts.map +0 -1
  103. package/dist/commands/api-keys.js +0 -129
  104. package/dist/commands/auth-config.d.ts +0 -4
  105. package/dist/commands/auth-config.d.ts.map +0 -1
  106. package/dist/commands/auth-config.js +0 -38
  107. package/dist/commands/auth-providers.d.ts +0 -4
  108. package/dist/commands/auth-providers.d.ts.map +0 -1
  109. package/dist/commands/auth-providers.js +0 -207
  110. package/dist/commands/context.d.ts +0 -4
  111. package/dist/commands/context.d.ts.map +0 -1
  112. package/dist/commands/context.js +0 -91
  113. package/dist/commands/create-extension.d.ts +0 -4
  114. package/dist/commands/create-extension.d.ts.map +0 -1
  115. package/dist/commands/create-extension.js +0 -60
  116. package/dist/commands/customer-profiles.d.ts +0 -4
  117. package/dist/commands/customer-profiles.d.ts.map +0 -1
  118. package/dist/commands/customer-profiles.js +0 -99
  119. package/dist/commands/customers.d.ts +0 -4
  120. package/dist/commands/customers.d.ts.map +0 -1
  121. package/dist/commands/customers.js +0 -126
  122. package/dist/commands/embeddings.d.ts +0 -4
  123. package/dist/commands/embeddings.d.ts.map +0 -1
  124. package/dist/commands/embeddings.js +0 -145
  125. package/dist/commands/experiments.d.ts +0 -4
  126. package/dist/commands/experiments.d.ts.map +0 -1
  127. package/dist/commands/experiments.js +0 -196
  128. package/dist/commands/extensions.d.ts +0 -4
  129. package/dist/commands/extensions.d.ts.map +0 -1
  130. package/dist/commands/extensions.js +0 -210
  131. package/dist/commands/files.d.ts +0 -4
  132. package/dist/commands/files.d.ts.map +0 -1
  133. package/dist/commands/files.js +0 -143
  134. package/dist/commands/hooks.d.ts +0 -4
  135. package/dist/commands/hooks.d.ts.map +0 -1
  136. package/dist/commands/hooks.js +0 -228
  137. package/dist/commands/locales.d.ts +0 -4
  138. package/dist/commands/locales.d.ts.map +0 -1
  139. package/dist/commands/locales.js +0 -140
  140. package/dist/commands/login.d.ts +0 -4
  141. package/dist/commands/login.d.ts.map +0 -1
  142. package/dist/commands/login.js +0 -124
  143. package/dist/commands/logout.d.ts +0 -4
  144. package/dist/commands/logout.d.ts.map +0 -1
  145. package/dist/commands/logout.js +0 -16
  146. package/dist/commands/media.d.ts +0 -4
  147. package/dist/commands/media.d.ts.map +0 -1
  148. package/dist/commands/media.js +0 -44
  149. package/dist/commands/models.d.ts +0 -4
  150. package/dist/commands/models.d.ts.map +0 -1
  151. package/dist/commands/models.js +0 -153
  152. package/dist/commands/notes.d.ts +0 -4
  153. package/dist/commands/notes.d.ts.map +0 -1
  154. package/dist/commands/notes.js +0 -132
  155. package/dist/commands/notifications.d.ts +0 -4
  156. package/dist/commands/notifications.d.ts.map +0 -1
  157. package/dist/commands/notifications.js +0 -73
  158. package/dist/commands/operations.d.ts +0 -4
  159. package/dist/commands/operations.d.ts.map +0 -1
  160. package/dist/commands/operations.js +0 -341
  161. package/dist/commands/playground.d.ts +0 -4
  162. package/dist/commands/playground.d.ts.map +0 -1
  163. package/dist/commands/playground.js +0 -270
  164. package/dist/commands/pull.d.ts +0 -4
  165. package/dist/commands/pull.d.ts.map +0 -1
  166. package/dist/commands/pull.js +0 -300
  167. package/dist/commands/records.d.ts +0 -4
  168. package/dist/commands/records.d.ts.map +0 -1
  169. package/dist/commands/records.js +0 -314
  170. package/dist/commands/register-commands.d.ts +0 -7
  171. package/dist/commands/register-commands.d.ts.map +0 -1
  172. package/dist/commands/register-commands.js +0 -259
  173. package/dist/commands/schedules.d.ts +0 -4
  174. package/dist/commands/schedules.d.ts.map +0 -1
  175. package/dist/commands/schedules.js +0 -155
  176. package/dist/commands/search.d.ts +0 -4
  177. package/dist/commands/search.d.ts.map +0 -1
  178. package/dist/commands/search.js +0 -60
  179. package/dist/commands/segments.d.ts +0 -4
  180. package/dist/commands/segments.d.ts.map +0 -1
  181. package/dist/commands/segments.js +0 -155
  182. package/dist/commands/select-project.d.ts +0 -4
  183. package/dist/commands/select-project.d.ts.map +0 -1
  184. package/dist/commands/select-project.js +0 -144
  185. package/dist/commands/settings.d.ts +0 -4
  186. package/dist/commands/settings.d.ts.map +0 -1
  187. package/dist/commands/settings.js +0 -115
  188. package/dist/commands/variant-catalog.d.ts +0 -4
  189. package/dist/commands/variant-catalog.d.ts.map +0 -1
  190. package/dist/commands/variant-catalog.js +0 -118
  191. package/dist/commands/whoami.d.ts +0 -4
  192. package/dist/commands/whoami.d.ts.map +0 -1
  193. package/dist/commands/whoami.js +0 -51
  194. package/dist/config/pull-config.d.ts +0 -33
  195. package/dist/config/pull-config.d.ts.map +0 -1
  196. package/dist/config/pull-config.js +0 -119
  197. package/dist/config/types.d.ts.map +0 -1
  198. package/dist/graphql/generated.d.ts +0 -6074
  199. package/dist/graphql/generated.d.ts.map +0 -1
  200. package/dist/graphql/generated.js +0 -355
  201. package/dist/lib/client.d.ts +0 -18
  202. package/dist/lib/client.d.ts.map +0 -1
  203. package/dist/lib/client.js +0 -64
  204. package/dist/lib/config-loader.d.ts +0 -28
  205. package/dist/lib/config-loader.d.ts.map +0 -1
  206. package/dist/lib/config-loader.js +0 -49
  207. package/dist/lib/config.d.ts +0 -12
  208. package/dist/lib/config.d.ts.map +0 -1
  209. package/dist/lib/config.js +0 -8
  210. package/dist/lib/errors.d.ts +0 -6
  211. package/dist/lib/errors.d.ts.map +0 -1
  212. package/dist/lib/errors.js +0 -76
  213. package/dist/lib/extension-helpers.d.ts.map +0 -1
  214. package/dist/lib/hook-helpers.d.ts.map +0 -1
  215. package/dist/lib/input.d.ts +0 -38
  216. package/dist/lib/input.d.ts.map +0 -1
  217. package/dist/lib/input.js +0 -108
  218. package/dist/lib/output.d.ts +0 -31
  219. package/dist/lib/output.d.ts.map +0 -1
  220. package/dist/lib/output.js +0 -107
  221. package/dist/lib/seed-helpers.d.ts.map +0 -1
  222. package/dist/scaffold/package-manager.d.ts +0 -12
  223. package/dist/scaffold/package-manager.d.ts.map +0 -1
  224. package/dist/scaffold/package-manager.js +0 -51
  225. package/dist/scaffold/scaffold.d.ts +0 -4
  226. package/dist/scaffold/scaffold.d.ts.map +0 -1
  227. package/dist/scaffold/scaffold.js +0 -462
@@ -1,22 +0,0 @@
1
- /**
2
- * Generates the operations/index.ts barrel re-export file.
3
- */
4
- export function generateTypedOperationsIndex(models, hasCustomerProfile) {
5
- const lines = [];
6
- lines.push(`/**
7
- * Typed GraphQL operations.
8
- *
9
- * @generated by foir — DO NOT EDIT MANUALLY
10
- */
11
-
12
- export * from './_common.js';
13
- `);
14
- for (const model of models) {
15
- lines.push(`export * from './${model.key}.js';`);
16
- }
17
- if (hasCustomerProfile) {
18
- lines.push(`export * from './customer-profile.js';`);
19
- }
20
- lines.push('');
21
- return lines.join('\n');
22
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Generates per-model typed operation modules.
3
- * Each module exports gql tagged templates + typed Variables/Result interfaces.
4
- */
5
- import type { CodegenModel } from '../fetch-models.js';
6
- export declare function generateTypedOperations(model: CodegenModel, typesRelPath: string): string;
7
- /**
8
- * Compute the relative import path from the operations dir to the types dir.
9
- */
10
- export declare function computeTypesRelPath(opsDir: string, typesDir: string): string;
11
- //# sourceMappingURL=typed-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-operations.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/typed-operations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,CAwRR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG5E"}
@@ -1,263 +0,0 @@
1
- /**
2
- * Generates per-model typed operation modules.
3
- * Each module exports gql tagged templates + typed Variables/Result interfaces.
4
- */
5
- import path from 'path';
6
- import { toPascalCase, toUpperSnakeCase } from '../field-mapping.js';
7
- export function generateTypedOperations(model, typesRelPath) {
8
- const typeName = toPascalCase(model.key);
9
- const upperSnake = toUpperSnakeCase(model.key);
10
- const pluralName = model.pluralName
11
- ? toPascalCase(model.pluralName.replace(/\s+/g, ''))
12
- : `${typeName}s`;
13
- const pluralUpperSnake = model.pluralName
14
- ? toUpperSnakeCase(model.pluralName.replace(/\s+/g, ''))
15
- : `${upperSnake}S`;
16
- const dataType = `${typeName}Data`;
17
- const lines = [];
18
- lines.push(`/**
19
- * Typed operations for ${model.name ?? model.key}
20
- *
21
- * @generated by foir — DO NOT EDIT MANUALLY
22
- */
23
-
24
- import type { JsonValue } from '${typesRelPath}/field-types.js';
25
- import type { ${dataType} } from '${typesRelPath}/models/${model.key}.js';
26
- import type {
27
- BaseRecord,
28
- ResolvedContent,
29
- PaginatedResult,
30
- CreateRecordResult,
31
- UpdateRecordResult,
32
- DeleteRecordResult,
33
- FieldSelection,${model.config.sharing?.enabled ? '\n ShareResult,\n ShareWithRecord,' : ''}
34
- } from './_common.js';
35
- `);
36
- // Type alias
37
- lines.push(`export type ${typeName}Record = BaseRecord<${dataType}>;`);
38
- lines.push('');
39
- // GET query
40
- lines.push(`export const GET_${upperSnake} = \`
41
- query Get${typeName}($id: ID!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
42
- record(id: $id) {
43
- id modelKey naturalKey data metadata
44
- publishedVersionNumber publishedAt versionNumber changeDescription
45
- createdAt updatedAt
46
- resolved(locale: $locale, preview: $preview, fields: $fields) {
47
- content
48
- record { id modelKey naturalKey }
49
- version { id versionNumber }
50
- }
51
- }
52
- }
53
- \`;`);
54
- lines.push('');
55
- lines.push(`export interface Get${typeName}Variables {
56
- id: string;
57
- locale?: string;
58
- preview?: boolean;
59
- fields?: FieldSelection<${dataType}>;
60
- }`);
61
- lines.push('');
62
- lines.push(`export interface Get${typeName}Result {
63
- record: ${typeName}Record & {
64
- resolved: ResolvedContent<${dataType}> | null;
65
- } | null;
66
- }`);
67
- lines.push('');
68
- // GET BY KEY query
69
- lines.push(`export const GET_${upperSnake}_BY_KEY = \`
70
- query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
71
- recordByKey(modelKey: "${model.key}", naturalKey: $naturalKey) {
72
- id modelKey naturalKey data metadata
73
- publishedVersionNumber publishedAt versionNumber changeDescription
74
- createdAt updatedAt
75
- resolved(locale: $locale, preview: $preview, fields: $fields) {
76
- content
77
- record { id modelKey naturalKey }
78
- version { id versionNumber }
79
- }
80
- }
81
- }
82
- \`;`);
83
- lines.push('');
84
- lines.push(`export interface Get${typeName}ByKeyVariables {
85
- naturalKey: string;
86
- locale?: string;
87
- preview?: boolean;
88
- fields?: FieldSelection<${dataType}>;
89
- }`);
90
- lines.push('');
91
- lines.push(`export interface Get${typeName}ByKeyResult {
92
- recordByKey: ${typeName}Record & {
93
- resolved: ResolvedContent<${dataType}> | null;
94
- } | null;
95
- }`);
96
- lines.push('');
97
- // LIST query
98
- lines.push(`export const LIST_${pluralUpperSnake} = \`
99
- query List${pluralName}($limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
100
- records(modelKey: "${model.key}", limit: $limit, offset: $offset, filters: $filters, sort: $sort) {
101
- items {
102
- id modelKey naturalKey data metadata
103
- publishedVersionNumber publishedAt versionNumber changeDescription
104
- createdAt updatedAt
105
- resolved(locale: $locale, preview: $preview, fields: $fields) {
106
- content
107
- record { id modelKey naturalKey }
108
- version { id versionNumber }
109
- }
110
- }
111
- total
112
- }
113
- }
114
- \`;`);
115
- lines.push('');
116
- lines.push(`export interface List${pluralName}Variables {
117
- limit?: number;
118
- offset?: number;
119
- filters?: Array<{ field: string; operator: string; value: JsonValue }>;
120
- sort?: { field: string; direction: 'ASC' | 'DESC' };
121
- locale?: string;
122
- preview?: boolean;
123
- fields?: FieldSelection<${dataType}>;
124
- }`);
125
- lines.push('');
126
- lines.push(`export interface List${pluralName}Result {
127
- records: PaginatedResult<${dataType}>;
128
- }`);
129
- lines.push('');
130
- // CREATE mutation
131
- lines.push(`export const CREATE_${upperSnake} = \`
132
- mutation Create${typeName}($input: CreateRecordInput!) {
133
- createRecord(input: $input) {
134
- record {
135
- id modelKey naturalKey data metadata createdAt updatedAt
136
- }
137
- }
138
- }
139
- \`;`);
140
- lines.push('');
141
- lines.push(`export interface Create${typeName}Variables {
142
- input: {
143
- modelKey: string;
144
- naturalKey?: string;
145
- data: Partial<${dataType}>;
146
- metadata?: Record<string, JsonValue>;
147
- };
148
- }`);
149
- lines.push('');
150
- lines.push(`export interface Create${typeName}Result {
151
- createRecord: CreateRecordResult<${dataType}>;
152
- }`);
153
- lines.push('');
154
- // UPDATE mutation
155
- lines.push(`export const UPDATE_${upperSnake} = \`
156
- mutation Update${typeName}($input: UpdateRecordInput!) {
157
- updateRecord(input: $input) {
158
- record {
159
- id modelKey naturalKey data metadata createdAt updatedAt
160
- }
161
- matched
162
- }
163
- }
164
- \`;`);
165
- lines.push('');
166
- lines.push(`export interface Update${typeName}Variables {
167
- input: {
168
- id: string;
169
- data?: Partial<${dataType}>;
170
- metadata?: Record<string, JsonValue>;
171
- changeDescription?: string;
172
- };
173
- }`);
174
- lines.push('');
175
- lines.push(`export interface Update${typeName}Result {
176
- updateRecord: UpdateRecordResult<${dataType}>;
177
- }`);
178
- lines.push('');
179
- // DELETE mutation
180
- lines.push(`export const DELETE_${upperSnake} = \`
181
- mutation Delete${typeName}($id: ID!) {
182
- deleteRecord(id: $id) { id }
183
- }
184
- \`;`);
185
- lines.push('');
186
- lines.push(`export interface Delete${typeName}Variables {
187
- id: string;
188
- }`);
189
- lines.push('');
190
- lines.push(`export interface Delete${typeName}Result {
191
- deleteRecord: DeleteRecordResult;
192
- }`);
193
- lines.push('');
194
- // PUBLISH/UNPUBLISH
195
- lines.push(`export const PUBLISH_${upperSnake}_VERSION = \`
196
- mutation Publish${typeName}Version($versionId: ID!) {
197
- publishVersion(versionId: $versionId)
198
- }
199
- \`;`);
200
- lines.push('');
201
- lines.push(`export const UNPUBLISH_${upperSnake} = \`
202
- mutation Unpublish${typeName}($id: ID!) {
203
- unpublishRecord(id: $id)
204
- }
205
- \`;`);
206
- lines.push('');
207
- // Sharing operations (conditional)
208
- if (model.config.sharing?.enabled) {
209
- lines.push(`// --- Sharing operations ---`);
210
- lines.push('');
211
- lines.push(`export const SHARE_${upperSnake} = \`
212
- mutation Share${typeName}($recordId: ID!, $sharedWithCustomerId: ID!, $permission: SharePermission!) {
213
- shareRecord(recordId: $recordId, sharedWithCustomerId: $sharedWithCustomerId, permission: $permission) {
214
- id resourceType permission status acceptedAt declinedAt expiresAt createdAt revokedAt
215
- }
216
- }
217
- \`;`);
218
- lines.push('');
219
- lines.push(`export interface Share${typeName}Variables {
220
- recordId: string;
221
- sharedWithCustomerId: string;
222
- permission: 'VIEW' | 'EDIT' | 'ADMIN';
223
- }`);
224
- lines.push('');
225
- lines.push(`export interface Share${typeName}Result {
226
- shareRecord: ShareResult;
227
- }`);
228
- lines.push('');
229
- lines.push(`export const ${upperSnake}_SHARES = \`
230
- query ${typeName}Shares($resourceId: ID!, $status: ShareStatus) {
231
- shares(resourceType: RECORD, resourceId: $resourceId, status: $status) {
232
- id resourceType permission status acceptedAt declinedAt expiresAt createdAt revokedAt
233
- }
234
- }
235
- \`;`);
236
- lines.push('');
237
- lines.push(`export const ${pluralUpperSnake}_SHARED_WITH_ME = \`
238
- query ${pluralName}SharedWithMe($status: ShareStatus) {
239
- sharedWithMe(resourceType: RECORD, modelKey: "${model.key}", status: $status) {
240
- id resourceType permission status acceptedAt declinedAt expiresAt createdAt revokedAt
241
- record {
242
- id modelKey naturalKey data metadata
243
- publishedVersionNumber publishedAt versionNumber changeDescription
244
- createdAt updatedAt
245
- }
246
- }
247
- }
248
- \`;`);
249
- lines.push('');
250
- lines.push(`export interface ${pluralName}SharedWithMeResult {
251
- sharedWithMe: ShareWithRecord<${dataType}>[];
252
- }`);
253
- lines.push('');
254
- }
255
- return lines.join('\n');
256
- }
257
- /**
258
- * Compute the relative import path from the operations dir to the types dir.
259
- */
260
- export function computeTypesRelPath(opsDir, typesDir) {
261
- const rel = path.relative(opsDir, typesDir).replace(/\\/g, '/');
262
- return rel.startsWith('.') ? rel : `./${rel}`;
263
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * Maps EIDE field types to Swift types for sync data serialization.
3
- *
4
- * Reference fields map to String (not a struct) because sync data
5
- * payloads carry plain string IDs — the platform resolves references separately.
6
- */
7
- import type { FieldSchemaForGen } from './field-mapping.js';
8
- export interface SwiftTypeMapping {
9
- /** Swift type name */
10
- type: string;
11
- /** Whether the field is always optional (regardless of required flag) */
12
- alwaysOptional: boolean;
13
- /** Default value expression for non-optional required fields in fromSyncData */
14
- defaultValue: string;
15
- /** The `as?` cast expression for fromSyncData */
16
- castExpression: string;
17
- /** Whether this type needs a shared struct in FieldTypes.swift */
18
- needsSharedType?: boolean;
19
- }
20
- export declare const SWIFT_FIELD_TYPE_MAPPING: Record<string, SwiftTypeMapping>;
21
- /**
22
- * Get the Swift type for a field.
23
- * Returns { type, isOptional } so callers can decide on `?` suffix.
24
- */
25
- export declare function getSwiftFieldType(field: FieldSchemaForGen): {
26
- type: string;
27
- isOptional: boolean;
28
- mapping: SwiftTypeMapping | undefined;
29
- };
30
- //# sourceMappingURL=swift-field-mapping.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swift-field-mapping.d.ts","sourceRoot":"","sources":["../../src/codegen/swift-field-mapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,cAAc,EAAE,OAAO,CAAC;IACxB,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA8HrE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACvC,CAeA"}
@@ -1,150 +0,0 @@
1
- /**
2
- * Maps EIDE field types to Swift types for sync data serialization.
3
- *
4
- * Reference fields map to String (not a struct) because sync data
5
- * payloads carry plain string IDs — the platform resolves references separately.
6
- */
7
- export const SWIFT_FIELD_TYPE_MAPPING = {
8
- text: {
9
- type: 'String',
10
- alwaysOptional: false,
11
- defaultValue: '""',
12
- castExpression: 'as? String',
13
- },
14
- richtext: {
15
- type: 'String',
16
- alwaysOptional: true,
17
- defaultValue: '""',
18
- castExpression: 'as? String',
19
- },
20
- number: {
21
- type: 'Double',
22
- alwaysOptional: true,
23
- defaultValue: '0',
24
- castExpression: 'as? Double',
25
- },
26
- boolean: {
27
- type: 'Bool',
28
- alwaysOptional: true,
29
- defaultValue: 'false',
30
- castExpression: 'as? Bool',
31
- },
32
- email: {
33
- type: 'String',
34
- alwaysOptional: true,
35
- defaultValue: '""',
36
- castExpression: 'as? String',
37
- },
38
- phone: {
39
- type: 'String',
40
- alwaysOptional: true,
41
- defaultValue: '""',
42
- castExpression: 'as? String',
43
- },
44
- url: {
45
- type: 'String',
46
- alwaysOptional: true,
47
- defaultValue: '""',
48
- castExpression: 'as? String',
49
- },
50
- date: {
51
- type: 'String',
52
- alwaysOptional: true,
53
- defaultValue: '""',
54
- castExpression: 'as? String',
55
- },
56
- image: {
57
- type: 'ImageValue',
58
- alwaysOptional: true,
59
- defaultValue: 'ImageValue(id: "", url: "")',
60
- castExpression: 'as? [String: Any]',
61
- needsSharedType: true,
62
- },
63
- video: {
64
- type: 'VideoValue',
65
- alwaysOptional: true,
66
- defaultValue: 'VideoValue(id: "", url: "")',
67
- castExpression: 'as? [String: Any]',
68
- needsSharedType: true,
69
- },
70
- file: {
71
- type: 'FileValue',
72
- alwaysOptional: true,
73
- defaultValue: 'FileValue(id: "", url: "", name: "", size: 0, mimeType: "")', // fromSyncData handles fileId→id mapping
74
- castExpression: 'as? [String: Any]',
75
- needsSharedType: true,
76
- },
77
- currency: {
78
- type: 'CurrencyValue',
79
- alwaysOptional: true,
80
- defaultValue: 'CurrencyValue(amount: 0, currency: "")',
81
- castExpression: 'as? [String: Any]',
82
- needsSharedType: true,
83
- },
84
- select: {
85
- type: 'String',
86
- alwaysOptional: true,
87
- defaultValue: '""',
88
- castExpression: 'as? String',
89
- },
90
- multiselect: {
91
- type: '[String]',
92
- alwaysOptional: true,
93
- defaultValue: '[]',
94
- castExpression: 'as? [String]',
95
- },
96
- json: {
97
- type: 'Any',
98
- alwaysOptional: true,
99
- defaultValue: 'nil',
100
- castExpression: '',
101
- },
102
- list: {
103
- type: '[Any]',
104
- alwaysOptional: true,
105
- defaultValue: '[]',
106
- castExpression: 'as? [Any]',
107
- },
108
- flexible: {
109
- type: '[[String: Any]]',
110
- alwaysOptional: true,
111
- defaultValue: '[]',
112
- castExpression: 'as? [[String: Any]]',
113
- },
114
- reference: {
115
- type: 'String',
116
- alwaysOptional: true,
117
- defaultValue: '""',
118
- castExpression: 'as? String',
119
- },
120
- link: {
121
- type: 'LinkValue',
122
- alwaysOptional: true,
123
- defaultValue: 'LinkValue(type: "")',
124
- castExpression: 'as? [String: Any]',
125
- needsSharedType: true,
126
- },
127
- model: {
128
- type: 'String',
129
- alwaysOptional: true,
130
- defaultValue: '""',
131
- castExpression: 'as? String',
132
- },
133
- };
134
- /**
135
- * Get the Swift type for a field.
136
- * Returns { type, isOptional } so callers can decide on `?` suffix.
137
- */
138
- export function getSwiftFieldType(field) {
139
- const mapping = SWIFT_FIELD_TYPE_MAPPING[field.type];
140
- if (!mapping) {
141
- // Unknown type — treat as optional Any
142
- return {
143
- type: 'Any',
144
- isOptional: true,
145
- mapping: undefined,
146
- };
147
- }
148
- const isOptional = mapping.alwaysOptional || !field.required;
149
- return { type: mapping.type, isOptional, mapping };
150
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * File writer with optional Prettier formatting.
3
- */
4
- /**
5
- * Write a generated file to disk with optional Prettier formatting.
6
- */
7
- export declare function writeGeneratedFile(filePath: string, content: string, usePrettier?: boolean): Promise<void>;
8
- /**
9
- * Write multiple files in batch.
10
- */
11
- export declare function writeFiles(files: Array<{
12
- path: string;
13
- content: string;
14
- }>, usePrettier?: boolean): Promise<void>;
15
- //# sourceMappingURL=write-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-files.d.ts","sourceRoot":"","sources":["../../src/codegen/write-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,OAAc,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,WAAW,GAAE,OAAc,GAC1B,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -1,36 +0,0 @@
1
- /**
2
- * File writer with optional Prettier formatting.
3
- */
4
- import { mkdir, writeFile } from 'fs/promises';
5
- import { dirname } from 'path';
6
- /**
7
- * Write a generated file to disk with optional Prettier formatting.
8
- */
9
- export async function writeGeneratedFile(filePath, content, usePrettier = true) {
10
- await mkdir(dirname(filePath), { recursive: true });
11
- let formattedContent = content;
12
- const isSwift = filePath.endsWith('.swift');
13
- if (usePrettier && !isSwift) {
14
- try {
15
- const prettier = await import('prettier');
16
- const parser = filePath.endsWith('.graphql') ? 'graphql' : 'typescript';
17
- formattedContent = await prettier.format(content, {
18
- parser,
19
- semi: true,
20
- singleQuote: true,
21
- trailingComma: 'es5',
22
- printWidth: 100,
23
- });
24
- }
25
- catch {
26
- // Prettier not available or formatting failed — write unformatted
27
- }
28
- }
29
- await writeFile(filePath, formattedContent, 'utf-8');
30
- }
31
- /**
32
- * Write multiple files in batch.
33
- */
34
- export async function writeFiles(files, usePrettier = true) {
35
- await Promise.all(files.map((file) => writeGeneratedFile(file.path, file.content, usePrettier)));
36
- }
@@ -1,4 +0,0 @@
1
- import type { Command } from 'commander';
2
- import type { GlobalOptions } from '../lib/config.js';
3
- export declare function registerApiKeysCommands(program: Command, globalOpts: () => GlobalOptions): void;
4
- //# sourceMappingURL=api-keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/commands/api-keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAYtD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAmKN"}
@@ -1,129 +0,0 @@
1
- import chalk from 'chalk';
2
- import { withErrorHandler } from '../lib/errors.js';
3
- import { createClient } from '../lib/client.js';
4
- import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
5
- import { confirmAction } from '../lib/input.js';
6
- import { ListApiKeysDocument, CreateApiKeyDocument, RotateApiKeyDocument, RevokeApiKeyDocument, } from '../graphql/generated.js';
7
- export function registerApiKeysCommands(program, globalOpts) {
8
- const apiKeys = program.command('api-keys').description('Manage API keys');
9
- // list
10
- apiKeys
11
- .command('list')
12
- .description('List API keys')
13
- .option('--include-inactive', 'Include revoked/inactive keys')
14
- .option('--search <term>', 'Search by name')
15
- .option('--limit <n>', 'Max results', '50')
16
- .action(withErrorHandler(globalOpts, async (cmdOpts) => {
17
- const opts = globalOpts();
18
- const client = await createClient(opts);
19
- const data = await client.request(ListApiKeysDocument, {
20
- includeInactive: !!cmdOpts.includeInactive,
21
- search: cmdOpts.search,
22
- limit: parseInt(String(cmdOpts.limit ?? '50'), 10),
23
- });
24
- formatList(data.listApiKeys.apiKeys, opts, {
25
- columns: [
26
- { key: 'id', header: 'ID', width: 28 },
27
- { key: 'name', header: 'Name', width: 24 },
28
- { key: 'keyPrefix', header: 'Prefix', width: 12 },
29
- {
30
- key: 'isActive',
31
- header: 'Active',
32
- width: 8,
33
- format: (v) => (v ? 'yes' : 'no'),
34
- },
35
- {
36
- key: 'scopes',
37
- header: 'Scopes',
38
- width: 30,
39
- format: (v) => (Array.isArray(v) ? v.join(', ') : ''),
40
- },
41
- {
42
- key: 'lastUsedAt',
43
- header: 'Last Used',
44
- width: 12,
45
- format: (v) => timeAgo(v),
46
- },
47
- ],
48
- total: data.listApiKeys.total,
49
- });
50
- }));
51
- // create
52
- apiKeys
53
- .command('create')
54
- .description('Create a new API key')
55
- .requiredOption('--name <name>', 'API key name')
56
- .requiredOption('--scopes <scopes>', 'Comma-separated scopes (e.g. records:read,records:write)')
57
- .option('--project-id <id>', 'Project ID (defaults to selected project)')
58
- .action(withErrorHandler(globalOpts, async (cmdOpts) => {
59
- const opts = globalOpts();
60
- const client = await createClient(opts);
61
- const scopes = cmdOpts.scopes.split(',').map((s) => s.trim());
62
- const input = {
63
- name: cmdOpts.name,
64
- scopes,
65
- };
66
- if (cmdOpts.projectId)
67
- input.projectId = cmdOpts.projectId;
68
- const data = await client.request(CreateApiKeyDocument, {
69
- input,
70
- });
71
- if (opts.json || opts.jsonl) {
72
- formatOutput(data.createApiKey, opts);
73
- }
74
- else {
75
- success(`Created API key: ${data.createApiKey.apiKey.name}`);
76
- console.log('');
77
- console.log(chalk.yellow(' Save this key now — it cannot be retrieved later:'));
78
- console.log(chalk.bold(` ${data.createApiKey.plainKey}`));
79
- if (data.createApiKey.warning) {
80
- console.log(chalk.gray(` ${data.createApiKey.warning}`));
81
- }
82
- }
83
- }));
84
- // rotate
85
- apiKeys
86
- .command('rotate <id>')
87
- .description('Rotate an API key (generates new secret)')
88
- .option('--confirm', 'Skip confirmation prompt')
89
- .action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
90
- const opts = globalOpts();
91
- const confirmed = await confirmAction(`Rotate API key ${id}? The old key will stop working.`, { confirm: !!cmdOpts.confirm });
92
- if (!confirmed) {
93
- console.log('Aborted.');
94
- return;
95
- }
96
- const client = await createClient(opts);
97
- const data = await client.request(RotateApiKeyDocument, { id });
98
- if (opts.json || opts.jsonl) {
99
- formatOutput(data.rotateApiKey, opts);
100
- }
101
- else {
102
- success(`Rotated API key: ${data.rotateApiKey.apiKey.name}`);
103
- console.log('');
104
- console.log(chalk.yellow(' Save this key now — it cannot be retrieved later:'));
105
- console.log(chalk.bold(` ${data.rotateApiKey.plainKey}`));
106
- }
107
- }));
108
- // revoke
109
- apiKeys
110
- .command('revoke <id>')
111
- .description('Revoke an API key')
112
- .option('--confirm', 'Skip confirmation prompt')
113
- .action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
114
- const opts = globalOpts();
115
- const confirmed = await confirmAction(`Revoke API key ${id}? This cannot be undone.`, { confirm: !!cmdOpts.confirm });
116
- if (!confirmed) {
117
- console.log('Aborted.');
118
- return;
119
- }
120
- const client = await createClient(opts);
121
- const data = await client.request(RevokeApiKeyDocument, { id });
122
- if (opts.json || opts.jsonl) {
123
- formatOutput(data.revokeApiKey, opts);
124
- }
125
- else {
126
- success(`Revoked API key ${id}`);
127
- }
128
- }));
129
- }
@@ -1,4 +0,0 @@
1
- import type { Command } from 'commander';
2
- import type { GlobalOptions } from '../lib/config.js';
3
- export declare function registerAuthConfigCommands(program: Command, globalOpts: () => GlobalOptions): void;
4
- //# sourceMappingURL=auth-config.d.ts.map