@eide/foir-cli 0.1.18 → 0.1.20

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.
@@ -33,6 +33,20 @@ export interface CodegenModel {
33
33
  config: CodegenModelConfig;
34
34
  hooks?: Record<string, unknown>;
35
35
  }
36
+ /**
37
+ * Normalize a field's item type reference into `options.itemType`.
38
+ *
39
+ * The platform stores the reference in different locations depending on
40
+ * how the field was created:
41
+ * - `options.itemType` (standard)
42
+ * - `config.itemType` (config variant)
43
+ * - `config.itemSchema` (inline model schema reference)
44
+ * - top-level `itemType` (inline model field definitions)
45
+ *
46
+ * We consolidate into `options.itemType` so downstream codegen has a
47
+ * single location to check.
48
+ */
49
+ export declare function normalizeField(raw: Record<string, unknown>): FieldSchemaForGen;
36
50
  export declare function fetchModelsForCodegen(client: GraphQLClient): Promise<CodegenModel[]>;
37
51
  /**
38
52
  * Filter models based on pull config options.
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-models.d.ts","sourceRoot":"","sources":["../../src/codegen/fetch-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,iBAAiB,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,CAAC;YAAE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EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACvD,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAsCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAyC9E;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,GACpD,YAAY,EAAE,CAahB"}
@@ -20,6 +20,51 @@ function normalizeConfig(raw) {
20
20
  embeddings: raw.embeddings,
21
21
  };
22
22
  }
23
+ /**
24
+ * Normalize a field's item type reference into `options.itemType`.
25
+ *
26
+ * The platform stores the reference in different locations depending on
27
+ * how the field was created:
28
+ * - `options.itemType` (standard)
29
+ * - `config.itemType` (config variant)
30
+ * - `config.itemSchema` (inline model schema reference)
31
+ * - top-level `itemType` (inline model field definitions)
32
+ *
33
+ * We consolidate into `options.itemType` so downstream codegen has a
34
+ * single location to check.
35
+ */
36
+ export function normalizeField(raw) {
37
+ const field = raw;
38
+ const options = { ...(field.options ?? {}) };
39
+ // Resolve composite type to its inline schema reference
40
+ const resolvedType = field.type === 'composite' && field.config?.schema
41
+ ? field.config.schema
42
+ : field.type;
43
+ // Resolve itemType from all possible locations (first wins)
44
+ if (!options.itemType) {
45
+ const resolved = field.itemType ??
46
+ field.config?.itemType ??
47
+ field.config?.itemSchema;
48
+ if (resolved) {
49
+ options.itemType = resolved;
50
+ }
51
+ }
52
+ // Carry over minItems/maxItems from config
53
+ if (field.config?.minItems !== undefined && options.minItems === undefined) {
54
+ options.minItems = field.config.minItems;
55
+ }
56
+ if (field.config?.maxItems !== undefined && options.maxItems === undefined) {
57
+ options.maxItems = field.config.maxItems;
58
+ }
59
+ return {
60
+ key: field.key,
61
+ type: resolvedType,
62
+ label: field.label,
63
+ required: field.required,
64
+ helpText: field.helpText,
65
+ options: Object.keys(options).length > 0 ? options : undefined,
66
+ };
67
+ }
23
68
  export async function fetchModelsForCodegen(client) {
24
69
  const data = await client.request(MODELS_FOR_CODEGEN, {
25
70
  limit: 500,
@@ -30,7 +75,7 @@ export async function fetchModelsForCodegen(client) {
30
75
  pluralName: item.pluralName,
31
76
  description: item.description,
32
77
  category: item.category,
33
- fields: item.fields ?? [],
78
+ fields: (item.fields ?? []).map((f) => normalizeField(f)),
34
79
  config: normalizeConfig(item.config ?? {}),
35
80
  hooks: item.hooks,
36
81
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"field-mapping.d.ts","sourceRoot":"","sources":["../../src/codegen/field-mapping.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,aAsBhC,CAAC;AAEH,wBAAgB,oBAA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eAAO,MAAM,qBAAqB,aAoBhC,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAoD1D,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,IAAI,GAAE,QAAQ,GAAG,OAAkB,GAClC,MAAM,CAqCR;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY3E;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,GAAG,CAAC,MAAM,CAAC,CAcb;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CA8EjE"}
@@ -19,8 +19,6 @@ export const PRIMITIVE_FIELD_TYPES = new Set([
19
19
  'multiselect',
20
20
  'json',
21
21
  'list',
22
- 'tree',
23
- 'entity-reference',
24
22
  'reference',
25
23
  'link',
26
24
  'flexible',
@@ -65,17 +63,11 @@ export const FIELD_TYPE_MAPPING = {
65
63
  multiselect: { outputType: 'string[]', inputType: 'string[]' },
66
64
  json: { outputType: 'unknown', inputType: 'unknown' },
67
65
  list: { outputType: 'unknown[]', inputType: 'unknown[]' },
68
- tree: { outputType: 'unknown[]', inputType: 'unknown[]' },
69
66
  flexible: {
70
67
  outputType: 'FlexibleFieldItem[]',
71
68
  inputType: 'FlexibleFieldItem[]',
72
69
  needsImport: 'field-types',
73
70
  },
74
- 'entity-reference': {
75
- outputType: 'ReferenceValue',
76
- inputType: 'ReferenceValue',
77
- needsImport: 'field-types',
78
- },
79
71
  reference: {
80
72
  outputType: 'ReferenceValue',
81
73
  inputType: 'ReferenceValue',
@@ -109,8 +101,7 @@ export function getFieldType(field, mode = 'output') {
109
101
  tsType = `(${options.map((o) => `'${o.value}'`).join(' | ')})[]`;
110
102
  }
111
103
  }
112
- if ((field.type === 'list' || field.type === 'tree') &&
113
- field.options?.itemType) {
104
+ if (field.type === 'list' && field.options?.itemType) {
114
105
  const itemType = field.options.itemType;
115
106
  const itemMapping = FIELD_TYPE_MAPPING[itemType];
116
107
  if (itemMapping) {
@@ -128,8 +119,7 @@ export function getRequiredImports(fields) {
128
119
  const mapping = FIELD_TYPE_MAPPING[field.type];
129
120
  if (mapping?.needsImport)
130
121
  imports.add(mapping.needsImport);
131
- if ((field.type === 'list' || field.type === 'tree') &&
132
- field.options?.itemType) {
122
+ if (field.type === 'list' && field.options?.itemType) {
133
123
  const itemMapping = FIELD_TYPE_MAPPING[field.options.itemType];
134
124
  if (itemMapping?.needsImport)
135
125
  imports.add(itemMapping.needsImport);
@@ -143,8 +133,7 @@ export function getInlineSchemaReferences(fields) {
143
133
  if (!isPrimitiveFieldType(field.type) && !FIELD_TYPE_MAPPING[field.type]) {
144
134
  refs.add(field.type);
145
135
  }
146
- if ((field.type === 'list' || field.type === 'tree') &&
147
- field.options?.itemType) {
136
+ if (field.type === 'list' && field.options?.itemType) {
148
137
  const itemType = field.options.itemType;
149
138
  if (!isPrimitiveFieldType(itemType) && !FIELD_TYPE_MAPPING[itemType]) {
150
139
  refs.add(itemType);
@@ -216,15 +205,14 @@ export function generateFieldDef(field) {
216
205
  .join(', ');
217
206
  parts.push(`options: [${optionsStr}]`);
218
207
  }
219
- if ((field.type === 'entity-reference' || field.type === 'reference') &&
208
+ if (field.type === 'reference' &&
220
209
  field.options?.referenceTypes) {
221
210
  const refTypes = field.options.referenceTypes;
222
211
  parts.push(`referenceTypes: [${refTypes.map((t) => `'${t}'`).join(', ')}]`);
223
212
  if (field.options.multiple)
224
213
  parts.push('multiple: true');
225
214
  }
226
- if ((field.type === 'list' || field.type === 'tree') &&
227
- field.options?.itemType) {
215
+ if (field.type === 'list' && field.options?.itemType) {
228
216
  parts.push(`itemType: '${field.options.itemType}'`);
229
217
  if (field.options.minItems !== undefined)
230
218
  parts.push(`minItems: ${field.options.minItems}`);
@@ -52,18 +52,18 @@ export interface FileValue {
52
52
  /** Link value (internal reference or external URL) */
53
53
  export interface LinkValue {
54
54
  type: 'entity' | 'url';
55
- entity?: LinkEntityReference;
55
+ entity?: LinkRecordReference;
56
56
  url?: string;
57
57
  target?: '_self' | '_blank';
58
58
  }
59
59
 
60
- /** Entity reference for internal links */
61
- export interface LinkEntityReference {
60
+ /** Record reference for internal links */
61
+ export interface LinkRecordReference {
62
62
  modelKey: string;
63
63
  naturalKey: string;
64
64
  }
65
65
 
66
- /** Entity reference value */
66
+ /** Record reference value */
67
67
  export interface ReferenceValue {
68
68
  _type: 'reference';
69
69
  _schema: string;
@@ -299,7 +299,7 @@ export interface LinkFieldDef extends BaseFieldDef {
299
299
  }
300
300
 
301
301
  export interface ReferenceFieldDef extends BaseFieldDef {
302
- type: 'entity-reference' | 'reference';
302
+ type: 'reference';
303
303
  referenceTypes?: string[];
304
304
  multiple?: boolean;
305
305
  }
@@ -37,6 +37,8 @@ function buildImportStatements(model, fieldTypeImports, inlineSchemaRefs, allMod
37
37
  imports.push(`import type { ${types} } from '../field-types.js';`);
38
38
  }
39
39
  for (const refKey of inlineSchemaRefs) {
40
+ if (refKey === model.key)
41
+ continue; // skip self-reference
40
42
  const refModel = allModels.find((m) => m.key === refKey);
41
43
  if (refModel) {
42
44
  const refTypeName = isInlineOnlyModel(refModel)
@@ -118,9 +120,8 @@ function generateDataInterface(model, fields, interfaceName, allModels) {
118
120
  if (refModel && !isInlineOnlyModel(refModel)) {
119
121
  fieldType = toPascalCase(field.type) + 'Data';
120
122
  }
121
- // Handle list/tree itemType refs
122
- if ((field.type === 'list' || field.type === 'tree') &&
123
- field.options?.itemType) {
123
+ // Handle list itemType refs
124
+ if (field.type === 'list' && field.options?.itemType) {
124
125
  const itemRefModel = allModels.find((m) => m.key === field.options.itemType);
125
126
  if (itemRefModel && !isInlineOnlyModel(itemRefModel)) {
126
127
  fieldType = toPascalCase(field.options.itemType) + 'Data[]';
@@ -138,13 +139,12 @@ function getFieldTypeImportsForFields(fields) {
138
139
  for (const field of fields) {
139
140
  const mapping = FIELD_TYPE_MAPPING[field.type];
140
141
  if (mapping?.needsImport === 'field-types') {
141
- imports.add(mapping.outputType);
142
+ imports.add(mapping.outputType.replace(/\[\]$/, ''));
142
143
  }
143
- if ((field.type === 'list' || field.type === 'tree') &&
144
- field.options?.itemType) {
144
+ if (field.type === 'list' && field.options?.itemType) {
145
145
  const itemMapping = FIELD_TYPE_MAPPING[field.options.itemType];
146
146
  if (itemMapping?.needsImport === 'field-types') {
147
- imports.add(itemMapping.outputType);
147
+ imports.add(itemMapping.outputType.replace(/\[\]$/, ''));
148
148
  }
149
149
  }
150
150
  }
@@ -1 +1 @@
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,CAoIrE,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
+ {"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,CAwHrE,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"}
@@ -105,24 +105,12 @@ export const SWIFT_FIELD_TYPE_MAPPING = {
105
105
  defaultValue: '[]',
106
106
  castExpression: 'as? [Any]',
107
107
  },
108
- tree: {
109
- type: '[Any]',
110
- alwaysOptional: true,
111
- defaultValue: '[]',
112
- castExpression: 'as? [Any]',
113
- },
114
108
  flexible: {
115
109
  type: '[[String: Any]]',
116
110
  alwaysOptional: true,
117
111
  defaultValue: '[]',
118
112
  castExpression: 'as? [[String: Any]]',
119
113
  },
120
- 'entity-reference': {
121
- type: 'String',
122
- alwaysOptional: true,
123
- defaultValue: '""',
124
- castExpression: 'as? String',
125
- },
126
114
  reference: {
127
115
  type: 'String',
128
116
  alwaysOptional: true,
@@ -1 +1 @@
1
- {"version":3,"file":"customer-profiles.d.ts","sourceRoot":"","sources":["../../src/commands/customer-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAYtD,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAgIN"}
1
+ {"version":3,"file":"customer-profiles.d.ts","sourceRoot":"","sources":["../../src/commands/customer-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAYtD,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAkIN"}
@@ -34,22 +34,22 @@ export function registerCustomerProfilesCommands(program, globalOpts) {
34
34
  // schema update
35
35
  schema
36
36
  .command('update')
37
- .description('Update the customer profile schema (fields array)')
38
- .option('-d, --data <json>', 'Fields array as JSON')
39
- .option('-f, --file <path>', 'Read fields from file')
37
+ .description('Update the customer profile schema. Accepts a JSON object with "fields" (required) and "publicFields" (optional).')
38
+ .option('-d, --data <json>', 'Schema data as JSON')
39
+ .option('-f, --file <path>', 'Read data from file')
40
40
  .action(withErrorHandler(globalOpts, async (cmdOpts) => {
41
41
  const opts = globalOpts();
42
42
  const client = await createClient(opts);
43
43
  const inputData = await parseInputData(cmdOpts);
44
- // Accept either { fields: [...] } or a raw array
45
- const fields = Array.isArray(inputData)
46
- ? inputData
47
- : (inputData.fields ?? inputData);
48
- if (!Array.isArray(fields)) {
49
- throw new Error('Input must be a fields array or an object with a "fields" key. ' +
50
- 'Example: [{"key":"name","label":"Name","type":"text"}]');
44
+ if (!inputData.fields || !Array.isArray(inputData.fields)) {
45
+ throw new Error('Input must be an object with a "fields" array. ' +
46
+ 'Example: {"fields":[{"key":"name","label":"Name","type":"text"}],"publicFields":["name"]}');
51
47
  }
52
- const data = await client.request(UPDATE_CUSTOMER_PROFILE_SCHEMA, { fields });
48
+ const variables = {
49
+ fields: inputData.fields,
50
+ publicFields: inputData.publicFields ?? undefined,
51
+ };
52
+ const data = await client.request(UPDATE_CUSTOMER_PROFILE_SCHEMA, variables);
53
53
  formatOutput(data.updateCustomerProfileSchema, opts);
54
54
  if (!(opts.json || opts.jsonl || opts.quiet)) {
55
55
  const version = data.updateCustomerProfileSchema.version;
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/commands/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyBtD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA+SN"}
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/commands/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA6BtD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA2YN"}
@@ -2,7 +2,7 @@ import { withErrorHandler } from '../lib/errors.js';
2
2
  import { createClient } from '../lib/client.js';
3
3
  import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
4
4
  import { parseInputData, parseFilters, parseSort, isUUID, confirmAction, } from '../lib/input.js';
5
- import { RECORDS, RECORD, RECORD_BY_KEY, CREATE_RECORD, UPDATE_RECORD, DELETE_RECORD, PUBLISH_VERSION, UNPUBLISH_RECORD, DUPLICATE_RECORD, RECORD_VERSIONS, RECORD_VARIANTS, } from '../graphql/queries.js';
5
+ import { RECORDS, RECORD, RECORD_RESOLVED, RECORD_BY_KEY, RECORD_BY_KEY_RESOLVED, CREATE_RECORD, UPDATE_RECORD, DELETE_RECORD, PUBLISH_VERSION, UNPUBLISH_RECORD, DUPLICATE_RECORD, CREATE_VERSION, CREATE_VARIANT, RECORD_VERSIONS, RECORD_VARIANTS, } from '../graphql/queries.js';
6
6
  export function registerRecordsCommands(program, globalOpts) {
7
7
  const records = program.command('records').description('Manage records');
8
8
  // list
@@ -46,16 +46,36 @@ export function registerRecordsCommands(program, globalOpts) {
46
46
  records
47
47
  .command('get <modelKey> <idOrKey>')
48
48
  .description('Get a record by ID or natural key')
49
- .action(withErrorHandler(globalOpts, async (modelKey, idOrKey) => {
49
+ .option('--resolved', 'Include resolved content (published version)')
50
+ .option('--preview', 'Resolve latest draft instead of published version')
51
+ .option('--locale <locale>', 'Locale for field translations')
52
+ .action(withErrorHandler(globalOpts, async (modelKey, idOrKey, cmdOpts) => {
50
53
  const opts = globalOpts();
51
54
  const client = await createClient(opts);
52
55
  let result;
56
+ const useResolved = !!cmdOpts.resolved || !!cmdOpts.preview;
53
57
  if (isUUID(idOrKey)) {
54
- const data = await client.request(RECORD, { id: idOrKey });
58
+ const query = useResolved ? RECORD_RESOLVED : RECORD;
59
+ const variables = { id: idOrKey };
60
+ if (useResolved) {
61
+ if (cmdOpts.locale)
62
+ variables.locale = cmdOpts.locale;
63
+ if (cmdOpts.preview)
64
+ variables.preview = true;
65
+ }
66
+ const data = await client.request(query, variables);
55
67
  result = data.record;
56
68
  }
57
69
  else {
58
- const data = await client.request(RECORD_BY_KEY, { modelKey, naturalKey: idOrKey });
70
+ const query = useResolved ? RECORD_BY_KEY_RESOLVED : RECORD_BY_KEY;
71
+ const variables = { modelKey, naturalKey: idOrKey };
72
+ if (useResolved) {
73
+ if (cmdOpts.locale)
74
+ variables.locale = cmdOpts.locale;
75
+ if (cmdOpts.preview)
76
+ variables.preview = true;
77
+ }
78
+ const data = await client.request(query, variables);
59
79
  result = data.recordByKey;
60
80
  }
61
81
  if (!result) {
@@ -213,4 +233,63 @@ export function registerRecordsCommands(program, globalOpts) {
213
233
  ],
214
234
  });
215
235
  }));
236
+ // create-version
237
+ records
238
+ .command('create-version <parentId>')
239
+ .description('Create a new version on a versioned record (or variant). parentId is the record or variant ID.')
240
+ .option('-d, --data <json>', 'Version content as JSON')
241
+ .option('-f, --file <path>', 'Read content from file')
242
+ .option('-m, --message <msg>', 'Change description')
243
+ .option('--source-version <id>', 'Source version ID to base off')
244
+ .action(withErrorHandler(globalOpts, async (parentId, cmdOpts) => {
245
+ const opts = globalOpts();
246
+ const client = await createClient(opts);
247
+ const inputData = await parseInputData(cmdOpts);
248
+ const input = {
249
+ parentId,
250
+ content: inputData,
251
+ };
252
+ if (cmdOpts.message)
253
+ input.changeDescription = cmdOpts.message;
254
+ if (cmdOpts.sourceVersion)
255
+ input.sourceVersionId = cmdOpts.sourceVersion;
256
+ const data = await client.request(CREATE_VERSION, { input });
257
+ formatOutput(data.createVersion, opts);
258
+ if (!(opts.json || opts.jsonl || opts.quiet)) {
259
+ success(`Created version ${data.createVersion.id}`);
260
+ }
261
+ }));
262
+ // create-variant
263
+ records
264
+ .command('create-variant <recordId>')
265
+ .description('Create a new variant on a record')
266
+ .requiredOption('--key <variantKey>', 'Variant key (e.g. "uk-market")')
267
+ .option('--name <name>', 'Variant display name')
268
+ .option('--description <desc>', 'Variant description')
269
+ .option('--catalog-id <id>', 'Variant catalog entry ID')
270
+ .option('--priority <n>', 'Priority (lower = higher priority)')
271
+ .option('--default', 'Set as default variant')
272
+ .action(withErrorHandler(globalOpts, async (recordId, cmdOpts) => {
273
+ const opts = globalOpts();
274
+ const client = await createClient(opts);
275
+ const input = {
276
+ recordId,
277
+ variantKey: cmdOpts.key,
278
+ };
279
+ if (cmdOpts.name)
280
+ input.name = cmdOpts.name;
281
+ if (cmdOpts.description)
282
+ input.description = cmdOpts.description;
283
+ if (cmdOpts.catalogId)
284
+ input.catalogId = cmdOpts.catalogId;
285
+ if (cmdOpts.priority !== undefined)
286
+ input.priority = parseInt(cmdOpts.priority, 10);
287
+ if (cmdOpts.default)
288
+ input.isDefault = true;
289
+ const data = await client.request(CREATE_VARIANT, { input });
290
+ formatOutput(data.createVariant, opts);
291
+ if (!(opts.json || opts.jsonl || opts.quiet)) {
292
+ success(`Created variant ${data.createVariant.id}`);
293
+ }
294
+ }));
216
295
  }
@@ -10,7 +10,9 @@ export declare const CREATE_AUTH_PROVIDER = "\n mutation($input: CreateAuthProv
10
10
  export declare const UPDATE_AUTH_PROVIDER = "\n mutation($id: ID!, $input: UpdateAuthProviderInput!) {\n updateCustomerAuthProvider(id: $id, input: $input) {\n id key name type enabled isDefault priority updatedAt\n }\n }\n";
11
11
  export declare const DELETE_AUTH_PROVIDER = "\n mutation($id: ID!) { deleteCustomerAuthProvider(id: $id) }\n";
12
12
  export declare const RECORD = "\n query($id: ID!) { record(id: $id) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }\n";
13
+ export declare const RECORD_RESOLVED = "\n query($id: ID!, $locale: String, $preview: Boolean) {\n record(id: $id) {\n id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey variantName }\n version { id versionNumber publishStatus }\n }\n }\n }\n";
13
14
  export declare const RECORD_BY_KEY = "\n query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }\n";
15
+ export declare const RECORD_BY_KEY_RESOLVED = "\n query($modelKey: String!, $naturalKey: String!, $locale: String, $preview: Boolean) {\n recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) {\n id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey variantName }\n version { id versionNumber publishStatus }\n }\n }\n }\n";
14
16
  export declare const RECORDS = "\n query($modelKey: String!, $limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {\n records(modelKey: $modelKey, limit: $limit, offset: $offset, filters: $filters, sort: $sort) {\n items { id modelKey naturalKey recordType publishStatus versionNumber customerId createdAt updatedAt }\n total\n }\n }\n";
15
17
  export declare const CREATE_RECORD = "\n mutation($input: CreateRecordInput!) { createRecord(input: $input) { record { id modelKey naturalKey recordType data metadata createdAt } variant { id variantKey } version { id versionNumber } } }\n";
16
18
  export declare const UPDATE_RECORD = "\n mutation($input: UpdateRecordInput!) { updateRecord(input: $input) { record { id modelKey naturalKey data metadata updatedAt } matched } }\n";
@@ -18,6 +20,8 @@ export declare const DELETE_RECORD = "\n mutation($id: ID!) { deleteRecord(id:
18
20
  export declare const PUBLISH_VERSION = "\n mutation($versionId: ID!) { publishVersion(versionId: $versionId) }\n";
19
21
  export declare const UNPUBLISH_RECORD = "\n mutation($id: ID!) { unpublishRecord(id: $id) }\n";
20
22
  export declare const DUPLICATE_RECORD = "\n mutation($input: DuplicateRecordInput!) { duplicateRecord(input: $input) { record { id modelKey naturalKey } variant { id variantKey } version { id versionNumber } } }\n";
23
+ export declare const CREATE_VERSION = "\n mutation($input: CreateVersionInput!) { createVersion(input: $input) { id modelKey recordType parentId data metadata versionNumber contentHash changeDescription publishStatus createdAt } }\n";
24
+ export declare const CREATE_VARIANT = "\n mutation($input: CreateVariantInput!) { createVariant(input: $input) { id modelKey recordType parentId variantKey variantName isDefault priority createdAt } }\n";
21
25
  export declare const RECORD_VERSIONS = "\n query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber publishStatus data contentHash changeDescription createdAt createdBy } } }\n";
22
26
  export declare const RECORD_VARIANTS = "\n query($recordId: ID!, $limit: Int, $offset: Int) { recordVariants(recordId: $recordId, limit: $limit, offset: $offset) { items { id variantKey variantName isDefault priority createdAt } } }\n";
23
27
  export declare const MODELS_FOR_CODEGEN = "\n query($limit: Int) {\n models(limit: $limit) {\n items { id key name pluralName description category fields config hooks }\n total\n }\n }\n";
@@ -28,8 +32,8 @@ export declare const UPDATE_MODEL = "\n mutation($input: UpdateModelInput!) { u
28
32
  export declare const DELETE_MODEL = "\n mutation($id: ID!) { deleteModel(id: $id) }\n";
29
33
  export declare const MODEL_VERSIONS = "\n query($modelId: ID!, $limit: Int, $offset: Int) { modelVersions(modelId: $modelId, limit: $limit, offset: $offset) { items { id modelId versionNumber contentHash changeDescription createdAt createdBy } } }\n";
30
34
  export declare const GLOBAL_SEARCH = "\n query($query: String!, $limit: Int, $modelKeys: [String!], $includeMedia: Boolean) {\n globalSearch(query: $query, limit: $limit, modelKeys: $modelKeys, includeMedia: $includeMedia) {\n records { id modelKey title naturalKey subtitle modelName updatedAt }\n media { id fileName altText fileUrl }\n }\n }\n";
31
- export declare const CUSTOMER_PROFILE_SCHEMA = "\n query { customerProfileSchema { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } version createdAt updatedAt updatedBy } }\n";
32
- export declare const UPDATE_CUSTOMER_PROFILE_SCHEMA = "\n mutation($fields: [FieldDefinitionInput!]!) { updateCustomerProfileSchema(fields: $fields) { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } version createdAt updatedAt } }\n";
35
+ export declare const CUSTOMER_PROFILE_SCHEMA = "\n query { customerProfileSchema { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } publicFields version createdAt updatedAt updatedBy } }\n";
36
+ export declare const UPDATE_CUSTOMER_PROFILE_SCHEMA = "\n mutation($fields: [FieldDefinitionInput!]!, $publicFields: [String!]) { updateCustomerProfileSchema(fields: $fields, publicFields: $publicFields) { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } publicFields version createdAt updatedAt } }\n";
33
37
  export declare const CUSTOMER_PROFILE = "\n query($customerId: ID!) { customerProfile(customerId: $customerId) { id customerId data schemaVersionNumber createdAt updatedAt createdBy updatedBy } }\n";
34
38
  export declare const SET_CUSTOMER_PROFILE = "\n mutation($customerId: ID!, $data: JSON!) { setCustomerProfile(customerId: $customerId, data: $data) { id customerId data schemaVersionNumber createdAt updatedAt } }\n";
35
39
  export declare const CUSTOMERS = "\n query($status: CustomerStatus, $search: String, $filters: [FilterInput!], $limit: Int, $offset: Int) {\n customers(status: $status, search: $search, filters: $filters, limit: $limit, offset: $offset) {\n customers { id email status lastLoginAt createdAt updatedAt }\n total\n }\n }\n";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/graphql/queries.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,8HAE/B,CAAC;AAIF,eAAO,MAAM,aAAa,oVAOzB,CAAC;AAEF,eAAO,MAAM,WAAW,oOAEvB,CAAC;AAEF,eAAO,MAAM,cAAc,2JAE1B,CAAC;AAEF,eAAO,MAAM,cAAc,mHAE1B,CAAC;AAEF,eAAO,MAAM,cAAc,s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O,MAAM,4BAA4B,oEAExC,CAAC"}
@@ -64,9 +64,35 @@ export const DELETE_AUTH_PROVIDER = `
64
64
  export const RECORD = `
65
65
  query($id: ID!) { record(id: $id) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }
66
66
  `;
67
+ export const RECORD_RESOLVED = `
68
+ query($id: ID!, $locale: String, $preview: Boolean) {
69
+ record(id: $id) {
70
+ id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy
71
+ resolved(locale: $locale, preview: $preview) {
72
+ content
73
+ record { id modelKey naturalKey }
74
+ variant { id variantKey variantName }
75
+ version { id versionNumber publishStatus }
76
+ }
77
+ }
78
+ }
79
+ `;
67
80
  export const RECORD_BY_KEY = `
68
81
  query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }
69
82
  `;
83
+ export const RECORD_BY_KEY_RESOLVED = `
84
+ query($modelKey: String!, $naturalKey: String!, $locale: String, $preview: Boolean) {
85
+ recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) {
86
+ id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy
87
+ resolved(locale: $locale, preview: $preview) {
88
+ content
89
+ record { id modelKey naturalKey }
90
+ variant { id variantKey variantName }
91
+ version { id versionNumber publishStatus }
92
+ }
93
+ }
94
+ }
95
+ `;
70
96
  export const RECORDS = `
71
97
  query($modelKey: String!, $limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {
72
98
  records(modelKey: $modelKey, limit: $limit, offset: $offset, filters: $filters, sort: $sort) {
@@ -93,6 +119,12 @@ export const UNPUBLISH_RECORD = `
93
119
  export const DUPLICATE_RECORD = `
94
120
  mutation($input: DuplicateRecordInput!) { duplicateRecord(input: $input) { record { id modelKey naturalKey } variant { id variantKey } version { id versionNumber } } }
95
121
  `;
122
+ export const CREATE_VERSION = `
123
+ mutation($input: CreateVersionInput!) { createVersion(input: $input) { id modelKey recordType parentId data metadata versionNumber contentHash changeDescription publishStatus createdAt } }
124
+ `;
125
+ export const CREATE_VARIANT = `
126
+ mutation($input: CreateVariantInput!) { createVariant(input: $input) { id modelKey recordType parentId variantKey variantName isDefault priority createdAt } }
127
+ `;
96
128
  export const RECORD_VERSIONS = `
97
129
  query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber publishStatus data contentHash changeDescription createdAt createdBy } } }
98
130
  `;
@@ -142,10 +174,10 @@ export const GLOBAL_SEARCH = `
142
174
  `;
143
175
  // --- Customer Profile Schema ---
144
176
  export const CUSTOMER_PROFILE_SCHEMA = `
145
- query { customerProfileSchema { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } version createdAt updatedAt updatedBy } }
177
+ query { customerProfileSchema { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } publicFields version createdAt updatedAt updatedBy } }
146
178
  `;
147
179
  export const UPDATE_CUSTOMER_PROFILE_SCHEMA = `
148
- mutation($fields: [FieldDefinitionInput!]!) { updateCustomerProfileSchema(fields: $fields) { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } version createdAt updatedAt } }
180
+ mutation($fields: [FieldDefinitionInput!]!, $publicFields: [String!]) { updateCustomerProfileSchema(fields: $fields, publicFields: $publicFields) { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } publicFields version createdAt updatedAt } }
149
181
  `;
150
182
  export const CUSTOMER_PROFILE = `
151
183
  query($customerId: ID!) { customerProfile(customerId: $customerId) { id customerId data schemaVersionNumber createdAt updatedAt createdBy updatedBy } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Universal platform CLI for EIDE — scriptable, composable resource management",
5
5
  "type": "module",
6
6
  "publishConfig": {