@eide/foir-cli 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7467 -42
- package/dist/config/types.d.ts +7 -6
- package/dist/config/types.js +6 -14
- package/dist/generated-CPsQ9jfu.d.ts +195 -0
- package/dist/lib/extension-helpers.d.ts +10 -7
- package/dist/lib/extension-helpers.js +15 -85
- package/dist/lib/hook-helpers.d.ts +9 -6
- package/dist/lib/hook-helpers.js +12 -105
- package/dist/lib/seed-helpers.d.ts +10 -8
- package/dist/lib/seed-helpers.js +18 -124
- package/package.json +9 -8
- package/dist/auth/credentials.d.ts +0 -31
- package/dist/auth/credentials.d.ts.map +0 -1
- package/dist/auth/credentials.js +0 -139
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
- package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.js +0 -21
- package/dist/codegen/fetch-models.d.ts +0 -58
- package/dist/codegen/fetch-models.d.ts.map +0 -1
- package/dist/codegen/fetch-models.js +0 -96
- package/dist/codegen/field-mapping.d.ts +0 -34
- package/dist/codegen/field-mapping.d.ts.map +0 -1
- package/dist/codegen/field-mapping.js +0 -250
- package/dist/codegen/generators/config.d.ts +0 -5
- package/dist/codegen/generators/config.d.ts.map +0 -1
- package/dist/codegen/generators/config.js +0 -82
- package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-documents.js +0 -42
- package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-hooks.js +0 -78
- package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-loaders.js +0 -67
- package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-operations.js +0 -126
- package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
- package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-types.js +0 -45
- package/dist/codegen/generators/documents.d.ts +0 -12
- package/dist/codegen/generators/documents.d.ts.map +0 -1
- package/dist/codegen/generators/documents.js +0 -178
- package/dist/codegen/generators/field-types.d.ts +0 -5
- package/dist/codegen/generators/field-types.d.ts.map +0 -1
- package/dist/codegen/generators/field-types.js +0 -346
- package/dist/codegen/generators/model-index.d.ts +0 -6
- package/dist/codegen/generators/model-index.d.ts.map +0 -1
- package/dist/codegen/generators/model-index.js +0 -26
- package/dist/codegen/generators/model-types.d.ts +0 -12
- package/dist/codegen/generators/model-types.d.ts.map +0 -1
- package/dist/codegen/generators/model-types.js +0 -177
- package/dist/codegen/generators/public-schema-content.d.ts +0 -14
- package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
- package/dist/codegen/generators/public-schema-content.js +0 -22
- package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
- package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks-index.js +0 -20
- package/dist/codegen/generators/react-hooks.d.ts +0 -7
- package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks.js +0 -139
- package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
- package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders-index.js +0 -20
- package/dist/codegen/generators/remix-loaders.d.ts +0 -7
- package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders.js +0 -107
- package/dist/codegen/generators/static-documents.d.ts +0 -14
- package/dist/codegen/generators/static-documents.d.ts.map +0 -1
- package/dist/codegen/generators/static-documents.js +0 -771
- package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
- package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
- package/dist/codegen/generators/swift-customer-profile.js +0 -152
- package/dist/codegen/generators/swift-field-types.d.ts +0 -5
- package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-field-types.js +0 -151
- package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
- package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
- package/dist/codegen/generators/swift-model-keys.js +0 -25
- package/dist/codegen/generators/swift-types.d.ts +0 -13
- package/dist/codegen/generators/swift-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-types.js +0 -188
- package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-common.js +0 -84
- package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-index.js +0 -22
- package/dist/codegen/generators/typed-operations.d.ts +0 -11
- package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations.js +0 -263
- package/dist/codegen/swift-field-mapping.d.ts +0 -30
- package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
- package/dist/codegen/swift-field-mapping.js +0 -150
- package/dist/codegen/write-files.d.ts +0 -15
- package/dist/codegen/write-files.d.ts.map +0 -1
- package/dist/codegen/write-files.js +0 -36
- package/dist/commands/api-keys.d.ts +0 -4
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -129
- package/dist/commands/auth-config.d.ts +0 -4
- package/dist/commands/auth-config.d.ts.map +0 -1
- package/dist/commands/auth-config.js +0 -38
- package/dist/commands/auth-providers.d.ts +0 -4
- package/dist/commands/auth-providers.d.ts.map +0 -1
- package/dist/commands/auth-providers.js +0 -207
- package/dist/commands/context.d.ts +0 -4
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -91
- package/dist/commands/create-extension.d.ts +0 -4
- package/dist/commands/create-extension.d.ts.map +0 -1
- package/dist/commands/create-extension.js +0 -60
- package/dist/commands/customer-profiles.d.ts +0 -4
- package/dist/commands/customer-profiles.d.ts.map +0 -1
- package/dist/commands/customer-profiles.js +0 -99
- package/dist/commands/customers.d.ts +0 -4
- package/dist/commands/customers.d.ts.map +0 -1
- package/dist/commands/customers.js +0 -126
- package/dist/commands/embeddings.d.ts +0 -4
- package/dist/commands/embeddings.d.ts.map +0 -1
- package/dist/commands/embeddings.js +0 -145
- package/dist/commands/experiments.d.ts +0 -4
- package/dist/commands/experiments.d.ts.map +0 -1
- package/dist/commands/experiments.js +0 -196
- package/dist/commands/extensions.d.ts +0 -4
- package/dist/commands/extensions.d.ts.map +0 -1
- package/dist/commands/extensions.js +0 -210
- package/dist/commands/files.d.ts +0 -4
- package/dist/commands/files.d.ts.map +0 -1
- package/dist/commands/files.js +0 -143
- package/dist/commands/hooks.d.ts +0 -4
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -228
- package/dist/commands/locales.d.ts +0 -4
- package/dist/commands/locales.d.ts.map +0 -1
- package/dist/commands/locales.js +0 -140
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -124
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -16
- package/dist/commands/media.d.ts +0 -4
- package/dist/commands/media.d.ts.map +0 -1
- package/dist/commands/media.js +0 -44
- package/dist/commands/models.d.ts +0 -4
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -153
- package/dist/commands/notes.d.ts +0 -4
- package/dist/commands/notes.d.ts.map +0 -1
- package/dist/commands/notes.js +0 -132
- package/dist/commands/notifications.d.ts +0 -4
- package/dist/commands/notifications.d.ts.map +0 -1
- package/dist/commands/notifications.js +0 -73
- package/dist/commands/operations.d.ts +0 -4
- package/dist/commands/operations.d.ts.map +0 -1
- package/dist/commands/operations.js +0 -341
- package/dist/commands/playground.d.ts +0 -4
- package/dist/commands/playground.d.ts.map +0 -1
- package/dist/commands/playground.js +0 -270
- package/dist/commands/pull.d.ts +0 -4
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -300
- package/dist/commands/records.d.ts +0 -4
- package/dist/commands/records.d.ts.map +0 -1
- package/dist/commands/records.js +0 -314
- package/dist/commands/register-commands.d.ts +0 -7
- package/dist/commands/register-commands.d.ts.map +0 -1
- package/dist/commands/register-commands.js +0 -259
- package/dist/commands/schedules.d.ts +0 -4
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -155
- package/dist/commands/search.d.ts +0 -4
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -60
- package/dist/commands/segments.d.ts +0 -4
- package/dist/commands/segments.d.ts.map +0 -1
- package/dist/commands/segments.js +0 -155
- package/dist/commands/select-project.d.ts +0 -4
- package/dist/commands/select-project.d.ts.map +0 -1
- package/dist/commands/select-project.js +0 -144
- package/dist/commands/settings.d.ts +0 -4
- package/dist/commands/settings.d.ts.map +0 -1
- package/dist/commands/settings.js +0 -115
- package/dist/commands/variant-catalog.d.ts +0 -4
- package/dist/commands/variant-catalog.d.ts.map +0 -1
- package/dist/commands/variant-catalog.js +0 -118
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -51
- package/dist/config/pull-config.d.ts +0 -33
- package/dist/config/pull-config.d.ts.map +0 -1
- package/dist/config/pull-config.js +0 -119
- package/dist/config/types.d.ts.map +0 -1
- package/dist/graphql/generated.d.ts +0 -6074
- package/dist/graphql/generated.d.ts.map +0 -1
- package/dist/graphql/generated.js +0 -355
- package/dist/lib/client.d.ts +0 -18
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js +0 -64
- package/dist/lib/config-loader.d.ts +0 -28
- package/dist/lib/config-loader.d.ts.map +0 -1
- package/dist/lib/config-loader.js +0 -49
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -8
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/errors.js +0 -76
- package/dist/lib/extension-helpers.d.ts.map +0 -1
- package/dist/lib/hook-helpers.d.ts.map +0 -1
- package/dist/lib/input.d.ts +0 -38
- package/dist/lib/input.d.ts.map +0 -1
- package/dist/lib/input.js +0 -108
- package/dist/lib/output.d.ts +0 -31
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.js +0 -107
- package/dist/lib/seed-helpers.d.ts.map +0 -1
- package/dist/scaffold/package-manager.d.ts +0 -12
- package/dist/scaffold/package-manager.d.ts.map +0 -1
- package/dist/scaffold/package-manager.js +0 -51
- package/dist/scaffold/scaffold.d.ts +0 -4
- package/dist/scaffold/scaffold.d.ts.map +0 -1
- 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 +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"}
|