@eide/foir-cli 0.1.9 → 0.1.10
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/codegen/fetch-models.d.ts +4 -0
- package/dist/codegen/fetch-models.d.ts.map +1 -1
- package/dist/codegen/fetch-models.js +6 -0
- package/dist/codegen/generators/customer-profile-documents.d.ts +5 -0
- package/dist/codegen/generators/customer-profile-documents.d.ts.map +1 -0
- package/dist/codegen/generators/customer-profile-documents.js +40 -0
- package/dist/codegen/generators/documents.js +54 -0
- package/dist/codegen/generators/swift-types.js +2 -0
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +6 -0
- package/package.json +1 -1
|
@@ -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;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACvD,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAsCD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,YAAY,EAAE,CAAC,CAezB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,GACpD,YAAY,EAAE,CAahB"}
|
|
@@ -11,6 +11,12 @@ function normalizeConfig(raw) {
|
|
|
11
11
|
publishing: Boolean(raw.publishing ?? false),
|
|
12
12
|
variants: Boolean(raw.variants ?? false),
|
|
13
13
|
customerScoped: Boolean(raw.customerScoped ?? false),
|
|
14
|
+
sharing: raw.sharing
|
|
15
|
+
? {
|
|
16
|
+
enabled: Boolean(raw.sharing.enabled ?? false),
|
|
17
|
+
requireAcceptance: Boolean(raw.sharing.requireAcceptance ?? true),
|
|
18
|
+
}
|
|
19
|
+
: undefined,
|
|
14
20
|
embeddings: raw.embeddings,
|
|
15
21
|
};
|
|
16
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-profile-documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,gCAAgC,IAAI,MAAM,CAoCzD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a customer-profile.graphql file with query + mutation operations.
|
|
3
|
+
*/
|
|
4
|
+
export function generateCustomerProfileDocuments() {
|
|
5
|
+
return `# Generated GraphQL operations for Customer Profiles
|
|
6
|
+
# @generated by foir — DO NOT EDIT MANUALLY
|
|
7
|
+
|
|
8
|
+
fragment CustomerProfileFields on CustomerProfile {
|
|
9
|
+
id
|
|
10
|
+
customerId
|
|
11
|
+
data
|
|
12
|
+
createdAt
|
|
13
|
+
updatedAt
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
query GetMyProfile {
|
|
17
|
+
myProfile {
|
|
18
|
+
...CustomerProfileFields
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
query GetCustomerProfile($customerId: ID!) {
|
|
23
|
+
customerProfile(customerId: $customerId) {
|
|
24
|
+
...CustomerProfileFields
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
mutation SetMyProfile($data: JSON!) {
|
|
29
|
+
setMyProfile(data: $data) {
|
|
30
|
+
...CustomerProfileFields
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
mutation UpdateCustomerProfile($customerId: ID, $data: JSON!) {
|
|
35
|
+
updateCustomerProfile(customerId: $customerId, input: { data: $data }) {
|
|
36
|
+
...CustomerProfileFields
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
@@ -87,5 +87,59 @@ mutation Unpublish${typeName}($id: ID!) {
|
|
|
87
87
|
...${typeName}Fields
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
${model.config.sharing?.enabled ? generateSharingOperations(model.key, typeName, pluralName) : ''}`;
|
|
91
|
+
}
|
|
92
|
+
function generateSharingOperations(modelKey, typeName, pluralName) {
|
|
93
|
+
return `# Sharing operations
|
|
94
|
+
fragment ShareFields on Share {
|
|
95
|
+
id
|
|
96
|
+
resourceType
|
|
97
|
+
permission
|
|
98
|
+
status
|
|
99
|
+
acceptedAt
|
|
100
|
+
declinedAt
|
|
101
|
+
expiresAt
|
|
102
|
+
createdAt
|
|
103
|
+
revokedAt
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
mutation Share${typeName}($recordId: ID!, $sharedWithCustomerId: ID!, $permission: SharePermission!) {
|
|
107
|
+
shareRecord(recordId: $recordId, sharedWithCustomerId: $sharedWithCustomerId, permission: $permission) {
|
|
108
|
+
...ShareFields
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
mutation Accept${typeName}Share($shareId: ID!) {
|
|
113
|
+
acceptShare(shareId: $shareId) {
|
|
114
|
+
...ShareFields
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
mutation Decline${typeName}Share($shareId: ID!) {
|
|
119
|
+
declineShare(shareId: $shareId) {
|
|
120
|
+
...ShareFields
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
mutation Revoke${typeName}Share($shareId: ID!) {
|
|
125
|
+
revokeShare(shareId: $shareId) {
|
|
126
|
+
...ShareFields
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
query ${typeName}Shares($resourceId: ID!, $status: ShareStatus) {
|
|
131
|
+
shares(resourceType: RECORD, resourceId: $resourceId, status: $status) {
|
|
132
|
+
...ShareFields
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
query ${pluralName}SharedWithMe($status: ShareStatus) {
|
|
137
|
+
sharedWithMe(resourceType: RECORD, modelKey: "${modelKey}", status: $status) {
|
|
138
|
+
...ShareFields
|
|
139
|
+
record {
|
|
140
|
+
...${typeName}Fields
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
90
144
|
`;
|
|
91
145
|
}
|
|
@@ -180,6 +180,8 @@ function generateConfigEnum(typeName, model) {
|
|
|
180
180
|
lines.push(` static let versioning = ${model.config.versioning}`);
|
|
181
181
|
lines.push(` static let publishing = ${model.config.publishing}`);
|
|
182
182
|
lines.push(` static let variants = ${model.config.variants}`);
|
|
183
|
+
lines.push(` static let sharingEnabled = ${model.config.sharing?.enabled ?? false}`);
|
|
184
|
+
lines.push(` static let sharingRequireAcceptance = ${model.config.sharing?.requireAcceptance ?? true}`);
|
|
183
185
|
lines.push('}');
|
|
184
186
|
lines.push('');
|
|
185
187
|
return lines.join('\n');
|
|
@@ -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;
|
|
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;AAuBtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA4LN"}
|
package/dist/commands/pull.js
CHANGED
|
@@ -16,6 +16,7 @@ import { generateSwiftFieldTypesFile } from '../codegen/generators/swift-field-t
|
|
|
16
16
|
import { generateSwiftModelKeys } from '../codegen/generators/swift-model-keys.js';
|
|
17
17
|
import { generateCustomerProfileTypes } from '../codegen/generators/customer-profile-types.js';
|
|
18
18
|
import { generateSwiftCustomerProfileFile } from '../codegen/generators/swift-customer-profile.js';
|
|
19
|
+
import { generateCustomerProfileDocuments } from '../codegen/generators/customer-profile-documents.js';
|
|
19
20
|
import { writeFiles } from '../codegen/write-files.js';
|
|
20
21
|
export function registerPullCommand(program, globalOpts) {
|
|
21
22
|
program
|
|
@@ -95,6 +96,11 @@ export function registerPullCommand(program, globalOpts) {
|
|
|
95
96
|
content: generateModelDocuments(model),
|
|
96
97
|
});
|
|
97
98
|
}
|
|
99
|
+
// 5b. Customer profile GraphQL documents (always — static platform operations)
|
|
100
|
+
files.push({
|
|
101
|
+
path: resolve(docsDir, 'customer-profile.graphql'),
|
|
102
|
+
content: generateCustomerProfileDocuments(),
|
|
103
|
+
});
|
|
98
104
|
// 6. Main index
|
|
99
105
|
const hasCustomerProfile = !!(cpSchema && cpSchema.fields.length > 0);
|
|
100
106
|
files.push({
|