@remkoj/optimizely-graph-functions 6.0.0-pre8 → 6.0.0-pre9
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/LICENSE +12 -12
- package/dist/_transform/cleanFragments.d.ts +10 -0
- package/dist/_transform/cleanFragments.js +39 -0
- package/dist/_transform/cleanFragments.js.map +1 -0
- package/dist/_transform/cleanSpreads.d.ts +10 -0
- package/dist/_transform/cleanSpreads.js +36 -0
- package/dist/_transform/cleanSpreads.js.map +1 -0
- package/dist/_transform/injectComponentDocuments.d.ts +13 -0
- package/dist/_transform/injectComponentDocuments.js +122 -0
- package/dist/_transform/injectComponentDocuments.js.map +1 -0
- package/dist/_transform/injectPageQueries.d.ts +4 -0
- package/dist/_transform/injectPageQueries.js +81 -0
- package/dist/_transform/injectPageQueries.js.map +1 -0
- package/dist/_transform/injectSectionQueries.d.ts +4 -0
- package/dist/_transform/injectSectionQueries.js +81 -0
- package/dist/_transform/injectSectionQueries.js.map +1 -0
- package/dist/_transform/normalizeFragmentNames.d.ts +12 -0
- package/dist/_transform/normalizeFragmentNames.js +75 -0
- package/dist/_transform/normalizeFragmentNames.js.map +1 -0
- package/dist/_transform/normalizeQueryNames.d.ts +12 -0
- package/dist/_transform/normalizeQueryNames.js +83 -0
- package/dist/_transform/normalizeQueryNames.js.map +1 -0
- package/dist/_transform/options.d.ts +3 -0
- package/dist/_transform/options.js +21 -0
- package/dist/_transform/options.js.map +1 -0
- package/dist/_transform/performInjections.d.ts +24 -0
- package/dist/_transform/performInjections.js +225 -0
- package/dist/_transform/performInjections.js.map +1 -0
- package/dist/_transform/tools.d.ts +34 -0
- package/dist/_transform/tools.js +103 -0
- package/dist/_transform/tools.js.map +1 -0
- package/dist/cms/index.d.ts +17 -0
- package/dist/cms/index.js +88 -0
- package/dist/cms/index.js.map +1 -0
- package/dist/contenttype-loader.d.ts +58 -0
- package/dist/contenttype-loader.js +337 -0
- package/dist/contenttype-loader.js.map +1 -0
- package/dist/documents/fragments.cms13.js +91 -47
- package/dist/documents/fragments.cms13.js.map +1 -1
- package/dist/documents/queries.cms13.js +9 -3
- package/dist/documents/queries.cms13.js.map +1 -1
- package/dist/embedded-loader.js +31 -16
- package/dist/embedded-loader.js.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js.map +1 -1
- package/dist/preset.d.ts +2 -4
- package/dist/preset.js +16 -42
- package/dist/preset.js.map +1 -1
- package/dist/tools.d.ts +4 -0
- package/dist/tools.js +20 -0
- package/dist/tools.js.map +1 -0
- package/dist/transform.d.ts +11 -1
- package/dist/transform.js +41 -58
- package/dist/transform.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/package.json +21 -19
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Types } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import type { IntegrationApi } from '@remkoj/optimizely-cms-api';
|
|
3
|
+
export * as Tools from './tools';
|
|
4
|
+
type LoaderConfig = {
|
|
5
|
+
pluginContext?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type LoaderFunction = (documentUri: string, config: LoaderConfig) => Promise<Types.DocumentFile | undefined | void>;
|
|
10
|
+
declare const ContentTypeLoader: LoaderFunction;
|
|
11
|
+
export type VirtualLocationOptions = {
|
|
12
|
+
forProperty: boolean;
|
|
13
|
+
type: 'fragment' | 'query';
|
|
14
|
+
};
|
|
15
|
+
export type VirtualLocationData = {
|
|
16
|
+
contentTypeBase: string;
|
|
17
|
+
contentTypeKey: string;
|
|
18
|
+
injectionTargets: Array<string>;
|
|
19
|
+
} & VirtualLocationOptions;
|
|
20
|
+
export declare function parseVirtualLocation(virtualPath: string): VirtualLocationData | undefined;
|
|
21
|
+
export declare function buildVirtualLocation(contentType: IntegrationApi.ContentType, options?: Partial<VirtualLocationOptions>): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Get the Graph Type for the Content Type
|
|
24
|
+
* @param contentType
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function getGraphType(contentType: IntegrationApi.ContentType): string;
|
|
28
|
+
export declare function getGraphPropertyType(contentType: IntegrationApi.ContentType): string;
|
|
29
|
+
export declare function parseBaseType(storedBaseType: string): string;
|
|
30
|
+
export declare function extractBaseType(contentType: IntegrationApi.ContentType, fallback?: string): string;
|
|
31
|
+
export declare enum ContentTypeTarget {
|
|
32
|
+
'SectionData' = "SectionData",
|
|
33
|
+
'PageData' = "PageData",
|
|
34
|
+
'MediaData' = "MediaData",
|
|
35
|
+
'ComponentData' = "ComponentData",
|
|
36
|
+
'ElementData' = "ElementData",
|
|
37
|
+
'SectionElementData' = "SectionElementData",
|
|
38
|
+
'FormElementData' = "FormElementData",
|
|
39
|
+
'BlockData' = "BlockData"
|
|
40
|
+
}
|
|
41
|
+
export declare function getContentTypeTargets(contentType: IntegrationApi.ContentType): ContentTypeTarget[];
|
|
42
|
+
export declare function buildGetQuery(contentType: IntegrationApi.ContentType, queryName?: string | ((defaultName: string) => string), propertyTracker?: PropertyCollisionTracker): string;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieve a list of component keys that are referenced as property by this type
|
|
45
|
+
*
|
|
46
|
+
* @param contentType
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
export declare function getReferencedPropertyComponents(contentType: IntegrationApi.ContentType): string[];
|
|
50
|
+
export declare function getSlugFromKey(key: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Tracker for all properties, indexed by property name, then type
|
|
53
|
+
* for a list of all ContentTypes.
|
|
54
|
+
*/
|
|
55
|
+
export type PropertyCollisionTracker = Map<string, string>;
|
|
56
|
+
export declare function buildFragment(contentType: IntegrationApi.ContentType, fragmentName?: string | ((defaultName: string) => string), forProperty?: boolean, propertyTracker?: PropertyCollisionTracker): string;
|
|
57
|
+
export declare function buildProperty(propertyName: string, propertyConfig?: IntegrationApi.ContentTypeProperty, propertyTracker?: PropertyCollisionTracker): string | null;
|
|
58
|
+
export default ContentTypeLoader;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
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;
|
|
49
|
+
const graphql_1 = require("graphql");
|
|
50
|
+
const OptiCMS = __importStar(require("./cms"));
|
|
51
|
+
const tools_1 = require("./tools");
|
|
52
|
+
exports.Tools = __importStar(require("./tools"));
|
|
53
|
+
const ContentTypeLoader = async (documentUri, config) => {
|
|
54
|
+
const parsedData = parseVirtualLocation(documentUri);
|
|
55
|
+
if (!parsedData)
|
|
56
|
+
return undefined;
|
|
57
|
+
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);
|
|
66
|
+
return rawSDL ? {
|
|
67
|
+
document: (0, graphql_1.parse)(rawSDL),
|
|
68
|
+
location: documentUri,
|
|
69
|
+
hash: documentUri,
|
|
70
|
+
rawSDL
|
|
71
|
+
} : undefined;
|
|
72
|
+
};
|
|
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
|
+
exports.default = ContentTypeLoader;
|
|
337
|
+
//# sourceMappingURL=contenttype-loader.js.map
|
|
@@ -0,0 +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,WAAW;QACd,MAAM,IAAI,KAAK,CAAC,wBAAw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O,kBAAkB,GAAG,UAAU,QAAQ,gBAAgB,CAAA;QAChE,CAAC;QACD,KAAK,MAAM;YACT,OAAO,kBAAkB,GAAG;;;;;;;;;IAS9B,CAAC;QACD,KAAK,kBAAkB,CAAC,CAAC,CAAC;YACxB,MAAM,IAAI,GAAa,CAAC,kBAAkB,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;YAC/F,MAAM,IAAI,GAAa,CAAC,kBAAkB,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;YAClG,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAA;YAC5E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAA;YACxE,qDAAqD;YACrD;;;aAGC;YACD,OAAO,kBAAkB,GAAG;;;;;;;IAO9B,CAAA;QACA,CAAC;QACD;YACE,OAAO,kBAAkB,CAAA;IAC7B,CAAC;AACH,CAAC;AAED,kBAAe,iBAAiB,CAAA"}
|
|
@@ -1,83 +1,131 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = [
|
|
4
|
-
`fragment
|
|
4
|
+
`fragment _IContentData on _IContent
|
|
5
5
|
{
|
|
6
6
|
_metadata {
|
|
7
|
-
|
|
7
|
+
key
|
|
8
|
+
locale
|
|
9
|
+
types
|
|
10
|
+
displayName
|
|
11
|
+
version
|
|
12
|
+
changeset
|
|
13
|
+
variation
|
|
14
|
+
url {
|
|
15
|
+
type
|
|
16
|
+
base
|
|
17
|
+
default
|
|
18
|
+
}
|
|
8
19
|
}
|
|
9
20
|
_type: __typename
|
|
10
21
|
}`,
|
|
11
|
-
`fragment
|
|
22
|
+
`fragment _IElementData on _IComponent {
|
|
12
23
|
_metadata {
|
|
13
|
-
|
|
24
|
+
key
|
|
25
|
+
locale
|
|
26
|
+
types
|
|
27
|
+
displayName
|
|
28
|
+
version
|
|
29
|
+
url {
|
|
30
|
+
type
|
|
31
|
+
base
|
|
32
|
+
default
|
|
33
|
+
}
|
|
14
34
|
}
|
|
15
35
|
_type: __typename
|
|
16
36
|
}`,
|
|
17
|
-
`fragment
|
|
18
|
-
...IElementData
|
|
19
|
-
}`,
|
|
20
|
-
`fragment BlockData on _IComponent {
|
|
21
|
-
...IContentData
|
|
22
|
-
}`,
|
|
23
|
-
`fragment PageData on _IContent {
|
|
24
|
-
...IContentData
|
|
25
|
-
}`,
|
|
26
|
-
`fragment LinkData on ContentUrl {
|
|
37
|
+
`fragment _LinkData on ContentUrl {
|
|
27
38
|
type
|
|
28
39
|
base
|
|
29
40
|
default
|
|
30
41
|
}`,
|
|
31
|
-
`fragment
|
|
42
|
+
`fragment _ReferenceData on ContentReference {
|
|
32
43
|
key
|
|
33
44
|
url {
|
|
34
|
-
|
|
45
|
+
type
|
|
46
|
+
base
|
|
47
|
+
default
|
|
35
48
|
}
|
|
36
49
|
}`,
|
|
37
|
-
`fragment
|
|
50
|
+
`fragment _IContentInfo on IContentMetadata {
|
|
38
51
|
key
|
|
39
52
|
locale
|
|
40
53
|
types
|
|
41
54
|
displayName
|
|
42
55
|
version
|
|
43
56
|
url {
|
|
44
|
-
|
|
57
|
+
type
|
|
58
|
+
base
|
|
59
|
+
default
|
|
45
60
|
}
|
|
46
61
|
}`,
|
|
47
|
-
`fragment
|
|
62
|
+
`fragment _IContentListItem on _IContent {
|
|
48
63
|
...IContentData
|
|
49
64
|
}`,
|
|
50
|
-
`fragment
|
|
65
|
+
`fragment _ExperienceData on _IExperience {
|
|
51
66
|
composition {
|
|
52
|
-
# Experience level
|
|
53
67
|
...CompositionNodeData
|
|
54
68
|
nodes {
|
|
55
|
-
# Section level
|
|
56
69
|
...CompositionNodeData
|
|
57
|
-
... on
|
|
70
|
+
... on CompositionComponentNode {
|
|
71
|
+
component {
|
|
72
|
+
...IContentData
|
|
73
|
+
...SectionElementData
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
... on CompositionStructureNode {
|
|
58
77
|
nodes {
|
|
59
|
-
# Row level
|
|
60
78
|
...CompositionNodeData
|
|
61
|
-
...
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
nodes {
|
|
67
|
-
# Element level
|
|
68
|
-
...CompositionNodeData
|
|
69
|
-
...CompositionComponentNodeData
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
79
|
+
...CompositionStructureNode
|
|
80
|
+
...CompositionComponentNode
|
|
81
|
+
}
|
|
82
|
+
component {
|
|
83
|
+
...SectionData
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
|
-
...CompositionComponentNodeData
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
}`,
|
|
80
|
-
`fragment
|
|
89
|
+
`fragment _SectionCompositionData on _ISection {
|
|
90
|
+
composition {
|
|
91
|
+
...CompositionNodeData
|
|
92
|
+
nodes {
|
|
93
|
+
...CompositionNodeData
|
|
94
|
+
... on CompositionComponentNode {
|
|
95
|
+
component {
|
|
96
|
+
...IContentData
|
|
97
|
+
...SectionElementData
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
... on CompositionStructureNode {
|
|
101
|
+
nodes {
|
|
102
|
+
...CompositionNodeData
|
|
103
|
+
...CompositionStructureNode
|
|
104
|
+
...CompositionComponentNode
|
|
105
|
+
}
|
|
106
|
+
component {
|
|
107
|
+
...SectionData
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}`,
|
|
113
|
+
`fragment _CompositionStructureNode on ICompositionStructureNode {
|
|
114
|
+
nodes {
|
|
115
|
+
...CompositionNodeData
|
|
116
|
+
...CompositionStructureNode
|
|
117
|
+
...CompositionComponentNode
|
|
118
|
+
}
|
|
119
|
+
}`,
|
|
120
|
+
`fragment _CompositionComponentNode on CompositionComponentNode {
|
|
121
|
+
component {
|
|
122
|
+
...IContentData
|
|
123
|
+
...BlockData
|
|
124
|
+
...ElementData
|
|
125
|
+
...FormElementData
|
|
126
|
+
}
|
|
127
|
+
}`,
|
|
128
|
+
`fragment _CompositionNodeData on ICompositionNode {
|
|
81
129
|
name: displayName
|
|
82
130
|
layoutType: nodeType
|
|
83
131
|
type
|
|
@@ -88,18 +136,14 @@ exports.default = [
|
|
|
88
136
|
value
|
|
89
137
|
}
|
|
90
138
|
}`,
|
|
91
|
-
`fragment
|
|
92
|
-
component {
|
|
93
|
-
...BlockData
|
|
94
|
-
...ElementData
|
|
95
|
-
}
|
|
96
|
-
}`,
|
|
97
|
-
`fragment LinkItemData on Link {
|
|
139
|
+
`fragment _LinkItemData on Link {
|
|
98
140
|
title
|
|
99
141
|
text
|
|
100
142
|
target
|
|
101
143
|
url {
|
|
102
|
-
|
|
144
|
+
type
|
|
145
|
+
base
|
|
146
|
+
default
|
|
103
147
|
}
|
|
104
148
|
}`
|
|
105
149
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.cms13.js","sourceRoot":"","sources":["../../src/documents/fragments.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb
|
|
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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = [
|
|
4
|
-
`query
|
|
4
|
+
`query _getContentById($key: String!, $version: String, $locale: [Locales!], $path: String = "-", $domain: String, $changeset: String) {
|
|
5
5
|
content: _Content(
|
|
6
6
|
variation: { include: ALL }
|
|
7
7
|
where: {
|
|
@@ -23,10 +23,15 @@ exports.default = [
|
|
|
23
23
|
...IContentData
|
|
24
24
|
...BlockData
|
|
25
25
|
...PageData
|
|
26
|
+
...ElementData
|
|
27
|
+
...ComponentData
|
|
28
|
+
...SectionData
|
|
29
|
+
...FormElementData
|
|
30
|
+
...SectionCompositionData
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
}`,
|
|
29
|
-
`query
|
|
34
|
+
`query _getContentByPath($path: [String!]!, $locale: [Locales!], $siteId: String, $changeset: String = null, $variation: VariationInput) {
|
|
30
35
|
content: _Content(
|
|
31
36
|
where: {
|
|
32
37
|
_metadata: {
|
|
@@ -35,6 +40,7 @@ exports.default = [
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
locale: $locale
|
|
43
|
+
variation:$variation
|
|
38
44
|
) {
|
|
39
45
|
total
|
|
40
46
|
items: item {
|
|
@@ -43,7 +49,7 @@ exports.default = [
|
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
}`,
|
|
46
|
-
`query
|
|
52
|
+
`query _getContentType($key: String!, $version: String, $locale: [Locales!], $path: String = "-", $domain: String) {
|
|
47
53
|
content: _Content(
|
|
48
54
|
variation: { include: ALL }
|
|
49
55
|
where: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.cms13.js","sourceRoot":"","sources":["../../src/documents/queries.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb
|
|
1
|
+
{"version":3,"file":"queries.cms13.js","sourceRoot":"","sources":["../../src/documents/queries.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BI;IACJ;;;;;;;;;;;;;;;;;MAiBI;IACJ;;;;;;;;;;;;;;;;;;MAkBI;CACL,CAAA"}
|