@eide/foir-cli 0.1.33 → 0.1.34

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.
@@ -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,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,CAW3E;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,GAAG,CAAC,MAAM,CAAC,CAUb;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,GAAG,CAAC,MAAM,CAAC,CAcb;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,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AAC,MAAM,CAAC,CAUb;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,CA2EjE"}
@@ -22,6 +22,7 @@ export const PRIMITIVE_FIELD_TYPES = new Set([
22
22
  'reference',
23
23
  'link',
24
24
  'flexible',
25
+ 'model',
25
26
  ]);
26
27
  export function isPrimitiveFieldType(type) {
27
28
  return PRIMITIVE_FIELD_TYPES.has(type);
@@ -78,6 +79,7 @@ export const FIELD_TYPE_MAPPING = {
78
79
  inputType: 'LinkValue',
79
80
  needsImport: 'field-types',
80
81
  },
82
+ model: { outputType: 'string', inputType: 'string' },
81
83
  };
82
84
  export function getFieldType(field, mode = 'output') {
83
85
  if (!field?.type)
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAiGlE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAoBhD"}
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAyGlE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAoBhD"}
@@ -25,10 +25,10 @@ fragment ${typeName}Fields on Record {
25
25
  updatedAt
26
26
  }
27
27
 
28
- query Get${typeName}($id: ID!, $locale: String, $preview: Boolean) {
28
+ query Get${typeName}($id: ID!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
29
29
  record(id: $id) {
30
30
  ...${typeName}Fields
31
- resolved(locale: $locale, preview: $preview) {
31
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
32
32
  content
33
33
  record { id modelKey naturalKey }
34
34
  version { id versionNumber }
@@ -36,10 +36,10 @@ query Get${typeName}($id: ID!, $locale: String, $preview: Boolean) {
36
36
  }
37
37
  }
38
38
 
39
- query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean) {
39
+ query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
40
40
  recordByKey(modelKey: "${model.key}", naturalKey: $naturalKey) {
41
41
  ...${typeName}Fields
42
- resolved(locale: $locale, preview: $preview) {
42
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
43
43
  content
44
44
  record { id modelKey naturalKey }
45
45
  version { id versionNumber }
@@ -52,6 +52,9 @@ query List${pluralName}(
52
52
  $offset: Int
53
53
  $filters: [FilterInput!]
54
54
  $sort: SortInput
55
+ $locale: String
56
+ $preview: Boolean
57
+ $fields: FieldSelectionInput
55
58
  ) {
56
59
  records(
57
60
  modelKey: "${model.key}"
@@ -62,6 +65,11 @@ query List${pluralName}(
62
65
  ) {
63
66
  items {
64
67
  ...${typeName}Fields
68
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
69
+ content
70
+ record { id modelKey naturalKey }
71
+ version { id versionNumber }
72
+ }
65
73
  }
66
74
  total
67
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"typed-operations-common.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/typed-operations-common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAuE1E"}
1
+ {"version":3,"file":"typed-operations-common.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/typed-operations-common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA+E1E"}
@@ -35,7 +35,7 @@ export interface ResolvedContent<T> {
35
35
 
36
36
  /** Paginated list result. */
37
37
  export interface PaginatedResult<T> {
38
- items: BaseRecord<T>[];
38
+ items: (BaseRecord<T> & { resolved: ResolvedContent<T> | null })[];
39
39
  total: number;
40
40
  }
41
41
 
@@ -72,5 +72,13 @@ export interface ShareResult {
72
72
  export interface ShareWithRecord<T> extends ShareResult {
73
73
  record: BaseRecord<T>;
74
74
  }
75
+
76
+ /** Field selection for resolved content — pick or omit specific fields. */
77
+ export interface FieldSelection<T = Record<string, unknown>> {
78
+ /** Include only these field keys (mutually exclusive with omit) */
79
+ pick?: (keyof T & string)[];
80
+ /** Exclude these field keys (mutually exclusive with omit) */
81
+ omit?: (keyof T & string)[];
82
+ }
75
83
  `;
76
84
  }
@@ -1 +1 @@
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,CA6QR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG5E"}
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"}
@@ -29,7 +29,8 @@ import type {
29
29
  PaginatedResult,
30
30
  CreateRecordResult,
31
31
  UpdateRecordResult,
32
- DeleteRecordResult,${model.config.sharing?.enabled ? '\n ShareResult,\n ShareWithRecord,' : ''}
32
+ DeleteRecordResult,
33
+ FieldSelection,${model.config.sharing?.enabled ? '\n ShareResult,\n ShareWithRecord,' : ''}
33
34
  } from './_common.js';
34
35
  `);
35
36
  // Type alias
@@ -37,12 +38,12 @@ import type {
37
38
  lines.push('');
38
39
  // GET query
39
40
  lines.push(`export const GET_${upperSnake} = \`
40
- query Get${typeName}($id: ID!, $locale: String, $preview: Boolean) {
41
+ query Get${typeName}($id: ID!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
41
42
  record(id: $id) {
42
43
  id modelKey naturalKey data metadata
43
44
  publishedVersionNumber publishedAt versionNumber changeDescription
44
45
  createdAt updatedAt
45
- resolved(locale: $locale, preview: $preview) {
46
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
46
47
  content
47
48
  record { id modelKey naturalKey }
48
49
  version { id versionNumber }
@@ -55,6 +56,7 @@ import type {
55
56
  id: string;
56
57
  locale?: string;
57
58
  preview?: boolean;
59
+ fields?: FieldSelection<${dataType}>;
58
60
  }`);
59
61
  lines.push('');
60
62
  lines.push(`export interface Get${typeName}Result {
@@ -65,12 +67,12 @@ import type {
65
67
  lines.push('');
66
68
  // GET BY KEY query
67
69
  lines.push(`export const GET_${upperSnake}_BY_KEY = \`
68
- query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean) {
70
+ query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
69
71
  recordByKey(modelKey: "${model.key}", naturalKey: $naturalKey) {
70
72
  id modelKey naturalKey data metadata
71
73
  publishedVersionNumber publishedAt versionNumber changeDescription
72
74
  createdAt updatedAt
73
- resolved(locale: $locale, preview: $preview) {
75
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
74
76
  content
75
77
  record { id modelKey naturalKey }
76
78
  version { id versionNumber }
@@ -83,6 +85,7 @@ import type {
83
85
  naturalKey: string;
84
86
  locale?: string;
85
87
  preview?: boolean;
88
+ fields?: FieldSelection<${dataType}>;
86
89
  }`);
87
90
  lines.push('');
88
91
  lines.push(`export interface Get${typeName}ByKeyResult {
@@ -93,12 +96,17 @@ import type {
93
96
  lines.push('');
94
97
  // LIST query
95
98
  lines.push(`export const LIST_${pluralUpperSnake} = \`
96
- query List${pluralName}($limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {
99
+ query List${pluralName}($limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
97
100
  records(modelKey: "${model.key}", limit: $limit, offset: $offset, filters: $filters, sort: $sort) {
98
101
  items {
99
102
  id modelKey naturalKey data metadata
100
103
  publishedVersionNumber publishedAt versionNumber changeDescription
101
104
  createdAt updatedAt
105
+ resolved(locale: $locale, preview: $preview, fields: $fields) {
106
+ content
107
+ record { id modelKey naturalKey }
108
+ version { id versionNumber }
109
+ }
102
110
  }
103
111
  total
104
112
  }
@@ -110,6 +118,9 @@ import type {
110
118
  offset?: number;
111
119
  filters?: Array<{ field: string; operator: string; value: JsonValue }>;
112
120
  sort?: { field: string; direction: 'ASC' | 'DESC' };
121
+ locale?: string;
122
+ preview?: boolean;
123
+ fields?: FieldSelection<${dataType}>;
113
124
  }`);
114
125
  lines.push('');
115
126
  lines.push(`export interface List${pluralName}Result {
@@ -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,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"}
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"}
@@ -124,6 +124,12 @@ export const SWIFT_FIELD_TYPE_MAPPING = {
124
124
  castExpression: 'as? [String: Any]',
125
125
  needsSharedType: true,
126
126
  },
127
+ model: {
128
+ type: 'String',
129
+ alwaysOptional: true,
130
+ defaultValue: '""',
131
+ castExpression: 'as? String',
132
+ },
127
133
  };
128
134
  /**
129
135
  * Get the Swift type for a field.
@@ -1583,6 +1583,13 @@ export type FieldOperationInput = {
1583
1583
  path: Scalars['String']['input'];
1584
1584
  value?: InputMaybe<Scalars['JSON']['input']>;
1585
1585
  };
1586
+ /** Field selection for resolved content — pick or omit specific fields */
1587
+ export type FieldSelectionInput = {
1588
+ /** Exclude these field keys (mutually exclusive with omit) */
1589
+ omit?: InputMaybe<Array<Scalars['String']['input']>>;
1590
+ /** Include only these field keys (mutually exclusive with omit) */
1591
+ pick?: InputMaybe<Array<Scalars['String']['input']>>;
1592
+ };
1586
1593
  /** A file stored in the system (unified: images, videos, documents, etc.) */
1587
1594
  export type File = {
1588
1595
  /** Alt text for accessibility */
@@ -4792,6 +4799,7 @@ export type Record = {
4792
4799
  };
4793
4800
  export type RecordResolvedArgs = {
4794
4801
  contexts?: InputMaybe<Scalars['JSON']['input']>;
4802
+ fields?: InputMaybe<FieldSelectionInput>;
4795
4803
  locale?: InputMaybe<Scalars['String']['input']>;
4796
4804
  maxDepth?: InputMaybe<Scalars['Int']['input']>;
4797
4805
  preview?: InputMaybe<Scalars['Boolean']['input']>;