@eide/foir-cli 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -19,6 +19,7 @@ import { registerRecordsCommands } from './commands/records.js';
19
19
  import { registerModelsCommands } from './commands/models.js';
20
20
  import { registerSearchCommands } from './commands/search.js';
21
21
  import { registerCustomersCommands } from './commands/customers.js';
22
+ import { registerCustomerProfilesCommands } from './commands/customer-profiles.js';
22
23
  import { registerSegmentsCommands } from './commands/segments.js';
23
24
  import { registerExperimentsCommands } from './commands/experiments.js';
24
25
  import { registerSettingsCommands } from './commands/settings.js';
@@ -61,6 +62,7 @@ registerRecordsCommands(program, getGlobalOpts);
61
62
  registerModelsCommands(program, getGlobalOpts);
62
63
  registerSearchCommands(program, getGlobalOpts);
63
64
  registerCustomersCommands(program, getGlobalOpts);
65
+ registerCustomerProfilesCommands(program, getGlobalOpts);
64
66
  registerSegmentsCommands(program, getGlobalOpts);
65
67
  registerExperimentsCommands(program, getGlobalOpts);
66
68
  registerSettingsCommands(program, getGlobalOpts);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Fetches the customer profile schema from the platform GraphQL API for codegen.
3
+ */
4
+ import type { GraphQLClient } from 'graphql-request';
5
+ import type { FieldSchemaForGen } from './field-mapping.js';
6
+ export interface CodegenCustomerProfileSchema {
7
+ id: string;
8
+ fields: FieldSchemaForGen[];
9
+ version: number;
10
+ }
11
+ export declare function fetchCustomerProfileSchema(client: GraphQLClient): Promise<CodegenCustomerProfileSchema | null>;
12
+ //# sourceMappingURL=fetch-customer-profile-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-customer-profile-schema.d.ts","sourceRoot":"","sources":["../../src/codegen/fetch-customer-profile-schema.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,4BAA4B;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAqBD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAiB9C"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Fetches the customer profile schema from the platform GraphQL API for codegen.
3
+ */
4
+ import { CUSTOMER_PROFILE_SCHEMA } from '../graphql/queries.js';
5
+ export async function fetchCustomerProfileSchema(client) {
6
+ const data = await client.request(CUSTOMER_PROFILE_SCHEMA);
7
+ if (!data.customerProfileSchema)
8
+ return null;
9
+ return {
10
+ id: data.customerProfileSchema.id,
11
+ version: data.customerProfileSchema.version,
12
+ fields: (data.customerProfileSchema.fields ?? []).map((f) => ({
13
+ key: f.key,
14
+ type: f.type,
15
+ label: f.label,
16
+ required: f.required,
17
+ helpText: f.helpText,
18
+ options: f.config,
19
+ })),
20
+ };
21
+ }
@@ -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,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EA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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,CAwCR;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAc3E;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,GAAG,CAAC,MAAM,CAAC,CAiBb;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAiFjE"}
@@ -30,26 +30,62 @@ export function isPrimitiveFieldType(type) {
30
30
  }
31
31
  export const FIELD_TYPE_MAPPING = {
32
32
  text: { outputType: 'string', inputType: 'string' },
33
- richtext: { outputType: 'RichtextValue', inputType: 'RichtextValue', needsImport: 'field-types' },
33
+ richtext: {
34
+ outputType: 'RichtextValue',
35
+ inputType: 'RichtextValue',
36
+ needsImport: 'field-types',
37
+ },
34
38
  number: { outputType: 'number', inputType: 'number' },
35
39
  boolean: { outputType: 'boolean', inputType: 'boolean' },
36
40
  email: { outputType: 'string', inputType: 'string' },
37
41
  phone: { outputType: 'string', inputType: 'string' },
38
42
  url: { outputType: 'string', inputType: 'string' },
39
43
  date: { outputType: 'Date', inputType: 'string' },
40
- image: { outputType: 'ImageValue', inputType: 'string', needsImport: 'field-types' },
41
- video: { outputType: 'VideoValue', inputType: 'string', needsImport: 'field-types' },
42
- file: { outputType: 'FileValue', inputType: 'string', needsImport: 'field-types' },
43
- currency: { outputType: 'CurrencyValue', inputType: 'CurrencyValue', needsImport: 'field-types' },
44
+ image: {
45
+ outputType: 'ImageValue',
46
+ inputType: 'string',
47
+ needsImport: 'field-types',
48
+ },
49
+ video: {
50
+ outputType: 'VideoValue',
51
+ inputType: 'string',
52
+ needsImport: 'field-types',
53
+ },
54
+ file: {
55
+ outputType: 'FileValue',
56
+ inputType: 'string',
57
+ needsImport: 'field-types',
58
+ },
59
+ currency: {
60
+ outputType: 'CurrencyValue',
61
+ inputType: 'CurrencyValue',
62
+ needsImport: 'field-types',
63
+ },
44
64
  select: { outputType: 'string', inputType: 'string' },
45
65
  multiselect: { outputType: 'string[]', inputType: 'string[]' },
46
66
  json: { outputType: 'unknown', inputType: 'unknown' },
47
67
  list: { outputType: 'unknown[]', inputType: 'unknown[]' },
48
68
  tree: { outputType: 'unknown[]', inputType: 'unknown[]' },
49
- flexible: { outputType: 'FlexibleFieldItem[]', inputType: 'FlexibleFieldItem[]', needsImport: 'field-types' },
50
- 'entity-reference': { outputType: 'ReferenceValue', inputType: 'ReferenceValue', needsImport: 'field-types' },
51
- reference: { outputType: 'ReferenceValue', inputType: 'ReferenceValue', needsImport: 'field-types' },
52
- link: { outputType: 'LinkValue', inputType: 'LinkValue', needsImport: 'field-types' },
69
+ flexible: {
70
+ outputType: 'FlexibleFieldItem[]',
71
+ inputType: 'FlexibleFieldItem[]',
72
+ needsImport: 'field-types',
73
+ },
74
+ 'entity-reference': {
75
+ outputType: 'ReferenceValue',
76
+ inputType: 'ReferenceValue',
77
+ needsImport: 'field-types',
78
+ },
79
+ reference: {
80
+ outputType: 'ReferenceValue',
81
+ inputType: 'ReferenceValue',
82
+ needsImport: 'field-types',
83
+ },
84
+ link: {
85
+ outputType: 'LinkValue',
86
+ inputType: 'LinkValue',
87
+ needsImport: 'field-types',
88
+ },
53
89
  };
54
90
  export function getFieldType(field, mode = 'output') {
55
91
  if (!field?.type)
@@ -73,7 +109,8 @@ export function getFieldType(field, mode = 'output') {
73
109
  tsType = `(${options.map((o) => `'${o.value}'`).join(' | ')})[]`;
74
110
  }
75
111
  }
76
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
112
+ if ((field.type === 'list' || field.type === 'tree') &&
113
+ field.options?.itemType) {
77
114
  const itemType = field.options.itemType;
78
115
  const itemMapping = FIELD_TYPE_MAPPING[itemType];
79
116
  if (itemMapping) {
@@ -91,7 +128,8 @@ export function getRequiredImports(fields) {
91
128
  const mapping = FIELD_TYPE_MAPPING[field.type];
92
129
  if (mapping?.needsImport)
93
130
  imports.add(mapping.needsImport);
94
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
131
+ if ((field.type === 'list' || field.type === 'tree') &&
132
+ field.options?.itemType) {
95
133
  const itemMapping = FIELD_TYPE_MAPPING[field.options.itemType];
96
134
  if (itemMapping?.needsImport)
97
135
  imports.add(itemMapping.needsImport);
@@ -105,7 +143,8 @@ export function getInlineSchemaReferences(fields) {
105
143
  if (!isPrimitiveFieldType(field.type) && !FIELD_TYPE_MAPPING[field.type]) {
106
144
  refs.add(field.type);
107
145
  }
108
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
146
+ if ((field.type === 'list' || field.type === 'tree') &&
147
+ field.options?.itemType) {
109
148
  const itemType = field.options.itemType;
110
149
  if (!isPrimitiveFieldType(itemType) && !FIELD_TYPE_MAPPING[itemType]) {
111
150
  refs.add(itemType);
@@ -156,7 +195,8 @@ export function generateFieldDef(field) {
156
195
  if (field.options.step !== undefined)
157
196
  parts.push(`step: ${field.options.step}`);
158
197
  }
159
- if ((field.type === 'select' || field.type === 'multiselect') && field.options?.options) {
198
+ if ((field.type === 'select' || field.type === 'multiselect') &&
199
+ field.options?.options) {
160
200
  const options = field.options.options;
161
201
  const optionsStr = options
162
202
  .filter((o) => o.value !== undefined)
@@ -168,20 +208,24 @@ export function generateFieldDef(field) {
168
208
  .join(', ');
169
209
  parts.push(`options: [${optionsStr}]`);
170
210
  }
171
- if ((field.type === 'entity-reference' || field.type === 'reference') && field.options?.referenceTypes) {
211
+ if ((field.type === 'entity-reference' || field.type === 'reference') &&
212
+ field.options?.referenceTypes) {
172
213
  const refTypes = field.options.referenceTypes;
173
214
  parts.push(`referenceTypes: [${refTypes.map((t) => `'${t}'`).join(', ')}]`);
174
215
  if (field.options.multiple)
175
216
  parts.push('multiple: true');
176
217
  }
177
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
218
+ if ((field.type === 'list' || field.type === 'tree') &&
219
+ field.options?.itemType) {
178
220
  parts.push(`itemType: '${field.options.itemType}'`);
179
221
  if (field.options.minItems !== undefined)
180
222
  parts.push(`minItems: ${field.options.minItems}`);
181
223
  if (field.options.maxItems !== undefined)
182
224
  parts.push(`maxItems: ${field.options.maxItems}`);
183
225
  }
184
- if ((field.type === 'image' || field.type === 'video' || field.type === 'file') &&
226
+ if ((field.type === 'image' ||
227
+ field.type === 'video' ||
228
+ field.type === 'file') &&
185
229
  field.options) {
186
230
  if (field.options.allowedTypes) {
187
231
  const types = field.options.allowedTypes;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates TypeScript types for the customer profile schema.
3
+ */
4
+ import type { CodegenCustomerProfileSchema } from '../fetch-customer-profile-schema.js';
5
+ export declare function generateCustomerProfileTypes(schema: CodegenCustomerProfileSchema): string;
6
+ //# sourceMappingURL=customer-profile-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-profile-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAQxF,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,4BAA4B,GACnC,MAAM,CAqCR"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Generates TypeScript types for the customer profile schema.
3
+ */
4
+ import { getFieldType, sanitizeFieldName, FIELD_TYPE_MAPPING, } from '../field-mapping.js';
5
+ export function generateCustomerProfileTypes(schema) {
6
+ const fields = schema.fields ?? [];
7
+ const fieldTypeImports = getFieldTypeImportsForFields(fields);
8
+ let code = `/**
9
+ * Customer Profile Types
10
+ *
11
+ * @generated by foir from customer profile schema (version ${schema.version}) — DO NOT EDIT MANUALLY
12
+ */\n\n`;
13
+ if (fieldTypeImports.size > 0) {
14
+ const types = Array.from(fieldTypeImports).sort().join(', ');
15
+ code += `import type { ${types} } from '../field-types.js';\n\n`;
16
+ }
17
+ code += `/**
18
+ * Customer Profile Data
19
+ * Typed field values for customer profiles
20
+ *
21
+ * @generated from customer profile schema (version ${schema.version})
22
+ */\n`;
23
+ code += `export interface CustomerProfileData {\n`;
24
+ for (const field of fields) {
25
+ const fieldName = sanitizeFieldName(field.key);
26
+ const fieldType = getFieldType(field, 'output');
27
+ const optional = field.required ? '' : '?';
28
+ if (field.helpText) {
29
+ code += ` /** ${field.helpText} */\n`;
30
+ }
31
+ code += ` ${fieldName}${optional}: ${fieldType};\n`;
32
+ }
33
+ code += `}\n`;
34
+ return code;
35
+ }
36
+ function getFieldTypeImportsForFields(fields) {
37
+ const imports = new Set();
38
+ for (const field of fields) {
39
+ const mapping = FIELD_TYPE_MAPPING[field.type];
40
+ if (mapping?.needsImport === 'field-types') {
41
+ imports.add(mapping.outputType);
42
+ }
43
+ }
44
+ return imports;
45
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"model-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/model-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBvD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,YAAY,EAAE,GACxB,MAAM,CAoBR"}
1
+ {"version":3,"file":"model-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/model-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBvD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,YAAY,EAAE,GACxB,MAAM,CAyBR"}
@@ -119,7 +119,8 @@ function generateDataInterface(model, fields, interfaceName, allModels) {
119
119
  fieldType = toPascalCase(field.type) + 'Data';
120
120
  }
121
121
  // Handle list/tree itemType refs
122
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
122
+ if ((field.type === 'list' || field.type === 'tree') &&
123
+ field.options?.itemType) {
123
124
  const itemRefModel = allModels.find((m) => m.key === field.options.itemType);
124
125
  if (itemRefModel && !isInlineOnlyModel(itemRefModel)) {
125
126
  fieldType = toPascalCase(field.options.itemType) + 'Data[]';
@@ -139,7 +140,8 @@ function getFieldTypeImportsForFields(fields) {
139
140
  if (mapping?.needsImport === 'field-types') {
140
141
  imports.add(mapping.outputType);
141
142
  }
142
- if ((field.type === 'list' || field.type === 'tree') && field.options?.itemType) {
143
+ if ((field.type === 'list' || field.type === 'tree') &&
144
+ field.options?.itemType) {
143
145
  const itemMapping = FIELD_TYPE_MAPPING[field.options.itemType];
144
146
  if (itemMapping?.needsImport === 'field-types') {
145
147
  imports.add(itemMapping.outputType);
@@ -1 +1 @@
1
- {"version":3,"file":"swift-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/swift-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAkClE"}
1
+ {"version":3,"file":"swift-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/swift-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQvD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAkClE"}
@@ -6,7 +6,7 @@
6
6
  * - Model config constant
7
7
  */
8
8
  import { toPascalCase } from '../field-mapping.js';
9
- import { getSwiftFieldType, SWIFT_FIELD_TYPE_MAPPING } from '../swift-field-mapping.js';
9
+ import { getSwiftFieldType, SWIFT_FIELD_TYPE_MAPPING, } from '../swift-field-mapping.js';
10
10
  /**
11
11
  * Generate a complete Swift file for a single model.
12
12
  */
@@ -112,7 +112,9 @@ function generateSerializationExtension(typeName, fields) {
112
112
  lines.push(' }');
113
113
  lines.push('');
114
114
  // fromSyncData()
115
- lines.push(' static func fromSyncData(_ data: [String: Any]) -> ' + typeName + 'Data {');
115
+ lines.push(' static func fromSyncData(_ data: [String: Any]) -> ' +
116
+ typeName +
117
+ 'Data {');
116
118
  lines.push(` ${typeName}Data(`);
117
119
  fields.forEach((field, i) => {
118
120
  const comma = i < fields.length - 1 ? ',' : '';
@@ -1 +1 @@
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,CAIf"}
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"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from 'commander';
2
+ import type { GlobalOptions } from '../lib/config.js';
3
+ export declare function registerCustomerProfilesCommands(program: Command, globalOpts: () => GlobalOptions): void;
4
+ //# sourceMappingURL=customer-profiles.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,97 @@
1
+ import { withErrorHandler } from '../lib/errors.js';
2
+ import { createClient } from '../lib/client.js';
3
+ import { formatOutput, success } from '../lib/output.js';
4
+ import { parseInputData } from '../lib/input.js';
5
+ import { CUSTOMER_PROFILE_SCHEMA, UPDATE_CUSTOMER_PROFILE_SCHEMA, CUSTOMER_PROFILE, SET_CUSTOMER_PROFILE, } from '../graphql/queries.js';
6
+ export function registerCustomerProfilesCommands(program, globalOpts) {
7
+ const cp = program
8
+ .command('customer-profiles')
9
+ .alias('cp')
10
+ .description('Manage customer profile schema and profiles');
11
+ // --- Schema subcommands ---
12
+ const schema = cp
13
+ .command('schema')
14
+ .description('Manage the customer profile schema');
15
+ // schema get
16
+ schema
17
+ .command('get')
18
+ .description('Get the customer profile schema for the current project')
19
+ .action(withErrorHandler(globalOpts, async () => {
20
+ const opts = globalOpts();
21
+ const client = await createClient(opts);
22
+ const data = await client.request(CUSTOMER_PROFILE_SCHEMA);
23
+ if (!data.customerProfileSchema) {
24
+ if (opts.json || opts.jsonl) {
25
+ formatOutput(null, opts);
26
+ }
27
+ else {
28
+ console.log('No customer profile schema defined. Use "customer-profiles schema update" to create one.');
29
+ }
30
+ return;
31
+ }
32
+ formatOutput(data.customerProfileSchema, opts);
33
+ }));
34
+ // schema update
35
+ schema
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')
40
+ .action(withErrorHandler(globalOpts, async (cmdOpts) => {
41
+ const opts = globalOpts();
42
+ const client = await createClient(opts);
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"}]');
51
+ }
52
+ const data = await client.request(UPDATE_CUSTOMER_PROFILE_SCHEMA, { fields });
53
+ formatOutput(data.updateCustomerProfileSchema, opts);
54
+ if (!(opts.json || opts.jsonl || opts.quiet)) {
55
+ const version = data.updateCustomerProfileSchema.version;
56
+ success(`Updated customer profile schema (version ${version})`);
57
+ }
58
+ }));
59
+ // --- Profile subcommands ---
60
+ const profile = cp
61
+ .command('profile')
62
+ .description('Manage individual customer profiles');
63
+ // profile get
64
+ profile
65
+ .command('get <customerId>')
66
+ .description("Get a customer's profile data")
67
+ .action(withErrorHandler(globalOpts, async (customerId) => {
68
+ const opts = globalOpts();
69
+ const client = await createClient(opts);
70
+ const data = await client.request(CUSTOMER_PROFILE, { customerId });
71
+ if (!data.customerProfile) {
72
+ throw new Error(`No profile found for customer "${customerId}".`);
73
+ }
74
+ formatOutput(data.customerProfile, opts);
75
+ }));
76
+ // profile set
77
+ profile
78
+ .command('set <customerId>')
79
+ .description("Set a customer's profile data")
80
+ .option('-d, --data <json>', 'Profile data as JSON')
81
+ .option('-f, --file <path>', 'Read data from file')
82
+ .action(withErrorHandler(globalOpts, async (customerId, cmdOpts) => {
83
+ const opts = globalOpts();
84
+ const client = await createClient(opts);
85
+ const inputData = await parseInputData(cmdOpts);
86
+ // Accept either { data: {...} } or the raw data object
87
+ const profileData = inputData.data ?? inputData;
88
+ const data = await client.request(SET_CUSTOMER_PROFILE, {
89
+ customerId,
90
+ data: profileData,
91
+ });
92
+ formatOutput(data.setCustomerProfile, opts);
93
+ if (!(opts.json || opts.jsonl || opts.quiet)) {
94
+ success(`Set profile for customer ${customerId}`);
95
+ }
96
+ }));
97
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAgBtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAmJN"}
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAqBtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA8KN"}
@@ -3,7 +3,8 @@ import chalk from 'chalk';
3
3
  import { withErrorHandler } from '../lib/errors.js';
4
4
  import { createClient } from '../lib/client.js';
5
5
  import { loadPullConfig } from '../config/pull-config.js';
6
- import { fetchModelsForCodegen, filterModels } from '../codegen/fetch-models.js';
6
+ import { fetchModelsForCodegen, filterModels, } from '../codegen/fetch-models.js';
7
+ import { fetchCustomerProfileSchema } from '../codegen/fetch-customer-profile-schema.js';
7
8
  import { toPascalCase } from '../codegen/field-mapping.js';
8
9
  import { generateFieldTypesFile } from '../codegen/generators/field-types.js';
9
10
  import { generateConfigFile } from '../codegen/generators/config.js';
@@ -13,6 +14,7 @@ import { generateModelDocuments } from '../codegen/generators/documents.js';
13
14
  import { generateSwiftModelFile } from '../codegen/generators/swift-types.js';
14
15
  import { generateSwiftFieldTypesFile } from '../codegen/generators/swift-field-types.js';
15
16
  import { generateSwiftModelKeys } from '../codegen/generators/swift-model-keys.js';
17
+ import { generateCustomerProfileTypes } from '../codegen/generators/customer-profile-types.js';
16
18
  import { writeFiles } from '../codegen/write-files.js';
17
19
  export function registerPullCommand(program, globalOpts) {
18
20
  program
@@ -35,11 +37,14 @@ export function registerPullCommand(program, globalOpts) {
35
37
  swift: cmdOpts.swift,
36
38
  };
37
39
  const config = await loadPullConfig(flags);
38
- // Fetch models
40
+ // Fetch models + customer profile schema
39
41
  const client = await createClient(opts);
40
42
  console.log(chalk.dim('Fetching models…'));
41
- const allModels = await fetchModelsForCodegen(client);
42
- if (allModels.length === 0) {
43
+ const [allModels, cpSchema] = await Promise.all([
44
+ fetchModelsForCodegen(client),
45
+ fetchCustomerProfileSchema(client),
46
+ ]);
47
+ if (allModels.length === 0 && !cpSchema) {
43
48
  console.log(chalk.yellow('No models found. Nothing to generate.'));
44
49
  return;
45
50
  }
@@ -74,7 +79,14 @@ export function registerPullCommand(program, globalOpts) {
74
79
  path: resolve(typesDir, 'models', 'index.ts'),
75
80
  content: generateModelIndex(models),
76
81
  });
77
- // 4. Per-model GraphQL documents (only for publicApi models with records)
82
+ // 4. Customer profile types (when schema exists)
83
+ if (cpSchema && cpSchema.fields.length > 0) {
84
+ files.push({
85
+ path: resolve(typesDir, 'customer-profile.ts'),
86
+ content: generateCustomerProfileTypes(cpSchema),
87
+ });
88
+ }
89
+ // 5. Per-model GraphQL documents (only for publicApi models with records)
78
90
  const publicModels = models.filter((m) => m.config.publicApi && m.config.records);
79
91
  for (const model of publicModels) {
80
92
  files.push({
@@ -82,12 +94,13 @@ export function registerPullCommand(program, globalOpts) {
82
94
  content: generateModelDocuments(model),
83
95
  });
84
96
  }
85
- // 5. Main index
97
+ // 6. Main index
98
+ const hasCustomerProfile = !!(cpSchema && cpSchema.fields.length > 0);
86
99
  files.push({
87
100
  path: resolve(typesDir, 'index.ts'),
88
- content: generateMainIndex(),
101
+ content: generateMainIndex(hasCustomerProfile),
89
102
  });
90
- // 6. Swift output (when configured)
103
+ // 7. Swift output (when configured)
91
104
  if (config.output.swift) {
92
105
  const swiftDir = resolve(cwd, config.output.swift);
93
106
  // Shared types
@@ -125,8 +138,9 @@ export function registerPullCommand(program, globalOpts) {
125
138
  const modelCount = models.length;
126
139
  const docCount = publicModels.length;
127
140
  const swiftCount = config.output.swift ? models.length + 2 : 0; // +2 for FieldTypes + ModelKeys
141
+ const cpSuffix = hasCustomerProfile ? ', customer profile' : '';
128
142
  console.log(chalk.green(`\nGenerated ${files.length} file(s)`) +
129
- chalk.dim(` (${modelCount} model type(s), ${docCount} document(s)${swiftCount > 0 ? `, ${swiftCount} Swift file(s)` : ''})`));
143
+ chalk.dim(` (${modelCount} model type(s), ${docCount} document(s)${cpSuffix}${swiftCount > 0 ? `, ${swiftCount} Swift file(s)` : ''})`));
130
144
  console.log(chalk.dim(` Types: ${typesDir}`));
131
145
  if (docCount > 0) {
132
146
  console.log(chalk.dim(` Documents: ${docsDir}`));
@@ -136,8 +150,8 @@ export function registerPullCommand(program, globalOpts) {
136
150
  }
137
151
  }));
138
152
  }
139
- function generateMainIndex() {
140
- return `/**
153
+ function generateMainIndex(includeCustomerProfile) {
154
+ let code = `/**
141
155
  * Generated types and configs
142
156
  *
143
157
  * @generated by foir — DO NOT EDIT MANUALLY
@@ -147,4 +161,8 @@ export * from './field-types.js';
147
161
  export * from './config.js';
148
162
  export * from './models/index.js';
149
163
  `;
164
+ if (includeCustomerProfile) {
165
+ code += `export * from './customer-profile.js';\n`;
166
+ }
167
+ return code;
150
168
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pull-config.d.ts","sourceRoot":"","sources":["../../src/config/pull-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+CH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAwB7B"}
1
+ {"version":3,"file":"pull-config.d.ts","sourceRoot":"","sources":["../../src/config/pull-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+CH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,kBAAkB,CAAC,CA4B7B"}
@@ -55,10 +55,14 @@ export async function loadPullConfig(flags) {
55
55
  const types = flags.out ?? fileConfig.output?.types ?? DEFAULT_TYPES_DIR;
56
56
  const documents = fileConfig.output?.documents ?? DEFAULT_DOCS_DIR;
57
57
  const swift = flags.swift ?? fileConfig.output?.swift;
58
- const output = { types, documents, ...(swift ? { swift } : {}) };
58
+ const output = {
59
+ types,
60
+ documents,
61
+ ...(swift ? { swift } : {}),
62
+ };
59
63
  const only = flags.only
60
64
  ? flags.only.split(',').map((s) => s.trim())
61
- : fileConfig.only ?? [];
65
+ : (fileConfig.only ?? []);
62
66
  const includeInline = fileConfig.includeInline ?? true;
63
67
  const prettier = flags.noPrettier ? false : (fileConfig.prettier ?? true);
64
68
  const dryRun = flags.dryRun ?? false;
@@ -23,6 +23,10 @@ export declare const UPDATE_MODEL = "\n mutation($input: UpdateModelInput!) { u
23
23
  export declare const DELETE_MODEL = "\n mutation($id: ID!) { deleteModel(id: $id) }\n";
24
24
  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";
25
25
  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";
26
+ 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";
27
+ 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";
28
+ export declare const CUSTOMER_PROFILE = "\n query($customerId: ID!) { customerProfile(customerId: $customerId) { id customerId data schemaVersionNumber createdAt updatedAt createdBy updatedBy } }\n";
29
+ export declare const SET_CUSTOMER_PROFILE = "\n mutation($customerId: ID!, $data: JSON!) { setCustomerProfile(customerId: $customerId, data: $data) { id customerId data schemaVersionNumber createdAt updatedAt } }\n";
26
30
  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";
27
31
  export declare const CUSTOMER = "\n query($id: ID!) { customer(id: $id) { id email status lastLoginAt createdAt updatedAt } }\n";
28
32
  export declare const CUSTOMER_BY_EMAIL = "\n query($email: String!) { customerByEmail(email: $email) { id email status lastLoginAt createdAt updatedAt } }\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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M,kBAAkB,uFAE9B,CAAC;AAEF,eAAO,MAAM,WAAW,uRAEvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,qOAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,qDAEvB,CAAC;AAIF,eAAO,MAAM,KAAK,6XAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,qLAEhB,CAAC;AAEF,eAAO,MAAM,WAAW,8HAEvB,CAAC;AAEF,eAAO,MAAM,YAAY,qHAExB,CAAC;AAEF,eAAO,MAAM,WAAW,iEAEvB,CAAC;AAIF,eAAO,MAAM,eAAe,qNAE3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yIAEjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qJAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,iJAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,oKAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,oEAExC,CAAC"}
@@ -107,6 +107,19 @@ export const GLOBAL_SEARCH = `
107
107
  }
108
108
  }
109
109
  `;
110
+ // --- Customer Profile Schema ---
111
+ export const CUSTOMER_PROFILE_SCHEMA = `
112
+ query { customerProfileSchema { id fields { id key label type required helpText placeholder defaultValue config validation { rule value message } isTranslatable } version createdAt updatedAt updatedBy } }
113
+ `;
114
+ export const UPDATE_CUSTOMER_PROFILE_SCHEMA = `
115
+ 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 } }
116
+ `;
117
+ export const CUSTOMER_PROFILE = `
118
+ query($customerId: ID!) { customerProfile(customerId: $customerId) { id customerId data schemaVersionNumber createdAt updatedAt createdBy updatedBy } }
119
+ `;
120
+ export const SET_CUSTOMER_PROFILE = `
121
+ mutation($customerId: ID!, $data: JSON!) { setCustomerProfile(customerId: $customerId, data: $data) { id customerId data schemaVersionNumber createdAt updatedAt } }
122
+ `;
110
123
  // --- Customers ---
111
124
  export const CUSTOMERS = `
112
125
  query($status: CustomerStatus, $search: String, $filters: [FilterInput!], $limit: Int, $offset: Int) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Universal platform CLI for EIDE — scriptable, composable resource management",
5
5
  "type": "module",
6
6
  "publishConfig": {