@adobe/alloy 2.21.1 → 2.22.0-alpha.1
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/babel.config.cjs +0 -1
- package/libEs5/baseCode/index.js +3 -2
- package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +23 -20
- package/libEs5/components/ActivityCollector/configValidators.js +2 -2
- package/libEs5/components/ActivityCollector/createClickActivityStorage.js +11 -9
- package/libEs5/components/ActivityCollector/createClickedElementProperties.js +39 -32
- package/libEs5/components/ActivityCollector/createGetClickedElementProperties.js +28 -20
- package/libEs5/components/ActivityCollector/createInjectClickedElementProperties.js +24 -21
- package/libEs5/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +10 -8
- package/libEs5/components/ActivityCollector/createStorePageViewProperties.js +6 -4
- package/libEs5/components/ActivityCollector/getLinkName.js +19 -18
- package/libEs5/components/ActivityCollector/getLinkRegion.js +10 -9
- package/libEs5/components/ActivityCollector/index.js +61 -45
- package/libEs5/components/ActivityCollector/utils/activityMapExtensionEnabled.js +3 -5
- package/libEs5/components/ActivityCollector/utils/createTransientStorage.js +7 -6
- package/libEs5/components/ActivityCollector/utils/determineLinkType.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/elementHasClickHandler.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/extractDomain.js +5 -4
- package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +11 -8
- package/libEs5/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/isDownloadLink.js +6 -5
- package/libEs5/components/ActivityCollector/utils/dom/isExitLink.js +6 -5
- package/libEs5/components/ActivityCollector/utils/dom/isInputSubmitElement.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedTextNode.js +4 -3
- package/libEs5/components/ActivityCollector/utils/hasPageName.js +4 -3
- package/libEs5/components/ActivityCollector/utils/isDifferentDomains.js +5 -4
- package/libEs5/components/ActivityCollector/utils/trimQueryFromUrl.js +5 -4
- package/libEs5/components/ActivityCollector/utils/truncateWhiteSpace.js +3 -2
- package/libEs5/components/ActivityCollector/utils/urlStartsWithScheme.js +3 -2
- package/libEs5/components/Audiences/index.js +13 -12
- package/libEs5/components/Audiences/injectProcessDestinations.js +32 -35
- package/libEs5/components/Audiences/injectProcessResponse.js +19 -16
- package/libEs5/components/Context/createComponent.js +10 -13
- package/libEs5/components/Context/implementationDetails.js +5 -4
- package/libEs5/components/Context/index.js +24 -28
- package/libEs5/components/Context/injectDevice.js +23 -15
- package/libEs5/components/Context/injectEnvironment.js +17 -12
- package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +12 -21
- package/libEs5/components/Context/injectPlaceContext.js +8 -7
- package/libEs5/components/Context/injectTimestamp.js +6 -5
- package/libEs5/components/Context/injectWeb.js +6 -5
- package/libEs5/components/DataCollector/index.js +37 -38
- package/libEs5/components/DataCollector/validateApplyResponse.js +6 -4
- package/libEs5/components/DataCollector/validateUserEventOptions.js +6 -4
- package/libEs5/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +11 -8
- package/libEs5/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +10 -7
- package/libEs5/components/DecisioningEngine/constants.js +3 -3
- package/libEs5/components/DecisioningEngine/createApplyResponse.js +15 -15
- package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +17 -13
- package/libEs5/components/DecisioningEngine/createContextProvider.js +48 -44
- package/libEs5/components/DecisioningEngine/createDecisionHistory.js +7 -5
- package/libEs5/components/DecisioningEngine/createDecisionProvider.js +16 -21
- package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +39 -37
- package/libEs5/components/DecisioningEngine/createEvaluateRulesetsCommand.js +21 -19
- package/libEs5/components/DecisioningEngine/createEventRegistry.js +63 -67
- package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +23 -22
- package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +100 -55
- package/libEs5/components/DecisioningEngine/index.js +83 -54
- package/libEs5/components/DecisioningEngine/utils.js +43 -38
- package/libEs5/components/EventMerge/createComponent.js +5 -3
- package/libEs5/components/EventMerge/createEventMergeId.js +3 -2
- package/libEs5/components/EventMerge/index.js +1 -1
- package/libEs5/components/Identity/addEcidQueryToPayload.js +3 -2
- package/libEs5/components/Identity/addEcidToPayload.js +3 -2
- package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +13 -23
- package/libEs5/components/Identity/configValidators.js +1 -1
- package/libEs5/components/Identity/constants/authState.js +3 -3
- package/libEs5/components/Identity/createComponent.js +39 -33
- package/libEs5/components/Identity/createLegacyIdentity.js +29 -29
- package/libEs5/components/Identity/getEcidFromResponse.js +5 -7
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +17 -15
- package/libEs5/components/Identity/getIdentity/createIdentityRequest.js +10 -8
- package/libEs5/components/Identity/getIdentity/createIdentityRequestPayload.js +5 -4
- package/libEs5/components/Identity/index.js +61 -62
- package/libEs5/components/Identity/injectAddLegacyEcidToPayload.js +8 -6
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +46 -52
- package/libEs5/components/Identity/injectAwaitIdentityCookie.js +14 -11
- package/libEs5/components/Identity/injectEnsureSingleIdentity.js +25 -24
- package/libEs5/components/Identity/injectHandleResponseForIdSyncs.js +6 -4
- package/libEs5/components/Identity/injectProcessIdSyncs.js +20 -22
- package/libEs5/components/Identity/injectSetDomainForInitialIdentityPayload.js +7 -5
- package/libEs5/components/Identity/visitorService/awaitVisitorOptIn.js +8 -6
- package/libEs5/components/Identity/visitorService/getVisitor.js +4 -3
- package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +15 -13
- package/libEs5/components/LegacyMediaAnalytics/constants/constants.js +9 -9
- package/libEs5/components/LegacyMediaAnalytics/constants/mediaKeysToXdmConverter.js +2 -2
- package/libEs5/components/LegacyMediaAnalytics/createGetInstance.js +61 -63
- package/libEs5/components/LegacyMediaAnalytics/createLegacyMediaComponent.js +38 -37
- package/libEs5/components/LegacyMediaAnalytics/createMediaHelper.js +54 -52
- package/libEs5/components/LegacyMediaAnalytics/index.js +32 -33
- package/libEs5/components/LibraryInfo/index.js +23 -30
- package/libEs5/components/MachineLearning/index.js +1 -1
- package/libEs5/components/MachineLearning/processResponse.js +5 -3
- package/libEs5/components/Personalization/constants/loggerMessage.js +2 -2
- package/libEs5/components/Personalization/constants/scopeType.js +3 -3
- package/libEs5/components/Personalization/constants/surface.js +4 -4
- package/libEs5/components/Personalization/createActionsProvider.js +37 -32
- package/libEs5/components/Personalization/createApplyPropositions.js +71 -81
- package/libEs5/components/Personalization/createClickStorage.js +30 -32
- package/libEs5/components/Personalization/createComponent.js +65 -74
- package/libEs5/components/Personalization/createFetchDataHandler.js +83 -52
- package/libEs5/components/Personalization/createGetPageLocation.js +6 -6
- package/libEs5/components/Personalization/createHandleConsentFlicker.js +15 -14
- package/libEs5/components/Personalization/createInteractionStorage.js +25 -39
- package/libEs5/components/Personalization/createNotificationHandler.js +9 -10
- package/libEs5/components/Personalization/createOnClickHandler.js +29 -25
- package/libEs5/components/Personalization/createOnDecisionHandler.js +23 -21
- package/libEs5/components/Personalization/createPersonalizationDetails.js +39 -45
- package/libEs5/components/Personalization/createPreprocessors.js +7 -7
- package/libEs5/components/Personalization/createSetTargetMigration.js +6 -4
- package/libEs5/components/Personalization/createViewCacheManager.js +29 -32
- package/libEs5/components/Personalization/createViewChangeHandler.js +35 -20
- package/libEs5/components/Personalization/dom-actions/action.js +24 -25
- package/libEs5/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +12 -13
- package/libEs5/components/Personalization/dom-actions/appendHtml.js +8 -7
- package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +28 -33
- package/libEs5/components/Personalization/dom-actions/clicks/collectInteractions.js +37 -40
- package/libEs5/components/Personalization/dom-actions/collectInteractions.js +3 -2
- package/libEs5/components/Personalization/dom-actions/createPreprocess.js +10 -11
- package/libEs5/components/Personalization/dom-actions/createRedirect.js +11 -13
- package/libEs5/components/Personalization/dom-actions/dom/createFragment.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getChildNodes.js +6 -3
- package/libEs5/components/Personalization/dom-actions/dom/getChildren.js +6 -3
- package/libEs5/components/Personalization/dom-actions/dom/getElementById.js +3 -3
- package/libEs5/components/Personalization/dom-actions/dom/getFirstChild.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNextSibling.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNonce.js +7 -6
- package/libEs5/components/Personalization/dom-actions/dom/getParent.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/helperForEq.js +7 -7
- package/libEs5/components/Personalization/dom-actions/dom/index.js +14 -14
- package/libEs5/components/Personalization/dom-actions/dom/insertAfter.js +4 -3
- package/libEs5/components/Personalization/dom-actions/dom/insertBefore.js +4 -3
- package/libEs5/components/Personalization/dom-actions/dom/isDomElement.js +2 -3
- package/libEs5/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +6 -5
- package/libEs5/components/Personalization/dom-actions/dom/removeAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +39 -38
- package/libEs5/components/Personalization/dom-actions/dom/setAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/setStyle.js +4 -3
- package/libEs5/components/Personalization/dom-actions/images.js +10 -9
- package/libEs5/components/Personalization/dom-actions/index.js +1 -1
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +40 -25
- package/libEs5/components/Personalization/dom-actions/insertHtmlAfter.js +9 -8
- package/libEs5/components/Personalization/dom-actions/insertHtmlBefore.js +8 -7
- package/libEs5/components/Personalization/dom-actions/prependHtml.js +13 -10
- package/libEs5/components/Personalization/dom-actions/rearrangeChildren.js +9 -7
- package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +14 -9
- package/libEs5/components/Personalization/dom-actions/remapHeadOffers.js +16 -14
- package/libEs5/components/Personalization/dom-actions/replaceHtml.js +4 -3
- package/libEs5/components/Personalization/dom-actions/scripts.js +58 -38
- package/libEs5/components/Personalization/dom-actions/setAttributes.js +4 -3
- package/libEs5/components/Personalization/dom-actions/setHtml.js +5 -4
- package/libEs5/components/Personalization/dom-actions/setStyles.js +8 -8
- package/libEs5/components/Personalization/dom-actions/setText.js +3 -2
- package/libEs5/components/Personalization/dom-actions/swapImage.js +3 -2
- package/libEs5/components/Personalization/flicker/index.js +66 -49
- package/libEs5/components/Personalization/handlers/createDecorateProposition.js +16 -13
- package/libEs5/components/Personalization/handlers/createProcessDomAction.js +45 -50
- package/libEs5/components/Personalization/handlers/createProcessHtmlContent.js +30 -29
- package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +35 -31
- package/libEs5/components/Personalization/handlers/createProcessPropositions.js +109 -105
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +38 -28
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +59 -67
- package/libEs5/components/Personalization/handlers/processDefaultContent.js +3 -2
- package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +140 -121
- package/libEs5/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +4 -5
- package/libEs5/components/Personalization/in-app-message-actions/utils.js +23 -19
- package/libEs5/components/Personalization/index.js +120 -103
- package/libEs5/components/Personalization/utils/addRenderAttemptedToDecisions.js +10 -10
- package/libEs5/components/Personalization/utils/createAsyncArray.js +10 -9
- package/libEs5/components/Personalization/utils/isAuthoringModeEnabled.js +3 -3
- package/libEs5/components/Personalization/utils/metaUtils.js +14 -19
- package/libEs5/components/Personalization/utils/surfaceUtils.js +27 -46
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +8 -6
- package/libEs5/components/Privacy/computeConsentHash.js +9 -9
- package/libEs5/components/Privacy/createComponent.js +32 -32
- package/libEs5/components/Privacy/createConsentHashStore.js +27 -24
- package/libEs5/components/Privacy/createConsentRequest.js +10 -8
- package/libEs5/components/Privacy/createConsentRequestPayload.js +9 -8
- package/libEs5/components/Privacy/createStoredConsent.js +11 -9
- package/libEs5/components/Privacy/index.js +26 -23
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +30 -29
- package/libEs5/components/Privacy/parseConsentCookie.js +6 -14
- package/libEs5/components/StreamingMedia/createMediaEventManager.js +59 -45
- package/libEs5/components/StreamingMedia/createMediaRequest.js +8 -6
- package/libEs5/components/StreamingMedia/createMediaResponseHandler.js +22 -17
- package/libEs5/components/StreamingMedia/createMediaSessionCacheManager.js +22 -18
- package/libEs5/components/StreamingMedia/createStreamingMediaComponent.js +30 -29
- package/libEs5/components/StreamingMedia/createTrackMediaEvent.js +41 -36
- package/libEs5/components/StreamingMedia/createTrackMediaSession.js +25 -22
- package/libEs5/components/StreamingMedia/index.js +33 -34
- package/libEs5/components/StreamingMedia/validateMediaEventOptions.js +9 -12
- package/libEs5/components/StreamingMedia/validateMediaSessionOptions.js +6 -4
- package/libEs5/constants/browser.js +7 -7
- package/libEs5/constants/consentPurpose.js +1 -1
- package/libEs5/constants/consentStatus.js +3 -3
- package/libEs5/constants/contentType.js +2 -2
- package/libEs5/constants/cookieNameKey.js +3 -3
- package/libEs5/constants/coreCommands.js +2 -2
- package/libEs5/constants/decisionProvider.js +4 -3
- package/libEs5/constants/domain.js +2 -2
- package/libEs5/constants/elementAttribute.js +1 -1
- package/libEs5/constants/eventType.js +5 -5
- package/libEs5/constants/handle.js +1 -1
- package/libEs5/constants/httpHeaderNames.js +2 -2
- package/libEs5/constants/httpStatusCode.js +5 -5
- package/libEs5/constants/identityMapAuthenticatedState.js +3 -3
- package/libEs5/constants/legacyCookies.js +3 -3
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/propositionEventType.js +18 -12
- package/libEs5/constants/propositionInteractionType.js +4 -4
- package/libEs5/constants/schema.js +11 -11
- package/libEs5/constants/sessionDataKeys.js +1 -1
- package/libEs5/constants/tagName.js +7 -7
- package/libEs5/core/buildAndValidateConfig.js +55 -69
- package/libEs5/core/componentCreators.js +70 -41
- package/libEs5/core/config/createConfig.js +4 -3
- package/libEs5/core/config/createCoreConfigs.js +11 -12
- package/libEs5/core/consent/createConsent.js +16 -14
- package/libEs5/core/consent/createConsentStateMachine.js +27 -35
- package/libEs5/core/createComponentRegistry.js +28 -27
- package/libEs5/core/createCookieTransfer.js +18 -18
- package/libEs5/core/createEvent.js +39 -44
- package/libEs5/core/createEventManager.js +64 -69
- package/libEs5/core/createInstanceFunction.js +4 -11
- package/libEs5/core/createLifecycle.js +14 -19
- package/libEs5/core/createLogController.js +30 -29
- package/libEs5/core/createLogger.js +41 -27
- package/libEs5/core/edgeNetwork/handleRequestFailure.js +6 -5
- package/libEs5/core/edgeNetwork/injectApplyResponse.js +29 -32
- package/libEs5/core/edgeNetwork/injectExtractEdgeInfo.js +19 -25
- package/libEs5/core/edgeNetwork/injectGetLocationHint.js +11 -11
- package/libEs5/core/edgeNetwork/injectProcessWarningsAndErrors.js +20 -16
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +42 -38
- package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +8 -12
- package/libEs5/core/index.js +137 -133
- package/libEs5/core/initializeComponents.js +17 -15
- package/libEs5/core/injectCreateResponse.js +47 -53
- package/libEs5/core/injectExecuteCommand.js +39 -40
- package/libEs5/core/injectHandleError.js +19 -19
- package/libEs5/core/injectShouldTransferCookie.js +12 -12
- package/libEs5/core/network/getRequestRetryDelay.js +20 -18
- package/libEs5/core/network/injectSendNetworkRequest.js +46 -49
- package/libEs5/core/network/isRequestRetryable.js +9 -8
- package/libEs5/core/network/requestMethods/injectSendBeaconRequest.js +10 -8
- package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +18 -19
- package/libEs5/core/requiredComponentCreators.js +23 -0
- package/libEs5/core/validateCommandOptions.js +14 -11
- package/libEs5/index.js +43 -22
- package/libEs5/standalone.js +6 -1
- package/libEs5/utils/areThirdPartyCookiesSupportedByDefault.js +3 -5
- package/libEs5/utils/assignConcatArrayValues.js +9 -18
- package/libEs5/utils/clone.js +2 -3
- package/libEs5/utils/cookieJar.js +4 -4
- package/libEs5/utils/crc32.js +8 -8
- package/libEs5/utils/createCallbackAggregator.js +7 -11
- package/libEs5/utils/createCollect.js +52 -0
- package/libEs5/utils/createLoggingCookieJar.js +14 -16
- package/libEs5/utils/createMerger.js +9 -10
- package/libEs5/utils/createSubscription.js +48 -48
- package/libEs5/utils/createTaskQueue.js +8 -7
- package/libEs5/utils/deduplicateArray.js +7 -11
- package/libEs5/utils/deepAssign.js +7 -11
- package/libEs5/utils/defer.js +5 -4
- package/libEs5/utils/dom/appendNode.js +3 -2
- package/libEs5/utils/dom/awaitSelector.js +36 -34
- package/libEs5/utils/dom/createNode.js +10 -15
- package/libEs5/utils/dom/index.js +8 -8
- package/libEs5/utils/dom/isShadowSelector.js +2 -3
- package/libEs5/utils/dom/matchesSelector.js +3 -2
- package/libEs5/utils/dom/querySelectorAll.js +5 -13
- package/libEs5/utils/dom/removeNode.js +4 -3
- package/libEs5/utils/dom/selectNodes.js +3 -3
- package/libEs5/utils/dom/selectNodesWithShadow.js +14 -23
- package/libEs5/utils/event.js +49 -0
- package/libEs5/utils/filterObject.js +14 -12
- package/libEs5/utils/fireImage.js +10 -9
- package/libEs5/utils/flattenArray.js +4 -11
- package/libEs5/utils/flattenObject.js +8 -18
- package/libEs5/utils/getApexDomain.js +7 -6
- package/libEs5/utils/getBrowser.js +45 -12
- package/libEs5/utils/getLastArrayItems.js +2 -3
- package/libEs5/utils/getNamespacedCookieName.js +2 -3
- package/libEs5/utils/groupBy.js +6 -5
- package/libEs5/utils/index.js +50 -113
- package/libEs5/utils/injectDoesIdentityCookieExist.js +7 -7
- package/libEs5/utils/injectFireReferrerHideableImage.js +28 -34
- package/libEs5/utils/injectStorage.js +13 -15
- package/libEs5/utils/intersection.js +2 -6
- package/libEs5/utils/isBlankString.js +2 -3
- package/libEs5/utils/isBoolean.js +2 -3
- package/libEs5/utils/isEmptyObject.js +2 -3
- package/libEs5/utils/isFunction.js +2 -3
- package/libEs5/utils/isInteger.js +4 -3
- package/libEs5/utils/isNamespacedCookieName.js +2 -3
- package/libEs5/utils/isNil.js +2 -3
- package/libEs5/utils/isNonEmptyArray.js +2 -3
- package/libEs5/utils/isNonEmptyString.js +2 -3
- package/libEs5/utils/isNumber.js +2 -4
- package/libEs5/utils/isObject.js +3 -4
- package/libEs5/utils/isString.js +2 -3
- package/libEs5/utils/isUnique.js +6 -5
- package/libEs5/utils/isValidRegExp.js +3 -2
- package/libEs5/utils/memoize.js +7 -6
- package/libEs5/utils/noop.js +2 -1
- package/libEs5/utils/parseUrl.js +19 -25
- package/libEs5/utils/prepareConfigOverridesForEdge.js +6 -5
- package/libEs5/utils/request/createAddIdentity.js +4 -3
- package/libEs5/utils/request/createDataCollectionRequest.js +15 -11
- package/libEs5/utils/request/createDataCollectionRequestPayload.js +9 -10
- package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +17 -15
- package/libEs5/utils/request/createHasIdentity.js +4 -5
- package/libEs5/utils/request/createRequest.js +26 -23
- package/libEs5/utils/request/createRequestParams.js +13 -13
- package/libEs5/utils/request/createRequestPayload.js +13 -12
- package/libEs5/utils/request/index.js +8 -8
- package/libEs5/utils/sanitizeOrgIdForCookieName.js +2 -3
- package/libEs5/utils/stackError.js +8 -6
- package/libEs5/utils/stringToBoolean.js +3 -2
- package/libEs5/utils/toArray.js +3 -2
- package/libEs5/utils/toError.js +3 -2
- package/libEs5/utils/toISOStringLocal.js +29 -14
- package/libEs5/utils/toInteger.js +5 -5
- package/libEs5/utils/updateErrorMessage.js +6 -4
- package/libEs5/utils/validation/booleanValidator.js +3 -2
- package/libEs5/utils/validation/callbackValidator.js +3 -2
- package/libEs5/utils/validation/createAnyOfValidator.js +14 -17
- package/libEs5/utils/validation/createArrayOfValidator.js +16 -18
- package/libEs5/utils/validation/createDefaultValidator.js +7 -8
- package/libEs5/utils/validation/createDeprecatedValidator.js +12 -14
- package/libEs5/utils/validation/createLiteralValidator.js +5 -6
- package/libEs5/utils/validation/createMapOfValuesValidator.js +20 -22
- package/libEs5/utils/validation/createMaximumValidator.js +5 -6
- package/libEs5/utils/validation/createMinimumValidator.js +5 -6
- package/libEs5/utils/validation/createNoUnknownFieldsValidator.js +13 -14
- package/libEs5/utils/validation/createNonEmptyValidator.js +9 -10
- package/libEs5/utils/validation/createObjectOfValidator.js +27 -29
- package/libEs5/utils/validation/createRenamedValidator.js +24 -27
- package/libEs5/utils/validation/createUniqueItemsValidator.js +4 -3
- package/libEs5/utils/validation/createUniqueValidator.js +5 -4
- package/libEs5/utils/validation/domainValidator.js +4 -3
- package/libEs5/utils/validation/index.js +66 -72
- package/libEs5/utils/validation/integerValidator.js +3 -2
- package/libEs5/utils/validation/matchesRegexpValidator.js +5 -6
- package/libEs5/utils/validation/numberValidator.js +3 -2
- package/libEs5/utils/validation/regexpValidator.js +3 -2
- package/libEs5/utils/validation/requiredValidator.js +3 -2
- package/libEs5/utils/validation/stringValidator.js +3 -2
- package/libEs5/utils/validation/utils.js +29 -35
- package/libEs6/components/ActivityCollector/index.js +18 -8
- package/libEs6/components/Context/createComponent.js +1 -3
- package/libEs6/components/DecisioningEngine/createApplyResponse.js +1 -1
- package/libEs6/components/DecisioningEngine/createSubscribeRulesetItems.js +78 -28
- package/libEs6/components/DecisioningEngine/index.js +22 -2
- package/libEs6/components/DecisioningEngine/utils.js +2 -9
- package/libEs6/components/Identity/createComponent.js +4 -2
- package/libEs6/components/Identity/getEcidFromResponse.js +1 -3
- package/libEs6/components/LegacyMediaAnalytics/createGetInstance.js +2 -2
- package/libEs6/components/LibraryInfo/index.js +4 -5
- package/libEs6/components/Personalization/createActionsProvider.js +4 -2
- package/libEs6/components/Personalization/createComponent.js +2 -2
- package/libEs6/components/Personalization/createFetchDataHandler.js +35 -1
- package/libEs6/components/Personalization/createPersonalizationDetails.js +6 -6
- package/libEs6/components/Personalization/createViewCacheManager.js +5 -2
- package/libEs6/components/Personalization/createViewChangeHandler.js +11 -1
- package/libEs6/components/Personalization/dom-actions/createPreprocess.js +5 -2
- package/libEs6/components/Personalization/dom-actions/dom/selectNodesWithEq.js +1 -3
- package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +6 -4
- package/libEs6/components/Personalization/dom-actions/remapHeadOffers.js +3 -2
- package/libEs6/components/Personalization/dom-actions/scripts.js +18 -2
- package/libEs6/components/Personalization/flicker/index.js +44 -30
- package/libEs6/components/Personalization/handlers/createDecorateProposition.js +2 -2
- package/libEs6/components/Personalization/handlers/createProcessPropositions.js +29 -9
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +9 -0
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +0 -3
- package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +8 -5
- package/libEs6/components/Personalization/in-app-message-actions/utils.js +2 -2
- package/libEs6/components/Personalization/index.js +9 -5
- package/libEs6/components/Personalization/utils/addRenderAttemptedToDecisions.js +4 -4
- package/libEs6/components/Personalization/utils/surfaceUtils.js +3 -3
- package/libEs6/constants/decisionProvider.js +1 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/schema.js +1 -1
- package/libEs6/core/buildAndValidateConfig.js +8 -5
- package/libEs6/core/componentCreators.js +14 -43
- package/libEs6/core/config/createConfig.js +3 -2
- package/libEs6/core/createCookieTransfer.js +1 -3
- package/libEs6/core/createInstanceFunction.js +1 -9
- package/libEs6/core/createLogger.js +17 -2
- package/libEs6/core/edgeNetwork/injectExtractEdgeInfo.js +1 -7
- package/libEs6/core/index.js +11 -10
- package/libEs6/core/injectCreateResponse.js +1 -3
- package/libEs6/core/network/isRequestRetryable.js +1 -2
- package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -2
- package/libEs6/{utils/assignIf.js → core/requiredComponentCreators.js} +4 -8
- package/libEs6/index.js +26 -6
- package/libEs6/standalone.js +7 -1
- package/libEs6/utils/areThirdPartyCookiesSupportedByDefault.js +1 -2
- package/libEs6/utils/assignConcatArrayValues.js +1 -2
- package/libEs6/utils/cookieJar.js +4 -4
- package/libEs6/{components/Personalization → utils}/createCollect.js +3 -3
- package/libEs6/utils/createSubscription.js +20 -3
- package/libEs6/utils/dom/querySelectorAll.js +1 -10
- package/libEs6/utils/dom/selectNodesWithShadow.js +2 -12
- package/libEs6/{components/Personalization → utils}/event.js +1 -1
- package/libEs6/utils/index.js +1 -10
- package/libEs6/utils/injectStorage.js +1 -2
- package/libEs6/utils/intersection.js +1 -4
- package/libEs6/utils/isNumber.js +1 -2
- package/libEs6/utils/toISOStringLocal.js +14 -1
- package/libEs6/utils/toInteger.js +1 -2
- package/libEs6/utils/validation/createAnyOfValidator.js +1 -2
- package/libEs6/utils/validation/utils.js +3 -6
- package/package.json +35 -37
- package/rollup.config.js +115 -7
- package/scripts/alloyBuilder.js +89 -55
- package/scripts/helpers/entryPointGeneratorBabelPlugin.js +39 -0
- package/libEs5/components/Personalization/createCollect.js +0 -53
- package/libEs5/components/Personalization/event.js +0 -49
- package/libEs5/core/network/requestMethods/injectSendXhrRequest.js +0 -50
- package/libEs5/utils/assign.js +0 -16
- package/libEs5/utils/assignIf.js +0 -21
- package/libEs5/utils/endsWith.js +0 -23
- package/libEs5/utils/find.js +0 -30
- package/libEs5/utils/flatMap.js +0 -17
- package/libEs5/utils/includes.js +0 -23
- package/libEs5/utils/padStart.js +0 -27
- package/libEs5/utils/startsWith.js +0 -23
- package/libEs5/utils/values.js +0 -25
- package/libEs6/core/network/requestMethods/injectSendXhrRequest.js +0 -49
- package/libEs6/utils/assign.js +0 -14
- package/libEs6/utils/endsWith.js +0 -19
- package/libEs6/utils/find.js +0 -28
- package/libEs6/utils/flatMap.js +0 -14
- package/libEs6/utils/includes.js +0 -21
- package/libEs6/utils/padStart.js +0 -25
- package/libEs6/utils/startsWith.js +0 -19
- package/libEs6/utils/values.js +0 -21
- package/scripts/helpers/alloyComponents.js +0 -63
- package/scripts/helpers/conditionalBuildBabelPlugin.js +0 -57
|
@@ -13,9 +13,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
13
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var _default =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
16
|
+
var _default = (typeName, minimum) => (value, path) => {
|
|
17
|
+
(0, _utils.assertValid)(value >= minimum, value, path, typeName + " greater than or equal to " + minimum);
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
|
@@ -12,18 +12,17 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
var _default =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
errors.push("'" + subPath + "': Unknown field.");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
if (errors.length) {
|
|
25
|
-
throw new Error(errors.join("\n"));
|
|
15
|
+
var _default = schema => (value, path) => {
|
|
16
|
+
const errors = [];
|
|
17
|
+
Object.keys(value).forEach(subKey => {
|
|
18
|
+
if (!schema[subKey]) {
|
|
19
|
+
const subPath = path ? path + "." + subKey : subKey;
|
|
20
|
+
errors.push("'" + subPath + "': Unknown field.");
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
});
|
|
23
|
+
if (errors.length) {
|
|
24
|
+
throw new Error(errors.join("\n"));
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
exports.default = _default;
|
|
@@ -15,13 +15,12 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
18
|
+
var _default = message => (value, path) => {
|
|
19
|
+
if ((0, _isObject.default)(value)) {
|
|
20
|
+
(0, _utils.assertValid)(!(0, _isEmptyObject.default)(value), value, path, message);
|
|
21
|
+
} else {
|
|
22
|
+
(0, _utils.assertValid)(value.length > 0, value, path, message);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
exports.default = _default;
|
|
@@ -14,35 +14,33 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (validatedValue !== undefined) {
|
|
30
|
-
validatedObject[subKey] = validatedValue;
|
|
31
|
-
}
|
|
32
|
-
} catch (e) {
|
|
33
|
-
errors.push(e.message);
|
|
17
|
+
var _default = schema => function objectOf(value, path) {
|
|
18
|
+
(0, _utils.assertValid)((0, _isObject.default)(value), value, path, "an object");
|
|
19
|
+
const errors = [];
|
|
20
|
+
const validatedObject = {};
|
|
21
|
+
Object.keys(schema).forEach(subKey => {
|
|
22
|
+
const subValue = value[subKey];
|
|
23
|
+
const subSchema = schema[subKey];
|
|
24
|
+
const subPath = path ? path + "." + subKey : subKey;
|
|
25
|
+
try {
|
|
26
|
+
const validatedValue = subSchema.call(this, subValue, subPath);
|
|
27
|
+
if (validatedValue !== undefined) {
|
|
28
|
+
validatedObject[subKey] = validatedValue;
|
|
34
29
|
}
|
|
35
|
-
})
|
|
30
|
+
} catch (e) {
|
|
31
|
+
errors.push(e.message);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
if (errors.length) {
|
|
44
|
-
throw new Error(errors.join("\n"));
|
|
35
|
+
// copy over unknown properties
|
|
36
|
+
Object.keys(value).forEach(subKey => {
|
|
37
|
+
if (!Object.prototype.hasOwnProperty.call(validatedObject, subKey)) {
|
|
38
|
+
validatedObject[subKey] = value[subKey];
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
});
|
|
41
|
+
if (errors.length) {
|
|
42
|
+
throw new Error(errors.join("\n"));
|
|
43
|
+
}
|
|
44
|
+
return validatedObject;
|
|
45
|
+
};
|
|
46
|
+
exports.default = _default;
|
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _isObject = require("../isObject.js");
|
|
5
5
|
var _utils = require("./utils.js");
|
|
6
|
-
|
|
7
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
11
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
6
|
+
/*
|
|
14
7
|
Copyright 2023 Adobe. All rights reserved.
|
|
15
8
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
9
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
@@ -21,24 +14,28 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
21
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
15
|
governing permissions and limitations under the License.
|
|
23
16
|
*/
|
|
24
|
-
var _default =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (newValue !== undefined && newValue !== validatedOldValue) {
|
|
37
|
-
throw new Error(message);
|
|
38
|
-
} else if (this && this.logger) {
|
|
39
|
-
this.logger.warn(message);
|
|
40
|
-
}
|
|
17
|
+
var _default = (oldField, oldSchema, newField) => function deprecated(value, path) {
|
|
18
|
+
(0, _utils.assertValid)((0, _isObject.default)(value), value, path, "an object");
|
|
19
|
+
const {
|
|
20
|
+
[oldField]: oldValue,
|
|
21
|
+
[newField]: newValue,
|
|
22
|
+
...otherValues
|
|
23
|
+
} = value;
|
|
24
|
+
const validatedOldValue = oldSchema(oldValue, path);
|
|
25
|
+
if (validatedOldValue !== undefined) {
|
|
26
|
+
let message = "The field '" + oldField + "' is deprecated. Use '" + newField + "' instead.";
|
|
27
|
+
if (path) {
|
|
28
|
+
message = "'" + path + "': " + message;
|
|
41
29
|
}
|
|
42
|
-
|
|
30
|
+
if (newValue !== undefined && newValue !== validatedOldValue) {
|
|
31
|
+
throw new Error(message);
|
|
32
|
+
} else if (this && this.logger) {
|
|
33
|
+
this.logger.warn(message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
[newField]: newValue || validatedOldValue,
|
|
38
|
+
...otherValues
|
|
43
39
|
};
|
|
44
|
-
};
|
|
40
|
+
};
|
|
41
|
+
exports.default = _default;
|
|
@@ -14,8 +14,9 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
18
|
-
return
|
|
17
|
+
var _default = () => {
|
|
18
|
+
return (value, path) => {
|
|
19
19
|
(0, _utils.assertValid)((0, _isUnique.default)(value), value, path, "array values to be unique");
|
|
20
20
|
};
|
|
21
|
-
};
|
|
21
|
+
};
|
|
22
|
+
exports.default = _default;
|
|
@@ -13,11 +13,12 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
13
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var _default =
|
|
17
|
-
|
|
18
|
-
return
|
|
16
|
+
var _default = () => {
|
|
17
|
+
const values = [];
|
|
18
|
+
return (value, path) => {
|
|
19
19
|
(0, _utils.assertValid)(values.indexOf(value) === -1, value, path, "a unique value across instances");
|
|
20
20
|
values.push(value);
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
|
-
};
|
|
23
|
+
};
|
|
24
|
+
exports.default = _default;
|
|
@@ -14,8 +14,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
var _default =
|
|
17
|
+
const DOMAIN_REGEX = /^[a-z0-9.-]{1,}$/i;
|
|
18
|
+
var _default = (value, path) => {
|
|
19
19
|
(0, _utils.assertValid)(DOMAIN_REGEX.test(value), value, path, "a valid domain");
|
|
20
20
|
return value;
|
|
21
|
-
};
|
|
21
|
+
};
|
|
22
|
+
exports.default = _default;
|
|
@@ -25,12 +25,7 @@ var _regexpValidator = require("./regexpValidator.js");
|
|
|
25
25
|
var _requiredValidator = require("./requiredValidator.js");
|
|
26
26
|
var _stringValidator = require("./stringValidator.js");
|
|
27
27
|
var _matchesRegexpValidator = require("./matchesRegexpValidator.js");
|
|
28
|
-
|
|
29
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
32
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
33
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
28
|
+
/*
|
|
34
29
|
Copyright 2020 Adobe. All rights reserved.
|
|
35
30
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
36
31
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
@@ -40,7 +35,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
40
35
|
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
41
36
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
42
37
|
governing permissions and limitations under the License.
|
|
43
|
-
*/
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
44
41
|
* Validators are functions of two parameters (value and path) that return the
|
|
45
42
|
* computed value if the input is valid, or throw an exception if the input is
|
|
46
43
|
* invalid. In most cases the returned value is the same as the input value;
|
|
@@ -97,10 +94,9 @@ governing permissions and limitations under the License.
|
|
|
97
94
|
* So to keep from having to have a null check in front of most validators,
|
|
98
95
|
* nullSafeChain allows you to chain a validator in a null-safe way.
|
|
99
96
|
*/
|
|
97
|
+
|
|
100
98
|
// The base validator does no validation and just returns the value unchanged
|
|
101
|
-
|
|
102
|
-
return value;
|
|
103
|
-
};
|
|
99
|
+
const base = value => value;
|
|
104
100
|
|
|
105
101
|
// The 'default', 'required', and 'deprecated' methods are available after any
|
|
106
102
|
// data-type method. Don't use the nullSafeChain on 'default' or 'required'
|
|
@@ -116,128 +112,126 @@ base.deprecated = function deprecated(message) {
|
|
|
116
112
|
};
|
|
117
113
|
|
|
118
114
|
// helper validators
|
|
119
|
-
|
|
115
|
+
const domain = function domain() {
|
|
120
116
|
return (0, _utils.nullSafeChain)(this, _domainValidator.default);
|
|
121
117
|
};
|
|
122
|
-
|
|
118
|
+
const minimumInteger = function minimumInteger(minValue) {
|
|
123
119
|
return (0, _utils.nullSafeChain)(this, (0, _createMinimumValidator.default)("an integer", minValue));
|
|
124
120
|
};
|
|
125
|
-
|
|
121
|
+
const minimumNumber = function minimumNumber(minValue) {
|
|
126
122
|
return (0, _utils.nullSafeChain)(this, (0, _createMinimumValidator.default)("a number", minValue));
|
|
127
123
|
};
|
|
128
|
-
|
|
124
|
+
const maximumNumber = function maximumNumber(maxValue) {
|
|
129
125
|
return (0, _utils.nullSafeChain)(this, (0, _createMaximumValidator.default)("a number", maxValue));
|
|
130
126
|
};
|
|
131
|
-
|
|
127
|
+
const integer = function integer() {
|
|
132
128
|
return (0, _utils.nullSafeChain)(this, _integerValidator.default, {
|
|
133
129
|
minimum: minimumInteger
|
|
134
130
|
});
|
|
135
131
|
};
|
|
136
|
-
|
|
132
|
+
const nonEmptyString = function nonEmptyString() {
|
|
137
133
|
return (0, _utils.nullSafeChain)(this, (0, _createNonEmptyValidator.default)("a non-empty string"));
|
|
138
134
|
};
|
|
139
|
-
|
|
135
|
+
const nonEmptyArray = function nonEmptyArray() {
|
|
140
136
|
return (0, _utils.nullSafeChain)(this, (0, _createNonEmptyValidator.default)("a non-empty array"));
|
|
141
137
|
};
|
|
142
|
-
|
|
138
|
+
const nonEmptyObject = function nonEmptyObject() {
|
|
143
139
|
return (0, _utils.nullSafeChain)(this, (0, _createNonEmptyValidator.default)("a non-empty object"));
|
|
144
140
|
};
|
|
145
|
-
|
|
141
|
+
const regexp = function regexp() {
|
|
146
142
|
return (0, _utils.nullSafeChain)(this, _regexpValidator.default);
|
|
147
143
|
};
|
|
148
|
-
|
|
144
|
+
const matches = function matches(regexpPattern) {
|
|
149
145
|
return (0, _utils.nullSafeChain)(this, (0, _matchesRegexpValidator.default)(regexpPattern));
|
|
150
146
|
};
|
|
151
|
-
|
|
147
|
+
const unique = function createUnique() {
|
|
152
148
|
return (0, _utils.nullSafeChain)(this, (0, _createUniqueValidator.default)());
|
|
153
149
|
};
|
|
154
|
-
|
|
150
|
+
const uniqueItems = function createUniqueItems() {
|
|
155
151
|
return (0, _utils.nullSafeChain)(this, (0, _createUniqueItemsValidator.default)());
|
|
156
152
|
};
|
|
157
153
|
|
|
158
154
|
// top-level validators. These are the first functions that are called to create a validator.
|
|
159
|
-
|
|
155
|
+
const anyOf = function anyOf(validators, message) {
|
|
160
156
|
// use chain here because we don't want to accept null or undefined unless at least
|
|
161
157
|
// one of the validators accept null or undefined.
|
|
162
158
|
return (0, _utils.chain)(this, (0, _createAnyOfValidator.default)(validators, message));
|
|
163
159
|
};
|
|
164
|
-
|
|
160
|
+
const anything = function anything() {
|
|
165
161
|
return this;
|
|
166
162
|
};
|
|
167
|
-
|
|
163
|
+
const arrayOf = function arrayOf(elementValidator) {
|
|
168
164
|
return (0, _utils.nullSafeChain)(this, (0, _createArrayOfValidator.default)(elementValidator), {
|
|
169
165
|
nonEmpty: nonEmptyArray,
|
|
170
|
-
uniqueItems
|
|
166
|
+
uniqueItems
|
|
171
167
|
});
|
|
172
168
|
};
|
|
173
|
-
|
|
169
|
+
const boolean = function boolean() {
|
|
174
170
|
return (0, _utils.nullSafeChain)(this, _booleanValidator.default);
|
|
175
171
|
};
|
|
176
|
-
|
|
172
|
+
const callback = function callback() {
|
|
177
173
|
return (0, _utils.nullSafeChain)(this, _callbackValidator.default);
|
|
178
174
|
};
|
|
179
|
-
|
|
175
|
+
const literal = function literal(literalValue) {
|
|
180
176
|
return (0, _utils.nullSafeChain)(this, (0, _createLiteralValidator.default)(literalValue));
|
|
181
177
|
};
|
|
182
|
-
|
|
178
|
+
const number = function number() {
|
|
183
179
|
return (0, _utils.nullSafeChain)(this, _numberValidator.default, {
|
|
184
180
|
minimum: minimumNumber,
|
|
185
181
|
maximum: maximumNumber,
|
|
186
|
-
integer
|
|
187
|
-
unique
|
|
182
|
+
integer,
|
|
183
|
+
unique
|
|
188
184
|
});
|
|
189
185
|
};
|
|
190
|
-
|
|
186
|
+
const mapOfValues = function mapOfValues(valuesValidator) {
|
|
191
187
|
return (0, _utils.nullSafeChain)(this, (0, _createMapOfValuesValidator.default)(valuesValidator), {
|
|
192
188
|
nonEmpty: nonEmptyObject
|
|
193
189
|
});
|
|
194
190
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
191
|
+
const createObjectOfAdditionalProperties = schema => ({
|
|
192
|
+
noUnknownFields: function noUnknownFields() {
|
|
193
|
+
return (0, _utils.nullSafeChain)(this, (0, _createNoUnknownFieldsValidator.default)(schema));
|
|
194
|
+
},
|
|
195
|
+
nonEmpty: nonEmptyObject,
|
|
196
|
+
concat: function concat(otherObjectOfValidator) {
|
|
197
|
+
// combine the schema so that noUnknownFields, and concat have the combined schema
|
|
198
|
+
const newSchema = {
|
|
199
|
+
...schema,
|
|
200
|
+
...otherObjectOfValidator.schema
|
|
201
|
+
};
|
|
202
|
+
return (0, _utils.nullSafeChain)(this, otherObjectOfValidator, createObjectOfAdditionalProperties(newSchema));
|
|
203
|
+
},
|
|
204
|
+
renamed: function renamed(oldField, oldSchema, newField) {
|
|
205
|
+
// Run the deprecated validator first so that the deprecated field is removed
|
|
206
|
+
// before the objectOf validator runs.
|
|
207
|
+
return (0, _utils.reverseNullSafeChainJoinErrors)(this, (0, _createRenamedValidator.default)(oldField, oldSchema, newField));
|
|
208
|
+
},
|
|
209
|
+
schema
|
|
210
|
+
});
|
|
211
|
+
const objectOf = function objectOf(schema) {
|
|
215
212
|
return (0, _utils.nullSafeChain)(this, (0, _createObjectOfValidator.default)(schema), createObjectOfAdditionalProperties(schema));
|
|
216
213
|
};
|
|
217
|
-
|
|
214
|
+
const string = function string() {
|
|
218
215
|
return (0, _utils.nullSafeChain)(this, _stringValidator.default, {
|
|
219
|
-
regexp
|
|
220
|
-
domain
|
|
216
|
+
regexp,
|
|
217
|
+
domain,
|
|
221
218
|
nonEmpty: nonEmptyString,
|
|
222
|
-
unique
|
|
223
|
-
matches
|
|
219
|
+
unique,
|
|
220
|
+
matches
|
|
224
221
|
});
|
|
225
222
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
223
|
+
const boundAnyOf = exports.anyOf = anyOf.bind(base);
|
|
224
|
+
const boundAnything = exports.anything = anything.bind(base);
|
|
225
|
+
const boundArrayOf = exports.arrayOf = arrayOf.bind(base);
|
|
226
|
+
const boundBoolean = exports.boolean = boolean.bind(base);
|
|
227
|
+
const boundCallback = exports.callback = callback.bind(base);
|
|
228
|
+
const boundLiteral = exports.literal = literal.bind(base);
|
|
229
|
+
const boundNumber = exports.number = number.bind(base);
|
|
230
|
+
const boundMapOfValues = exports.mapOfValues = mapOfValues.bind(base);
|
|
231
|
+
const boundObjectOf = exports.objectOf = objectOf.bind(base);
|
|
232
|
+
const boundString = exports.string = string.bind(base);
|
|
236
233
|
|
|
237
234
|
// compound validators
|
|
238
|
-
|
|
239
|
-
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
240
|
-
values[_key] = arguments[_key];
|
|
241
|
-
}
|
|
235
|
+
const boundEnumOf = exports.enumOf = function boundEnumOf(...values) {
|
|
242
236
|
return boundAnyOf(values.map(boundLiteral), "one of these values: [" + JSON.stringify(values) + "]");
|
|
243
237
|
};
|
|
@@ -14,7 +14,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
17
|
+
var _default = (value, path) => {
|
|
18
18
|
(0, _utils.assertValid)((0, _isInteger.default)(value), value, path, "an integer");
|
|
19
19
|
return value;
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|
|
@@ -13,9 +13,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
13
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var _default =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
16
|
+
var _default = regexp => (value, path) => {
|
|
17
|
+
(0, _utils.assertValid)(regexp.test(value), value, path, "does not match the " + regexp.toString());
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
|
@@ -14,7 +14,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
17
|
+
var _default = (value, path) => {
|
|
18
18
|
(0, _utils.assertValid)((0, _isNumber.default)(value), value, path, "a number");
|
|
19
19
|
return value;
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|
|
@@ -14,7 +14,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
17
|
+
var _default = (value, path) => {
|
|
18
18
|
(0, _utils.assertValid)((0, _isValidRegExp.default)(value), value, path, "a regular expression");
|
|
19
19
|
return value;
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|
|
@@ -12,9 +12,10 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
var _default =
|
|
15
|
+
var _default = (value, path) => {
|
|
16
16
|
if (value == null) {
|
|
17
17
|
throw new Error("'" + path + "' is a required option");
|
|
18
18
|
}
|
|
19
19
|
return value;
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|
|
@@ -14,7 +14,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var _default =
|
|
17
|
+
var _default = (value, path) => {
|
|
18
18
|
(0, _utils.assertValid)((0, _isString.default)(value), value, path, "a string");
|
|
19
19
|
return value;
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|