@eide/foir-cli 0.1.34 → 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 (221) hide show
  1. package/dist/cli.js +7469 -81
  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 -7
  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 -176
  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/pull.d.ts +0 -4
  162. package/dist/commands/pull.d.ts.map +0 -1
  163. package/dist/commands/pull.js +0 -300
  164. package/dist/commands/records.d.ts +0 -4
  165. package/dist/commands/records.d.ts.map +0 -1
  166. package/dist/commands/records.js +0 -314
  167. package/dist/commands/schedules.d.ts +0 -4
  168. package/dist/commands/schedules.d.ts.map +0 -1
  169. package/dist/commands/schedules.js +0 -155
  170. package/dist/commands/search.d.ts +0 -4
  171. package/dist/commands/search.d.ts.map +0 -1
  172. package/dist/commands/search.js +0 -60
  173. package/dist/commands/segments.d.ts +0 -4
  174. package/dist/commands/segments.d.ts.map +0 -1
  175. package/dist/commands/segments.js +0 -155
  176. package/dist/commands/select-project.d.ts +0 -4
  177. package/dist/commands/select-project.d.ts.map +0 -1
  178. package/dist/commands/select-project.js +0 -144
  179. package/dist/commands/settings.d.ts +0 -4
  180. package/dist/commands/settings.d.ts.map +0 -1
  181. package/dist/commands/settings.js +0 -115
  182. package/dist/commands/variant-catalog.d.ts +0 -4
  183. package/dist/commands/variant-catalog.d.ts.map +0 -1
  184. package/dist/commands/variant-catalog.js +0 -118
  185. package/dist/commands/whoami.d.ts +0 -4
  186. package/dist/commands/whoami.d.ts.map +0 -1
  187. package/dist/commands/whoami.js +0 -51
  188. package/dist/config/pull-config.d.ts +0 -33
  189. package/dist/config/pull-config.d.ts.map +0 -1
  190. package/dist/config/pull-config.js +0 -119
  191. package/dist/config/types.d.ts.map +0 -1
  192. package/dist/graphql/generated.d.ts +0 -8330
  193. package/dist/graphql/generated.d.ts.map +0 -1
  194. package/dist/graphql/generated.js +0 -135
  195. package/dist/lib/client.d.ts +0 -18
  196. package/dist/lib/client.d.ts.map +0 -1
  197. package/dist/lib/client.js +0 -64
  198. package/dist/lib/config-loader.d.ts +0 -28
  199. package/dist/lib/config-loader.d.ts.map +0 -1
  200. package/dist/lib/config-loader.js +0 -49
  201. package/dist/lib/config.d.ts +0 -12
  202. package/dist/lib/config.d.ts.map +0 -1
  203. package/dist/lib/config.js +0 -8
  204. package/dist/lib/errors.d.ts +0 -6
  205. package/dist/lib/errors.d.ts.map +0 -1
  206. package/dist/lib/errors.js +0 -76
  207. package/dist/lib/extension-helpers.d.ts.map +0 -1
  208. package/dist/lib/hook-helpers.d.ts.map +0 -1
  209. package/dist/lib/input.d.ts +0 -38
  210. package/dist/lib/input.d.ts.map +0 -1
  211. package/dist/lib/input.js +0 -108
  212. package/dist/lib/output.d.ts +0 -31
  213. package/dist/lib/output.d.ts.map +0 -1
  214. package/dist/lib/output.js +0 -107
  215. package/dist/lib/seed-helpers.d.ts.map +0 -1
  216. package/dist/scaffold/package-manager.d.ts +0 -12
  217. package/dist/scaffold/package-manager.d.ts.map +0 -1
  218. package/dist/scaffold/package-manager.js +0 -51
  219. package/dist/scaffold/scaffold.d.ts +0 -4
  220. package/dist/scaffold/scaffold.d.ts.map +0 -1
  221. package/dist/scaffold/scaffold.js +0 -462
@@ -1,126 +0,0 @@
1
- /**
2
- * Generates typed operations for customer profiles.
3
- */
4
- export function generateCustomerProfileOperations(typesRelPath) {
5
- return `/**
6
- * Typed operations for Customer Profiles
7
- *
8
- * @generated by foir — DO NOT EDIT MANUALLY
9
- */
10
-
11
- import type { CustomerProfileData } from '${typesRelPath}/customer-profile.js';
12
-
13
- export const GET_MY_PROFILE = \`
14
- query GetMyProfile {
15
- myProfile {
16
- id
17
- customerId
18
- data
19
- createdAt
20
- updatedAt
21
- }
22
- }
23
- \`;
24
-
25
- export interface GetMyProfileResult {
26
- myProfile: {
27
- id: string;
28
- customerId: string;
29
- data: CustomerProfileData;
30
- createdAt: string;
31
- updatedAt: string;
32
- } | null;
33
- }
34
-
35
- export const GET_CUSTOMER_PROFILE = \`
36
- query GetCustomerProfile($customerId: ID!) {
37
- customerProfile(customerId: $customerId) {
38
- id
39
- customerId
40
- data
41
- createdAt
42
- updatedAt
43
- }
44
- }
45
- \`;
46
-
47
- export interface GetCustomerProfileVariables {
48
- customerId: string;
49
- }
50
-
51
- export interface GetCustomerProfileResult {
52
- customerProfile: {
53
- id: string;
54
- customerId: string;
55
- data: CustomerProfileData;
56
- createdAt: string;
57
- updatedAt: string;
58
- } | null;
59
- }
60
-
61
- export const SET_MY_PROFILE = \`
62
- mutation SetMyProfile($data: JSON!) {
63
- setMyProfile(data: $data) {
64
- id
65
- customerId
66
- data
67
- createdAt
68
- updatedAt
69
- }
70
- }
71
- \`;
72
-
73
- export interface SetMyProfileVariables {
74
- data: Partial<CustomerProfileData>;
75
- }
76
-
77
- export interface SetMyProfileResult {
78
- setMyProfile: {
79
- id: string;
80
- customerId: string;
81
- data: CustomerProfileData;
82
- createdAt: string;
83
- updatedAt: string;
84
- };
85
- }
86
-
87
- export const UPDATE_CUSTOMER_PROFILE = \`
88
- mutation UpdateCustomerProfile($customerId: ID, $input: CustomerProfileInput!) {
89
- updateCustomerProfile(customerId: $customerId, input: $input) {
90
- id
91
- customerId
92
- data
93
- createdAt
94
- updatedAt
95
- }
96
- }
97
- \`;
98
-
99
- export interface UpdateCustomerProfileVariables {
100
- customerId?: string;
101
- input: {
102
- data: Partial<CustomerProfileData>;
103
- };
104
- }
105
-
106
- export interface UpdateCustomerProfileResult {
107
- updateCustomerProfile: {
108
- id: string;
109
- customerId: string;
110
- data: CustomerProfileData;
111
- createdAt: string;
112
- updatedAt: string;
113
- };
114
- }
115
-
116
- export const DELETE_MY_PROFILE = \`
117
- mutation DeleteMyProfile {
118
- deleteMyProfile
119
- }
120
- \`;
121
-
122
- export interface DeleteMyProfileResult {
123
- deleteMyProfile: boolean;
124
- }
125
- `;
126
- }
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,45 +0,0 @@
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,12 +0,0 @@
1
- /**
2
- * Generates per-model .graphql files with CRUD operations for the public API.
3
- */
4
- import type { CodegenModel } from '../fetch-models.js';
5
- export declare function generateModelDocuments(model: CodegenModel): string;
6
- /**
7
- * Generate the shared ShareFields fragment file.
8
- * This must be emitted once (not per-model) to avoid duplicate fragment errors
9
- * in Apollo iOS and other codegen tools that validate across all .graphql files.
10
- */
11
- export declare function generateSharedFragments(): string;
12
- //# sourceMappingURL=documents.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,178 +0,0 @@
1
- /**
2
- * Generates per-model .graphql files with CRUD operations for the public API.
3
- */
4
- import { toPascalCase } from '../field-mapping.js';
5
- export function generateModelDocuments(model) {
6
- const typeName = toPascalCase(model.key);
7
- const pluralName = model.pluralName
8
- ? toPascalCase(model.pluralName.replace(/\s+/g, ''))
9
- : `${typeName}s`;
10
- const displayName = model.name ?? model.key;
11
- return `# Generated GraphQL operations for ${displayName}
12
- # @generated by foir — DO NOT EDIT MANUALLY
13
-
14
- fragment ${typeName}Fields on Record {
15
- id
16
- modelKey
17
- naturalKey
18
- data
19
- metadata
20
- publishedVersionNumber
21
- publishedAt
22
- versionNumber
23
- changeDescription
24
- createdAt
25
- updatedAt
26
- }
27
-
28
- query Get${typeName}($id: ID!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
29
- record(id: $id) {
30
- ...${typeName}Fields
31
- resolved(locale: $locale, preview: $preview, fields: $fields) {
32
- content
33
- record { id modelKey naturalKey }
34
- version { id versionNumber }
35
- }
36
- }
37
- }
38
-
39
- query Get${typeName}ByKey($naturalKey: String!, $locale: String, $preview: Boolean, $fields: FieldSelectionInput) {
40
- recordByKey(modelKey: "${model.key}", naturalKey: $naturalKey) {
41
- ...${typeName}Fields
42
- resolved(locale: $locale, preview: $preview, fields: $fields) {
43
- content
44
- record { id modelKey naturalKey }
45
- version { id versionNumber }
46
- }
47
- }
48
- }
49
-
50
- query List${pluralName}(
51
- $limit: Int
52
- $offset: Int
53
- $filters: [FilterInput!]
54
- $sort: SortInput
55
- $locale: String
56
- $preview: Boolean
57
- $fields: FieldSelectionInput
58
- ) {
59
- records(
60
- modelKey: "${model.key}"
61
- limit: $limit
62
- offset: $offset
63
- filters: $filters
64
- sort: $sort
65
- ) {
66
- items {
67
- ...${typeName}Fields
68
- resolved(locale: $locale, preview: $preview, fields: $fields) {
69
- content
70
- record { id modelKey naturalKey }
71
- version { id versionNumber }
72
- }
73
- }
74
- total
75
- }
76
- }
77
-
78
- mutation Create${typeName}($input: CreateRecordInput!) {
79
- createRecord(input: $input) {
80
- record {
81
- ...${typeName}Fields
82
- }
83
- }
84
- }
85
-
86
- mutation Update${typeName}($input: UpdateRecordInput!) {
87
- updateRecord(input: $input) {
88
- record {
89
- ...${typeName}Fields
90
- }
91
- matched
92
- }
93
- }
94
-
95
- mutation Delete${typeName}($id: ID!) {
96
- deleteRecord(id: $id) {
97
- id
98
- }
99
- }
100
-
101
- mutation Publish${typeName}Version($versionId: ID!) {
102
- publishVersion(versionId: $versionId)
103
- }
104
-
105
- mutation Unpublish${typeName}($id: ID!) {
106
- unpublishRecord(id: $id)
107
- }
108
- ${model.config.sharing?.enabled ? generateSharingOperations(model.key, typeName, pluralName) : ''}`;
109
- }
110
- /**
111
- * Generate the shared ShareFields fragment file.
112
- * This must be emitted once (not per-model) to avoid duplicate fragment errors
113
- * in Apollo iOS and other codegen tools that validate across all .graphql files.
114
- */
115
- export function generateSharedFragments() {
116
- return `# Shared fragments used across multiple model documents
117
- # @generated by foir — DO NOT EDIT MANUALLY
118
-
119
- fragment ShareFields on Share {
120
- id
121
- resourceType
122
- recordId
123
- fileId
124
- permission
125
- status
126
- sharedWithCustomerId
127
- acceptedAt
128
- declinedAt
129
- expiresAt
130
- createdAt
131
- createdBy
132
- revokedAt
133
- }
134
- `;
135
- }
136
- function generateSharingOperations(modelKey, typeName, pluralName) {
137
- return `# Sharing operations
138
-
139
- mutation Share${typeName}($recordId: ID!, $sharedWithCustomerId: ID!, $permission: SharePermission!) {
140
- shareRecord(recordId: $recordId, sharedWithCustomerId: $sharedWithCustomerId, permission: $permission) {
141
- ...ShareFields
142
- }
143
- }
144
-
145
- mutation Accept${typeName}Share($shareId: ID!) {
146
- acceptShare(shareId: $shareId) {
147
- ...ShareFields
148
- }
149
- }
150
-
151
- mutation Decline${typeName}Share($shareId: ID!) {
152
- declineShare(shareId: $shareId) {
153
- ...ShareFields
154
- }
155
- }
156
-
157
- mutation Revoke${typeName}Share($shareId: ID!) {
158
- revokeShare(shareId: $shareId) {
159
- ...ShareFields
160
- }
161
- }
162
-
163
- query ${typeName}Shares($resourceId: ID!, $status: ShareStatus) {
164
- shares(resourceType: RECORD, resourceId: $resourceId, status: $status) {
165
- ...ShareFields
166
- }
167
- }
168
-
169
- query ${pluralName}SharedWithMe($status: ShareStatus) {
170
- sharedWithMe(resourceType: RECORD, modelKey: "${modelKey}", status: $status) {
171
- ...ShareFields
172
- record {
173
- ...${typeName}Fields
174
- }
175
- }
176
- }
177
- `;
178
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates the static field-types.ts file with value types, filter types, and field defs.
3
- */
4
- export declare function generateFieldTypesFile(): string;
5
- //# sourceMappingURL=field-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/field-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,sBAAsB,IAAI,MAAM,CAsV/C"}