@salesforce/lds-adapters-cms-type 1.124.2 → 1.124.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/es2018/cms-type.js +439 -439
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/getContentType.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +1 -1
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +3 -3
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteCmsDeploymentsByDeploymentId.d.ts +9 -9
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteCmsSiteAuthorContentByContentKey.d.ts +14 -14
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteConnectCmsContentJobsByJobId.d.ts +11 -11
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteConnectCmsFoldersByFolderId.d.ts +11 -11
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteConnectManagedContentContentSpacesContentsByContentSpaceIdAndManagedContentId.d.ts +10 -10
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteConnectManagedContentContentSpacesMembersByContentSpaceIdAndMemberIdOrMe.d.ts +10 -10
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsContentsByContentKeyOrId.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsDeliveryCollectionByCollectionNameOrContentKeyAndTargetId.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsDeliveryCollectionMetadataByCollectionNameOrContentKeyAndTargetId.d.ts +19 -19
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsDeployments.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsSiteAuthorContentByContentKey.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsSiteAuthorContentContentKeys.d.ts +17 -17
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsSiteAuthorContentNodeByContentKeyAndContentNode.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsSiteAuthorContentNodesByContentKey.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/getCmsSpacesByContentSpaceId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsChannelsSearchableContentTypesByChannelId.d.ts +19 -19
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsContent.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsContentJobsByJobId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsContentTypesByContentTypeFQN.d.ts +20 -20
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsContentVersionByManagedContentVersionId.d.ts +19 -19
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsContentsVariantsByVariantId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsFoldersByFolderId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCmsFoldersItemsByFolderId.d.ts +25 -25
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCommunitiesManagedContentDeliveryByCommunityId.d.ts +25 -25
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCommunitiesManagedContentDeliveryContentsByCommunityId.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectCommunitiesManagedContentDeliveryContentsSearchByCommunityId.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectManagedContentContentSpacesContentVersionsByContentSpaceIdAndManagedContentVersionId.d.ts +19 -19
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectManagedContentContentSpacesMembersByContentSpaceId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectManagedContentContentSpacesMembersPermissionsByContentSpaceIdAndMemberIdOrMe.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectManagedContentRoles.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/patchCmsDeploymentsByDeploymentId.d.ts +9 -9
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectCmsChannelsSearchableContentTypesByChannelId.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectCmsContentVersionByManagedContentVersionId.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectCmsFoldersByFolderId.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectCmsFoldersItemsByFolderId.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectCmsSchedulesByDeploymentId.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectManagedContentContentSpacesContentVersionsByContentSpaceIdAndManagedContentVersionId.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectManagedContentContentSpacesContentsByContentSpaceIdAndManagedContentId.d.ts +14 -14
- package/dist/{types → es/es2018/types}/src/generated/resources/patchConnectManagedContentContentSpacesMembersByContentSpaceIdAndMemberIdOrMe.d.ts +14 -14
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsContents.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsDeliveryChannelsVariantsByChannelId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsDeployments.d.ts +17 -17
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsSiteDeliveryContentsContentKeysByChannelId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsSiteDeliveryContentsContentTypesByChannelId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/postCmsSiteDeliveryContentsNodeIdsByChannelId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsContentJobsExport.d.ts +17 -17
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsContentJobsImport.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsContentSpacesVersionByContentSpaceId.d.ts +24 -24
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsContentSpacesVersionsByContentSpaceId.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsContentVariant.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsFolders.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCmsSchedules.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectManagedContentContentSpacesContentVersionsByContentSpaceId.d.ts +23 -23
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectManagedContentContentSpacesMembersByContentSpaceId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectManagedContentTranslation.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/putConnectCmsContentVersionByManagedContentVersionId.d.ts +21 -21
- package/dist/{types → es/es2018/types}/src/generated/resources/putConnectCmsContentsVariantsByVariantId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/types/AbstractMCSFolderRepresentation.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/AbstractMContentRepresentation.d.ts +50 -50
- package/dist/{types → es/es2018/types}/src/generated/types/MCDeliveryV2VariantCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/MCDeliveryV2VariantInputRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/MCDeliveryV2VariantRepresentation.d.ts +53 -53
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteContentCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteContentRepresentation.d.ts +46 -46
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteDeliveryByContentKeysInputRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteDeliveryByContentTypesInputRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteDeliveryByNodesInputRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteNodeCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteNodeRepresentation.d.ts +45 -45
- package/dist/{types → es/es2018/types}/src/generated/types/MCSiteVariantRepresentation.d.ts +47 -47
- package/dist/{types → es/es2018/types}/src/generated/types/MContentBodyRepresentation.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/MContentCollectionMetadataRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/MContentCollectionRepresentation.d.ts +51 -51
- package/dist/{types → es/es2018/types}/src/generated/types/MContentDetailRepresentation.d.ts +31 -31
- package/dist/{types → es/es2018/types}/src/generated/types/MContentSummaryRepresentation.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentAssociationsInputRep.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentAssociationsRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentBodyInputRep.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentChildRepresentation.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDateAndTimeNodeValueRepresentation.d.ts +34 -34
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDateNodeValueRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDeploymentCollectionRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDeploymentInputRepresentation.d.ts +44 -44
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDeploymentItemRepresentation.d.ts +41 -41
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDeploymentRepresentation.d.ts +51 -51
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDetailCollectionRepresentation.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDetailRepresentation.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentDocumentRepresentation.d.ts +74 -74
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentExportContentJobRequestInputRepresentation.d.ts +44 -44
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentExportJobItemIdsInputList.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentFolderSummaryRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentInputRep.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentInputRepresentation.d.ts +45 -45
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentJobRepresentation.d.ts +65 -65
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentJobRequestInputRepresentation.d.ts +41 -41
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentMediaNodeValueRepresentation.d.ts +57 -57
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentMediaSourceNodeValueRepresentation.d.ts +51 -51
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentNodeTypeRepresentation.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentNodeValueRepresentation.d.ts +34 -34
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentScheduleInputRepresentation.d.ts +47 -47
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSearchResultCollectionRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSearchResultContentTypeRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSearchResultRepresentation.d.ts +45 -45
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderDetailRepresentation.d.ts +43 -43
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderInputRep.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderItemCollectionInputRep.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderItemCollectionRepresentation.d.ts +36 -36
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderItemRepresentation.d.ts +65 -65
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceFolderRepresentation.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceMemberCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceMemberInputRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceMemberPermissionsRepresentation.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceMemberRepresentation.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpacePermissionRepresentation.d.ts +50 -50
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceRepresentation.d.ts +56 -56
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceRoleCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceRoleRepresentation.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentSpaceSummaryRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTextNodeValueRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTranslationRepresentation.d.ts +65 -65
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTranslationRequestInputRep.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeRepresentation.d.ts +40 -40
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeSchemaRepresentation.d.ts +50 -50
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeSearchableCollectionRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeSearchableInputRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeSearchableRepresentation.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeSummaryRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentTypeViewRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentUserSummaryRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVariantRepresentation.d.ts +79 -79
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVariantUpdateInputRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVariantV1InputRep.d.ts +47 -47
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVariantV1Representation.d.ts +50 -50
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionCollectionRepresentation.d.ts +50 -50
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionInputRep.d.ts +51 -51
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionInternalCollectionRepresentation.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionInternalRepresentation.d.ts +81 -81
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionRepresentation.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionSiteNodeCollectionRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionSiteNodeRepresentation.d.ts +41 -41
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionV2CollectionInputRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionV2CollectionRepresentation.d.ts +33 -33
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionV2InputRepresentation.d.ts +54 -54
- package/dist/{types → es/es2018/types}/src/generated/types/ManagedContentVersionV2Representation.d.ts +75 -75
- package/dist/{types → es/es2018/types}/src/generated/types/ReferenceRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/StreamedRepresentation.d.ts +26 -26
- package/dist/{types → es/es2018/types}/src/generated/types/TopicSummaryRepresentation.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
- package/package.json +5 -5
- package/sfdc/index.d.ts +1 -1
- package/sfdc/index.js +459 -459
- package/dist/umd/es2018/cms-type.js +0 -468
- package/dist/umd/es5/cms-type.js +0 -470
|
@@ -6,455 +6,455 @@
|
|
|
6
6
|
|
|
7
7
|
import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
|
|
8
8
|
|
|
9
|
-
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
-
const { keys: ObjectKeys$1, freeze: ObjectFreeze$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
|
-
};
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$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
51
|
const keyPrefix = 'CMSType';
|
|
52
52
|
|
|
53
|
-
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
-
const { isArray: ArrayIsArray } = Array;
|
|
55
|
-
const { stringify: JSONStringify } = JSON;
|
|
56
|
-
function deepFreeze$2(value) {
|
|
57
|
-
// No need to freeze primitives
|
|
58
|
-
if (typeof value !== 'object' || value === null) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (ArrayIsArray(value)) {
|
|
62
|
-
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
63
|
-
deepFreeze$2(value[i]);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const keys = ObjectKeys(value);
|
|
68
|
-
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
69
|
-
deepFreeze$2(value[keys[i]]);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
ObjectFreeze(value);
|
|
73
|
-
}
|
|
74
|
-
function createLink(ref) {
|
|
75
|
-
return {
|
|
76
|
-
__ref: serializeStructuredKey(ref),
|
|
77
|
-
};
|
|
53
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
+
const { isArray: ArrayIsArray } = Array;
|
|
55
|
+
const { stringify: JSONStringify } = JSON;
|
|
56
|
+
function deepFreeze$2(value) {
|
|
57
|
+
// No need to freeze primitives
|
|
58
|
+
if (typeof value !== 'object' || value === null) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (ArrayIsArray(value)) {
|
|
62
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
63
|
+
deepFreeze$2(value[i]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const keys = ObjectKeys(value);
|
|
68
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
69
|
+
deepFreeze$2(value[keys[i]]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
ObjectFreeze(value);
|
|
73
|
+
}
|
|
74
|
+
function createLink(ref) {
|
|
75
|
+
return {
|
|
76
|
+
__ref: serializeStructuredKey(ref),
|
|
77
|
+
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function validate$1(obj, path = 'ManagedContentTypeViewRepresentation') {
|
|
81
|
-
const v_error = (() => {
|
|
82
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
83
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
84
|
-
}
|
|
85
|
-
const obj_view = obj.view;
|
|
86
|
-
const path_view = path + '.view';
|
|
87
|
-
if (typeof obj_view !== 'object' || ArrayIsArray(obj_view) || obj_view === null) {
|
|
88
|
-
return new TypeError('Expected "object" but received "' + typeof obj_view + '" (at "' + path_view + '")');
|
|
89
|
-
}
|
|
90
|
-
const obj_view_keys = ObjectKeys(obj_view);
|
|
91
|
-
for (let i = 0; i < obj_view_keys.length; i++) {
|
|
92
|
-
const key = obj_view_keys[i];
|
|
93
|
-
const obj_view_prop = obj_view[key];
|
|
94
|
-
const path_view_prop = path_view + '["' + key + '"]';
|
|
95
|
-
if (obj_view_prop === undefined) {
|
|
96
|
-
return new TypeError('Expected "defined" but received "' + typeof obj_view_prop + '" (at "' + path_view_prop + '")');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const obj_viewMode = obj.viewMode;
|
|
100
|
-
const path_viewMode = path + '.viewMode';
|
|
101
|
-
if (typeof obj_viewMode !== 'string') {
|
|
102
|
-
return new TypeError('Expected "string" but received "' + typeof obj_viewMode + '" (at "' + path_viewMode + '")');
|
|
103
|
-
}
|
|
104
|
-
const obj_viewType = obj.viewType;
|
|
105
|
-
const path_viewType = path + '.viewType';
|
|
106
|
-
if (typeof obj_viewType !== 'string') {
|
|
107
|
-
return new TypeError('Expected "string" but received "' + typeof obj_viewType + '" (at "' + path_viewType + '")');
|
|
108
|
-
}
|
|
109
|
-
})();
|
|
110
|
-
return v_error === undefined ? null : v_error;
|
|
111
|
-
}
|
|
112
|
-
function deepFreeze$1(input) {
|
|
113
|
-
const input_view = input.view;
|
|
114
|
-
const input_view_keys = Object.keys(input_view);
|
|
115
|
-
const input_view_length = input_view_keys.length;
|
|
116
|
-
for (let i = 0; i < input_view_length; i++) {
|
|
117
|
-
const key = input_view_keys[i];
|
|
118
|
-
const input_view_prop = input_view[key];
|
|
119
|
-
deepFreeze$2(input_view_prop);
|
|
120
|
-
}
|
|
121
|
-
ObjectFreeze(input_view);
|
|
122
|
-
ObjectFreeze(input);
|
|
80
|
+
function validate$1(obj, path = 'ManagedContentTypeViewRepresentation') {
|
|
81
|
+
const v_error = (() => {
|
|
82
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
83
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
84
|
+
}
|
|
85
|
+
const obj_view = obj.view;
|
|
86
|
+
const path_view = path + '.view';
|
|
87
|
+
if (typeof obj_view !== 'object' || ArrayIsArray(obj_view) || obj_view === null) {
|
|
88
|
+
return new TypeError('Expected "object" but received "' + typeof obj_view + '" (at "' + path_view + '")');
|
|
89
|
+
}
|
|
90
|
+
const obj_view_keys = ObjectKeys(obj_view);
|
|
91
|
+
for (let i = 0; i < obj_view_keys.length; i++) {
|
|
92
|
+
const key = obj_view_keys[i];
|
|
93
|
+
const obj_view_prop = obj_view[key];
|
|
94
|
+
const path_view_prop = path_view + '["' + key + '"]';
|
|
95
|
+
if (obj_view_prop === undefined) {
|
|
96
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_view_prop + '" (at "' + path_view_prop + '")');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const obj_viewMode = obj.viewMode;
|
|
100
|
+
const path_viewMode = path + '.viewMode';
|
|
101
|
+
if (typeof obj_viewMode !== 'string') {
|
|
102
|
+
return new TypeError('Expected "string" but received "' + typeof obj_viewMode + '" (at "' + path_viewMode + '")');
|
|
103
|
+
}
|
|
104
|
+
const obj_viewType = obj.viewType;
|
|
105
|
+
const path_viewType = path + '.viewType';
|
|
106
|
+
if (typeof obj_viewType !== 'string') {
|
|
107
|
+
return new TypeError('Expected "string" but received "' + typeof obj_viewType + '" (at "' + path_viewType + '")');
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return v_error === undefined ? null : v_error;
|
|
111
|
+
}
|
|
112
|
+
function deepFreeze$1(input) {
|
|
113
|
+
const input_view = input.view;
|
|
114
|
+
const input_view_keys = Object.keys(input_view);
|
|
115
|
+
const input_view_length = input_view_keys.length;
|
|
116
|
+
for (let i = 0; i < input_view_length; i++) {
|
|
117
|
+
const key = input_view_keys[i];
|
|
118
|
+
const input_view_prop = input_view[key];
|
|
119
|
+
deepFreeze$2(input_view_prop);
|
|
120
|
+
}
|
|
121
|
+
ObjectFreeze(input_view);
|
|
122
|
+
ObjectFreeze(input);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
const TTL = 3600000;
|
|
126
|
-
const VERSION = "3c4a15dba742b4df9662b670ac97d9ce";
|
|
127
|
-
function validate(obj, path = 'ManagedContentTypeSchemaRepresentation') {
|
|
128
|
-
const v_error = (() => {
|
|
129
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
131
|
-
}
|
|
132
|
-
if (obj.description !== undefined) {
|
|
133
|
-
const obj_description = obj.description;
|
|
134
|
-
const path_description = path + '.description';
|
|
135
|
-
if (typeof obj_description !== 'string') {
|
|
136
|
-
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (obj.developerName !== undefined) {
|
|
140
|
-
const obj_developerName = obj.developerName;
|
|
141
|
-
const path_developerName = path + '.developerName';
|
|
142
|
-
if (typeof obj_developerName !== 'string') {
|
|
143
|
-
return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (obj.label !== undefined) {
|
|
147
|
-
const obj_label = obj.label;
|
|
148
|
-
const path_label = path + '.label';
|
|
149
|
-
if (typeof obj_label !== 'string') {
|
|
150
|
-
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (obj.namespacePrefix !== undefined) {
|
|
154
|
-
const obj_namespacePrefix = obj.namespacePrefix;
|
|
155
|
-
const path_namespacePrefix = path + '.namespacePrefix';
|
|
156
|
-
if (typeof obj_namespacePrefix !== 'string') {
|
|
157
|
-
return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (obj.schema !== undefined) {
|
|
161
|
-
const obj_schema = obj.schema;
|
|
162
|
-
const path_schema = path + '.schema';
|
|
163
|
-
if (typeof obj_schema !== 'object' || ArrayIsArray(obj_schema) || obj_schema === null) {
|
|
164
|
-
return new TypeError('Expected "object" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
|
|
165
|
-
}
|
|
166
|
-
const obj_schema_keys = ObjectKeys(obj_schema);
|
|
167
|
-
for (let i = 0; i < obj_schema_keys.length; i++) {
|
|
168
|
-
const key = obj_schema_keys[i];
|
|
169
|
-
const obj_schema_prop = obj_schema[key];
|
|
170
|
-
const path_schema_prop = path_schema + '["' + key + '"]';
|
|
171
|
-
if (obj_schema_prop === undefined) {
|
|
172
|
-
return new TypeError('Expected "defined" but received "' + typeof obj_schema_prop + '" (at "' + path_schema_prop + '")');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (obj.views !== undefined) {
|
|
177
|
-
const obj_views = obj.views;
|
|
178
|
-
const path_views = path + '.views';
|
|
179
|
-
if (!ArrayIsArray(obj_views)) {
|
|
180
|
-
return new TypeError('Expected "array" but received "' + typeof obj_views + '" (at "' + path_views + '")');
|
|
181
|
-
}
|
|
182
|
-
for (let i = 0; i < obj_views.length; i++) {
|
|
183
|
-
const obj_views_item = obj_views[i];
|
|
184
|
-
const path_views_item = path_views + '[' + i + ']';
|
|
185
|
-
const referencepath_views_itemValidationError = validate$1(obj_views_item, path_views_item);
|
|
186
|
-
if (referencepath_views_itemValidationError !== null) {
|
|
187
|
-
let message = 'Object doesn\'t match ManagedContentTypeViewRepresentation (at "' + path_views_item + '")\n';
|
|
188
|
-
message += referencepath_views_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
189
|
-
return new TypeError(message);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
})();
|
|
194
|
-
return v_error === undefined ? null : v_error;
|
|
195
|
-
}
|
|
196
|
-
const RepresentationType = 'ManagedContentTypeSchemaRepresentation';
|
|
197
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
198
|
-
return input;
|
|
199
|
-
}
|
|
200
|
-
const select$1 = function ManagedContentTypeSchemaRepresentationSelect() {
|
|
201
|
-
return {
|
|
202
|
-
kind: 'Fragment',
|
|
203
|
-
version: VERSION,
|
|
204
|
-
private: [],
|
|
205
|
-
opaque: true
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
function equals(existing, incoming) {
|
|
209
|
-
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
function deepFreeze(input) {
|
|
215
|
-
const input_schema = input.schema;
|
|
216
|
-
if (input_schema !== undefined) {
|
|
217
|
-
const input_schema_keys = Object.keys(input_schema);
|
|
218
|
-
const input_schema_length = input_schema_keys.length;
|
|
219
|
-
for (let i = 0; i < input_schema_length; i++) {
|
|
220
|
-
const key = input_schema_keys[i];
|
|
221
|
-
const input_schema_prop = input_schema[key];
|
|
222
|
-
deepFreeze$2(input_schema_prop);
|
|
223
|
-
}
|
|
224
|
-
ObjectFreeze(input_schema);
|
|
225
|
-
}
|
|
226
|
-
const input_views = input.views;
|
|
227
|
-
if (input_views !== undefined) {
|
|
228
|
-
for (let i = 0; i < input_views.length; i++) {
|
|
229
|
-
const input_views_item = input_views[i];
|
|
230
|
-
deepFreeze$1(input_views_item);
|
|
231
|
-
}
|
|
232
|
-
ObjectFreeze(input_views);
|
|
233
|
-
}
|
|
234
|
-
ObjectFreeze(input);
|
|
235
|
-
}
|
|
236
|
-
const ingest = function ManagedContentTypeSchemaRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
237
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
238
|
-
const validateError = validate(input);
|
|
239
|
-
if (validateError !== null) {
|
|
240
|
-
throw validateError;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const key = path.fullPath;
|
|
244
|
-
const existingRecord = store.readEntry(key);
|
|
245
|
-
const ttlToUse = TTL;
|
|
246
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
247
|
-
fullPath: key,
|
|
248
|
-
parent: path.parent,
|
|
249
|
-
propertyName: path.propertyName,
|
|
250
|
-
ttl: ttlToUse
|
|
251
|
-
});
|
|
252
|
-
deepFreeze(input);
|
|
253
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
254
|
-
luvio.storePublish(key, incomingRecord);
|
|
255
|
-
}
|
|
256
|
-
{
|
|
257
|
-
const storeMetadataParams = {
|
|
258
|
-
ttl: ttlToUse,
|
|
259
|
-
namespace: "CMSType",
|
|
260
|
-
version: VERSION,
|
|
261
|
-
representationName: RepresentationType,
|
|
262
|
-
};
|
|
263
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
264
|
-
}
|
|
265
|
-
return createLink(key);
|
|
266
|
-
};
|
|
267
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
268
|
-
const rootKeySet = new StoreKeyMap();
|
|
269
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
270
|
-
const rootKey = fullPathFactory();
|
|
271
|
-
rootKeySet.set(rootKey, {
|
|
272
|
-
namespace: keyPrefix,
|
|
273
|
-
representationName: RepresentationType,
|
|
274
|
-
mergeable: false
|
|
275
|
-
});
|
|
276
|
-
return rootKeySet;
|
|
125
|
+
const TTL = 3600000;
|
|
126
|
+
const VERSION = "3c4a15dba742b4df9662b670ac97d9ce";
|
|
127
|
+
function validate(obj, path = 'ManagedContentTypeSchemaRepresentation') {
|
|
128
|
+
const v_error = (() => {
|
|
129
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
131
|
+
}
|
|
132
|
+
if (obj.description !== undefined) {
|
|
133
|
+
const obj_description = obj.description;
|
|
134
|
+
const path_description = path + '.description';
|
|
135
|
+
if (typeof obj_description !== 'string') {
|
|
136
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (obj.developerName !== undefined) {
|
|
140
|
+
const obj_developerName = obj.developerName;
|
|
141
|
+
const path_developerName = path + '.developerName';
|
|
142
|
+
if (typeof obj_developerName !== 'string') {
|
|
143
|
+
return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (obj.label !== undefined) {
|
|
147
|
+
const obj_label = obj.label;
|
|
148
|
+
const path_label = path + '.label';
|
|
149
|
+
if (typeof obj_label !== 'string') {
|
|
150
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (obj.namespacePrefix !== undefined) {
|
|
154
|
+
const obj_namespacePrefix = obj.namespacePrefix;
|
|
155
|
+
const path_namespacePrefix = path + '.namespacePrefix';
|
|
156
|
+
if (typeof obj_namespacePrefix !== 'string') {
|
|
157
|
+
return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (obj.schema !== undefined) {
|
|
161
|
+
const obj_schema = obj.schema;
|
|
162
|
+
const path_schema = path + '.schema';
|
|
163
|
+
if (typeof obj_schema !== 'object' || ArrayIsArray(obj_schema) || obj_schema === null) {
|
|
164
|
+
return new TypeError('Expected "object" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
|
|
165
|
+
}
|
|
166
|
+
const obj_schema_keys = ObjectKeys(obj_schema);
|
|
167
|
+
for (let i = 0; i < obj_schema_keys.length; i++) {
|
|
168
|
+
const key = obj_schema_keys[i];
|
|
169
|
+
const obj_schema_prop = obj_schema[key];
|
|
170
|
+
const path_schema_prop = path_schema + '["' + key + '"]';
|
|
171
|
+
if (obj_schema_prop === undefined) {
|
|
172
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_schema_prop + '" (at "' + path_schema_prop + '")');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (obj.views !== undefined) {
|
|
177
|
+
const obj_views = obj.views;
|
|
178
|
+
const path_views = path + '.views';
|
|
179
|
+
if (!ArrayIsArray(obj_views)) {
|
|
180
|
+
return new TypeError('Expected "array" but received "' + typeof obj_views + '" (at "' + path_views + '")');
|
|
181
|
+
}
|
|
182
|
+
for (let i = 0; i < obj_views.length; i++) {
|
|
183
|
+
const obj_views_item = obj_views[i];
|
|
184
|
+
const path_views_item = path_views + '[' + i + ']';
|
|
185
|
+
const referencepath_views_itemValidationError = validate$1(obj_views_item, path_views_item);
|
|
186
|
+
if (referencepath_views_itemValidationError !== null) {
|
|
187
|
+
let message = 'Object doesn\'t match ManagedContentTypeViewRepresentation (at "' + path_views_item + '")\n';
|
|
188
|
+
message += referencepath_views_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
189
|
+
return new TypeError(message);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})();
|
|
194
|
+
return v_error === undefined ? null : v_error;
|
|
195
|
+
}
|
|
196
|
+
const RepresentationType = 'ManagedContentTypeSchemaRepresentation';
|
|
197
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
198
|
+
return input;
|
|
199
|
+
}
|
|
200
|
+
const select$1 = function ManagedContentTypeSchemaRepresentationSelect() {
|
|
201
|
+
return {
|
|
202
|
+
kind: 'Fragment',
|
|
203
|
+
version: VERSION,
|
|
204
|
+
private: [],
|
|
205
|
+
opaque: true
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
function equals(existing, incoming) {
|
|
209
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
function deepFreeze(input) {
|
|
215
|
+
const input_schema = input.schema;
|
|
216
|
+
if (input_schema !== undefined) {
|
|
217
|
+
const input_schema_keys = Object.keys(input_schema);
|
|
218
|
+
const input_schema_length = input_schema_keys.length;
|
|
219
|
+
for (let i = 0; i < input_schema_length; i++) {
|
|
220
|
+
const key = input_schema_keys[i];
|
|
221
|
+
const input_schema_prop = input_schema[key];
|
|
222
|
+
deepFreeze$2(input_schema_prop);
|
|
223
|
+
}
|
|
224
|
+
ObjectFreeze(input_schema);
|
|
225
|
+
}
|
|
226
|
+
const input_views = input.views;
|
|
227
|
+
if (input_views !== undefined) {
|
|
228
|
+
for (let i = 0; i < input_views.length; i++) {
|
|
229
|
+
const input_views_item = input_views[i];
|
|
230
|
+
deepFreeze$1(input_views_item);
|
|
231
|
+
}
|
|
232
|
+
ObjectFreeze(input_views);
|
|
233
|
+
}
|
|
234
|
+
ObjectFreeze(input);
|
|
235
|
+
}
|
|
236
|
+
const ingest = function ManagedContentTypeSchemaRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
237
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
238
|
+
const validateError = validate(input);
|
|
239
|
+
if (validateError !== null) {
|
|
240
|
+
throw validateError;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const key = path.fullPath;
|
|
244
|
+
const existingRecord = store.readEntry(key);
|
|
245
|
+
const ttlToUse = TTL;
|
|
246
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
247
|
+
fullPath: key,
|
|
248
|
+
parent: path.parent,
|
|
249
|
+
propertyName: path.propertyName,
|
|
250
|
+
ttl: ttlToUse
|
|
251
|
+
});
|
|
252
|
+
deepFreeze(input);
|
|
253
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
254
|
+
luvio.storePublish(key, incomingRecord);
|
|
255
|
+
}
|
|
256
|
+
{
|
|
257
|
+
const storeMetadataParams = {
|
|
258
|
+
ttl: ttlToUse,
|
|
259
|
+
namespace: "CMSType",
|
|
260
|
+
version: VERSION,
|
|
261
|
+
representationName: RepresentationType,
|
|
262
|
+
};
|
|
263
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
264
|
+
}
|
|
265
|
+
return createLink(key);
|
|
266
|
+
};
|
|
267
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
268
|
+
const rootKeySet = new StoreKeyMap();
|
|
269
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
270
|
+
const rootKey = fullPathFactory();
|
|
271
|
+
rootKeySet.set(rootKey, {
|
|
272
|
+
namespace: keyPrefix,
|
|
273
|
+
representationName: RepresentationType,
|
|
274
|
+
mergeable: false
|
|
275
|
+
});
|
|
276
|
+
return rootKeySet;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
function select(luvio, params) {
|
|
280
|
-
return select$1();
|
|
281
|
-
}
|
|
282
|
-
function keyBuilder$1(luvio, params) {
|
|
283
|
-
return keyPrefix + '::ManagedContentTypeSchemaRepresentation:(' + 'includeSchemaDefinitions:' + params.queryParams.includeSchemaDefinitions + ',' + 'language:' + params.queryParams.language + ',' + 'viewMode:' + params.queryParams.viewMode + ',' + 'contentTypeFQN:' + params.urlParams.contentTypeFQN + ')';
|
|
284
|
-
}
|
|
285
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
286
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
287
|
-
}
|
|
288
|
-
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
289
|
-
const { body } = response;
|
|
290
|
-
const key = keyBuilder$1(luvio, resourceParams);
|
|
291
|
-
luvio.storeIngest(key, ingest, body);
|
|
292
|
-
const snapshot = luvio.storeLookup({
|
|
293
|
-
recordId: key,
|
|
294
|
-
node: select(),
|
|
295
|
-
variables: {},
|
|
296
|
-
}, snapshotRefresh);
|
|
297
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
298
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
299
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return snapshot;
|
|
303
|
-
}
|
|
304
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
305
|
-
const key = keyBuilder$1(luvio, params);
|
|
306
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
307
|
-
const storeMetadataParams = {
|
|
308
|
-
ttl: TTL,
|
|
309
|
-
namespace: keyPrefix,
|
|
310
|
-
version: VERSION,
|
|
311
|
-
representationName: RepresentationType
|
|
312
|
-
};
|
|
313
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
314
|
-
return errorSnapshot;
|
|
315
|
-
}
|
|
316
|
-
function createResourceRequest(config) {
|
|
317
|
-
const headers = {};
|
|
318
|
-
return {
|
|
319
|
-
baseUri: '/services/data/v58.0',
|
|
320
|
-
basePath: '/connect/cms/content-types/' + config.urlParams.contentTypeFQN + '',
|
|
321
|
-
method: 'get',
|
|
322
|
-
body: null,
|
|
323
|
-
urlParams: config.urlParams,
|
|
324
|
-
queryParams: config.queryParams,
|
|
325
|
-
headers,
|
|
326
|
-
priority: 'normal',
|
|
327
|
-
};
|
|
279
|
+
function select(luvio, params) {
|
|
280
|
+
return select$1();
|
|
281
|
+
}
|
|
282
|
+
function keyBuilder$1(luvio, params) {
|
|
283
|
+
return keyPrefix + '::ManagedContentTypeSchemaRepresentation:(' + 'includeSchemaDefinitions:' + params.queryParams.includeSchemaDefinitions + ',' + 'language:' + params.queryParams.language + ',' + 'viewMode:' + params.queryParams.viewMode + ',' + 'contentTypeFQN:' + params.urlParams.contentTypeFQN + ')';
|
|
284
|
+
}
|
|
285
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
286
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
287
|
+
}
|
|
288
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
289
|
+
const { body } = response;
|
|
290
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
291
|
+
luvio.storeIngest(key, ingest, body);
|
|
292
|
+
const snapshot = luvio.storeLookup({
|
|
293
|
+
recordId: key,
|
|
294
|
+
node: select(),
|
|
295
|
+
variables: {},
|
|
296
|
+
}, snapshotRefresh);
|
|
297
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
298
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
299
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return snapshot;
|
|
303
|
+
}
|
|
304
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
305
|
+
const key = keyBuilder$1(luvio, params);
|
|
306
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
307
|
+
const storeMetadataParams = {
|
|
308
|
+
ttl: TTL,
|
|
309
|
+
namespace: keyPrefix,
|
|
310
|
+
version: VERSION,
|
|
311
|
+
representationName: RepresentationType
|
|
312
|
+
};
|
|
313
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
314
|
+
return errorSnapshot;
|
|
315
|
+
}
|
|
316
|
+
function createResourceRequest(config) {
|
|
317
|
+
const headers = {};
|
|
318
|
+
return {
|
|
319
|
+
baseUri: '/services/data/v58.0',
|
|
320
|
+
basePath: '/connect/cms/content-types/' + config.urlParams.contentTypeFQN + '',
|
|
321
|
+
method: 'get',
|
|
322
|
+
body: null,
|
|
323
|
+
urlParams: config.urlParams,
|
|
324
|
+
queryParams: config.queryParams,
|
|
325
|
+
headers,
|
|
326
|
+
priority: 'normal',
|
|
327
|
+
};
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
const getContentType_ConfigPropertyNames = {
|
|
331
|
-
displayName: 'getContentType',
|
|
332
|
-
parameters: {
|
|
333
|
-
required: ['contentTypeFQN'],
|
|
334
|
-
optional: ['includeSchemaDefinitions', 'language', 'viewMode']
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
function createResourceParams(config) {
|
|
338
|
-
const resourceParams = {
|
|
339
|
-
urlParams: {
|
|
340
|
-
contentTypeFQN: config.contentTypeFQN
|
|
341
|
-
},
|
|
342
|
-
queryParams: {
|
|
343
|
-
includeSchemaDefinitions: config.includeSchemaDefinitions, language: config.language, viewMode: config.viewMode
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
return resourceParams;
|
|
347
|
-
}
|
|
348
|
-
function keyBuilder(luvio, config) {
|
|
349
|
-
const resourceParams = createResourceParams(config);
|
|
350
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
351
|
-
}
|
|
352
|
-
function typeCheckConfig(untrustedConfig) {
|
|
353
|
-
const config = {};
|
|
354
|
-
const untrustedConfig_contentTypeFQN = untrustedConfig.contentTypeFQN;
|
|
355
|
-
if (typeof untrustedConfig_contentTypeFQN === 'string') {
|
|
356
|
-
config.contentTypeFQN = untrustedConfig_contentTypeFQN;
|
|
357
|
-
}
|
|
358
|
-
const untrustedConfig_includeSchemaDefinitions = untrustedConfig.includeSchemaDefinitions;
|
|
359
|
-
if (typeof untrustedConfig_includeSchemaDefinitions === 'boolean') {
|
|
360
|
-
config.includeSchemaDefinitions = untrustedConfig_includeSchemaDefinitions;
|
|
361
|
-
}
|
|
362
|
-
const untrustedConfig_language = untrustedConfig.language;
|
|
363
|
-
if (typeof untrustedConfig_language === 'string') {
|
|
364
|
-
config.language = untrustedConfig_language;
|
|
365
|
-
}
|
|
366
|
-
const untrustedConfig_viewMode = untrustedConfig.viewMode;
|
|
367
|
-
if (ArrayIsArray$1(untrustedConfig_viewMode)) {
|
|
368
|
-
const untrustedConfig_viewMode_array = [];
|
|
369
|
-
for (let i = 0, arrayLength = untrustedConfig_viewMode.length; i < arrayLength; i++) {
|
|
370
|
-
const untrustedConfig_viewMode_item = untrustedConfig_viewMode[i];
|
|
371
|
-
if (typeof untrustedConfig_viewMode_item === 'string') {
|
|
372
|
-
untrustedConfig_viewMode_array.push(untrustedConfig_viewMode_item);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
config.viewMode = untrustedConfig_viewMode_array;
|
|
376
|
-
}
|
|
377
|
-
return config;
|
|
378
|
-
}
|
|
379
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
380
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
384
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
385
|
-
}
|
|
386
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
387
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
return config;
|
|
391
|
-
}
|
|
392
|
-
function adapterFragment(luvio, config) {
|
|
393
|
-
createResourceParams(config);
|
|
394
|
-
return select();
|
|
395
|
-
}
|
|
396
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
397
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
398
|
-
config,
|
|
399
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
400
|
-
});
|
|
401
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
402
|
-
}
|
|
403
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
404
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
405
|
-
config,
|
|
406
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
407
|
-
});
|
|
408
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
409
|
-
}
|
|
410
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
411
|
-
const resourceParams = createResourceParams(config);
|
|
412
|
-
const request = createResourceRequest(resourceParams);
|
|
413
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
414
|
-
.then((response) => {
|
|
415
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
416
|
-
}, (response) => {
|
|
417
|
-
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
421
|
-
const { luvio, config } = context;
|
|
422
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
423
|
-
const dispatchOptions = {
|
|
424
|
-
resourceRequestContext: {
|
|
425
|
-
requestCorrelator,
|
|
426
|
-
luvioRequestMethod: undefined,
|
|
427
|
-
},
|
|
428
|
-
eventObservers
|
|
429
|
-
};
|
|
430
|
-
if (networkPriority !== 'normal') {
|
|
431
|
-
dispatchOptions.overrides = {
|
|
432
|
-
priority: networkPriority
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
436
|
-
}
|
|
437
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
438
|
-
const { luvio, config } = context;
|
|
439
|
-
const selector = {
|
|
440
|
-
recordId: keyBuilder(luvio, config),
|
|
441
|
-
node: adapterFragment(luvio, config),
|
|
442
|
-
variables: {},
|
|
443
|
-
};
|
|
444
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
445
|
-
config,
|
|
446
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
447
|
-
});
|
|
448
|
-
return cacheSnapshot;
|
|
449
|
-
}
|
|
450
|
-
const getContentTypeAdapterFactory = (luvio) => function CMSType__getContentType(untrustedConfig, requestContext) {
|
|
451
|
-
const config = validateAdapterConfig(untrustedConfig, getContentType_ConfigPropertyNames);
|
|
452
|
-
// Invalid or incomplete config
|
|
453
|
-
if (config === null) {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
457
|
-
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
330
|
+
const getContentType_ConfigPropertyNames = {
|
|
331
|
+
displayName: 'getContentType',
|
|
332
|
+
parameters: {
|
|
333
|
+
required: ['contentTypeFQN'],
|
|
334
|
+
optional: ['includeSchemaDefinitions', 'language', 'viewMode']
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
function createResourceParams(config) {
|
|
338
|
+
const resourceParams = {
|
|
339
|
+
urlParams: {
|
|
340
|
+
contentTypeFQN: config.contentTypeFQN
|
|
341
|
+
},
|
|
342
|
+
queryParams: {
|
|
343
|
+
includeSchemaDefinitions: config.includeSchemaDefinitions, language: config.language, viewMode: config.viewMode
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
return resourceParams;
|
|
347
|
+
}
|
|
348
|
+
function keyBuilder(luvio, config) {
|
|
349
|
+
const resourceParams = createResourceParams(config);
|
|
350
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
351
|
+
}
|
|
352
|
+
function typeCheckConfig(untrustedConfig) {
|
|
353
|
+
const config = {};
|
|
354
|
+
const untrustedConfig_contentTypeFQN = untrustedConfig.contentTypeFQN;
|
|
355
|
+
if (typeof untrustedConfig_contentTypeFQN === 'string') {
|
|
356
|
+
config.contentTypeFQN = untrustedConfig_contentTypeFQN;
|
|
357
|
+
}
|
|
358
|
+
const untrustedConfig_includeSchemaDefinitions = untrustedConfig.includeSchemaDefinitions;
|
|
359
|
+
if (typeof untrustedConfig_includeSchemaDefinitions === 'boolean') {
|
|
360
|
+
config.includeSchemaDefinitions = untrustedConfig_includeSchemaDefinitions;
|
|
361
|
+
}
|
|
362
|
+
const untrustedConfig_language = untrustedConfig.language;
|
|
363
|
+
if (typeof untrustedConfig_language === 'string') {
|
|
364
|
+
config.language = untrustedConfig_language;
|
|
365
|
+
}
|
|
366
|
+
const untrustedConfig_viewMode = untrustedConfig.viewMode;
|
|
367
|
+
if (ArrayIsArray$1(untrustedConfig_viewMode)) {
|
|
368
|
+
const untrustedConfig_viewMode_array = [];
|
|
369
|
+
for (let i = 0, arrayLength = untrustedConfig_viewMode.length; i < arrayLength; i++) {
|
|
370
|
+
const untrustedConfig_viewMode_item = untrustedConfig_viewMode[i];
|
|
371
|
+
if (typeof untrustedConfig_viewMode_item === 'string') {
|
|
372
|
+
untrustedConfig_viewMode_array.push(untrustedConfig_viewMode_item);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
config.viewMode = untrustedConfig_viewMode_array;
|
|
376
|
+
}
|
|
377
|
+
return config;
|
|
378
|
+
}
|
|
379
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
380
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
384
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
385
|
+
}
|
|
386
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
387
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
return config;
|
|
391
|
+
}
|
|
392
|
+
function adapterFragment(luvio, config) {
|
|
393
|
+
createResourceParams(config);
|
|
394
|
+
return select();
|
|
395
|
+
}
|
|
396
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
397
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
398
|
+
config,
|
|
399
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
400
|
+
});
|
|
401
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
402
|
+
}
|
|
403
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
404
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
405
|
+
config,
|
|
406
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
407
|
+
});
|
|
408
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
409
|
+
}
|
|
410
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
411
|
+
const resourceParams = createResourceParams(config);
|
|
412
|
+
const request = createResourceRequest(resourceParams);
|
|
413
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
414
|
+
.then((response) => {
|
|
415
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
416
|
+
}, (response) => {
|
|
417
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
421
|
+
const { luvio, config } = context;
|
|
422
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
423
|
+
const dispatchOptions = {
|
|
424
|
+
resourceRequestContext: {
|
|
425
|
+
requestCorrelator,
|
|
426
|
+
luvioRequestMethod: undefined,
|
|
427
|
+
},
|
|
428
|
+
eventObservers
|
|
429
|
+
};
|
|
430
|
+
if (networkPriority !== 'normal') {
|
|
431
|
+
dispatchOptions.overrides = {
|
|
432
|
+
priority: networkPriority
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
436
|
+
}
|
|
437
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
438
|
+
const { luvio, config } = context;
|
|
439
|
+
const selector = {
|
|
440
|
+
recordId: keyBuilder(luvio, config),
|
|
441
|
+
node: adapterFragment(luvio, config),
|
|
442
|
+
variables: {},
|
|
443
|
+
};
|
|
444
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
445
|
+
config,
|
|
446
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
447
|
+
});
|
|
448
|
+
return cacheSnapshot;
|
|
449
|
+
}
|
|
450
|
+
const getContentTypeAdapterFactory = (luvio) => function CMSType__getContentType(untrustedConfig, requestContext) {
|
|
451
|
+
const config = validateAdapterConfig(untrustedConfig, getContentType_ConfigPropertyNames);
|
|
452
|
+
// Invalid or incomplete config
|
|
453
|
+
if (config === null) {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
457
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
458
458
|
};
|
|
459
459
|
|
|
460
460
|
export { getContentTypeAdapterFactory };
|