@salesforce/lds-adapters-cms-delivery 0.1.0-dev1
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.txt +82 -0
- package/dist/es/es2018/cms-delivery.js +1981 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getCollectionItemsForChannel.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/getCollectionItemsForSite.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/getCollectionMetadataForChannel.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/getCollectionMetadataForSite.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/listContent.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/adapters/listContentInternal.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/deleteConnectCmsContentJobsByJobId.d.ts +11 -0
- package/dist/es/es2018/types/src/generated/resources/deleteConnectManagedContentContentSpacesContentsByContentSpaceIdAndManagedContentId.d.ts +10 -0
- package/dist/es/es2018/types/src/generated/resources/deleteConnectManagedContentContentSpacesMembersByContentSpaceIdAndMemberIdOrMe.d.ts +10 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsChannelsSearchableContentTypesByChannelId.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsContent.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsContentJobsByJobId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsContentVersionByManagedContentVersionId.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryChannelsCollectionsByChannelIdAndCollectionKeyOrId.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryChannelsCollectionsMetadataByChannelIdAndCollectionKeyOrId.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryChannelsContentsQueryByChannelId.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryChannelsContentsSearchByChannelId.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryChannelsMediaContentByChannelIdAndMediaGuid.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsDeliveryRecordsContentsByRecordId.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsFoldersByFolderId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsFoldersItemsByFolderId.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCmsSpacesByContentSpaceId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCommunitiesManagedContentDeliveryByCommunityId.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCommunitiesManagedContentDeliveryContentsByCommunityId.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCommunitiesManagedContentDeliveryContentsByCommunityIdAndManagedContentId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCommunitiesManagedContentDeliveryContentsSearchByCommunityId.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectManagedContentContentSpacesContentVersionsByContentSpaceIdAndManagedContentVersionId.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectManagedContentContentSpacesMembersByContentSpaceId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectManagedContentContentSpacesMembersPermissionsByContentSpaceIdAndMemberIdOrMe.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectManagedContentDeliveryContentsByManagedContentId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectManagedContentRoles.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectSitesCmsDeliveryCollectionsByCollectionKeyOrIdAndSiteId.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectSitesCmsDeliveryCollectionsMetadataByCollectionKeyOrIdAndSiteId.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/patchConnectCmsChannelsSearchableContentTypesByChannelId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/patchConnectCmsFoldersItemsByFolderId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/patchConnectManagedContentContentSpacesContentsByContentSpaceIdAndManagedContentId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/types/AbstractMCSFolderRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentAssociationsInputRep.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentAssociationsRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentBodyInputRep.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentChannelSummaryRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentChannelTargetSummaryRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentCollectionItemRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentCollectionItemTypeSummaryRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentCollectionItemsRepresentation.d.ts +67 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentCollectionMetadataRepresentation.d.ts +65 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentCollectionRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentDateAndTimeNodeValueRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentDateNodeValueRepresentation.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentDeliveryChannelSummaryRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentDetailCollectionRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentDetailRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentInputRep.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentJobRepresentation.d.ts +64 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentJobRequestInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentMediaNodeValueRepresentation.d.ts +56 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentMediaSourceNodeValueRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentNodeTypeRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentNodeValueRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSearchResultCollectionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSearchResultContentTypeRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSearchResultRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceFolderDetailRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceFolderItemCollectionInputRep.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceFolderItemCollectionRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceFolderItemRepresentation.d.ts +61 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceFolderRepresentation.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceMemberCollectionRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceMemberInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceMemberPermissionsRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceMemberRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpacePermissionRepresentation.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceRepresentation.d.ts +55 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceRoleCollectionRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceRoleRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTextNodeValueRepresentation.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTranslationRepresentation.d.ts +64 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTranslationRequestInputRep.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTypeRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTypeSearchableCollectionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTypeSearchableInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTypeSearchableRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentTypeSummaryRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVariantInputRep.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVariantRepresentation.d.ts +49 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionCollectionRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionInputRep.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionInternalCollectionRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionInternalRepresentation.d.ts +81 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionRepresentation.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionV2CollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionV2CollectionRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionV2InputRepresentation.d.ts +53 -0
- package/dist/es/es2018/types/src/generated/types/ManagedContentVersionV2Representation.d.ts +71 -0
- package/dist/es/es2018/types/src/generated/types/ReferenceRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/StreamedRepresentation.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/types/TopicSummaryRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/dist/es/es2018/types/src/raml-artifacts/adapters/getCollectionMetadataForChannel/onFetchResponseSuccess.d.ts +5 -0
- package/dist/es/es2018/types/src/raml-artifacts/adapters/getCollectionMetadataForSite/onFetchResponseSuccess.d.ts +5 -0
- package/package.json +61 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +2071 -0
- package/src/raml/api.raml +2164 -0
- package/src/raml/luvio.raml +47 -0
|
@@ -0,0 +1,1981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$6, typeCheckConfig as typeCheckConfig$6, StoreKeyMap, createResourceParams as createResourceParams$6 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'CMS';
|
|
73
|
+
|
|
74
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
75
|
+
const { isArray: ArrayIsArray } = Array;
|
|
76
|
+
const { stringify: JSONStringify } = JSON;
|
|
77
|
+
function equalsArray(a, b, equalsItem) {
|
|
78
|
+
const aLength = a.length;
|
|
79
|
+
const bLength = b.length;
|
|
80
|
+
if (aLength !== bLength) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < aLength; i++) {
|
|
84
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
function createLink(ref) {
|
|
91
|
+
return {
|
|
92
|
+
__ref: serializeStructuredKey(ref),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function validate$g(obj, path = 'ManagedContentChannelTargetSummaryRepresentation') {
|
|
97
|
+
const v_error = (() => {
|
|
98
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
+
}
|
|
101
|
+
const obj_id = obj.id;
|
|
102
|
+
const path_id = path + '.id';
|
|
103
|
+
if (typeof obj_id !== 'string') {
|
|
104
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
return v_error === undefined ? null : v_error;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function validate$f(obj, path = 'ManagedContentDeliveryChannelSummaryRepresentation') {
|
|
111
|
+
const v_error = (() => {
|
|
112
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
113
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
114
|
+
}
|
|
115
|
+
const obj_domainUrl = obj.domainUrl;
|
|
116
|
+
const path_domainUrl = path + '.domainUrl';
|
|
117
|
+
if (typeof obj_domainUrl !== 'string') {
|
|
118
|
+
return new TypeError('Expected "string" but received "' + typeof obj_domainUrl + '" (at "' + path_domainUrl + '")');
|
|
119
|
+
}
|
|
120
|
+
const obj_id = obj.id;
|
|
121
|
+
const path_id = path + '.id';
|
|
122
|
+
if (typeof obj_id !== 'string') {
|
|
123
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
124
|
+
}
|
|
125
|
+
const obj_name = obj.name;
|
|
126
|
+
const path_name = path + '.name';
|
|
127
|
+
if (typeof obj_name !== 'string') {
|
|
128
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
129
|
+
}
|
|
130
|
+
const obj_resourceUrl = obj.resourceUrl;
|
|
131
|
+
const path_resourceUrl = path + '.resourceUrl';
|
|
132
|
+
if (typeof obj_resourceUrl !== 'string') {
|
|
133
|
+
return new TypeError('Expected "string" but received "' + typeof obj_resourceUrl + '" (at "' + path_resourceUrl + '")');
|
|
134
|
+
}
|
|
135
|
+
if (obj.target !== undefined) {
|
|
136
|
+
const obj_target = obj.target;
|
|
137
|
+
const path_target = path + '.target';
|
|
138
|
+
const referencepath_targetValidationError = validate$g(obj_target, path_target);
|
|
139
|
+
if (referencepath_targetValidationError !== null) {
|
|
140
|
+
let message = 'Object doesn\'t match ManagedContentChannelTargetSummaryRepresentation (at "' + path_target + '")\n';
|
|
141
|
+
message += referencepath_targetValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
142
|
+
return new TypeError(message);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const obj_type = obj.type;
|
|
146
|
+
const path_type = path + '.type';
|
|
147
|
+
if (typeof obj_type !== 'string') {
|
|
148
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
return v_error === undefined ? null : v_error;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function validate$e(obj, path = 'ManagedContentTypeSummaryRepresentation') {
|
|
155
|
+
const v_error = (() => {
|
|
156
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
157
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
158
|
+
}
|
|
159
|
+
const obj_fullyQualifiedName = obj.fullyQualifiedName;
|
|
160
|
+
const path_fullyQualifiedName = path + '.fullyQualifiedName';
|
|
161
|
+
if (typeof obj_fullyQualifiedName !== 'string') {
|
|
162
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fullyQualifiedName + '" (at "' + path_fullyQualifiedName + '")');
|
|
163
|
+
}
|
|
164
|
+
if (obj.name !== undefined) {
|
|
165
|
+
const obj_name = obj.name;
|
|
166
|
+
const path_name = path + '.name';
|
|
167
|
+
if (typeof obj_name !== 'string') {
|
|
168
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
return v_error === undefined ? null : v_error;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function validate$d(obj, path = 'ManagedContentCollectionItemTypeSummaryRepresentation') {
|
|
176
|
+
const v_error = (() => {
|
|
177
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
178
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
179
|
+
}
|
|
180
|
+
const obj_fullyQualifiedName = obj.fullyQualifiedName;
|
|
181
|
+
const path_fullyQualifiedName = path + '.fullyQualifiedName';
|
|
182
|
+
if (typeof obj_fullyQualifiedName !== 'string') {
|
|
183
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fullyQualifiedName + '" (at "' + path_fullyQualifiedName + '")');
|
|
184
|
+
}
|
|
185
|
+
const obj_name = obj.name;
|
|
186
|
+
const path_name = path + '.name';
|
|
187
|
+
if (typeof obj_name !== 'string') {
|
|
188
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
191
|
+
return v_error === undefined ? null : v_error;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function validate$c(obj, path = 'ManagedContentCollectionItemRepresentation') {
|
|
195
|
+
const v_error = (() => {
|
|
196
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
197
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
198
|
+
}
|
|
199
|
+
const obj_body = obj.body;
|
|
200
|
+
const path_body = path + '.body';
|
|
201
|
+
if (typeof obj_body !== 'object' || ArrayIsArray(obj_body) || obj_body === null) {
|
|
202
|
+
return new TypeError('Expected "object" but received "' + typeof obj_body + '" (at "' + path_body + '")');
|
|
203
|
+
}
|
|
204
|
+
const obj_body_keys = ObjectKeys(obj_body);
|
|
205
|
+
for (let i = 0; i < obj_body_keys.length; i++) {
|
|
206
|
+
const key = obj_body_keys[i];
|
|
207
|
+
const obj_body_prop = obj_body[key];
|
|
208
|
+
const path_body_prop = path_body + '["' + key + '"]';
|
|
209
|
+
if (obj_body_prop === undefined) {
|
|
210
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_body_prop + '" (at "' + path_body_prop + '")');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const obj_contentType = obj.contentType;
|
|
214
|
+
const path_contentType = path + '.contentType';
|
|
215
|
+
const referencepath_contentTypeValidationError = validate$d(obj_contentType, path_contentType);
|
|
216
|
+
if (referencepath_contentTypeValidationError !== null) {
|
|
217
|
+
let message = 'Object doesn\'t match ManagedContentCollectionItemTypeSummaryRepresentation (at "' + path_contentType + '")\n';
|
|
218
|
+
message += referencepath_contentTypeValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
219
|
+
return new TypeError(message);
|
|
220
|
+
}
|
|
221
|
+
const obj_id = obj.id;
|
|
222
|
+
const path_id = path + '.id';
|
|
223
|
+
if (typeof obj_id !== 'string') {
|
|
224
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
225
|
+
}
|
|
226
|
+
const obj_name = obj.name;
|
|
227
|
+
const path_name = path + '.name';
|
|
228
|
+
if (typeof obj_name !== 'string') {
|
|
229
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
230
|
+
}
|
|
231
|
+
})();
|
|
232
|
+
return v_error === undefined ? null : v_error;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const TTL$3 = 3600000;
|
|
236
|
+
const VERSION$4 = "b513480693ae9012df7865f2698d2001";
|
|
237
|
+
function validate$b(obj, path = 'ManagedContentCollectionItemsRepresentation') {
|
|
238
|
+
const v_error = (() => {
|
|
239
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
240
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
241
|
+
}
|
|
242
|
+
const obj_channelSummary = obj.channelSummary;
|
|
243
|
+
const path_channelSummary = path + '.channelSummary';
|
|
244
|
+
const referencepath_channelSummaryValidationError = validate$f(obj_channelSummary, path_channelSummary);
|
|
245
|
+
if (referencepath_channelSummaryValidationError !== null) {
|
|
246
|
+
let message = 'Object doesn\'t match ManagedContentDeliveryChannelSummaryRepresentation (at "' + path_channelSummary + '")\n';
|
|
247
|
+
message += referencepath_channelSummaryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
248
|
+
return new TypeError(message);
|
|
249
|
+
}
|
|
250
|
+
const obj_collectionKey = obj.collectionKey;
|
|
251
|
+
const path_collectionKey = path + '.collectionKey';
|
|
252
|
+
if (typeof obj_collectionKey !== 'string') {
|
|
253
|
+
return new TypeError('Expected "string" but received "' + typeof obj_collectionKey + '" (at "' + path_collectionKey + '")');
|
|
254
|
+
}
|
|
255
|
+
const obj_collectionType = obj.collectionType;
|
|
256
|
+
const path_collectionType = path + '.collectionType';
|
|
257
|
+
const referencepath_collectionTypeValidationError = validate$e(obj_collectionType, path_collectionType);
|
|
258
|
+
if (referencepath_collectionTypeValidationError !== null) {
|
|
259
|
+
let message = 'Object doesn\'t match ManagedContentTypeSummaryRepresentation (at "' + path_collectionType + '")\n';
|
|
260
|
+
message += referencepath_collectionTypeValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
261
|
+
return new TypeError(message);
|
|
262
|
+
}
|
|
263
|
+
const obj_currentPageUrl = obj.currentPageUrl;
|
|
264
|
+
const path_currentPageUrl = path + '.currentPageUrl';
|
|
265
|
+
if (typeof obj_currentPageUrl !== 'string') {
|
|
266
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
267
|
+
}
|
|
268
|
+
const obj_id = obj.id;
|
|
269
|
+
const path_id = path + '.id';
|
|
270
|
+
if (typeof obj_id !== 'string') {
|
|
271
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
272
|
+
}
|
|
273
|
+
const obj_items = obj.items;
|
|
274
|
+
const path_items = path + '.items';
|
|
275
|
+
if (!ArrayIsArray(obj_items)) {
|
|
276
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
277
|
+
}
|
|
278
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
279
|
+
const obj_items_item = obj_items[i];
|
|
280
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
281
|
+
const referencepath_items_itemValidationError = validate$c(obj_items_item, path_items_item);
|
|
282
|
+
if (referencepath_items_itemValidationError !== null) {
|
|
283
|
+
let message = 'Object doesn\'t match ManagedContentCollectionItemRepresentation (at "' + path_items_item + '")\n';
|
|
284
|
+
message += referencepath_items_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
285
|
+
return new TypeError(message);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const obj_language = obj.language;
|
|
289
|
+
const path_language = path + '.language';
|
|
290
|
+
if (typeof obj_language !== 'string') {
|
|
291
|
+
return new TypeError('Expected "string" but received "' + typeof obj_language + '" (at "' + path_language + '")');
|
|
292
|
+
}
|
|
293
|
+
if (obj.nextPageUrl !== undefined) {
|
|
294
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
295
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
296
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
297
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (obj.previousPageUrl !== undefined) {
|
|
301
|
+
const obj_previousPageUrl = obj.previousPageUrl;
|
|
302
|
+
const path_previousPageUrl = path + '.previousPageUrl';
|
|
303
|
+
if (typeof obj_previousPageUrl !== 'string') {
|
|
304
|
+
return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const obj_publishedDate = obj.publishedDate;
|
|
308
|
+
const path_publishedDate = path + '.publishedDate';
|
|
309
|
+
if (typeof obj_publishedDate !== 'string') {
|
|
310
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishedDate + '" (at "' + path_publishedDate + '")');
|
|
311
|
+
}
|
|
312
|
+
const obj_title = obj.title;
|
|
313
|
+
const path_title = path + '.title';
|
|
314
|
+
if (typeof obj_title !== 'string') {
|
|
315
|
+
return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
|
|
316
|
+
}
|
|
317
|
+
if (obj.total !== undefined) {
|
|
318
|
+
const obj_total = obj.total;
|
|
319
|
+
const path_total = path + '.total';
|
|
320
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
321
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const obj_urlName = obj.urlName;
|
|
325
|
+
const path_urlName = path + '.urlName';
|
|
326
|
+
if (typeof obj_urlName !== 'string') {
|
|
327
|
+
return new TypeError('Expected "string" but received "' + typeof obj_urlName + '" (at "' + path_urlName + '")');
|
|
328
|
+
}
|
|
329
|
+
})();
|
|
330
|
+
return v_error === undefined ? null : v_error;
|
|
331
|
+
}
|
|
332
|
+
const RepresentationType$4 = 'ManagedContentCollectionItemsRepresentation';
|
|
333
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
334
|
+
return input;
|
|
335
|
+
}
|
|
336
|
+
const select$a = function ManagedContentCollectionItemsRepresentationSelect() {
|
|
337
|
+
return {
|
|
338
|
+
kind: 'Fragment',
|
|
339
|
+
version: VERSION$4,
|
|
340
|
+
private: [],
|
|
341
|
+
opaque: true
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
function equals$4(existing, incoming) {
|
|
345
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
const ingest$4 = function ManagedContentCollectionItemsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
351
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
352
|
+
const validateError = validate$b(input);
|
|
353
|
+
if (validateError !== null) {
|
|
354
|
+
throw validateError;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const key = path.fullPath;
|
|
358
|
+
const ttlToUse = TTL$3;
|
|
359
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "CMS", VERSION$4, RepresentationType$4, equals$4);
|
|
360
|
+
return createLink(key);
|
|
361
|
+
};
|
|
362
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
363
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
364
|
+
const rootKey = fullPathFactory();
|
|
365
|
+
rootKeySet.set(rootKey, {
|
|
366
|
+
namespace: keyPrefix,
|
|
367
|
+
representationName: RepresentationType$4,
|
|
368
|
+
mergeable: false
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function select$9(luvio, params) {
|
|
373
|
+
return select$a();
|
|
374
|
+
}
|
|
375
|
+
function keyBuilder$b(luvio, params) {
|
|
376
|
+
return keyPrefix + '::ManagedContentCollectionItemsRepresentation:(' + 'language:' + params.queryParams.language + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'pageToken:' + params.queryParams.pageToken + ',' + 'channelId:' + params.urlParams.channelId + ',' + 'collectionKeyOrId:' + params.urlParams.collectionKeyOrId + ')';
|
|
377
|
+
}
|
|
378
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
379
|
+
getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$b(luvio, resourceParams));
|
|
380
|
+
}
|
|
381
|
+
function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
382
|
+
const { body } = response;
|
|
383
|
+
const key = keyBuilder$b(luvio, resourceParams);
|
|
384
|
+
luvio.storeIngest(key, ingest$4, body);
|
|
385
|
+
const snapshot = luvio.storeLookup({
|
|
386
|
+
recordId: key,
|
|
387
|
+
node: select$9(),
|
|
388
|
+
variables: {},
|
|
389
|
+
}, snapshotRefresh);
|
|
390
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
391
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
392
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
deepFreeze(snapshot.data);
|
|
396
|
+
return snapshot;
|
|
397
|
+
}
|
|
398
|
+
function ingestError$5(luvio, params, error, snapshotRefresh) {
|
|
399
|
+
const key = keyBuilder$b(luvio, params);
|
|
400
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
401
|
+
const storeMetadataParams = {
|
|
402
|
+
ttl: TTL$3,
|
|
403
|
+
namespace: keyPrefix,
|
|
404
|
+
version: VERSION$4,
|
|
405
|
+
representationName: RepresentationType$4
|
|
406
|
+
};
|
|
407
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
408
|
+
return errorSnapshot;
|
|
409
|
+
}
|
|
410
|
+
function createResourceRequest$5(config) {
|
|
411
|
+
const headers = {};
|
|
412
|
+
return {
|
|
413
|
+
baseUri: '/services/data/v66.0',
|
|
414
|
+
basePath: '/connect/cms/delivery/channels/' + config.urlParams.channelId + '/collections/' + config.urlParams.collectionKeyOrId + '',
|
|
415
|
+
method: 'get',
|
|
416
|
+
body: null,
|
|
417
|
+
urlParams: config.urlParams,
|
|
418
|
+
queryParams: config.queryParams,
|
|
419
|
+
headers,
|
|
420
|
+
priority: 'normal',
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const adapterName$5 = 'getCollectionItemsForChannel';
|
|
425
|
+
const getCollectionItemsForChannel_ConfigPropertyMetadata = [
|
|
426
|
+
generateParamConfigMetadata('channelId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
427
|
+
generateParamConfigMetadata('collectionKeyOrId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
428
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
429
|
+
generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
430
|
+
generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
431
|
+
];
|
|
432
|
+
const getCollectionItemsForChannel_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getCollectionItemsForChannel_ConfigPropertyMetadata);
|
|
433
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(getCollectionItemsForChannel_ConfigPropertyMetadata);
|
|
434
|
+
function keyBuilder$a(luvio, config) {
|
|
435
|
+
const resourceParams = createResourceParams$5(config);
|
|
436
|
+
return keyBuilder$b(luvio, resourceParams);
|
|
437
|
+
}
|
|
438
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
439
|
+
const config = {};
|
|
440
|
+
typeCheckConfig$6(untrustedConfig, config, getCollectionItemsForChannel_ConfigPropertyMetadata);
|
|
441
|
+
return config;
|
|
442
|
+
}
|
|
443
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
444
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
448
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
449
|
+
}
|
|
450
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
451
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
return config;
|
|
455
|
+
}
|
|
456
|
+
function adapterFragment$5(luvio, config) {
|
|
457
|
+
createResourceParams$5(config);
|
|
458
|
+
return select$9();
|
|
459
|
+
}
|
|
460
|
+
function onFetchResponseSuccess$7(luvio, config, resourceParams, response) {
|
|
461
|
+
const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
|
|
462
|
+
config,
|
|
463
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
464
|
+
});
|
|
465
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
466
|
+
}
|
|
467
|
+
function onFetchResponseError$5(luvio, config, resourceParams, response) {
|
|
468
|
+
const snapshot = ingestError$5(luvio, resourceParams, response, {
|
|
469
|
+
config,
|
|
470
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
471
|
+
});
|
|
472
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
473
|
+
}
|
|
474
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
475
|
+
const resourceParams = createResourceParams$5(config);
|
|
476
|
+
const request = createResourceRequest$5(resourceParams);
|
|
477
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
478
|
+
.then((response) => {
|
|
479
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$7(luvio, config, resourceParams, response), () => {
|
|
480
|
+
const cache = new StoreKeyMap();
|
|
481
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
482
|
+
return cache;
|
|
483
|
+
});
|
|
484
|
+
}, (response) => {
|
|
485
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$5(luvio, config, resourceParams, response));
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext) {
|
|
489
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
|
|
490
|
+
}
|
|
491
|
+
function buildCachedSnapshotCachePolicy$5(context, storeLookup) {
|
|
492
|
+
const { luvio, config } = context;
|
|
493
|
+
const selector = {
|
|
494
|
+
recordId: keyBuilder$a(luvio, config),
|
|
495
|
+
node: adapterFragment$5(luvio, config),
|
|
496
|
+
variables: {},
|
|
497
|
+
};
|
|
498
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
499
|
+
config,
|
|
500
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
501
|
+
});
|
|
502
|
+
return cacheSnapshot;
|
|
503
|
+
}
|
|
504
|
+
const getCollectionItemsForChannelAdapterFactory = (luvio) => function CMS__getCollectionItemsForChannel(untrustedConfig, requestContext) {
|
|
505
|
+
const config = validateAdapterConfig$5(untrustedConfig, getCollectionItemsForChannel_ConfigPropertyNames);
|
|
506
|
+
// Invalid or incomplete config
|
|
507
|
+
if (config === null) {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
511
|
+
buildCachedSnapshotCachePolicy$5, buildNetworkSnapshotCachePolicy$5);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
const TTL$2 = 3600000;
|
|
515
|
+
const VERSION$3 = "04f084216502225bdb5fe939fc41b883";
|
|
516
|
+
function validate$a(obj, path = 'ManagedContentCollectionMetadataRepresentation') {
|
|
517
|
+
const v_error = (() => {
|
|
518
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
519
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
520
|
+
}
|
|
521
|
+
const obj_channelSummary = obj.channelSummary;
|
|
522
|
+
const path_channelSummary = path + '.channelSummary';
|
|
523
|
+
const referencepath_channelSummaryValidationError = validate$f(obj_channelSummary, path_channelSummary);
|
|
524
|
+
if (referencepath_channelSummaryValidationError !== null) {
|
|
525
|
+
let message = 'Object doesn\'t match ManagedContentDeliveryChannelSummaryRepresentation (at "' + path_channelSummary + '")\n';
|
|
526
|
+
message += referencepath_channelSummaryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
527
|
+
return new TypeError(message);
|
|
528
|
+
}
|
|
529
|
+
const obj_collectionKey = obj.collectionKey;
|
|
530
|
+
const path_collectionKey = path + '.collectionKey';
|
|
531
|
+
if (typeof obj_collectionKey !== 'string') {
|
|
532
|
+
return new TypeError('Expected "string" but received "' + typeof obj_collectionKey + '" (at "' + path_collectionKey + '")');
|
|
533
|
+
}
|
|
534
|
+
const obj_collectionMetadata = obj.collectionMetadata;
|
|
535
|
+
const path_collectionMetadata = path + '.collectionMetadata';
|
|
536
|
+
if (typeof obj_collectionMetadata !== 'object' || ArrayIsArray(obj_collectionMetadata) || obj_collectionMetadata === null) {
|
|
537
|
+
return new TypeError('Expected "object" but received "' + typeof obj_collectionMetadata + '" (at "' + path_collectionMetadata + '")');
|
|
538
|
+
}
|
|
539
|
+
const obj_collectionMetadata_keys = ObjectKeys(obj_collectionMetadata);
|
|
540
|
+
for (let i = 0; i < obj_collectionMetadata_keys.length; i++) {
|
|
541
|
+
const key = obj_collectionMetadata_keys[i];
|
|
542
|
+
const obj_collectionMetadata_prop = obj_collectionMetadata[key];
|
|
543
|
+
const path_collectionMetadata_prop = path_collectionMetadata + '["' + key + '"]';
|
|
544
|
+
if (obj_collectionMetadata_prop === undefined) {
|
|
545
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_collectionMetadata_prop + '" (at "' + path_collectionMetadata_prop + '")');
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
const obj_collectionType = obj.collectionType;
|
|
549
|
+
const path_collectionType = path + '.collectionType';
|
|
550
|
+
const referencepath_collectionTypeValidationError = validate$e(obj_collectionType, path_collectionType);
|
|
551
|
+
if (referencepath_collectionTypeValidationError !== null) {
|
|
552
|
+
let message = 'Object doesn\'t match ManagedContentTypeSummaryRepresentation (at "' + path_collectionType + '")\n';
|
|
553
|
+
message += referencepath_collectionTypeValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
554
|
+
return new TypeError(message);
|
|
555
|
+
}
|
|
556
|
+
const obj_id = obj.id;
|
|
557
|
+
const path_id = path + '.id';
|
|
558
|
+
if (typeof obj_id !== 'string') {
|
|
559
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
560
|
+
}
|
|
561
|
+
const obj_language = obj.language;
|
|
562
|
+
const path_language = path + '.language';
|
|
563
|
+
if (typeof obj_language !== 'string') {
|
|
564
|
+
return new TypeError('Expected "string" but received "' + typeof obj_language + '" (at "' + path_language + '")');
|
|
565
|
+
}
|
|
566
|
+
const obj_publishedDate = obj.publishedDate;
|
|
567
|
+
const path_publishedDate = path + '.publishedDate';
|
|
568
|
+
if (typeof obj_publishedDate !== 'string') {
|
|
569
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishedDate + '" (at "' + path_publishedDate + '")');
|
|
570
|
+
}
|
|
571
|
+
const obj_schema = obj.schema;
|
|
572
|
+
const path_schema = path + '.schema';
|
|
573
|
+
if (typeof obj_schema !== 'object' || ArrayIsArray(obj_schema) || obj_schema === null) {
|
|
574
|
+
return new TypeError('Expected "object" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
|
|
575
|
+
}
|
|
576
|
+
const obj_schema_keys = ObjectKeys(obj_schema);
|
|
577
|
+
for (let i = 0; i < obj_schema_keys.length; i++) {
|
|
578
|
+
const key = obj_schema_keys[i];
|
|
579
|
+
const obj_schema_prop = obj_schema[key];
|
|
580
|
+
const path_schema_prop = path_schema + '["' + key + '"]';
|
|
581
|
+
if (obj_schema_prop === undefined) {
|
|
582
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_schema_prop + '" (at "' + path_schema_prop + '")');
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
const obj_title = obj.title;
|
|
586
|
+
const path_title = path + '.title';
|
|
587
|
+
if (typeof obj_title !== 'string') {
|
|
588
|
+
return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
|
|
589
|
+
}
|
|
590
|
+
const obj_urlName = obj.urlName;
|
|
591
|
+
const path_urlName = path + '.urlName';
|
|
592
|
+
if (typeof obj_urlName !== 'string') {
|
|
593
|
+
return new TypeError('Expected "string" but received "' + typeof obj_urlName + '" (at "' + path_urlName + '")');
|
|
594
|
+
}
|
|
595
|
+
})();
|
|
596
|
+
return v_error === undefined ? null : v_error;
|
|
597
|
+
}
|
|
598
|
+
const RepresentationType$3 = 'ManagedContentCollectionMetadataRepresentation';
|
|
599
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
600
|
+
return input;
|
|
601
|
+
}
|
|
602
|
+
const select$8 = function ManagedContentCollectionMetadataRepresentationSelect() {
|
|
603
|
+
return {
|
|
604
|
+
kind: 'Fragment',
|
|
605
|
+
version: VERSION$3,
|
|
606
|
+
private: [],
|
|
607
|
+
opaque: true
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
function equals$3(existing, incoming) {
|
|
611
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
612
|
+
return false;
|
|
613
|
+
}
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
616
|
+
const ingest$3 = function ManagedContentCollectionMetadataRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
617
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
618
|
+
const validateError = validate$a(input);
|
|
619
|
+
if (validateError !== null) {
|
|
620
|
+
throw validateError;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const key = path.fullPath;
|
|
624
|
+
const ttlToUse = TTL$2;
|
|
625
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "CMS", VERSION$3, RepresentationType$3, equals$3);
|
|
626
|
+
return createLink(key);
|
|
627
|
+
};
|
|
628
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
629
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
630
|
+
const rootKey = fullPathFactory();
|
|
631
|
+
rootKeySet.set(rootKey, {
|
|
632
|
+
namespace: keyPrefix,
|
|
633
|
+
representationName: RepresentationType$3,
|
|
634
|
+
mergeable: false
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function select$7(luvio, params) {
|
|
639
|
+
return select$8();
|
|
640
|
+
}
|
|
641
|
+
function keyBuilder$9(luvio, params) {
|
|
642
|
+
return keyPrefix + '::ManagedContentCollectionMetadataRepresentation:(' + 'expandMetadata:' + params.queryParams.expandMetadata + ',' + 'language:' + params.queryParams.language + ',' + 'channelId:' + params.urlParams.channelId + ',' + 'collectionKeyOrId:' + params.urlParams.collectionKeyOrId + ')';
|
|
643
|
+
}
|
|
644
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
645
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$9(luvio, resourceParams));
|
|
646
|
+
}
|
|
647
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
648
|
+
const { body } = response;
|
|
649
|
+
const key = keyBuilder$9(luvio, resourceParams);
|
|
650
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
651
|
+
const snapshot = luvio.storeLookup({
|
|
652
|
+
recordId: key,
|
|
653
|
+
node: select$7(),
|
|
654
|
+
variables: {},
|
|
655
|
+
}, snapshotRefresh);
|
|
656
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
657
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
658
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
deepFreeze(snapshot.data);
|
|
662
|
+
return snapshot;
|
|
663
|
+
}
|
|
664
|
+
function ingestError$4(luvio, params, error, snapshotRefresh) {
|
|
665
|
+
const key = keyBuilder$9(luvio, params);
|
|
666
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
667
|
+
const storeMetadataParams = {
|
|
668
|
+
ttl: TTL$2,
|
|
669
|
+
namespace: keyPrefix,
|
|
670
|
+
version: VERSION$3,
|
|
671
|
+
representationName: RepresentationType$3
|
|
672
|
+
};
|
|
673
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
674
|
+
return errorSnapshot;
|
|
675
|
+
}
|
|
676
|
+
function createResourceRequest$4(config) {
|
|
677
|
+
const headers = {};
|
|
678
|
+
return {
|
|
679
|
+
baseUri: '/services/data/v66.0',
|
|
680
|
+
basePath: '/connect/cms/delivery/channels/' + config.urlParams.channelId + '/collections/' + config.urlParams.collectionKeyOrId + '/metadata',
|
|
681
|
+
method: 'get',
|
|
682
|
+
body: null,
|
|
683
|
+
urlParams: config.urlParams,
|
|
684
|
+
queryParams: config.queryParams,
|
|
685
|
+
headers,
|
|
686
|
+
priority: 'normal',
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function onFetchResponseSuccess$6(luvio, config, resourceParams, response) {
|
|
691
|
+
let updatedResourceParams = resourceParams;
|
|
692
|
+
// If language is not provided in request resource params, use language from the response
|
|
693
|
+
// and update the response params. As this resource params will be used to build a cache key.
|
|
694
|
+
if (updatedResourceParams.queryParams.language === undefined) {
|
|
695
|
+
updatedResourceParams.queryParams.language = response.body.language;
|
|
696
|
+
}
|
|
697
|
+
return onFetchResponseSuccess$5(luvio, config, updatedResourceParams, response);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
const adapterName$4 = 'getCollectionMetadataForChannel';
|
|
701
|
+
const getCollectionMetadataForChannel_ConfigPropertyMetadata = [
|
|
702
|
+
generateParamConfigMetadata('channelId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
703
|
+
generateParamConfigMetadata('collectionKeyOrId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
704
|
+
generateParamConfigMetadata('expandMetadata', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
705
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
706
|
+
];
|
|
707
|
+
const getCollectionMetadataForChannel_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getCollectionMetadataForChannel_ConfigPropertyMetadata);
|
|
708
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(getCollectionMetadataForChannel_ConfigPropertyMetadata);
|
|
709
|
+
function keyBuilder$8(luvio, config) {
|
|
710
|
+
const resourceParams = createResourceParams$4(config);
|
|
711
|
+
return keyBuilder$9(luvio, resourceParams);
|
|
712
|
+
}
|
|
713
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
714
|
+
const config = {};
|
|
715
|
+
typeCheckConfig$6(untrustedConfig, config, getCollectionMetadataForChannel_ConfigPropertyMetadata);
|
|
716
|
+
return config;
|
|
717
|
+
}
|
|
718
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
719
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
723
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
724
|
+
}
|
|
725
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
726
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
return config;
|
|
730
|
+
}
|
|
731
|
+
function adapterFragment$4(luvio, config) {
|
|
732
|
+
createResourceParams$4(config);
|
|
733
|
+
return select$7();
|
|
734
|
+
}
|
|
735
|
+
function onFetchResponseSuccess$5(luvio, config, resourceParams, response) {
|
|
736
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
737
|
+
config,
|
|
738
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
739
|
+
});
|
|
740
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
741
|
+
}
|
|
742
|
+
function onFetchResponseError$4(luvio, config, resourceParams, response) {
|
|
743
|
+
const snapshot = ingestError$4(luvio, resourceParams, response, {
|
|
744
|
+
config,
|
|
745
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
746
|
+
});
|
|
747
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
748
|
+
}
|
|
749
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
750
|
+
const resourceParams = createResourceParams$4(config);
|
|
751
|
+
const request = createResourceRequest$4(resourceParams);
|
|
752
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
753
|
+
.then((response) => {
|
|
754
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$6(luvio, config, resourceParams, response), () => {
|
|
755
|
+
const cache = new StoreKeyMap();
|
|
756
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
757
|
+
return cache;
|
|
758
|
+
});
|
|
759
|
+
}, (response) => {
|
|
760
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$4(luvio, config, resourceParams, response));
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
|
|
764
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
765
|
+
}
|
|
766
|
+
function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
|
|
767
|
+
const { luvio, config } = context;
|
|
768
|
+
const selector = {
|
|
769
|
+
recordId: keyBuilder$8(luvio, config),
|
|
770
|
+
node: adapterFragment$4(luvio, config),
|
|
771
|
+
variables: {},
|
|
772
|
+
};
|
|
773
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
774
|
+
config,
|
|
775
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
776
|
+
});
|
|
777
|
+
return cacheSnapshot;
|
|
778
|
+
}
|
|
779
|
+
const getCollectionMetadataForChannelAdapterFactory = (luvio) => function CMS__getCollectionMetadataForChannel(untrustedConfig, requestContext) {
|
|
780
|
+
const config = validateAdapterConfig$4(untrustedConfig, getCollectionMetadataForChannel_ConfigPropertyNames);
|
|
781
|
+
// Invalid or incomplete config
|
|
782
|
+
if (config === null) {
|
|
783
|
+
return null;
|
|
784
|
+
}
|
|
785
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
786
|
+
buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
function validate$9(obj, path = 'TopicSummaryRepresentation') {
|
|
790
|
+
const v_error = (() => {
|
|
791
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
792
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
793
|
+
}
|
|
794
|
+
const obj_id = obj.id;
|
|
795
|
+
const path_id = path + '.id';
|
|
796
|
+
if (typeof obj_id !== 'string') {
|
|
797
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
798
|
+
}
|
|
799
|
+
const obj_name = obj.name;
|
|
800
|
+
const path_name = path + '.name';
|
|
801
|
+
if (typeof obj_name !== 'string') {
|
|
802
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
803
|
+
}
|
|
804
|
+
})();
|
|
805
|
+
return v_error === undefined ? null : v_error;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
function validate$8(obj, path = 'ManagedContentAssociationsRepresentation') {
|
|
809
|
+
const v_error = (() => {
|
|
810
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
811
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
812
|
+
}
|
|
813
|
+
const obj_topics = obj.topics;
|
|
814
|
+
const path_topics = path + '.topics';
|
|
815
|
+
if (!ArrayIsArray(obj_topics)) {
|
|
816
|
+
return new TypeError('Expected "array" but received "' + typeof obj_topics + '" (at "' + path_topics + '")');
|
|
817
|
+
}
|
|
818
|
+
for (let i = 0; i < obj_topics.length; i++) {
|
|
819
|
+
const obj_topics_item = obj_topics[i];
|
|
820
|
+
const path_topics_item = path_topics + '[' + i + ']';
|
|
821
|
+
const referencepath_topics_itemValidationError = validate$9(obj_topics_item, path_topics_item);
|
|
822
|
+
if (referencepath_topics_itemValidationError !== null) {
|
|
823
|
+
let message = 'Object doesn\'t match TopicSummaryRepresentation (at "' + path_topics_item + '")\n';
|
|
824
|
+
message += referencepath_topics_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
825
|
+
return new TypeError(message);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
})();
|
|
829
|
+
return v_error === undefined ? null : v_error;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
var DiscriminatorValues;
|
|
833
|
+
(function (DiscriminatorValues) {
|
|
834
|
+
DiscriminatorValues["Date"] = "Date";
|
|
835
|
+
DiscriminatorValues["Text"] = "Text";
|
|
836
|
+
})(DiscriminatorValues || (DiscriminatorValues = {}));
|
|
837
|
+
function validate$7(obj, path = 'ManagedContentNodeValueRepresentation') {
|
|
838
|
+
const v_error = (() => {
|
|
839
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
840
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
841
|
+
}
|
|
842
|
+
const obj_nodeType = obj.nodeType;
|
|
843
|
+
const path_nodeType = path + '.nodeType';
|
|
844
|
+
if (typeof obj_nodeType !== 'string') {
|
|
845
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nodeType + '" (at "' + path_nodeType + '")');
|
|
846
|
+
}
|
|
847
|
+
})();
|
|
848
|
+
return v_error === undefined ? null : v_error;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function validate$6(obj, path = 'ManagedContentVersionRepresentation') {
|
|
852
|
+
const v_error = (() => {
|
|
853
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
854
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
855
|
+
}
|
|
856
|
+
if (obj.associations !== undefined) {
|
|
857
|
+
const obj_associations = obj.associations;
|
|
858
|
+
const path_associations = path + '.associations';
|
|
859
|
+
const referencepath_associationsValidationError = validate$8(obj_associations, path_associations);
|
|
860
|
+
if (referencepath_associationsValidationError !== null) {
|
|
861
|
+
let message = 'Object doesn\'t match ManagedContentAssociationsRepresentation (at "' + path_associations + '")\n';
|
|
862
|
+
message += referencepath_associationsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
863
|
+
return new TypeError(message);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const obj_contentKey = obj.contentKey;
|
|
867
|
+
const path_contentKey = path + '.contentKey';
|
|
868
|
+
if (typeof obj_contentKey !== 'string') {
|
|
869
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentKey + '" (at "' + path_contentKey + '")');
|
|
870
|
+
}
|
|
871
|
+
const obj_contentNodes = obj.contentNodes;
|
|
872
|
+
const path_contentNodes = path + '.contentNodes';
|
|
873
|
+
if (typeof obj_contentNodes !== 'object' || ArrayIsArray(obj_contentNodes) || obj_contentNodes === null) {
|
|
874
|
+
return new TypeError('Expected "object" but received "' + typeof obj_contentNodes + '" (at "' + path_contentNodes + '")');
|
|
875
|
+
}
|
|
876
|
+
const obj_contentNodes_keys = ObjectKeys(obj_contentNodes);
|
|
877
|
+
for (let i = 0; i < obj_contentNodes_keys.length; i++) {
|
|
878
|
+
const key = obj_contentNodes_keys[i];
|
|
879
|
+
const obj_contentNodes_prop = obj_contentNodes[key];
|
|
880
|
+
const path_contentNodes_prop = path_contentNodes + '["' + key + '"]';
|
|
881
|
+
const referencepath_contentNodes_propValidationError = validate$7(obj_contentNodes_prop, path_contentNodes_prop);
|
|
882
|
+
if (referencepath_contentNodes_propValidationError !== null) {
|
|
883
|
+
let message = 'Object doesn\'t match ManagedContentNodeValueRepresentation (at "' + path_contentNodes_prop + '")\n';
|
|
884
|
+
message += referencepath_contentNodes_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
885
|
+
return new TypeError(message);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
const obj_contentUrlName = obj.contentUrlName;
|
|
889
|
+
const path_contentUrlName = path + '.contentUrlName';
|
|
890
|
+
if (typeof obj_contentUrlName !== 'string') {
|
|
891
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentUrlName + '" (at "' + path_contentUrlName + '")');
|
|
892
|
+
}
|
|
893
|
+
const obj_language = obj.language;
|
|
894
|
+
const path_language = path + '.language';
|
|
895
|
+
if (typeof obj_language !== 'string') {
|
|
896
|
+
return new TypeError('Expected "string" but received "' + typeof obj_language + '" (at "' + path_language + '")');
|
|
897
|
+
}
|
|
898
|
+
const obj_managedContentId = obj.managedContentId;
|
|
899
|
+
const path_managedContentId = path + '.managedContentId';
|
|
900
|
+
if (typeof obj_managedContentId !== 'string') {
|
|
901
|
+
return new TypeError('Expected "string" but received "' + typeof obj_managedContentId + '" (at "' + path_managedContentId + '")');
|
|
902
|
+
}
|
|
903
|
+
const obj_publishedDate = obj.publishedDate;
|
|
904
|
+
const path_publishedDate = path + '.publishedDate';
|
|
905
|
+
if (typeof obj_publishedDate !== 'string') {
|
|
906
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishedDate + '" (at "' + path_publishedDate + '")');
|
|
907
|
+
}
|
|
908
|
+
const obj_title = obj.title;
|
|
909
|
+
const path_title = path + '.title';
|
|
910
|
+
if (typeof obj_title !== 'string') {
|
|
911
|
+
return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
|
|
912
|
+
}
|
|
913
|
+
const obj_type = obj.type;
|
|
914
|
+
const path_type = path + '.type';
|
|
915
|
+
if (typeof obj_type !== 'string') {
|
|
916
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
917
|
+
}
|
|
918
|
+
const obj_typeLabel = obj.typeLabel;
|
|
919
|
+
const path_typeLabel = path + '.typeLabel';
|
|
920
|
+
if (typeof obj_typeLabel !== 'string') {
|
|
921
|
+
return new TypeError('Expected "string" but received "' + typeof obj_typeLabel + '" (at "' + path_typeLabel + '")');
|
|
922
|
+
}
|
|
923
|
+
const obj_unauthenticatedUrl = obj.unauthenticatedUrl;
|
|
924
|
+
const path_unauthenticatedUrl = path + '.unauthenticatedUrl';
|
|
925
|
+
let obj_unauthenticatedUrl_union0 = null;
|
|
926
|
+
const obj_unauthenticatedUrl_union0_error = (() => {
|
|
927
|
+
if (typeof obj_unauthenticatedUrl !== 'string') {
|
|
928
|
+
return new TypeError('Expected "string" but received "' + typeof obj_unauthenticatedUrl + '" (at "' + path_unauthenticatedUrl + '")');
|
|
929
|
+
}
|
|
930
|
+
})();
|
|
931
|
+
if (obj_unauthenticatedUrl_union0_error != null) {
|
|
932
|
+
obj_unauthenticatedUrl_union0 = obj_unauthenticatedUrl_union0_error.message;
|
|
933
|
+
}
|
|
934
|
+
let obj_unauthenticatedUrl_union1 = null;
|
|
935
|
+
const obj_unauthenticatedUrl_union1_error = (() => {
|
|
936
|
+
if (obj_unauthenticatedUrl !== null) {
|
|
937
|
+
return new TypeError('Expected "null" but received "' + typeof obj_unauthenticatedUrl + '" (at "' + path_unauthenticatedUrl + '")');
|
|
938
|
+
}
|
|
939
|
+
})();
|
|
940
|
+
if (obj_unauthenticatedUrl_union1_error != null) {
|
|
941
|
+
obj_unauthenticatedUrl_union1 = obj_unauthenticatedUrl_union1_error.message;
|
|
942
|
+
}
|
|
943
|
+
if (obj_unauthenticatedUrl_union0 && obj_unauthenticatedUrl_union1) {
|
|
944
|
+
let message = 'Object doesn\'t match union (at "' + path_unauthenticatedUrl + '")';
|
|
945
|
+
message += '\n' + obj_unauthenticatedUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
946
|
+
message += '\n' + obj_unauthenticatedUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
947
|
+
return new TypeError(message);
|
|
948
|
+
}
|
|
949
|
+
})();
|
|
950
|
+
return v_error === undefined ? null : v_error;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function validate$5(obj, path = 'ManagedContentNodeTypeRepresentation') {
|
|
954
|
+
const v_error = (() => {
|
|
955
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
956
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
957
|
+
}
|
|
958
|
+
const obj_label = obj.label;
|
|
959
|
+
const path_label = path + '.label';
|
|
960
|
+
if (typeof obj_label !== 'string') {
|
|
961
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
962
|
+
}
|
|
963
|
+
const obj_name = obj.name;
|
|
964
|
+
const path_name = path + '.name';
|
|
965
|
+
if (typeof obj_name !== 'string') {
|
|
966
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
967
|
+
}
|
|
968
|
+
const obj_nodeType = obj.nodeType;
|
|
969
|
+
const path_nodeType = path + '.nodeType';
|
|
970
|
+
if (typeof obj_nodeType !== 'string') {
|
|
971
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nodeType + '" (at "' + path_nodeType + '")');
|
|
972
|
+
}
|
|
973
|
+
})();
|
|
974
|
+
return v_error === undefined ? null : v_error;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function validate$4(obj, path = 'ManagedContentTypeRepresentation') {
|
|
978
|
+
const v_error = (() => {
|
|
979
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
980
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
981
|
+
}
|
|
982
|
+
const obj_label = obj.label;
|
|
983
|
+
const path_label = path + '.label';
|
|
984
|
+
if (typeof obj_label !== 'string') {
|
|
985
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
986
|
+
}
|
|
987
|
+
const obj_name = obj.name;
|
|
988
|
+
const path_name = path + '.name';
|
|
989
|
+
if (typeof obj_name !== 'string') {
|
|
990
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
991
|
+
}
|
|
992
|
+
const obj_nodeTypes = obj.nodeTypes;
|
|
993
|
+
const path_nodeTypes = path + '.nodeTypes';
|
|
994
|
+
if (typeof obj_nodeTypes !== 'object' || ArrayIsArray(obj_nodeTypes) || obj_nodeTypes === null) {
|
|
995
|
+
return new TypeError('Expected "object" but received "' + typeof obj_nodeTypes + '" (at "' + path_nodeTypes + '")');
|
|
996
|
+
}
|
|
997
|
+
const obj_nodeTypes_keys = ObjectKeys(obj_nodeTypes);
|
|
998
|
+
for (let i = 0; i < obj_nodeTypes_keys.length; i++) {
|
|
999
|
+
const key = obj_nodeTypes_keys[i];
|
|
1000
|
+
const obj_nodeTypes_prop = obj_nodeTypes[key];
|
|
1001
|
+
const path_nodeTypes_prop = path_nodeTypes + '["' + key + '"]';
|
|
1002
|
+
const referencepath_nodeTypes_propValidationError = validate$5(obj_nodeTypes_prop, path_nodeTypes_prop);
|
|
1003
|
+
if (referencepath_nodeTypes_propValidationError !== null) {
|
|
1004
|
+
let message = 'Object doesn\'t match ManagedContentNodeTypeRepresentation (at "' + path_nodeTypes_prop + '")\n';
|
|
1005
|
+
message += referencepath_nodeTypes_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1006
|
+
return new TypeError(message);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
})();
|
|
1010
|
+
return v_error === undefined ? null : v_error;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const TTL$1 = 3600000;
|
|
1014
|
+
const VERSION$2 = "5ee006120d0880559392ef3c5fdc2a52";
|
|
1015
|
+
function validate$3(obj, path = 'ManagedContentVersionCollectionRepresentation') {
|
|
1016
|
+
const v_error = (() => {
|
|
1017
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1018
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1019
|
+
}
|
|
1020
|
+
const obj_currentPageUrl = obj.currentPageUrl;
|
|
1021
|
+
const path_currentPageUrl = path + '.currentPageUrl';
|
|
1022
|
+
if (typeof obj_currentPageUrl !== 'string') {
|
|
1023
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
1024
|
+
}
|
|
1025
|
+
const obj_items = obj.items;
|
|
1026
|
+
const path_items = path + '.items';
|
|
1027
|
+
if (!ArrayIsArray(obj_items)) {
|
|
1028
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
1029
|
+
}
|
|
1030
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
1031
|
+
const obj_items_item = obj_items[i];
|
|
1032
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
1033
|
+
const referencepath_items_itemValidationError = validate$6(obj_items_item, path_items_item);
|
|
1034
|
+
if (referencepath_items_itemValidationError !== null) {
|
|
1035
|
+
let message = 'Object doesn\'t match ManagedContentVersionRepresentation (at "' + path_items_item + '")\n';
|
|
1036
|
+
message += referencepath_items_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1037
|
+
return new TypeError(message);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
if (obj.managedContentTypes !== undefined) {
|
|
1041
|
+
const obj_managedContentTypes = obj.managedContentTypes;
|
|
1042
|
+
const path_managedContentTypes = path + '.managedContentTypes';
|
|
1043
|
+
if (typeof obj_managedContentTypes !== 'object' || ArrayIsArray(obj_managedContentTypes) || obj_managedContentTypes === null) {
|
|
1044
|
+
return new TypeError('Expected "object" but received "' + typeof obj_managedContentTypes + '" (at "' + path_managedContentTypes + '")');
|
|
1045
|
+
}
|
|
1046
|
+
const obj_managedContentTypes_keys = ObjectKeys(obj_managedContentTypes);
|
|
1047
|
+
for (let i = 0; i < obj_managedContentTypes_keys.length; i++) {
|
|
1048
|
+
const key = obj_managedContentTypes_keys[i];
|
|
1049
|
+
const obj_managedContentTypes_prop = obj_managedContentTypes[key];
|
|
1050
|
+
const path_managedContentTypes_prop = path_managedContentTypes + '["' + key + '"]';
|
|
1051
|
+
const referencepath_managedContentTypes_propValidationError = validate$4(obj_managedContentTypes_prop, path_managedContentTypes_prop);
|
|
1052
|
+
if (referencepath_managedContentTypes_propValidationError !== null) {
|
|
1053
|
+
let message = 'Object doesn\'t match ManagedContentTypeRepresentation (at "' + path_managedContentTypes_prop + '")\n';
|
|
1054
|
+
message += referencepath_managedContentTypes_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1055
|
+
return new TypeError(message);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
if (obj.nextPageUrl !== undefined) {
|
|
1060
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
1061
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
1062
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
1063
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
const obj_total = obj.total;
|
|
1067
|
+
const path_total = path + '.total';
|
|
1068
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
1069
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
1070
|
+
}
|
|
1071
|
+
const obj_totalTypes = obj.totalTypes;
|
|
1072
|
+
const path_totalTypes = path + '.totalTypes';
|
|
1073
|
+
if (typeof obj_totalTypes !== 'number' || (typeof obj_totalTypes === 'number' && Math.floor(obj_totalTypes) !== obj_totalTypes)) {
|
|
1074
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalTypes + '" (at "' + path_totalTypes + '")');
|
|
1075
|
+
}
|
|
1076
|
+
})();
|
|
1077
|
+
return v_error === undefined ? null : v_error;
|
|
1078
|
+
}
|
|
1079
|
+
const RepresentationType$2 = 'ManagedContentVersionCollectionRepresentation';
|
|
1080
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
1081
|
+
return input;
|
|
1082
|
+
}
|
|
1083
|
+
const select$6 = function ManagedContentVersionCollectionRepresentationSelect() {
|
|
1084
|
+
return {
|
|
1085
|
+
kind: 'Fragment',
|
|
1086
|
+
version: VERSION$2,
|
|
1087
|
+
private: [],
|
|
1088
|
+
opaque: true
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
function equals$2(existing, incoming) {
|
|
1092
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
return true;
|
|
1096
|
+
}
|
|
1097
|
+
const ingest$2 = function ManagedContentVersionCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1098
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1099
|
+
const validateError = validate$3(input);
|
|
1100
|
+
if (validateError !== null) {
|
|
1101
|
+
throw validateError;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
const key = path.fullPath;
|
|
1105
|
+
const ttlToUse = TTL$1;
|
|
1106
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "CMS", VERSION$2, RepresentationType$2, equals$2);
|
|
1107
|
+
return createLink(key);
|
|
1108
|
+
};
|
|
1109
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1110
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1111
|
+
const rootKey = fullPathFactory();
|
|
1112
|
+
rootKeySet.set(rootKey, {
|
|
1113
|
+
namespace: keyPrefix,
|
|
1114
|
+
representationName: RepresentationType$2,
|
|
1115
|
+
mergeable: false
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
function select$5(luvio, params) {
|
|
1120
|
+
return select$6();
|
|
1121
|
+
}
|
|
1122
|
+
function keyBuilder$7(luvio, params) {
|
|
1123
|
+
return keyPrefix + '::ManagedContentVersionCollectionRepresentation:(' + 'contentKeys:' + params.queryParams.contentKeys + ',' + 'language:' + params.queryParams.language + ',' + 'managedContentIds:' + params.queryParams.managedContentIds + ',' + 'managedContentType:' + params.queryParams.managedContentType + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'showAbsoluteUrl:' + params.queryParams.showAbsoluteUrl + ',' + 'topics:' + params.queryParams.topics + ',' + 'communityId:' + params.urlParams.communityId + ')';
|
|
1124
|
+
}
|
|
1125
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
1126
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$7(luvio, resourceParams));
|
|
1127
|
+
}
|
|
1128
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
1129
|
+
const { body } = response;
|
|
1130
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
1131
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1132
|
+
const snapshot = luvio.storeLookup({
|
|
1133
|
+
recordId: key,
|
|
1134
|
+
node: select$5(),
|
|
1135
|
+
variables: {},
|
|
1136
|
+
}, snapshotRefresh);
|
|
1137
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1138
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1139
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
deepFreeze(snapshot.data);
|
|
1143
|
+
return snapshot;
|
|
1144
|
+
}
|
|
1145
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
1146
|
+
const key = keyBuilder$7(luvio, params);
|
|
1147
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1148
|
+
const storeMetadataParams = {
|
|
1149
|
+
ttl: TTL$1,
|
|
1150
|
+
namespace: keyPrefix,
|
|
1151
|
+
version: VERSION$2,
|
|
1152
|
+
representationName: RepresentationType$2
|
|
1153
|
+
};
|
|
1154
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1155
|
+
return errorSnapshot;
|
|
1156
|
+
}
|
|
1157
|
+
function createResourceRequest$3(config) {
|
|
1158
|
+
const headers = {};
|
|
1159
|
+
return {
|
|
1160
|
+
baseUri: '/services/data/v66.0',
|
|
1161
|
+
basePath: '/connect/communities/' + config.urlParams.communityId + '/managed-content/delivery',
|
|
1162
|
+
method: 'get',
|
|
1163
|
+
body: null,
|
|
1164
|
+
urlParams: config.urlParams,
|
|
1165
|
+
queryParams: config.queryParams,
|
|
1166
|
+
headers,
|
|
1167
|
+
priority: 'normal',
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
const adapterName$3 = 'listContent';
|
|
1172
|
+
const listContent_ConfigPropertyMetadata = [
|
|
1173
|
+
generateParamConfigMetadata('communityId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1174
|
+
generateParamConfigMetadata('contentKeys', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1175
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1176
|
+
generateParamConfigMetadata('managedContentIds', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1177
|
+
generateParamConfigMetadata('managedContentType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1178
|
+
generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1179
|
+
generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1180
|
+
generateParamConfigMetadata('showAbsoluteUrl', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
1181
|
+
generateParamConfigMetadata('topics', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1182
|
+
];
|
|
1183
|
+
const listContent_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, listContent_ConfigPropertyMetadata);
|
|
1184
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(listContent_ConfigPropertyMetadata);
|
|
1185
|
+
function keyBuilder$6(luvio, config) {
|
|
1186
|
+
const resourceParams = createResourceParams$3(config);
|
|
1187
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
1188
|
+
}
|
|
1189
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
1190
|
+
const config = {};
|
|
1191
|
+
typeCheckConfig$6(untrustedConfig, config, listContent_ConfigPropertyMetadata);
|
|
1192
|
+
return config;
|
|
1193
|
+
}
|
|
1194
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1195
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1199
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1200
|
+
}
|
|
1201
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
1202
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1203
|
+
return null;
|
|
1204
|
+
}
|
|
1205
|
+
return config;
|
|
1206
|
+
}
|
|
1207
|
+
function adapterFragment$3(luvio, config) {
|
|
1208
|
+
createResourceParams$3(config);
|
|
1209
|
+
return select$5();
|
|
1210
|
+
}
|
|
1211
|
+
function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
|
|
1212
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
1213
|
+
config,
|
|
1214
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1215
|
+
});
|
|
1216
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1217
|
+
}
|
|
1218
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
1219
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
1220
|
+
config,
|
|
1221
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1222
|
+
});
|
|
1223
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1224
|
+
}
|
|
1225
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1226
|
+
const resourceParams = createResourceParams$3(config);
|
|
1227
|
+
const request = createResourceRequest$3(resourceParams);
|
|
1228
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1229
|
+
.then((response) => {
|
|
1230
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$4(luvio, config, resourceParams, response), () => {
|
|
1231
|
+
const cache = new StoreKeyMap();
|
|
1232
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
1233
|
+
return cache;
|
|
1234
|
+
});
|
|
1235
|
+
}, (response) => {
|
|
1236
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
1240
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
1241
|
+
}
|
|
1242
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
1243
|
+
const { luvio, config } = context;
|
|
1244
|
+
const selector = {
|
|
1245
|
+
recordId: keyBuilder$6(luvio, config),
|
|
1246
|
+
node: adapterFragment$3(luvio, config),
|
|
1247
|
+
variables: {},
|
|
1248
|
+
};
|
|
1249
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1250
|
+
config,
|
|
1251
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1252
|
+
});
|
|
1253
|
+
return cacheSnapshot;
|
|
1254
|
+
}
|
|
1255
|
+
const listContentAdapterFactory = (luvio) => function CMS__listContent(untrustedConfig, requestContext) {
|
|
1256
|
+
const config = validateAdapterConfig$3(untrustedConfig, listContent_ConfigPropertyNames);
|
|
1257
|
+
// Invalid or incomplete config
|
|
1258
|
+
if (config === null) {
|
|
1259
|
+
return null;
|
|
1260
|
+
}
|
|
1261
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1262
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
function validate$2(obj, path = 'ReferenceRepresentation') {
|
|
1266
|
+
const v_error = (() => {
|
|
1267
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1268
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1269
|
+
}
|
|
1270
|
+
const obj_id = obj.id;
|
|
1271
|
+
const path_id = path + '.id';
|
|
1272
|
+
if (typeof obj_id !== 'string') {
|
|
1273
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1274
|
+
}
|
|
1275
|
+
const obj_url = obj.url;
|
|
1276
|
+
const path_url = path + '.url';
|
|
1277
|
+
if (typeof obj_url !== 'string') {
|
|
1278
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
1279
|
+
}
|
|
1280
|
+
})();
|
|
1281
|
+
return v_error === undefined ? null : v_error;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
const TTL = 3600000;
|
|
1285
|
+
const VERSION$1 = "491bb0e1e249741b4ae64daf0f542156";
|
|
1286
|
+
function validate$1(obj, path = 'ManagedContentVersionInternalRepresentation') {
|
|
1287
|
+
const v_error = (() => {
|
|
1288
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1289
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1290
|
+
}
|
|
1291
|
+
const obj_associations = obj.associations;
|
|
1292
|
+
const path_associations = path + '.associations';
|
|
1293
|
+
const referencepath_associationsValidationError = validate$8(obj_associations, path_associations);
|
|
1294
|
+
if (referencepath_associationsValidationError !== null) {
|
|
1295
|
+
let message = 'Object doesn\'t match ManagedContentAssociationsRepresentation (at "' + path_associations + '")\n';
|
|
1296
|
+
message += referencepath_associationsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1297
|
+
return new TypeError(message);
|
|
1298
|
+
}
|
|
1299
|
+
const obj_authoredManagedContentId = obj.authoredManagedContentId;
|
|
1300
|
+
const path_authoredManagedContentId = path + '.authoredManagedContentId';
|
|
1301
|
+
if (typeof obj_authoredManagedContentId !== 'string') {
|
|
1302
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authoredManagedContentId + '" (at "' + path_authoredManagedContentId + '")');
|
|
1303
|
+
}
|
|
1304
|
+
const obj_body = obj.body;
|
|
1305
|
+
const path_body = path + '.body';
|
|
1306
|
+
if (typeof obj_body !== 'object' || ArrayIsArray(obj_body) || obj_body === null) {
|
|
1307
|
+
return new TypeError('Expected "object" but received "' + typeof obj_body + '" (at "' + path_body + '")');
|
|
1308
|
+
}
|
|
1309
|
+
const obj_body_keys = ObjectKeys(obj_body);
|
|
1310
|
+
for (let i = 0; i < obj_body_keys.length; i++) {
|
|
1311
|
+
const key = obj_body_keys[i];
|
|
1312
|
+
const obj_body_prop = obj_body[key];
|
|
1313
|
+
const path_body_prop = path_body + '["' + key + '"]';
|
|
1314
|
+
if (obj_body_prop === undefined) {
|
|
1315
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_body_prop + '" (at "' + path_body_prop + '")');
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
const obj_contentKey = obj.contentKey;
|
|
1319
|
+
const path_contentKey = path + '.contentKey';
|
|
1320
|
+
if (typeof obj_contentKey !== 'string') {
|
|
1321
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentKey + '" (at "' + path_contentKey + '")');
|
|
1322
|
+
}
|
|
1323
|
+
const obj_createdByReference = obj.createdByReference;
|
|
1324
|
+
const path_createdByReference = path + '.createdByReference';
|
|
1325
|
+
const referencepath_createdByReferenceValidationError = validate$2(obj_createdByReference, path_createdByReference);
|
|
1326
|
+
if (referencepath_createdByReferenceValidationError !== null) {
|
|
1327
|
+
let message = 'Object doesn\'t match ReferenceRepresentation (at "' + path_createdByReference + '")\n';
|
|
1328
|
+
message += referencepath_createdByReferenceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1329
|
+
return new TypeError(message);
|
|
1330
|
+
}
|
|
1331
|
+
const obj_createdDate = obj.createdDate;
|
|
1332
|
+
const path_createdDate = path + '.createdDate';
|
|
1333
|
+
if (typeof obj_createdDate !== 'string') {
|
|
1334
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
1335
|
+
}
|
|
1336
|
+
const obj_id = obj.id;
|
|
1337
|
+
const path_id = path + '.id';
|
|
1338
|
+
if (typeof obj_id !== 'string') {
|
|
1339
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1340
|
+
}
|
|
1341
|
+
const obj_lastUpdatedByReference = obj.lastUpdatedByReference;
|
|
1342
|
+
const path_lastUpdatedByReference = path + '.lastUpdatedByReference';
|
|
1343
|
+
const referencepath_lastUpdatedByReferenceValidationError = validate$2(obj_lastUpdatedByReference, path_lastUpdatedByReference);
|
|
1344
|
+
if (referencepath_lastUpdatedByReferenceValidationError !== null) {
|
|
1345
|
+
let message = 'Object doesn\'t match ReferenceRepresentation (at "' + path_lastUpdatedByReference + '")\n';
|
|
1346
|
+
message += referencepath_lastUpdatedByReferenceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1347
|
+
return new TypeError(message);
|
|
1348
|
+
}
|
|
1349
|
+
const obj_managedContentId = obj.managedContentId;
|
|
1350
|
+
const path_managedContentId = path + '.managedContentId';
|
|
1351
|
+
if (typeof obj_managedContentId !== 'string') {
|
|
1352
|
+
return new TypeError('Expected "string" but received "' + typeof obj_managedContentId + '" (at "' + path_managedContentId + '")');
|
|
1353
|
+
}
|
|
1354
|
+
const obj_primaryLanguage = obj.primaryLanguage;
|
|
1355
|
+
const path_primaryLanguage = path + '.primaryLanguage';
|
|
1356
|
+
if (typeof obj_primaryLanguage !== 'string') {
|
|
1357
|
+
return new TypeError('Expected "string" but received "' + typeof obj_primaryLanguage + '" (at "' + path_primaryLanguage + '")');
|
|
1358
|
+
}
|
|
1359
|
+
const obj_publishDate = obj.publishDate;
|
|
1360
|
+
const path_publishDate = path + '.publishDate';
|
|
1361
|
+
if (typeof obj_publishDate !== 'string') {
|
|
1362
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishDate + '" (at "' + path_publishDate + '")');
|
|
1363
|
+
}
|
|
1364
|
+
const obj_status = obj.status;
|
|
1365
|
+
const path_status = path + '.status';
|
|
1366
|
+
if (typeof obj_status !== 'string') {
|
|
1367
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
1368
|
+
}
|
|
1369
|
+
const obj_title = obj.title;
|
|
1370
|
+
const path_title = path + '.title';
|
|
1371
|
+
if (typeof obj_title !== 'string') {
|
|
1372
|
+
return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
|
|
1373
|
+
}
|
|
1374
|
+
const obj_type = obj.type;
|
|
1375
|
+
const path_type = path + '.type';
|
|
1376
|
+
if (typeof obj_type !== 'string') {
|
|
1377
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
1378
|
+
}
|
|
1379
|
+
const obj_typeLabel = obj.typeLabel;
|
|
1380
|
+
const path_typeLabel = path + '.typeLabel';
|
|
1381
|
+
if (typeof obj_typeLabel !== 'string') {
|
|
1382
|
+
return new TypeError('Expected "string" but received "' + typeof obj_typeLabel + '" (at "' + path_typeLabel + '")');
|
|
1383
|
+
}
|
|
1384
|
+
const obj_updatedDate = obj.updatedDate;
|
|
1385
|
+
const path_updatedDate = path + '.updatedDate';
|
|
1386
|
+
if (typeof obj_updatedDate !== 'string') {
|
|
1387
|
+
return new TypeError('Expected "string" but received "' + typeof obj_updatedDate + '" (at "' + path_updatedDate + '")');
|
|
1388
|
+
}
|
|
1389
|
+
const obj_urlName = obj.urlName;
|
|
1390
|
+
const path_urlName = path + '.urlName';
|
|
1391
|
+
if (typeof obj_urlName !== 'string') {
|
|
1392
|
+
return new TypeError('Expected "string" but received "' + typeof obj_urlName + '" (at "' + path_urlName + '")');
|
|
1393
|
+
}
|
|
1394
|
+
})();
|
|
1395
|
+
return v_error === undefined ? null : v_error;
|
|
1396
|
+
}
|
|
1397
|
+
const RepresentationType$1 = 'ManagedContentVersionInternalRepresentation';
|
|
1398
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1399
|
+
return input;
|
|
1400
|
+
}
|
|
1401
|
+
const select$4 = function ManagedContentVersionInternalRepresentationSelect() {
|
|
1402
|
+
return {
|
|
1403
|
+
kind: 'Fragment',
|
|
1404
|
+
version: VERSION$1,
|
|
1405
|
+
private: [],
|
|
1406
|
+
opaque: true
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
function equals$1(existing, incoming) {
|
|
1410
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1411
|
+
return false;
|
|
1412
|
+
}
|
|
1413
|
+
return true;
|
|
1414
|
+
}
|
|
1415
|
+
const ingest$1 = function ManagedContentVersionInternalRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1416
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1417
|
+
const validateError = validate$1(input);
|
|
1418
|
+
if (validateError !== null) {
|
|
1419
|
+
throw validateError;
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
const key = path.fullPath;
|
|
1423
|
+
const ttlToUse = TTL;
|
|
1424
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "CMS", VERSION$1, RepresentationType$1, equals$1);
|
|
1425
|
+
return createLink(key);
|
|
1426
|
+
};
|
|
1427
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1428
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1429
|
+
const rootKey = fullPathFactory();
|
|
1430
|
+
rootKeySet.set(rootKey, {
|
|
1431
|
+
namespace: keyPrefix,
|
|
1432
|
+
representationName: RepresentationType$1,
|
|
1433
|
+
mergeable: false
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
const VERSION = "a524ce828168211d9e25771a19aa2d0c";
|
|
1438
|
+
function validate(obj, path = 'ManagedContentVersionInternalCollectionRepresentation') {
|
|
1439
|
+
const v_error = (() => {
|
|
1440
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1441
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1442
|
+
}
|
|
1443
|
+
const obj_items = obj.items;
|
|
1444
|
+
const path_items = path + '.items';
|
|
1445
|
+
if (!ArrayIsArray(obj_items)) {
|
|
1446
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
1447
|
+
}
|
|
1448
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
1449
|
+
const obj_items_item = obj_items[i];
|
|
1450
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
1451
|
+
if (typeof obj_items_item !== 'object' || Array.isArray(obj_items_item)) {
|
|
1452
|
+
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
const obj_total = obj.total;
|
|
1456
|
+
const path_total = path + '.total';
|
|
1457
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
1458
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
1459
|
+
}
|
|
1460
|
+
})();
|
|
1461
|
+
return v_error === undefined ? null : v_error;
|
|
1462
|
+
}
|
|
1463
|
+
const RepresentationType = 'ManagedContentVersionInternalCollectionRepresentation';
|
|
1464
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1465
|
+
const input_items = input.items;
|
|
1466
|
+
const input_items_id = path.fullPath + '__items';
|
|
1467
|
+
for (let i = 0; i < input_items.length; i++) {
|
|
1468
|
+
const input_items_item = input_items[i];
|
|
1469
|
+
let input_items_item_id = input_items_id + '__' + i;
|
|
1470
|
+
input_items[i] = ingest$1(input_items_item, {
|
|
1471
|
+
fullPath: input_items_item_id,
|
|
1472
|
+
propertyName: i,
|
|
1473
|
+
parent: {
|
|
1474
|
+
data: input,
|
|
1475
|
+
key: path.fullPath,
|
|
1476
|
+
existing: existing,
|
|
1477
|
+
},
|
|
1478
|
+
ttl: path.ttl
|
|
1479
|
+
}, luvio, store, timestamp);
|
|
1480
|
+
}
|
|
1481
|
+
return input;
|
|
1482
|
+
}
|
|
1483
|
+
const select$3 = function ManagedContentVersionInternalCollectionRepresentationSelect() {
|
|
1484
|
+
return {
|
|
1485
|
+
kind: 'Fragment',
|
|
1486
|
+
version: VERSION,
|
|
1487
|
+
private: [],
|
|
1488
|
+
selections: [
|
|
1489
|
+
{
|
|
1490
|
+
name: 'items',
|
|
1491
|
+
kind: 'Link',
|
|
1492
|
+
plural: true,
|
|
1493
|
+
fragment: select$4()
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
name: 'total',
|
|
1497
|
+
kind: 'Scalar'
|
|
1498
|
+
}
|
|
1499
|
+
]
|
|
1500
|
+
};
|
|
1501
|
+
};
|
|
1502
|
+
function equals(existing, incoming) {
|
|
1503
|
+
const existing_total = existing.total;
|
|
1504
|
+
const incoming_total = incoming.total;
|
|
1505
|
+
if (!(existing_total === incoming_total)) {
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
const existing_items = existing.items;
|
|
1509
|
+
const incoming_items = incoming.items;
|
|
1510
|
+
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
1511
|
+
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
1512
|
+
return false;
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
if (equals_items_items === false) {
|
|
1516
|
+
return false;
|
|
1517
|
+
}
|
|
1518
|
+
return true;
|
|
1519
|
+
}
|
|
1520
|
+
const ingest = function ManagedContentVersionInternalCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1521
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1522
|
+
const validateError = validate(input);
|
|
1523
|
+
if (validateError !== null) {
|
|
1524
|
+
throw validateError;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
const key = path.fullPath;
|
|
1528
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
1529
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CMS", VERSION, RepresentationType, equals);
|
|
1530
|
+
return createLink(key);
|
|
1531
|
+
};
|
|
1532
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1533
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1534
|
+
const rootKey = fullPathFactory();
|
|
1535
|
+
rootKeySet.set(rootKey, {
|
|
1536
|
+
namespace: keyPrefix,
|
|
1537
|
+
representationName: RepresentationType,
|
|
1538
|
+
mergeable: false
|
|
1539
|
+
});
|
|
1540
|
+
const input_items_length = input.items.length;
|
|
1541
|
+
for (let i = 0; i < input_items_length; i++) {
|
|
1542
|
+
getTypeCacheKeys$1(rootKeySet, luvio, input.items[i], () => '');
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
function select$2(luvio, params) {
|
|
1547
|
+
return select$3();
|
|
1548
|
+
}
|
|
1549
|
+
function keyBuilder$5(luvio, params) {
|
|
1550
|
+
return keyPrefix + '::ManagedContentVersionInternalCollectionRepresentation:(' + 'collectionName:' + params.queryParams.collectionName + ',' + 'contentKeys:' + params.queryParams.contentKeys + ',' + 'language:' + params.queryParams.language + ',' + 'managedContentIds:' + params.queryParams.managedContentIds + ',' + 'managedContentType:' + params.queryParams.managedContentType + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'queryTerm:' + params.queryParams.queryTerm + ',' + 'topics:' + params.queryParams.topics + ',' + 'urlNameInList:' + params.queryParams.urlNameInList + ',' + 'communityId:' + params.urlParams.communityId + ')';
|
|
1551
|
+
}
|
|
1552
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1553
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
|
|
1554
|
+
}
|
|
1555
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1556
|
+
const { body } = response;
|
|
1557
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1558
|
+
luvio.storeIngest(key, ingest, body);
|
|
1559
|
+
const snapshot = luvio.storeLookup({
|
|
1560
|
+
recordId: key,
|
|
1561
|
+
node: select$2(),
|
|
1562
|
+
variables: {},
|
|
1563
|
+
}, snapshotRefresh);
|
|
1564
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1565
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1566
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
deepFreeze(snapshot.data);
|
|
1570
|
+
return snapshot;
|
|
1571
|
+
}
|
|
1572
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
1573
|
+
const key = keyBuilder$5(luvio, params);
|
|
1574
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1575
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1576
|
+
return errorSnapshot;
|
|
1577
|
+
}
|
|
1578
|
+
function createResourceRequest$2(config) {
|
|
1579
|
+
const headers = {};
|
|
1580
|
+
return {
|
|
1581
|
+
baseUri: '/services/data/v66.0',
|
|
1582
|
+
basePath: '/connect/communities/' + config.urlParams.communityId + '/managed-content/delivery/contents',
|
|
1583
|
+
method: 'get',
|
|
1584
|
+
body: null,
|
|
1585
|
+
urlParams: config.urlParams,
|
|
1586
|
+
queryParams: config.queryParams,
|
|
1587
|
+
headers,
|
|
1588
|
+
priority: 'normal',
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
const adapterName$2 = 'listContentInternal';
|
|
1593
|
+
const listContentInternal_ConfigPropertyMetadata = [
|
|
1594
|
+
generateParamConfigMetadata('communityId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1595
|
+
generateParamConfigMetadata('collectionName', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1596
|
+
generateParamConfigMetadata('contentKeys', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1597
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1598
|
+
generateParamConfigMetadata('managedContentIds', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1599
|
+
generateParamConfigMetadata('managedContentType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1600
|
+
generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1601
|
+
generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1602
|
+
generateParamConfigMetadata('queryTerm', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1603
|
+
generateParamConfigMetadata('topics', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1604
|
+
generateParamConfigMetadata('urlNameInList', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
1605
|
+
];
|
|
1606
|
+
const listContentInternal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, listContentInternal_ConfigPropertyMetadata);
|
|
1607
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(listContentInternal_ConfigPropertyMetadata);
|
|
1608
|
+
function keyBuilder$4(luvio, config) {
|
|
1609
|
+
const resourceParams = createResourceParams$2(config);
|
|
1610
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
1611
|
+
}
|
|
1612
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1613
|
+
const config = {};
|
|
1614
|
+
typeCheckConfig$6(untrustedConfig, config, listContentInternal_ConfigPropertyMetadata);
|
|
1615
|
+
return config;
|
|
1616
|
+
}
|
|
1617
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1618
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1619
|
+
return null;
|
|
1620
|
+
}
|
|
1621
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1622
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1623
|
+
}
|
|
1624
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1625
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1626
|
+
return null;
|
|
1627
|
+
}
|
|
1628
|
+
return config;
|
|
1629
|
+
}
|
|
1630
|
+
function adapterFragment$2(luvio, config) {
|
|
1631
|
+
createResourceParams$2(config);
|
|
1632
|
+
return select$2();
|
|
1633
|
+
}
|
|
1634
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
1635
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1636
|
+
config,
|
|
1637
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1638
|
+
});
|
|
1639
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1640
|
+
}
|
|
1641
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1642
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1643
|
+
config,
|
|
1644
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1645
|
+
});
|
|
1646
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1647
|
+
}
|
|
1648
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1649
|
+
const resourceParams = createResourceParams$2(config);
|
|
1650
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1651
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1652
|
+
.then((response) => {
|
|
1653
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
1654
|
+
const cache = new StoreKeyMap();
|
|
1655
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1656
|
+
return cache;
|
|
1657
|
+
});
|
|
1658
|
+
}, (response) => {
|
|
1659
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1663
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1664
|
+
}
|
|
1665
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1666
|
+
const { luvio, config } = context;
|
|
1667
|
+
const selector = {
|
|
1668
|
+
recordId: keyBuilder$4(luvio, config),
|
|
1669
|
+
node: adapterFragment$2(luvio, config),
|
|
1670
|
+
variables: {},
|
|
1671
|
+
};
|
|
1672
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1673
|
+
config,
|
|
1674
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1675
|
+
});
|
|
1676
|
+
return cacheSnapshot;
|
|
1677
|
+
}
|
|
1678
|
+
const listContentInternalAdapterFactory = (luvio) => function CMS__listContentInternal(untrustedConfig, requestContext) {
|
|
1679
|
+
const config = validateAdapterConfig$2(untrustedConfig, listContentInternal_ConfigPropertyNames);
|
|
1680
|
+
// Invalid or incomplete config
|
|
1681
|
+
if (config === null) {
|
|
1682
|
+
return null;
|
|
1683
|
+
}
|
|
1684
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1685
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
function select$1(luvio, params) {
|
|
1689
|
+
return select$a();
|
|
1690
|
+
}
|
|
1691
|
+
function keyBuilder$3(luvio, params) {
|
|
1692
|
+
return keyPrefix + '::ManagedContentCollectionItemsRepresentation:(' + 'language:' + params.queryParams.language + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'pageToken:' + params.queryParams.pageToken + ',' + 'collectionKeyOrId:' + params.urlParams.collectionKeyOrId + ',' + 'siteId:' + params.urlParams.siteId + ')';
|
|
1693
|
+
}
|
|
1694
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1695
|
+
getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
1696
|
+
}
|
|
1697
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1698
|
+
const { body } = response;
|
|
1699
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
1700
|
+
luvio.storeIngest(key, ingest$4, body);
|
|
1701
|
+
const snapshot = luvio.storeLookup({
|
|
1702
|
+
recordId: key,
|
|
1703
|
+
node: select$1(),
|
|
1704
|
+
variables: {},
|
|
1705
|
+
}, snapshotRefresh);
|
|
1706
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1707
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1708
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
deepFreeze(snapshot.data);
|
|
1712
|
+
return snapshot;
|
|
1713
|
+
}
|
|
1714
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1715
|
+
const key = keyBuilder$3(luvio, params);
|
|
1716
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1717
|
+
const storeMetadataParams = {
|
|
1718
|
+
ttl: TTL$3,
|
|
1719
|
+
namespace: keyPrefix,
|
|
1720
|
+
version: VERSION$4,
|
|
1721
|
+
representationName: RepresentationType$4
|
|
1722
|
+
};
|
|
1723
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1724
|
+
return errorSnapshot;
|
|
1725
|
+
}
|
|
1726
|
+
function createResourceRequest$1(config) {
|
|
1727
|
+
const headers = {};
|
|
1728
|
+
return {
|
|
1729
|
+
baseUri: '/services/data/v66.0',
|
|
1730
|
+
basePath: '/connect/sites/' + config.urlParams.siteId + '/cms/delivery/collections/' + config.urlParams.collectionKeyOrId + '',
|
|
1731
|
+
method: 'get',
|
|
1732
|
+
body: null,
|
|
1733
|
+
urlParams: config.urlParams,
|
|
1734
|
+
queryParams: config.queryParams,
|
|
1735
|
+
headers,
|
|
1736
|
+
priority: 'normal',
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
const adapterName$1 = 'getCollectionItemsForSite';
|
|
1741
|
+
const getCollectionItemsForSite_ConfigPropertyMetadata = [
|
|
1742
|
+
generateParamConfigMetadata('collectionKeyOrId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1743
|
+
generateParamConfigMetadata('siteId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1744
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1745
|
+
generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1746
|
+
generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1747
|
+
];
|
|
1748
|
+
const getCollectionItemsForSite_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCollectionItemsForSite_ConfigPropertyMetadata);
|
|
1749
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getCollectionItemsForSite_ConfigPropertyMetadata);
|
|
1750
|
+
function keyBuilder$2(luvio, config) {
|
|
1751
|
+
const resourceParams = createResourceParams$1(config);
|
|
1752
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
1753
|
+
}
|
|
1754
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1755
|
+
const config = {};
|
|
1756
|
+
typeCheckConfig$6(untrustedConfig, config, getCollectionItemsForSite_ConfigPropertyMetadata);
|
|
1757
|
+
return config;
|
|
1758
|
+
}
|
|
1759
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1760
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1761
|
+
return null;
|
|
1762
|
+
}
|
|
1763
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1764
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1765
|
+
}
|
|
1766
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1767
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1768
|
+
return null;
|
|
1769
|
+
}
|
|
1770
|
+
return config;
|
|
1771
|
+
}
|
|
1772
|
+
function adapterFragment$1(luvio, config) {
|
|
1773
|
+
createResourceParams$1(config);
|
|
1774
|
+
return select$1();
|
|
1775
|
+
}
|
|
1776
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1777
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1778
|
+
config,
|
|
1779
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1780
|
+
});
|
|
1781
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1782
|
+
}
|
|
1783
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1784
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1785
|
+
config,
|
|
1786
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1787
|
+
});
|
|
1788
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1789
|
+
}
|
|
1790
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1791
|
+
const resourceParams = createResourceParams$1(config);
|
|
1792
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1793
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1794
|
+
.then((response) => {
|
|
1795
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1796
|
+
const cache = new StoreKeyMap();
|
|
1797
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1798
|
+
return cache;
|
|
1799
|
+
});
|
|
1800
|
+
}, (response) => {
|
|
1801
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1805
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1806
|
+
}
|
|
1807
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1808
|
+
const { luvio, config } = context;
|
|
1809
|
+
const selector = {
|
|
1810
|
+
recordId: keyBuilder$2(luvio, config),
|
|
1811
|
+
node: adapterFragment$1(luvio, config),
|
|
1812
|
+
variables: {},
|
|
1813
|
+
};
|
|
1814
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1815
|
+
config,
|
|
1816
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1817
|
+
});
|
|
1818
|
+
return cacheSnapshot;
|
|
1819
|
+
}
|
|
1820
|
+
const getCollectionItemsForSiteAdapterFactory = (luvio) => function CMS__getCollectionItemsForSite(untrustedConfig, requestContext) {
|
|
1821
|
+
const config = validateAdapterConfig$1(untrustedConfig, getCollectionItemsForSite_ConfigPropertyNames);
|
|
1822
|
+
// Invalid or incomplete config
|
|
1823
|
+
if (config === null) {
|
|
1824
|
+
return null;
|
|
1825
|
+
}
|
|
1826
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1827
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
function select(luvio, params) {
|
|
1831
|
+
return select$8();
|
|
1832
|
+
}
|
|
1833
|
+
function keyBuilder$1(luvio, params) {
|
|
1834
|
+
return keyPrefix + '::ManagedContentCollectionMetadataRepresentation:(' + 'expandMetadata:' + params.queryParams.expandMetadata + ',' + 'language:' + params.queryParams.language + ',' + 'collectionKeyOrId:' + params.urlParams.collectionKeyOrId + ',' + 'siteId:' + params.urlParams.siteId + ')';
|
|
1835
|
+
}
|
|
1836
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1837
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1838
|
+
}
|
|
1839
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1840
|
+
const { body } = response;
|
|
1841
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1842
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1843
|
+
const snapshot = luvio.storeLookup({
|
|
1844
|
+
recordId: key,
|
|
1845
|
+
node: select(),
|
|
1846
|
+
variables: {},
|
|
1847
|
+
}, snapshotRefresh);
|
|
1848
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1849
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1850
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
deepFreeze(snapshot.data);
|
|
1854
|
+
return snapshot;
|
|
1855
|
+
}
|
|
1856
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1857
|
+
const key = keyBuilder$1(luvio, params);
|
|
1858
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1859
|
+
const storeMetadataParams = {
|
|
1860
|
+
ttl: TTL$2,
|
|
1861
|
+
namespace: keyPrefix,
|
|
1862
|
+
version: VERSION$3,
|
|
1863
|
+
representationName: RepresentationType$3
|
|
1864
|
+
};
|
|
1865
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1866
|
+
return errorSnapshot;
|
|
1867
|
+
}
|
|
1868
|
+
function createResourceRequest(config) {
|
|
1869
|
+
const headers = {};
|
|
1870
|
+
return {
|
|
1871
|
+
baseUri: '/services/data/v66.0',
|
|
1872
|
+
basePath: '/connect/sites/' + config.urlParams.siteId + '/cms/delivery/collections/' + config.urlParams.collectionKeyOrId + '/metadata',
|
|
1873
|
+
method: 'get',
|
|
1874
|
+
body: null,
|
|
1875
|
+
urlParams: config.urlParams,
|
|
1876
|
+
queryParams: config.queryParams,
|
|
1877
|
+
headers,
|
|
1878
|
+
priority: 'normal',
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1883
|
+
let updatedResourceParams = resourceParams;
|
|
1884
|
+
// If language is not provided in request resource params, use language from the response
|
|
1885
|
+
// and update the response params. As this resource params will be used to build a cache key.
|
|
1886
|
+
if (updatedResourceParams.queryParams.language === undefined) {
|
|
1887
|
+
updatedResourceParams.queryParams.language = response.body.language;
|
|
1888
|
+
}
|
|
1889
|
+
return onFetchResponseSuccess(luvio, config, updatedResourceParams, response);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
const adapterName = 'getCollectionMetadataForSite';
|
|
1893
|
+
const getCollectionMetadataForSite_ConfigPropertyMetadata = [
|
|
1894
|
+
generateParamConfigMetadata('collectionKeyOrId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1895
|
+
generateParamConfigMetadata('siteId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1896
|
+
generateParamConfigMetadata('expandMetadata', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
1897
|
+
generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1898
|
+
];
|
|
1899
|
+
const getCollectionMetadataForSite_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCollectionMetadataForSite_ConfigPropertyMetadata);
|
|
1900
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$6(getCollectionMetadataForSite_ConfigPropertyMetadata);
|
|
1901
|
+
function keyBuilder(luvio, config) {
|
|
1902
|
+
const resourceParams = createResourceParams(config);
|
|
1903
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1904
|
+
}
|
|
1905
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1906
|
+
const config = {};
|
|
1907
|
+
typeCheckConfig$6(untrustedConfig, config, getCollectionMetadataForSite_ConfigPropertyMetadata);
|
|
1908
|
+
return config;
|
|
1909
|
+
}
|
|
1910
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1911
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1912
|
+
return null;
|
|
1913
|
+
}
|
|
1914
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1915
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1916
|
+
}
|
|
1917
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1918
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1919
|
+
return null;
|
|
1920
|
+
}
|
|
1921
|
+
return config;
|
|
1922
|
+
}
|
|
1923
|
+
function adapterFragment(luvio, config) {
|
|
1924
|
+
createResourceParams(config);
|
|
1925
|
+
return select();
|
|
1926
|
+
}
|
|
1927
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1928
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1929
|
+
config,
|
|
1930
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1931
|
+
});
|
|
1932
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1933
|
+
}
|
|
1934
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1935
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1936
|
+
config,
|
|
1937
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1938
|
+
});
|
|
1939
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1940
|
+
}
|
|
1941
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1942
|
+
const resourceParams = createResourceParams(config);
|
|
1943
|
+
const request = createResourceRequest(resourceParams);
|
|
1944
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1945
|
+
.then((response) => {
|
|
1946
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1947
|
+
const cache = new StoreKeyMap();
|
|
1948
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1949
|
+
return cache;
|
|
1950
|
+
});
|
|
1951
|
+
}, (response) => {
|
|
1952
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1956
|
+
return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
1957
|
+
}
|
|
1958
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1959
|
+
const { luvio, config } = context;
|
|
1960
|
+
const selector = {
|
|
1961
|
+
recordId: keyBuilder(luvio, config),
|
|
1962
|
+
node: adapterFragment(luvio, config),
|
|
1963
|
+
variables: {},
|
|
1964
|
+
};
|
|
1965
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1966
|
+
config,
|
|
1967
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1968
|
+
});
|
|
1969
|
+
return cacheSnapshot;
|
|
1970
|
+
}
|
|
1971
|
+
const getCollectionMetadataForSiteAdapterFactory = (luvio) => function CMS__getCollectionMetadataForSite(untrustedConfig, requestContext) {
|
|
1972
|
+
const config = validateAdapterConfig(untrustedConfig, getCollectionMetadataForSite_ConfigPropertyNames);
|
|
1973
|
+
// Invalid or incomplete config
|
|
1974
|
+
if (config === null) {
|
|
1975
|
+
return null;
|
|
1976
|
+
}
|
|
1977
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1978
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
export { getCollectionItemsForChannelAdapterFactory, getCollectionItemsForSiteAdapterFactory, getCollectionMetadataForChannelAdapterFactory, getCollectionMetadataForSiteAdapterFactory, listContentAdapterFactory, listContentInternalAdapterFactory };
|