@remkoj/optimizely-graph-functions 6.0.0-pre9 → 6.0.0-rc.3

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 (55) hide show
  1. package/AGENTS.md +105 -0
  2. package/README.md +60 -14
  3. package/dist/_transform/handleDependDirective.d.ts +11 -0
  4. package/dist/_transform/handleDependDirective.js +128 -0
  5. package/dist/_transform/handleDependDirective.js.map +1 -0
  6. package/dist/_transform/injectComponentDocuments.d.ts +3 -0
  7. package/dist/_transform/injectComponentDocuments.js +78 -24
  8. package/dist/_transform/injectComponentDocuments.js.map +1 -1
  9. package/dist/_transform/injectPageQueries.d.ts +1 -0
  10. package/dist/_transform/injectPageQueries.js +40 -7
  11. package/dist/_transform/injectPageQueries.js.map +1 -1
  12. package/dist/_transform/injectSectionQueries.d.ts +1 -0
  13. package/dist/_transform/injectSectionQueries.js +64 -17
  14. package/dist/_transform/injectSectionQueries.js.map +1 -1
  15. package/dist/_transform/normalizeFragmentNames.js +2 -0
  16. package/dist/_transform/normalizeFragmentNames.js.map +1 -1
  17. package/dist/_transform/performInjections.js +2 -35
  18. package/dist/_transform/performInjections.js.map +1 -1
  19. package/dist/cms/index.d.ts +4 -10
  20. package/dist/cms/index.js +64 -29
  21. package/dist/cms/index.js.map +1 -1
  22. package/dist/contenttype-loader.d.ts +1 -48
  23. package/dist/contenttype-loader.js +21 -286
  24. package/dist/contenttype-loader.js.map +1 -1
  25. package/dist/document-ast-plugin.d.ts +1 -1
  26. package/dist/document-ast-plugin.js +1 -1
  27. package/dist/document-ast-plugin.js.map +1 -1
  28. package/dist/documents/fragments.cms12.js.map +1 -1
  29. package/dist/documents/fragments.cms13.js +77 -13
  30. package/dist/documents/fragments.cms13.js.map +1 -1
  31. package/dist/documents/queries.cms13.js +4 -4
  32. package/dist/generator/collision-tracker.d.ts +22 -0
  33. package/dist/generator/collision-tracker.js +104 -0
  34. package/dist/generator/collision-tracker.js.map +1 -0
  35. package/dist/generator/generator.d.ts +77 -0
  36. package/dist/generator/generator.js +277 -0
  37. package/dist/generator/generator.js.map +1 -0
  38. package/dist/generator/index.d.ts +3 -0
  39. package/dist/generator/index.js +42 -0
  40. package/dist/generator/index.js.map +1 -0
  41. package/dist/generator/virtual-location.d.ts +41 -0
  42. package/dist/generator/virtual-location.js +139 -0
  43. package/dist/generator/virtual-location.js.map +1 -0
  44. package/dist/index.js +4 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/patch.js.map +1 -1
  47. package/dist/preset.js +103 -38
  48. package/dist/preset.js.map +1 -1
  49. package/dist/transform.d.ts +4 -3
  50. package/dist/transform.js +8 -1
  51. package/dist/transform.js.map +1 -1
  52. package/dist/utils.d.ts +1 -1
  53. package/dist/utils.js +13 -3
  54. package/dist/utils.js.map +1 -1
  55. package/package.json +31 -21
@@ -33,36 +33,34 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ContentTypeTarget = exports.Tools = void 0;
37
- exports.parseVirtualLocation = parseVirtualLocation;
38
- exports.buildVirtualLocation = buildVirtualLocation;
39
- exports.getGraphType = getGraphType;
40
- exports.getGraphPropertyType = getGraphPropertyType;
41
- exports.parseBaseType = parseBaseType;
42
- exports.extractBaseType = extractBaseType;
43
- exports.getContentTypeTargets = getContentTypeTargets;
44
- exports.buildGetQuery = buildGetQuery;
45
- exports.getReferencedPropertyComponents = getReferencedPropertyComponents;
46
- exports.getSlugFromKey = getSlugFromKey;
47
- exports.buildFragment = buildFragment;
48
- exports.buildProperty = buildProperty;
36
+ exports.Tools = void 0;
49
37
  const graphql_1 = require("graphql");
50
38
  const OptiCMS = __importStar(require("./cms"));
51
- const tools_1 = require("./tools");
39
+ const generator_1 = require("./generator");
52
40
  exports.Tools = __importStar(require("./tools"));
41
+ const collisionTracker = new generator_1.PropertyCollisionTracker();
53
42
  const ContentTypeLoader = async (documentUri, config) => {
54
- const parsedData = parseVirtualLocation(documentUri);
43
+ collisionTracker.cwd = config.cwd;
44
+ const parsedData = generator_1.VirtualLocation.parse(documentUri);
55
45
  if (!parsedData)
56
46
  return undefined;
57
47
  const { type: loaderType, contentTypeBase: baseType, contentTypeKey, forProperty: isForProperty } = parsedData;
58
- const contentType = await OptiCMS.getContentType(contentTypeKey);
59
- if (!contentType)
60
- throw new Error(`ContentType with key ${baseType} cannot be loaded`);
61
- if (contentType.baseType !== baseType)
62
- throw new Error(`ContentType base types don't match, expected ${baseType} but received ${contentType.baseType}`);
63
- const rawSDL = loaderType === 'fragment' ?
64
- buildFragment(contentType, (name) => '_' + name, isForProperty) :
65
- buildGetQuery(contentType);
48
+ const allContentTypes = await OptiCMS.getContentTypes();
49
+ const generator = new generator_1.DocumentGenerator(allContentTypes);
50
+ let rawSDL;
51
+ if (loaderType === "target") {
52
+ rawSDL = generator.buildInjectionTarget(`_${contentTypeKey}`);
53
+ }
54
+ else {
55
+ const contentType = await OptiCMS.getContentType(contentTypeKey);
56
+ if (!contentType)
57
+ throw new Error(`ContentType with key ${contentTypeKey} cannot be loaded (Base: ${baseType})`);
58
+ if (contentType.baseType !== baseType)
59
+ throw new Error(`ContentType base types don't match, expected ${baseType} but received ${contentType.baseType}`);
60
+ rawSDL = loaderType === 'fragment' ?
61
+ generator.buildFragment(contentType, (name) => '_' + name, isForProperty, collisionTracker) :
62
+ generator.buildGetQuery(contentType, (name) => '_' + name, collisionTracker);
63
+ }
66
64
  return rawSDL ? {
67
65
  document: (0, graphql_1.parse)(rawSDL),
68
66
  location: documentUri,
@@ -70,268 +68,5 @@ const ContentTypeLoader = async (documentUri, config) => {
70
68
  rawSDL
71
69
  } : undefined;
72
70
  };
73
- const DefaultVirtualLocationOptions = { forProperty: false, type: 'fragment' };
74
- function parseVirtualLocation(virtualPath) {
75
- if (!virtualPath.startsWith('opti-cms:/'))
76
- return undefined;
77
- const virtualURL = new URL(virtualPath);
78
- const [basePath, baseType, ctKey, ...targets] = virtualURL.pathname.split('/').filter(tools_1.isNonEmptyString);
79
- // Validate the basepath
80
- if (!['contenttypes', 'contentquery'].includes(basePath))
81
- return undefined;
82
- const type = basePath == "contenttypes" ? 'fragment' : 'query';
83
- const forProperty = baseType.endsWith('.property');
84
- const contentTypeBase = parseBaseType(forProperty ? baseType.substring(0, baseType.length - 9) : baseType);
85
- const contentTypeKey = ctKey;
86
- const injectionTargets = targets;
87
- return { type, contentTypeBase, contentTypeKey, injectionTargets, forProperty };
88
- }
89
- function buildVirtualLocation(contentType, options) {
90
- const { forProperty, type } = { ...DefaultVirtualLocationOptions, ...options };
91
- const basePath = type == 'fragment' ? 'contenttypes' : 'contentquery';
92
- const ctKey = contentType.key;
93
- if (!ctKey || contentType.source === 'graph' || contentType.source === '_system')
94
- return undefined;
95
- const baseType = extractBaseType(contentType);
96
- return forProperty ?
97
- `opti-cms:/${basePath}/${baseType}.property/${ctKey}` :
98
- `opti-cms:/${basePath}/${baseType}/${ctKey}/${getContentTypeTargets(contentType).join('/')}`;
99
- }
100
- /**
101
- * Get the Graph Type for the Content Type
102
- * @param contentType
103
- * @returns
104
- */
105
- function getGraphType(contentType) {
106
- return contentType.key ? contentType.key : "_IContent";
107
- }
108
- function getGraphPropertyType(contentType) {
109
- return (contentType.key ? contentType.key : "_IContent") + "Property";
110
- }
111
- function parseBaseType(storedBaseType) {
112
- switch (storedBaseType.toLowerCase()) {
113
- case 'section':
114
- case 'media':
115
- case 'component':
116
- case 'experience':
117
- case 'page':
118
- return '_' + storedBaseType;
119
- default:
120
- return storedBaseType;
121
- }
122
- }
123
- function extractBaseType(contentType, fallback = 'cms') {
124
- return (contentType.baseType ?? fallback).replace(/^_+/, '');
125
- }
126
- var ContentTypeTarget;
127
- (function (ContentTypeTarget) {
128
- ContentTypeTarget["SectionData"] = "SectionData";
129
- ContentTypeTarget["PageData"] = "PageData";
130
- ContentTypeTarget["MediaData"] = "MediaData";
131
- ContentTypeTarget["ComponentData"] = "ComponentData";
132
- ContentTypeTarget["ElementData"] = "ElementData";
133
- ContentTypeTarget["SectionElementData"] = "SectionElementData";
134
- ContentTypeTarget["FormElementData"] = "FormElementData";
135
- ContentTypeTarget["BlockData"] = "BlockData";
136
- })(ContentTypeTarget || (exports.ContentTypeTarget = ContentTypeTarget = {}));
137
- function getContentTypeTargets(contentType) {
138
- if (!contentType.key || contentType.key.startsWith('graph:'))
139
- return [];
140
- const injections = [];
141
- const baseType = extractBaseType(contentType);
142
- switch (baseType) {
143
- case 'section':
144
- injections.push(ContentTypeTarget.SectionData);
145
- break;
146
- case 'page':
147
- case 'experience':
148
- injections.push(ContentTypeTarget.PageData);
149
- break;
150
- case 'media':
151
- case 'video':
152
- case 'image':
153
- injections.push(ContentTypeTarget.MediaData);
154
- break;
155
- case 'component': {
156
- const usage = contentType.compositionBehaviors ?? [];
157
- const source = contentType.source;
158
- if (!(source === '_server' && usage.length === 1 && usage[0] === 'formsElementEnabled'))
159
- injections.push(ContentTypeTarget.ComponentData);
160
- if (usage.includes('elementEnabled'))
161
- injections.push(ContentTypeTarget.ElementData);
162
- if (usage.includes('sectionEnabled'))
163
- injections.push(ContentTypeTarget.SectionElementData);
164
- if (usage.includes('formsElementEnabled'))
165
- injections.push(ContentTypeTarget.FormElementData);
166
- break;
167
- }
168
- default:
169
- injections.push(ContentTypeTarget.BlockData);
170
- break;
171
- }
172
- return injections;
173
- }
174
- function buildGetQuery(contentType, queryName, propertyTracker = new Map()) {
175
- // Prepare
176
- if (!contentType.key || contentType.source === 'graph')
177
- return '';
178
- const graphType = getGraphType(contentType);
179
- const renderedQueryName = (0, tools_1.isNonEmptyString)(queryName) ? queryName :
180
- (typeof queryName === 'function' ? queryName(`get${(0, tools_1.ucFirst)(graphType)}Data`) :
181
- `get${(0, tools_1.ucFirst)(graphType)}Data`);
182
- // Render properties
183
- const properties = [];
184
- for (const propName of Object.getOwnPropertyNames(contentType.properties ?? {}))
185
- properties.push(buildProperty(propName, (contentType.properties || {})[propName], propertyTracker));
186
- // Inject base type based defaults
187
- if (contentType.baseType === "_experience")
188
- properties.unshift("...ExperienceData");
189
- //Render query
190
- const query = `query ${renderedQueryName}($key: [String!]!, $locale: [Locales], $changeset: String, $variation: VariationInput, $version: String) {
191
- data: ${graphType}(
192
- ids: $key
193
- locale: $locale
194
- variation: $variation
195
- where: { _metadata: { changeset: { eq: $changeset }, version: { eq: $version } } }
196
- ) {
197
- total
198
- item {
199
- _metadata {
200
- key
201
- version
202
- locale
203
- changeset
204
- variation
205
- }
206
- ${properties.filter(tools_1.isNonEmptyString).join("\n ")}
207
- }
208
- }
209
- }`;
210
- return query;
211
- }
212
- /**
213
- * Retrieve a list of component keys that are referenced as property by this type
214
- *
215
- * @param contentType
216
- * @returns
217
- */
218
- function getReferencedPropertyComponents(contentType) {
219
- const properties = contentType.properties;
220
- if (!properties)
221
- return [];
222
- return Object.getOwnPropertyNames(properties).reduce((referencedTypes, propertyKey) => {
223
- if (properties[propertyKey].type == "component" && properties[propertyKey].contentType) {
224
- referencedTypes.push(properties[propertyKey]?.contentType);
225
- }
226
- if (properties[propertyKey].type == "array" && properties[propertyKey].items?.type == "component" && properties[propertyKey].items?.contentType) {
227
- referencedTypes.push(properties[propertyKey]?.items?.contentType);
228
- }
229
- return referencedTypes;
230
- }, []);
231
- }
232
- function getSlugFromKey(key) {
233
- let newKey = key.startsWith('_') ? (0, tools_1.ucFirst)(key.substring(1)) : key;
234
- if (newKey.includes(":"))
235
- newKey = newKey.split(":").map(x => (0, tools_1.ucFirst)(x)).join("");
236
- return newKey;
237
- }
238
- function buildFragment(contentType, fragmentName, forProperty = false, propertyTracker = new Map()) {
239
- if (!contentType.key)
240
- return '';
241
- const graphType = forProperty ? getGraphPropertyType(contentType) : getGraphType(contentType);
242
- const graphFragmentName = (0, tools_1.isNonEmptyString)(fragmentName) ?
243
- fragmentName : (typeof fragmentName === 'function' ? fragmentName((0, tools_1.ucFirst)(graphType) + "Data") : (0, tools_1.ucFirst)(graphType) + "Data");
244
- // Inject all properties
245
- const properties = [];
246
- for (const propName of Object.getOwnPropertyNames(contentType.properties ?? {}))
247
- properties.push(buildProperty(propName, (contentType.properties || {})[propName], propertyTracker));
248
- // Inject base type based defaults
249
- if (contentType.baseType === "_experience")
250
- properties.push("...ExperienceData");
251
- // Ensure that there's at least one property
252
- if (properties.length === 0)
253
- properties.unshift("__typename");
254
- // Construct fragment rawSDL
255
- return `fragment ${graphFragmentName} on ${graphType} {
256
- ${properties.filter(tools_1.isNonEmptyString).join("\n ")}
257
- }`;
258
- }
259
- function buildProperty(propertyName, propertyConfig, propertyTracker = new Map()) {
260
- const propertyItemConfig = propertyConfig?.type === 'array' ? propertyConfig?.items ?? propertyConfig : propertyConfig;
261
- const propertyType = propertyItemConfig?.type ?? 'any';
262
- // Ensure we don't have property naming collisions
263
- let outputPropertyName = propertyName;
264
- if (propertyTracker.has(propertyName)) {
265
- if (propertyTracker.get(propertyName) != propertyType) {
266
- outputPropertyName = `${propertyName}${(0, tools_1.ucFirst)(propertyType)}: ${propertyName}`;
267
- }
268
- }
269
- else {
270
- propertyTracker.set(propertyName, propertyType);
271
- }
272
- switch (propertyType) {
273
- case 'url':
274
- return outputPropertyName + " { type base default }";
275
- case 'content': {
276
- const pick = (propertyItemConfig?.allowedTypes ?? []);
277
- if (pick.length == 0) {
278
- return outputPropertyName + ` {
279
- ...IContentData
280
- ...BlockData
281
- ...ComponentData
282
- }`;
283
- }
284
- else {
285
- return outputPropertyName + ` {
286
- ...IContentData
287
- ${pick.map(x => {
288
- return `...${getSlugFromKey(x)}Data`;
289
- }).join("\n ")}
290
- }`;
291
- }
292
- }
293
- case 'richText':
294
- return outputPropertyName + " { json }";
295
- case 'component': {
296
- const dataType = propertyItemConfig?.contentType;
297
- if (!dataType)
298
- return null; // Skip this property if the contentType isn't set
299
- return outputPropertyName + ` { ...${dataType}PropertyData }`;
300
- }
301
- case 'link':
302
- return outputPropertyName + ` {
303
- title
304
- text
305
- target
306
- url {
307
- type
308
- base
309
- default
310
- }
311
- }`;
312
- case 'contentReference': {
313
- const pick = (propertyItemConfig?.allowedTypes ?? []).filter(x => !x.startsWith('_'));
314
- const hide = (propertyItemConfig?.restrictedTypes ?? []).filter(x => !x.startsWith('_'));
315
- const pickAll = pick.length == 0 || (pick.length == 1 && pick.at(0) === '*');
316
- if (hide.length > 0)
317
- console.log("Negative filtering isn't reflected in the Graph Queries");
318
- //const fragments = pick.map(x => "..." + x + "Data")
319
- /*
320
- item {
321
- ...IContentData${pickAll ? '\n ...BlockData' : '\n ' + fragments.join('\n ')}
322
- }*/
323
- return outputPropertyName + ` {
324
- key
325
- url {
326
- type
327
- base
328
- default
329
- }
330
- }`;
331
- }
332
- default:
333
- return outputPropertyName;
334
- }
335
- }
336
71
  exports.default = ContentTypeLoader;
337
72
  //# sourceMappingURL=contenttype-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contenttype-loader.js","sourceRoot":"","sources":["../src/contenttype-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,oDAgBC;AAED,oDAUC;AAOD,oCAEC;AACD,oDAEC;AAED,sCAWC;AAED,0CAEC;AAaD,sDAsCC;AAED,sCAwCC;AAQD,0EAcC;AAED,wCAKC;AAQD,sCAwBC;AAED,sCA4EC;AA9UD,qCAA+B;AAC/B,+CAAgC;AAEhC,mCAAmD;AAEnD,iDAAgC;AAUhC,MAAM,iBAAiB,GAAmB,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAA;IACpD,IAAI,CAAC,UAAU;QACb,OAAO,SAAS,CAAA;IAElB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,UAAU,CAAA;IAE9G,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;IAChE,IAAI,CAAC,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CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC;QACd,QAAQ,EAAE,IAAA,eAAK,EAAC,MAAM,CAAC;QACvB,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,WAAW;QACjB,MAAM;KACP,CAAC,CAAC,CAAC,SAAS,CAAA;AACf,CAAC,CAAA;AAGD,kBAAe,iBAAiB,CAAA"}
@@ -1 +1 @@
1
- export type DocumentAstPluginOptions = {};
1
+ export type DocumentAstPluginOptions = object;
@@ -7,7 +7,7 @@ const graphql_1 = require("graphql");
7
7
  const plugin = async (schema, documents) => {
8
8
  return "\n" + documents.map(document => document.document ? (0, graphql_1.print)(document.document) : undefined).filter(Boolean).join("\n\n");
9
9
  };
10
- const validate = (schema, documents, config, output, allPlugins, pluginContext) => {
10
+ const validate = (schema, documents /*, config, output, allPlugins, pluginContext*/) => {
11
11
  if (documents.filter(d => d.document).length < 1)
12
12
  throw new Error("Document-AST requires at least one document that can be printend");
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"document-ast-plugin.js","sourceRoot":"","sources":["../src/document-ast-plugin.ts"],"names":[],"mappings":";;AACA,qCAAqF;AAMrF;;GAEG;AACH,MAAM,MAAM,GAAqD,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;IAC3F,OAAO,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,eAAK,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAChI,CAAC,CAAA;AAED,MAAM,QAAQ,GAA+C,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE;IAC5H,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;AACvF,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA6C,CAAA"}
1
+ {"version":3,"file":"document-ast-plugin.js","sourceRoot":"","sources":["../src/document-ast-plugin.ts"],"names":[],"mappings":";;AACA,qCAA+B;AAI/B;;GAEG;AACH,MAAM,MAAM,GAAqD,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;IAC3F,OAAO,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,eAAK,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAChI,CAAC,CAAA;AAED,MAAM,QAAQ,GAA+C,CAAC,MAAM,EAAE,SAAS,CAAA,+CAA+C,EAAE,EAAE;IAChI,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;AACvF,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA6C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"fragments.cms12.js","sourceRoot":"","sources":["../../src/documents/fragments.cms12.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,4BAA4B;IAC5B;;IAEE;IACF;;IAEE;IAEF,kCAAkC;IAClC;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;IAEE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;IAGE;IAEF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;;;;;IAWE;IACF;;;;;;;;;;;IAWE;IAEF,4BAA4B;IAC5B;;;;;;;;;;;;IAYE;IACA;;;;;;;;;MASE;IACF;;;;;;;;;MASE;CACL,CAAA"}
1
+ {"version":3,"file":"fragments.cms12.js","sourceRoot":"","sources":["../../src/documents/fragments.cms12.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,4BAA4B;IAC5B;;IAEE;IACF;;IAEE;IAEF,kCAAkC;IAClC;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;IAEE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;IAGE;IAEF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;;;;;IAWE;IACF;;;;;;;;;;;IAWE;IAEF,4BAA4B;IAC5B;;;;;;;;;;;;IAYE;IACF;;;;;;;;;MASI;IACJ;;;;;;;;;MASI;CACL,CAAA"}
@@ -76,10 +76,37 @@ exports.default = [
76
76
  ... on CompositionStructureNode {
77
77
  nodes {
78
78
  ...CompositionNodeData
79
- ...CompositionStructureNode
80
- ...CompositionComponentNode
79
+ ... on CompositionStructureNode {
80
+ nodes {
81
+ ...CompositionNodeData
82
+ ... on CompositionStructureNode {
83
+ nodes {
84
+ ...CompositionNodeData
85
+ ... on CompositionComponentNode {
86
+ component {
87
+ ...IContentData
88
+ ...BlockData
89
+ ...ElementData
90
+ }
91
+ }
92
+ ... on CompositionStructureNode {
93
+ nodes {
94
+ ...CompositionNodeData
95
+ ... on CompositionComponentNode {
96
+ component {
97
+ ...IContentData
98
+ ...FormElementData
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
81
107
  }
82
108
  component {
109
+ ...IContentData
83
110
  ...SectionData
84
111
  }
85
112
  }
@@ -91,20 +118,32 @@ exports.default = [
91
118
  ...CompositionNodeData
92
119
  nodes {
93
120
  ...CompositionNodeData
94
- ... on CompositionComponentNode {
95
- component {
96
- ...IContentData
97
- ...SectionElementData
98
- }
99
- }
100
121
  ... on CompositionStructureNode {
101
122
  nodes {
102
123
  ...CompositionNodeData
103
- ...CompositionStructureNode
104
- ...CompositionComponentNode
105
- }
106
- component {
107
- ...SectionData
124
+ ... on CompositionStructureNode {
125
+ nodes {
126
+ ...CompositionNodeData
127
+ ... on CompositionComponentNode {
128
+ component {
129
+ ...IContentData
130
+ ...BlockData
131
+ ...ElementData
132
+ }
133
+ }
134
+ ... on CompositionStructureNode {
135
+ nodes {
136
+ ...CompositionNodeData
137
+ ... on CompositionComponentNode {
138
+ component {
139
+ ...IContentData
140
+ ...FormElementData
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
108
147
  }
109
148
  }
110
149
  }
@@ -145,6 +184,31 @@ exports.default = [
145
184
  base
146
185
  default
147
186
  }
187
+ }`,
188
+ `fragment _CmpImageAssetInfo on cmp_PublicImageAsset {
189
+ __typename
190
+ Title
191
+ AltText
192
+ Width
193
+ Height
194
+ Url
195
+ Renditions {
196
+ Name
197
+ Width
198
+ Height
199
+ Url
200
+ }
201
+ }`,
202
+ `fragment _CmpVideoAssetInfo on cmp_PublicVideoAsset {
203
+ Title
204
+ AltText
205
+ Url
206
+ Renditions {
207
+ Name
208
+ Width
209
+ Height
210
+ Url
211
+ }
148
212
  }`
149
213
  ];
150
214
  //# sourceMappingURL=fragments.cms13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragments.cms13.js","sourceRoot":"","sources":["../../src/documents/fragments.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb;;;;;;;;;;;;;;;;;EAiBA;IACA;;;;;;;;;;;;;;EAcA;IACA;;;;EAIA;IACA;;;;;;;EAOA;IACA;;;;;;;;;;;EAWA;IACA;;EAEA;IACA;;;;;;;;;;;;;;;;;;;;;;;EAuBA;IACA;;;;;;;;;;;;;;;;;;;;;;;EAuBA;IACA;;;;;;EAMA;IACA;;;;;;;EAOA;IACA;;;;;;;;;;EAUA;IACA;;;;;;;;;EASA;CACD,CAAA"}
1
+ {"version":3,"file":"fragments.cms13.js","sourceRoot":"","sources":["../../src/documents/fragments.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb;;;;;;;;;;;;;;;;;EAiBA;IACA;;;;;;;;;;;;;;EAcA;IACA;;;;EAIA;IACA;;;;;;;EAOA;IACA;;;;;;;;;;;EAWA;IACA;;EAEA;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDA;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA;IACA;;;;;;EAMA;IACA;;;;;;;EAOA;IACA;;;;;;;;;;EAUA;IACA;;;;;;;;;EASA;IACA;;;;;;;;;;;;;EAaA;IACA;;;;;;;;;;EAUA;CACD,CAAA"}
@@ -34,10 +34,10 @@ exports.default = [
34
34
  `query _getContentByPath($path: [String!]!, $locale: [Locales!], $siteId: String, $changeset: String = null, $variation: VariationInput) {
35
35
  content: _Content(
36
36
  where: {
37
- _metadata: {
38
- url: { default: { in: $path }, base: { eq: $siteId } }
39
- changeset: { eq: $changeset }
40
- }
37
+ _or: [
38
+ { _metadata: { url: { default: { in: $path }, base: { endsWith: $siteId } }, changeset: { eq: $changeset } } }
39
+ { _metadata: { url: { hierarchical: { in: $path }, type: { eq: "SIMPLE" }, base: { endsWith: $siteId } }, changeset: { eq: $changeset } } }
40
+ ]
41
41
  }
42
42
  locale: $locale
43
43
  variation:$variation
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Tracker for all properties, indexed by property name, then type
3
+ * for a list of all ContentTypes. This uses a lock file to remember
4
+ * any collision resolutions done by the code generation.
5
+ */
6
+ export declare class PropertyCollisionTracker extends Map<string, string> {
7
+ private _cwd;
8
+ private _ready;
9
+ set cwd(newValue: string | undefined);
10
+ get cwd(): string | undefined;
11
+ constructor(cwd?: string);
12
+ private ensureReady;
13
+ private updateLock;
14
+ private readLock;
15
+ private isMapData;
16
+ has(key: string): boolean;
17
+ set(key: string, value: string): this;
18
+ get(key: string): string | undefined;
19
+ delete(key: string): boolean;
20
+ clear(): void;
21
+ }
22
+ export default PropertyCollisionTracker;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PropertyCollisionTracker = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ /**
10
+ * Tracker for all properties, indexed by property name, then type
11
+ * for a list of all ContentTypes. This uses a lock file to remember
12
+ * any collision resolutions done by the code generation.
13
+ */
14
+ class PropertyCollisionTracker extends Map {
15
+ _cwd;
16
+ _ready = false;
17
+ set cwd(newValue) {
18
+ if (newValue !== this._cwd) {
19
+ this._cwd = newValue;
20
+ super.clear();
21
+ if (newValue === undefined) {
22
+ this._ready = false;
23
+ return;
24
+ }
25
+ this.readLock();
26
+ this._ready = true;
27
+ }
28
+ }
29
+ get cwd() {
30
+ return this._cwd;
31
+ }
32
+ constructor(cwd) {
33
+ super();
34
+ this.cwd = cwd;
35
+ }
36
+ ensureReady() {
37
+ if (!this._ready)
38
+ throw new Error("NOT READY");
39
+ }
40
+ updateLock() {
41
+ if (!this._cwd)
42
+ throw new Error("Working directory unknown");
43
+ const file = node_path_1.default.join(this._cwd, '.opti-props.lock');
44
+ const data = [];
45
+ for (const [entryKey, entryValue] of super.entries())
46
+ data.push({ propertyName: entryKey, propertyType: entryValue });
47
+ const raw = JSON.stringify(data, undefined, ' ');
48
+ node_fs_1.default.writeFileSync(file, raw, { encoding: 'utf-8' });
49
+ }
50
+ readLock() {
51
+ try {
52
+ if (!this._cwd)
53
+ throw new Error("Working directory unknown");
54
+ const file = node_path_1.default.join(this._cwd, '.opti-props.lock');
55
+ const raw = node_fs_1.default.readFileSync(file, { encoding: 'utf-8' });
56
+ const data = raw.length > 0 ? JSON.parse(raw) : [];
57
+ if (!Array.isArray(data))
58
+ throw new Error(`Invalid lock file at ${file}`);
59
+ for (const itm of data.filter(this.isMapData))
60
+ super.set(itm.propertyName, itm.propertyType);
61
+ }
62
+ catch (e) {
63
+ if (e.code === 'ENOENT')
64
+ return [];
65
+ throw e;
66
+ }
67
+ }
68
+ isMapData(v) {
69
+ if (typeof (v) !== 'object' || v === null)
70
+ return false;
71
+ return typeof (v.propertyName) === 'string' && typeof (v.propertyType) === 'string';
72
+ }
73
+ has(key) {
74
+ this.ensureReady();
75
+ return super.has(key);
76
+ }
77
+ set(key, value) {
78
+ this.ensureReady();
79
+ const cv = super.get(key);
80
+ if (cv !== value) {
81
+ super.set(key, value);
82
+ this.updateLock();
83
+ }
84
+ return this;
85
+ }
86
+ get(key) {
87
+ this.ensureReady();
88
+ return super.get(key);
89
+ }
90
+ delete(key) {
91
+ this.ensureReady();
92
+ const res = super.delete(key);
93
+ this.updateLock();
94
+ return res;
95
+ }
96
+ clear() {
97
+ this.ensureReady();
98
+ super.clear();
99
+ this.updateLock();
100
+ }
101
+ }
102
+ exports.PropertyCollisionTracker = PropertyCollisionTracker;
103
+ exports.default = PropertyCollisionTracker;
104
+ //# sourceMappingURL=collision-tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collision-tracker.js","sourceRoot":"","sources":["../../src/generator/collision-tracker.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,sDAAwB;AAExB;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,GAAkB;IACtD,IAAI,CAAqB;IACzB,MAAM,GAAY,KAAK,CAAC;IAEhC,IAAW,GAAG,CAAC,QAA4B;QAEzC,IAAI,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;YACpB,KAAK,CAAC,KAAK,EAAE,C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