@prismicio/manager 0.0.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/dist/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.js +168 -0
- package/dist/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/config.js +91 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/config.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/constants.js +17 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/constants.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/core-client.js +187 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/core-client.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/identify.js +90 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/identify.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/logger.js +64 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/logger.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/messages.js +17 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/messages.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js +323 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/revenue.js +55 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/revenue.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/timeline.js +245 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/timeline.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/transports/base.js +103 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/transports/base.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js +15 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js +119 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js +34 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js +14 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js +9 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js +25 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js +56 -0
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.js +134 -0
- package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/config.js +21 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/config.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/index.js +24 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/index.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/node-client.js +81 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/node-client.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js +37 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js +67 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/version.js +5 -0
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/version.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/event.js +33 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/event.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/index.js +17 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/index.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/logger.js +12 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/logger.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/plugin.js +10 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/plugin.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/server-zone.js +10 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/server-zone.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/status.js +16 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/status.js.map +1 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/transport.js +10 -0
- package/dist/_node_modules/@amplitude/analytics-types/lib/esm/transport.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.js +1234 -0
- package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/gen/version.js +14 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/gen/version.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-filter.js +34 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-filter.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.js +98 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.js +32 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.js +90 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/factory.js +46 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/factory.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/index.js +66 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/index.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.js +93 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +278 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/cohort-api.js +89 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/cohort-api.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/fetcher.js +114 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/fetcher.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/poller.js +115 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/poller.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/storage.js +46 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/storage.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js +86 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js +122 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/stream-flag-api.js +195 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/stream-flag-api.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/streamer.js +149 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/streamer.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/updater.js +107 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/updater.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js +168 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js +114 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/stream.js +164 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/stream.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/cohort.js +14 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/cohort.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/config.js +75 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/config.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/loglevel.js +23 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/loglevel.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js +73 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cache.js +99 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cache.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cohort.js +85 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cohort.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/config.js +47 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/config.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/hash.js +25 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/hash.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/logger.js +68 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/logger.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/threading.js +97 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/threading.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/time.js +20 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/time.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/user.js +57 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/user.js.map +1 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/variant.js +47 -0
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/variant.js.map +1 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js +133 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js.map +1 -0
- package/dist/_node_modules/common-tags/es/commaLists/commaLists.js +6 -0
- package/dist/_node_modules/common-tags/es/commaLists/commaLists.js.map +1 -0
- package/dist/_node_modules/common-tags/es/commaListsAnd/commaListsAnd.js +6 -0
- package/dist/_node_modules/common-tags/es/commaListsAnd/commaListsAnd.js.map +1 -0
- package/dist/_node_modules/common-tags/es/commaListsOr/commaListsOr.js +6 -0
- package/dist/_node_modules/common-tags/es/commaListsOr/commaListsOr.js.map +1 -0
- package/dist/_node_modules/common-tags/es/html/html.js +8 -0
- package/dist/_node_modules/common-tags/es/html/html.js.map +1 -0
- package/dist/_node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js +33 -0
- package/dist/_node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/inlineLists/inlineLists.js +6 -0
- package/dist/_node_modules/common-tags/es/inlineLists/inlineLists.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLine/oneLine.js +5 -0
- package/dist/_node_modules/common-tags/es/oneLine/oneLine.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js +6 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js +6 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js +6 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js +6 -0
- package/dist/_node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js.map +1 -0
- package/dist/_node_modules/common-tags/es/oneLineTrim/oneLineTrim.js +5 -0
- package/dist/_node_modules/common-tags/es/oneLineTrim/oneLineTrim.js.map +1 -0
- package/dist/_node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js +20 -0
- package/dist/_node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js +14 -0
- package/dist/_node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.js +18 -0
- package/dist/_node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/safeHtml/safeHtml.js +8 -0
- package/dist/_node_modules/common-tags/es/safeHtml/safeHtml.js.map +1 -0
- package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js +16 -0
- package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js +8 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.js +36 -0
- package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndents/stripIndents.js +5 -0
- package/dist/_node_modules/common-tags/es/stripIndents/stripIndents.js.map +1 -0
- package/dist/_node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.js +22 -0
- package/dist/_node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.js.map +1 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js +41 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
- package/dist/_node_modules/eventsource/lib/eventsource.js +384 -0
- package/dist/_node_modules/eventsource/lib/eventsource.js.map +1 -0
- package/dist/_node_modules/fetch-blob/file.js +41 -0
- package/dist/_node_modules/fetch-blob/file.js.map +1 -0
- package/dist/_node_modules/fetch-blob/from.js +9 -0
- package/dist/_node_modules/fetch-blob/from.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.js +201 -0
- package/dist/_node_modules/fetch-blob/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.js +52 -0
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js +90 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/_node_modules/get-port/index.js +115 -0
- package/dist/_node_modules/get-port/index.js.map +1 -0
- package/dist/_node_modules/node-domexception/index.js +20 -0
- package/dist/_node_modules/node-domexception/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.js +259 -0
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js +10 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js +17 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js +19 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.js +189 -0
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.js +290 -0
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.js +203 -0
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.js +123 -0
- package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js +12 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js +8 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js +28 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +356 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js +149 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3818 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +35 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/assignment-filter.js +5 -0
- package/dist/_virtual/assignment-filter.js.map +1 -0
- package/dist/_virtual/assignment-service.js +5 -0
- package/dist/_virtual/assignment-service.js.map +1 -0
- package/dist/_virtual/assignment.js +5 -0
- package/dist/_virtual/assignment.js.map +1 -0
- package/dist/_virtual/backoff.js +5 -0
- package/dist/_virtual/backoff.js.map +1 -0
- package/dist/_virtual/cache.js +5 -0
- package/dist/_virtual/cache.js.map +1 -0
- package/dist/_virtual/cache2.js +5 -0
- package/dist/_virtual/cache2.js.map +1 -0
- package/dist/_virtual/client.js +5 -0
- package/dist/_virtual/client.js.map +1 -0
- package/dist/_virtual/client2.js +5 -0
- package/dist/_virtual/client2.js.map +1 -0
- package/dist/_virtual/cohort-api.js +5 -0
- package/dist/_virtual/cohort-api.js.map +1 -0
- package/dist/_virtual/cohort.js +5 -0
- package/dist/_virtual/cohort.js.map +1 -0
- package/dist/_virtual/cohort2.js +5 -0
- package/dist/_virtual/cohort2.js.map +1 -0
- package/dist/_virtual/config.js +5 -0
- package/dist/_virtual/config.js.map +1 -0
- package/dist/_virtual/config2.js +5 -0
- package/dist/_virtual/config2.js.map +1 -0
- package/dist/_virtual/cookie.js +5 -0
- package/dist/_virtual/cookie.js.map +1 -0
- package/dist/_virtual/experiment-core.esm.js +7 -0
- package/dist/_virtual/experiment-core.esm.js.map +1 -0
- package/dist/_virtual/factory.js +5 -0
- package/dist/_virtual/factory.js.map +1 -0
- package/dist/_virtual/fetcher.js +5 -0
- package/dist/_virtual/fetcher.js.map +1 -0
- package/dist/_virtual/fetcher2.js +5 -0
- package/dist/_virtual/fetcher2.js.map +1 -0
- package/dist/_virtual/hash.js +5 -0
- package/dist/_virtual/hash.js.map +1 -0
- package/dist/_virtual/http.js +5 -0
- package/dist/_virtual/http.js.map +1 -0
- package/dist/_virtual/index.js +6 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +3 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +7 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/logger.js +5 -0
- package/dist/_virtual/logger.js.map +1 -0
- package/dist/_virtual/loglevel.js +5 -0
- package/dist/_virtual/loglevel.js.map +1 -0
- package/dist/_virtual/poller.js +5 -0
- package/dist/_virtual/poller.js.map +1 -0
- package/dist/_virtual/poller2.js +5 -0
- package/dist/_virtual/poller2.js.map +1 -0
- package/dist/_virtual/ponyfill.es2018.js +5 -0
- package/dist/_virtual/ponyfill.es2018.js.map +1 -0
- package/dist/_virtual/storage.js +5 -0
- package/dist/_virtual/storage.js.map +1 -0
- package/dist/_virtual/stream-flag-api.js +5 -0
- package/dist/_virtual/stream-flag-api.js.map +1 -0
- package/dist/_virtual/stream.js +5 -0
- package/dist/_virtual/stream.js.map +1 -0
- package/dist/_virtual/streamer.js +5 -0
- package/dist/_virtual/streamer.js.map +1 -0
- package/dist/_virtual/streams.js +3 -0
- package/dist/_virtual/streams.js.map +1 -0
- package/dist/_virtual/streams2.js +5 -0
- package/dist/_virtual/streams2.js.map +1 -0
- package/dist/_virtual/threading.js +5 -0
- package/dist/_virtual/threading.js.map +1 -0
- package/dist/_virtual/time.js +5 -0
- package/dist/_virtual/time.js.map +1 -0
- package/dist/_virtual/updater.js +5 -0
- package/dist/_virtual/updater.js.map +1 -0
- package/dist/_virtual/user.js +5 -0
- package/dist/_virtual/user.js.map +1 -0
- package/dist/_virtual/variant.js +5 -0
- package/dist/_virtual/variant.js.map +1 -0
- package/dist/_virtual/version.js +5 -0
- package/dist/_virtual/version.js.map +1 -0
- package/dist/auth/PrismicAuthManager.d.ts +47 -0
- package/dist/auth/PrismicAuthManager.js +214 -0
- package/dist/auth/PrismicAuthManager.js.map +1 -0
- package/dist/auth/createPrismicAuthManager.d.ts +4 -0
- package/dist/auth/createPrismicAuthManager.js +8 -0
- package/dist/auth/createPrismicAuthManager.js.map +1 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.d.ts +13 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.js +39 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.js.map +1 -0
- package/dist/constants/API_ENDPOINTS.d.ts +9 -0
- package/dist/constants/API_ENDPOINTS.js +73 -0
- package/dist/constants/API_ENDPOINTS.js.map +1 -0
- package/dist/constants/API_TOKENS.d.ts +6 -0
- package/dist/constants/API_TOKENS.js +27 -0
- package/dist/constants/API_TOKENS.js.map +1 -0
- package/dist/constants/APPLICATION_MODE.d.ts +8 -0
- package/dist/constants/APPLICATION_MODE.js +12 -0
- package/dist/constants/APPLICATION_MODE.js.map +1 -0
- package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.d.ts +1 -0
- package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.js +5 -0
- package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.js.map +1 -0
- package/dist/constants/PRISMIC_CLI_USER_AGENT.d.ts +1 -0
- package/dist/constants/PRISMIC_CLI_USER_AGENT.js +5 -0
- package/dist/constants/PRISMIC_CLI_USER_AGENT.js.map +1 -0
- package/dist/constants/PRISMIC_CONFIG_FILENAME.d.ts +1 -0
- package/dist/constants/PRISMIC_CONFIG_FILENAME.js +5 -0
- package/dist/constants/PRISMIC_CONFIG_FILENAME.js.map +1 -0
- package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.d.ts +1 -0
- package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.js +5 -0
- package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.js.map +1 -0
- package/dist/constants/TS_CONFIG_FILENAME.d.ts +1 -0
- package/dist/constants/TS_CONFIG_FILENAME.js +5 -0
- package/dist/constants/TS_CONFIG_FILENAME.js.map +1 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.js +20 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/DecodeError.d.ts +13 -0
- package/dist/lib/DecodeError.js +21 -0
- package/dist/lib/DecodeError.js.map +1 -0
- package/dist/lib/assertPluginsInitialized.d.ts +2 -0
- package/dist/lib/assertPluginsInitialized.js +9 -0
- package/dist/lib/assertPluginsInitialized.js.map +1 -0
- package/dist/lib/castArray.d.ts +1 -0
- package/dist/lib/castArray.js +7 -0
- package/dist/lib/castArray.js.map +1 -0
- package/dist/lib/decode.d.ts +10 -0
- package/dist/lib/decode.js +14 -0
- package/dist/lib/decode.js.map +1 -0
- package/dist/lib/decodeHookResult.d.ts +7 -0
- package/dist/lib/decodeHookResult.js +21 -0
- package/dist/lib/decodeHookResult.js.map +1 -0
- package/dist/lib/decodePackageJSON.d.ts +12 -0
- package/dist/lib/decodePrismicConfig.d.ts +3 -0
- package/dist/lib/decodePrismicConfig.js +22 -0
- package/dist/lib/decodePrismicConfig.js.map +1 -0
- package/dist/lib/fetchNPMPackageVersions.d.ts +5 -0
- package/dist/lib/fetchNPMPackageVersions.js +24 -0
- package/dist/lib/fetchNPMPackageVersions.js.map +1 -0
- package/dist/lib/format.d.ts +12 -0
- package/dist/lib/format.js +30 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/installDependencies.d.ts +13 -0
- package/dist/lib/installDependencies.js +45 -0
- package/dist/lib/installDependencies.js.map +1 -0
- package/dist/lib/locateFileUpward.d.ts +10 -0
- package/dist/lib/locateFileUpward.js +29 -0
- package/dist/lib/locateFileUpward.js.map +1 -0
- package/dist/lib/prismicrc.d.ts +8 -0
- package/dist/lib/prismicrc.js +29 -0
- package/dist/lib/prismicrc.js.map +1 -0
- package/dist/lib/trailingSlash.d.ts +1 -0
- package/dist/lib/trailingSlash.js +7 -0
- package/dist/lib/trailingSlash.js.map +1 -0
- package/dist/lib/typesInternalSchemas.d.ts +12 -0
- package/dist/lib/typesInternalSchemas.js +29 -0
- package/dist/lib/typesInternalSchemas.js.map +1 -0
- package/dist/managers/BaseManager.d.ts +27 -0
- package/dist/managers/BaseManager.js +48 -0
- package/dist/managers/BaseManager.js.map +1 -0
- package/dist/managers/PrismicManager.d.ts +33 -0
- package/dist/managers/PrismicManager.js +60 -0
- package/dist/managers/PrismicManager.js.map +1 -0
- package/dist/managers/createPrismicManager.d.ts +4 -0
- package/dist/managers/createPrismicManager.js +8 -0
- package/dist/managers/createPrismicManager.js.map +1 -0
- package/dist/managers/customTypes/CustomTypesManager.d.ts +44 -0
- package/dist/managers/customTypes/CustomTypesManager.js +111 -0
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -0
- package/dist/managers/customTypes/types.d.ts +2 -0
- package/dist/managers/plugins/PluginsManager.d.ts +13 -0
- package/dist/managers/plugins/PluginsManager.js +30 -0
- package/dist/managers/plugins/PluginsManager.js.map +1 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +12 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +79 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -0
- package/dist/managers/prismicRepository/types.d.ts +17 -0
- package/dist/managers/prismicRepository/types.js +24 -0
- package/dist/managers/prismicRepository/types.js.map +1 -0
- package/dist/managers/project/ProjectManager.d.ts +51 -0
- package/dist/managers/project/ProjectManager.js +208 -0
- package/dist/managers/project/ProjectManager.js.map +1 -0
- package/dist/managers/slices/SlicesManager.d.ts +61 -0
- package/dist/managers/slices/SlicesManager.js +169 -0
- package/dist/managers/slices/SlicesManager.js.map +1 -0
- package/dist/managers/telemetry/TelemetryManager.d.ts +23 -0
- package/dist/managers/telemetry/TelemetryManager.js +133 -0
- package/dist/managers/telemetry/TelemetryManager.js.map +1 -0
- package/dist/managers/telemetry/types.d.ts +35 -0
- package/dist/managers/telemetry/types.js +15 -0
- package/dist/managers/telemetry/types.js.map +1 -0
- package/dist/managers/user/UserManager.d.ts +22 -0
- package/dist/managers/user/UserManager.js +22 -0
- package/dist/managers/user/UserManager.js.map +1 -0
- package/dist/managers/versions/VersionsManager.d.ts +21 -0
- package/dist/managers/versions/VersionsManager.js +39 -0
- package/dist/managers/versions/VersionsManager.js.map +1 -0
- package/dist/types.d.ts +32 -0
- package/package.json +100 -0
- package/src/auth/PrismicAuthManager.ts +346 -0
- package/src/auth/createPrismicAuthManager.ts +11 -0
- package/src/auth/createPrismicAuthManagerMiddleware.ts +79 -0
- package/src/constants/API_ENDPOINTS.ts +106 -0
- package/src/constants/API_TOKENS.ts +29 -0
- package/src/constants/APPLICATION_MODE.ts +8 -0
- package/src/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.ts +1 -0
- package/src/constants/PRISMIC_CLI_USER_AGENT.ts +1 -0
- package/src/constants/PRISMIC_CONFIG_FILENAME.ts +1 -0
- package/src/constants/SLICEMACHINE_CONFIG_FILENAME.ts +1 -0
- package/src/constants/TS_CONFIG_FILENAME.ts +1 -0
- package/src/errors.ts +109 -0
- package/src/index.ts +5 -0
- package/src/lib/DecodeError.ts +31 -0
- package/src/lib/assertPluginsInitialized.ts +11 -0
- package/src/lib/castArray.ts +3 -0
- package/src/lib/decode.ts +28 -0
- package/src/lib/decodeHookResult.ts +36 -0
- package/src/lib/decodePackageJSON.ts +18 -0
- package/src/lib/decodePrismicConfig.ts +26 -0
- package/src/lib/fetchNPMPackageVersions.ts +45 -0
- package/src/lib/format.ts +34 -0
- package/src/lib/installDependencies.ts +74 -0
- package/src/lib/locateFileUpward.ts +53 -0
- package/src/lib/prismicrc.ts +41 -0
- package/src/lib/trailingSlash.ts +5 -0
- package/src/lib/typesInternalSchemas.ts +42 -0
- package/src/managers/BaseManager.ts +74 -0
- package/src/managers/PrismicManager.ts +81 -0
- package/src/managers/createPrismicManager.ts +9 -0
- package/src/managers/customTypes/CustomTypesManager.ts +221 -0
- package/src/managers/customTypes/types.ts +3 -0
- package/src/managers/plugins/PluginsManager.ts +44 -0
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +120 -0
- package/src/managers/prismicRepository/types.ts +23 -0
- package/src/managers/project/ProjectManager.ts +354 -0
- package/src/managers/slices/SlicesManager.ts +308 -0
- package/src/managers/telemetry/TelemetryManager.ts +227 -0
- package/src/managers/telemetry/types.ts +62 -0
- package/src/managers/user/UserManager.ts +35 -0
- package/src/managers/versions/VersionsManager.ts +53 -0
- package/src/types.ts +41 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PrismicAuthManager } from "./PrismicAuthManager";
|
|
2
|
+
|
|
3
|
+
type CreatePrismicAuthManager = ConstructorParameters<
|
|
4
|
+
typeof PrismicAuthManager
|
|
5
|
+
>[0];
|
|
6
|
+
|
|
7
|
+
export const createPrismicAuthManager = (
|
|
8
|
+
args?: CreatePrismicAuthManager,
|
|
9
|
+
): PrismicAuthManager => {
|
|
10
|
+
return new PrismicAuthManager(args);
|
|
11
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { parseSetCookie, type SetCookie } from "cookie";
|
|
2
|
+
import {
|
|
3
|
+
createEvent,
|
|
4
|
+
createRouter,
|
|
5
|
+
defineNodeMiddleware,
|
|
6
|
+
eventHandler,
|
|
7
|
+
NodeMiddleware,
|
|
8
|
+
readBody,
|
|
9
|
+
} from "h3";
|
|
10
|
+
import * as z from "zod";
|
|
11
|
+
|
|
12
|
+
import { decode } from "../lib/decode";
|
|
13
|
+
|
|
14
|
+
import { PrismicAuthManager } from "./PrismicAuthManager";
|
|
15
|
+
|
|
16
|
+
const PrismicAuthResponseSchema = z.object({
|
|
17
|
+
email: z.string(),
|
|
18
|
+
cookies: z.array(z.string()),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type PrismicAuthCheckStatusResponse =
|
|
22
|
+
| {
|
|
23
|
+
status: "ok";
|
|
24
|
+
shortId: string;
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
status: "pending";
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type CreatePrismicAuthManagerMiddlewareArgs = {
|
|
31
|
+
prismicAuthManager: PrismicAuthManager;
|
|
32
|
+
onLoginCallback?: () => void | Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const createPrismicAuthManagerMiddleware = (
|
|
36
|
+
args: CreatePrismicAuthManagerMiddlewareArgs,
|
|
37
|
+
): NodeMiddleware => {
|
|
38
|
+
const router = createRouter();
|
|
39
|
+
|
|
40
|
+
// Route called by the remote Prismic login page on successful login.
|
|
41
|
+
router.post(
|
|
42
|
+
"/",
|
|
43
|
+
eventHandler(async (event) => {
|
|
44
|
+
const body = await readBody(event);
|
|
45
|
+
const { value, error } = decode(PrismicAuthResponseSchema, body);
|
|
46
|
+
|
|
47
|
+
if (error) {
|
|
48
|
+
throw new Error(`Invalid auth payload: ${error.errors.join(", ")}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const token = value.cookies
|
|
52
|
+
.map((c: string) => parseSetCookie(c))
|
|
53
|
+
.find((c: SetCookie) => c.name === "prismic-auth")?.value;
|
|
54
|
+
|
|
55
|
+
if (!token) {
|
|
56
|
+
throw new Error("No token found in cookies");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
await args.prismicAuthManager.login({
|
|
60
|
+
email: value.email,
|
|
61
|
+
token: token,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (args.onLoginCallback) {
|
|
65
|
+
await args.onLoginCallback();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {};
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return defineNodeMiddleware(async (req, res) => {
|
|
73
|
+
const event = createEvent(req, res);
|
|
74
|
+
|
|
75
|
+
await router.handler(event);
|
|
76
|
+
|
|
77
|
+
res.end();
|
|
78
|
+
});
|
|
79
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { addTrailingSlash } from "../lib/trailingSlash";
|
|
2
|
+
|
|
3
|
+
import { APPLICATION_MODE } from "./APPLICATION_MODE";
|
|
4
|
+
|
|
5
|
+
export type APIEndpoints = {
|
|
6
|
+
PrismicWroom: string;
|
|
7
|
+
PrismicLegacyAuthenticationApi: string;
|
|
8
|
+
PrismicLegacyCustomTypesApi: string;
|
|
9
|
+
PrismicLegacyUserApi: string;
|
|
10
|
+
PrismicLegacyAclApi: string;
|
|
11
|
+
PrismicLegacySliceMachineApi: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const API_ENDPOINTS: APIEndpoints = (() => {
|
|
15
|
+
switch (process.env.PRISMIC_ENV) {
|
|
16
|
+
case APPLICATION_MODE.Development: {
|
|
17
|
+
const apiEndpoints = {
|
|
18
|
+
PrismicWroom: addTrailingSlash(process.env.wroom_endpoint),
|
|
19
|
+
PrismicLegacyAuthenticationApi: addTrailingSlash(
|
|
20
|
+
process.env.legacy_authentication_api_endpoint,
|
|
21
|
+
),
|
|
22
|
+
PrismicLegacyCustomTypesApi: addTrailingSlash(
|
|
23
|
+
process.env.legacy_custom_types_api_endpoint,
|
|
24
|
+
),
|
|
25
|
+
PrismicLegacyUserApi: addTrailingSlash(
|
|
26
|
+
process.env.legacy_user_api_endpoint,
|
|
27
|
+
),
|
|
28
|
+
PrismicLegacyAclApi: addTrailingSlash(
|
|
29
|
+
process.env.legacy_acl_api_endpoint,
|
|
30
|
+
),
|
|
31
|
+
PrismicLegacySliceMachineApi: addTrailingSlash(
|
|
32
|
+
process.env.legacy_slice_machine_api_endpoint,
|
|
33
|
+
),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {
|
|
37
|
+
return !apiEndpoints[key as keyof typeof apiEndpoints];
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (missingAPIEndpoints.length > 0) {
|
|
41
|
+
console.error(
|
|
42
|
+
`You are running the command in development mode (PRISMIC_ENV=${
|
|
43
|
+
APPLICATION_MODE.Development
|
|
44
|
+
}) where API endpoints are configured via environment variables.
|
|
45
|
+
|
|
46
|
+
The following endpoints were not configured: ${missingAPIEndpoints.join(", ")}.
|
|
47
|
+
|
|
48
|
+
Configure them before continuing.`,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.warn(`You are running the command in development mode (PRISMIC_ENV=${
|
|
55
|
+
APPLICATION_MODE.Development
|
|
56
|
+
}).
|
|
57
|
+
|
|
58
|
+
The following API endpoints were configured via environment variables:
|
|
59
|
+
${Object.entries(apiEndpoints)
|
|
60
|
+
.map(([name, endpoint]) => ` - ${name}: ${endpoint}`)
|
|
61
|
+
.join("\n")}
|
|
62
|
+
|
|
63
|
+
These endpoints are different than Prismic's normal endpoints and are not trusted.
|
|
64
|
+
|
|
65
|
+
If you didn't intend to run the command this way, stop it immediately and unset the PRISMIC_ENV environment variable.`);
|
|
66
|
+
|
|
67
|
+
return apiEndpoints as APIEndpoints;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case APPLICATION_MODE.Staging: {
|
|
71
|
+
return {
|
|
72
|
+
PrismicWroom: "https://wroom.io/",
|
|
73
|
+
PrismicLegacyAuthenticationApi: "https://auth.wroom.io/",
|
|
74
|
+
PrismicLegacyCustomTypesApi: "https://customtypes.wroom.io/",
|
|
75
|
+
PrismicLegacyUserApi: "https://user-service.wroom.io/",
|
|
76
|
+
PrismicLegacyAclApi: "https://acl-provider.wroom.io/",
|
|
77
|
+
PrismicLegacySliceMachineApi: "https://sm-api.wroom.io/v1/",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
case APPLICATION_MODE.DevTools:
|
|
82
|
+
case APPLICATION_MODE.MarketingTools:
|
|
83
|
+
case APPLICATION_MODE.Platform: {
|
|
84
|
+
return {
|
|
85
|
+
PrismicWroom: `https://${process.env.PRISMIC_ENV}-wroom.com/`,
|
|
86
|
+
PrismicLegacyAuthenticationApi: `https://auth.${process.env.PRISMIC_ENV}-wroom.com/`,
|
|
87
|
+
PrismicLegacyCustomTypesApi: `https://customtypes.${process.env.PRISMIC_ENV}-wroom.com/`,
|
|
88
|
+
PrismicLegacyUserApi: `https://user-service.${process.env.PRISMIC_ENV}-wroom.com/`,
|
|
89
|
+
PrismicLegacyAclApi: `https://acl-provider.${process.env.PRISMIC_ENV}-wroom.com/`,
|
|
90
|
+
PrismicLegacySliceMachineApi: `https://sm-api.${process.env.PRISMIC_ENV}-wroom.com/v1/`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
case APPLICATION_MODE.Production:
|
|
95
|
+
default: {
|
|
96
|
+
return {
|
|
97
|
+
PrismicWroom: "https://prismic.io/",
|
|
98
|
+
PrismicLegacyAuthenticationApi: "https://auth.prismic.io/",
|
|
99
|
+
PrismicLegacyCustomTypesApi: "https://customtypes.prismic.io/",
|
|
100
|
+
PrismicLegacyUserApi: "https://user-service.prismic.io/",
|
|
101
|
+
PrismicLegacyAclApi: "https://acl-provider.prismic.io/",
|
|
102
|
+
PrismicLegacySliceMachineApi: "https://sm-api.prismic.io/v1/",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { APPLICATION_MODE } from "./APPLICATION_MODE";
|
|
2
|
+
|
|
3
|
+
type APITokens = {
|
|
4
|
+
SegmentKey: string;
|
|
5
|
+
AmplitudeKey: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const API_TOKENS: APITokens = (() => {
|
|
9
|
+
switch (process.env.PRISMIC_ENV) {
|
|
10
|
+
case APPLICATION_MODE.Development:
|
|
11
|
+
case APPLICATION_MODE.DevTools:
|
|
12
|
+
case APPLICATION_MODE.MarketingTools:
|
|
13
|
+
case APPLICATION_MODE.Platform:
|
|
14
|
+
case APPLICATION_MODE.Staging:
|
|
15
|
+
return {
|
|
16
|
+
SegmentKey: "Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG",
|
|
17
|
+
AmplitudeKey: "client-rqVU4xTNaz7F51nBfKRUa0K3qnODiqzh",
|
|
18
|
+
};
|
|
19
|
+
case undefined:
|
|
20
|
+
case "":
|
|
21
|
+
case APPLICATION_MODE.Production:
|
|
22
|
+
return {
|
|
23
|
+
SegmentKey: "cGjidifKefYb6EPaGaqpt8rQXkv5TD6P",
|
|
24
|
+
AmplitudeKey: "client-JuQQWUPimfKWId3WWU6p8xSkTiFqd1qV",
|
|
25
|
+
};
|
|
26
|
+
default:
|
|
27
|
+
throw new Error(`Unknown application mode "${process.env.PRISMIC_ENV}".`);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PRISMIC_CLI_NPM_PACKAGE_NAME = "@prismicio/cli";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PRISMIC_CLI_USER_AGENT = "prismic-cli";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PRISMIC_CONFIG_FILENAME = "prismic.config.json";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SLICEMACHINE_CONFIG_FILENAME = "slicemachine.config.json";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TS_CONFIG_FILENAME = "tsconfig.json";
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { HookError } from "@prismicio/plugin-kit";
|
|
2
|
+
|
|
3
|
+
export class PrismicError extends Error {
|
|
4
|
+
name = "SMPrismicError";
|
|
5
|
+
}
|
|
6
|
+
export class UnauthorizedError extends PrismicError {
|
|
7
|
+
name = "SMUnauthorizedError" as const;
|
|
8
|
+
}
|
|
9
|
+
export class UnauthenticatedError extends PrismicError {
|
|
10
|
+
name = "SMUnauthenticatedError" as const;
|
|
11
|
+
message = "Authenticate before trying again.";
|
|
12
|
+
}
|
|
13
|
+
export class NotFoundError extends PrismicError {
|
|
14
|
+
name = "SMNotFoundError" as const;
|
|
15
|
+
}
|
|
16
|
+
export class UnexpectedDataError extends PrismicError {
|
|
17
|
+
name = "SMUnexpectedDataError" as const;
|
|
18
|
+
}
|
|
19
|
+
export class InternalError extends PrismicError {
|
|
20
|
+
name = "SMInternalError" as const;
|
|
21
|
+
}
|
|
22
|
+
export class PluginError extends PrismicError {
|
|
23
|
+
name = "SMPluginError" as const;
|
|
24
|
+
}
|
|
25
|
+
export class PluginHookResultError extends PrismicError {
|
|
26
|
+
name = "SMPluginHookResultError" as const;
|
|
27
|
+
|
|
28
|
+
constructor(errors: HookError[]) {
|
|
29
|
+
super(
|
|
30
|
+
`${errors.length} error${
|
|
31
|
+
errors.length === 1 ? "" : "s"
|
|
32
|
+
} were returned by one or more plugins.`,
|
|
33
|
+
{
|
|
34
|
+
cause: errors,
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class UnsupportedError extends PrismicError {
|
|
40
|
+
name = "SMUnsupportedError" as const;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type PrismicErrorNames =
|
|
44
|
+
| "SMPrismicError"
|
|
45
|
+
| UnauthorizedError["name"]
|
|
46
|
+
| UnauthenticatedError["name"]
|
|
47
|
+
| NotFoundError["name"]
|
|
48
|
+
| UnexpectedDataError["name"]
|
|
49
|
+
| InternalError["name"]
|
|
50
|
+
| PluginError["name"]
|
|
51
|
+
| PluginHookResultError["name"]
|
|
52
|
+
| UnsupportedError["name"];
|
|
53
|
+
|
|
54
|
+
type ShallowPrismicError<TName extends PrismicErrorNames> = Error & {
|
|
55
|
+
name: TName;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const isPrismicError = <TName extends PrismicErrorNames>(
|
|
59
|
+
error: unknown,
|
|
60
|
+
name?: TName,
|
|
61
|
+
): error is TName extends string ? ShallowPrismicError<TName> : Error => {
|
|
62
|
+
const isErrorInstance = error instanceof Error;
|
|
63
|
+
|
|
64
|
+
return name === undefined
|
|
65
|
+
? isErrorInstance && error.name.startsWith("SM")
|
|
66
|
+
: isErrorInstance && error.name === name;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const isUnauthorizedError = (
|
|
70
|
+
error: unknown,
|
|
71
|
+
): error is ShallowPrismicError<"SMUnauthorizedError"> => {
|
|
72
|
+
return isPrismicError(error, "SMUnauthorizedError");
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const isUnauthenticatedError = (
|
|
76
|
+
error: unknown,
|
|
77
|
+
): error is ShallowPrismicError<"SMUnauthenticatedError"> => {
|
|
78
|
+
return isPrismicError(error, "SMUnauthenticatedError");
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const isNotFoundError = (
|
|
82
|
+
error: unknown,
|
|
83
|
+
): error is ShallowPrismicError<"SMNotFoundError"> => {
|
|
84
|
+
return isPrismicError(error, "SMNotFoundError");
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const isUnexpectedDataError = (
|
|
88
|
+
error: unknown,
|
|
89
|
+
): error is ShallowPrismicError<"SMUnexpectedDataError"> => {
|
|
90
|
+
return isPrismicError(error, "SMUnexpectedDataError");
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const isInternalError = (
|
|
94
|
+
error: unknown,
|
|
95
|
+
): error is ShallowPrismicError<"SMInternalError"> => {
|
|
96
|
+
return isPrismicError(error, "SMInternalError");
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const isPluginError = (
|
|
100
|
+
error: unknown,
|
|
101
|
+
): error is ShallowPrismicError<"SMPluginError"> => {
|
|
102
|
+
return isPrismicError(error, "SMPluginError");
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const isUnsupportedError = (
|
|
106
|
+
error: unknown,
|
|
107
|
+
): error is ShallowPrismicError<"SMUnsupportedError"> => {
|
|
108
|
+
return isPrismicError(error, "SMUnsupportedError");
|
|
109
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
type ZodIssue = z.ZodIssue;
|
|
4
|
+
|
|
5
|
+
type DecodeErrorConstructorArgs<TInput = unknown> = {
|
|
6
|
+
input: TInput;
|
|
7
|
+
errors: ZodIssue[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function formatZodErrors(errors: ZodIssue[]): string[] {
|
|
11
|
+
return errors.map((err) => {
|
|
12
|
+
const path = err.path.length > 0 ? ` at ${err.path.join(".")}` : "";
|
|
13
|
+
|
|
14
|
+
return `${err.message}${path}`;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class DecodeError<TInput = unknown> extends Error {
|
|
19
|
+
name = "DecodeError";
|
|
20
|
+
input: TInput;
|
|
21
|
+
errors: string[];
|
|
22
|
+
|
|
23
|
+
constructor(args: DecodeErrorConstructorArgs<TInput>) {
|
|
24
|
+
const formattedErrors = formatZodErrors(args.errors);
|
|
25
|
+
|
|
26
|
+
super(formattedErrors.join(", "));
|
|
27
|
+
|
|
28
|
+
this.input = args.input;
|
|
29
|
+
this.errors = formattedErrors;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PluginSystemRunner } from "@prismicio/plugin-kit";
|
|
2
|
+
|
|
3
|
+
export function assertPluginsInitialized(
|
|
4
|
+
pluginSystemRunner: PluginSystemRunner | undefined,
|
|
5
|
+
): asserts pluginSystemRunner is NonNullable<typeof pluginSystemRunner> {
|
|
6
|
+
if (pluginSystemRunner == undefined) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
"Plugins have not been initialized. Run `PrismicManager.plugins.prototype.initPlugins()` before re-calling this method.",
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
import { DecodeError } from "./DecodeError";
|
|
4
|
+
|
|
5
|
+
export type DecodeReturnType<A, _O, I> =
|
|
6
|
+
| {
|
|
7
|
+
value: A;
|
|
8
|
+
error?: never;
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
value?: never;
|
|
12
|
+
error: DecodeError<I>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function decode<A, O, I>(
|
|
16
|
+
codec: z.ZodType<A>,
|
|
17
|
+
input: I,
|
|
18
|
+
): DecodeReturnType<A, O, I> {
|
|
19
|
+
const parsed = codec.safeParse(input);
|
|
20
|
+
|
|
21
|
+
if (parsed.success) {
|
|
22
|
+
return { value: parsed.data } as DecodeReturnType<A, O, I>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
error: new DecodeError({ input, errors: parsed.error.issues }),
|
|
27
|
+
} as DecodeReturnType<A, O, I>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CallHookReturnType, HookError } from "@prismicio/plugin-kit";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
import { DecodeError } from "./DecodeError";
|
|
5
|
+
import { decode } from "./decode";
|
|
6
|
+
|
|
7
|
+
export const decodeHookResult = <
|
|
8
|
+
A,
|
|
9
|
+
_O,
|
|
10
|
+
I,
|
|
11
|
+
THookResult extends Awaited<CallHookReturnType>,
|
|
12
|
+
>(
|
|
13
|
+
codec: z.ZodType<A>,
|
|
14
|
+
hookResult: THookResult,
|
|
15
|
+
): {
|
|
16
|
+
data: A[];
|
|
17
|
+
errors: (HookError | DecodeError<I>)[];
|
|
18
|
+
} => {
|
|
19
|
+
const data: A[] = [];
|
|
20
|
+
const errors: DecodeError<I>[] = [];
|
|
21
|
+
|
|
22
|
+
for (const dataElement of hookResult.data) {
|
|
23
|
+
const { value, error } = decode(codec, dataElement);
|
|
24
|
+
|
|
25
|
+
if (error) {
|
|
26
|
+
errors.push(error);
|
|
27
|
+
} else {
|
|
28
|
+
data.push(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
data,
|
|
34
|
+
errors: [...errors, ...hookResult.errors],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
import { decode, DecodeReturnType } from "./decode";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A minimally defined schema for package.json files. Only data needed for
|
|
7
|
+
* version detection is defined.
|
|
8
|
+
*/
|
|
9
|
+
const PackageJSONSchema = z.object({
|
|
10
|
+
version: z.string(),
|
|
11
|
+
});
|
|
12
|
+
type PackageJSON = z.infer<typeof PackageJSONSchema>;
|
|
13
|
+
|
|
14
|
+
export const decodePackageJSON = (
|
|
15
|
+
input: unknown,
|
|
16
|
+
): DecodeReturnType<PackageJSON, PackageJSON, unknown> => {
|
|
17
|
+
return decode(PackageJSONSchema, input);
|
|
18
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
import { PrismicConfig } from "../types";
|
|
4
|
+
|
|
5
|
+
import { decode, DecodeReturnType } from "./decode";
|
|
6
|
+
|
|
7
|
+
const PrismicConfigPluginRegistrationSchema = z.union([
|
|
8
|
+
z.string(),
|
|
9
|
+
z.object({
|
|
10
|
+
resolve: z.string(),
|
|
11
|
+
options: z.record(z.string(), z.unknown()).optional(),
|
|
12
|
+
}),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const PrismicConfigSchema = z.object({
|
|
16
|
+
repositoryName: z.string(),
|
|
17
|
+
adapter: PrismicConfigPluginRegistrationSchema,
|
|
18
|
+
apiEndpoint: z.string().optional(),
|
|
19
|
+
libraries: z.array(z.string()).optional(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const decodePrismicConfig = (
|
|
23
|
+
input: unknown,
|
|
24
|
+
): DecodeReturnType<PrismicConfig, PrismicConfig, unknown> => {
|
|
25
|
+
return decode(PrismicConfigSchema, input);
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fetch from "node-fetch";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
import { decode } from "./decode";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Accept header value used when only metadata required for package
|
|
8
|
+
* installation is needed. The response includes all versions and some of their
|
|
9
|
+
* metadata.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/npm/registry/blob/cfe04736f34db9274a780184d1cdb2fb3e4ead2a/docs/responses/package-metadata.md#package-metadata
|
|
12
|
+
*/
|
|
13
|
+
const NPM_REGISTRY_ABBREVIATED_METADATA_ACCEPT_HEADER =
|
|
14
|
+
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A minimally defined schema for NPM registry package metadata. Only data
|
|
18
|
+
* needed for version detection is defined.
|
|
19
|
+
*/
|
|
20
|
+
const NPMRegistryPackageMetadataSchema = z.object({
|
|
21
|
+
versions: z.record(z.string(), z.unknown()),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
type FetchNPMPackageVersionsArgs = {
|
|
25
|
+
packageName: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const fetchNPMPackageVersions = async (
|
|
29
|
+
args: FetchNPMPackageVersionsArgs,
|
|
30
|
+
): Promise<string[]> => {
|
|
31
|
+
const res = await fetch(`https://registry.npmjs.org/${args.packageName}`, {
|
|
32
|
+
headers: {
|
|
33
|
+
Accept: NPM_REGISTRY_ABBREVIATED_METADATA_ACCEPT_HEADER,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const json = await res.json();
|
|
38
|
+
const { value, error } = decode(NPMRegistryPackageMetadataSchema, json);
|
|
39
|
+
|
|
40
|
+
if (error) {
|
|
41
|
+
throw new Error(`Invalid NPM registry response.`, { cause: error });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return Object.keys(value.versions);
|
|
45
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { stripIndent } from "common-tags";
|
|
2
|
+
import prettier from "prettier";
|
|
3
|
+
|
|
4
|
+
type FormatOptions = {
|
|
5
|
+
prettier?: prettier.Options;
|
|
6
|
+
/**
|
|
7
|
+
* Determines if a newline is included at the end of the formatted result.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue `true`
|
|
10
|
+
*/
|
|
11
|
+
includeNewlineAtEnd?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const format = async (
|
|
15
|
+
source: string,
|
|
16
|
+
filePath: string,
|
|
17
|
+
options?: FormatOptions,
|
|
18
|
+
): Promise<string> => {
|
|
19
|
+
let formatted = stripIndent(source);
|
|
20
|
+
|
|
21
|
+
const prettierOptions = await prettier.resolveConfig(filePath);
|
|
22
|
+
|
|
23
|
+
formatted = await prettier.format(formatted, {
|
|
24
|
+
...prettierOptions,
|
|
25
|
+
filepath: filePath,
|
|
26
|
+
...(options?.prettier ?? {}),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (options?.includeNewlineAtEnd === false) {
|
|
30
|
+
formatted.replace(/[\r\n]+$/, "");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return formatted;
|
|
34
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { parseNi } from "@antfu/ni";
|
|
2
|
+
import { execaCommand, type ResultPromise, type Options } from "execa";
|
|
3
|
+
|
|
4
|
+
import { PackageManager } from "../types";
|
|
5
|
+
|
|
6
|
+
const EXTRA_INSTALL_FLAGS: Record<PackageManager, string[]> = {
|
|
7
|
+
npm: ["--color=always", "--loglevel=info"],
|
|
8
|
+
pnpm: [],
|
|
9
|
+
yarn: [],
|
|
10
|
+
"yarn@berry": [],
|
|
11
|
+
"pnpm@6": [],
|
|
12
|
+
bun: [],
|
|
13
|
+
deno: [],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type InstallDependenciesArgs = {
|
|
17
|
+
packageManager: PackageManager;
|
|
18
|
+
dependencies: Record<string, string>;
|
|
19
|
+
dev?: boolean;
|
|
20
|
+
execa?: Options;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type InstallDependenciesReturnType = {
|
|
24
|
+
execaProcess: ResultPromise;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const resolveCommand = (
|
|
28
|
+
command: string | { command: string; args: string[] },
|
|
29
|
+
): string => {
|
|
30
|
+
if (typeof command === "string") {
|
|
31
|
+
return command;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return [command.command, ...command.args].join(" ");
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const installDependencies = async (
|
|
38
|
+
args: InstallDependenciesArgs,
|
|
39
|
+
): Promise<InstallDependenciesReturnType> => {
|
|
40
|
+
const commandArgs = Object.entries(args.dependencies).map(
|
|
41
|
+
([pkg, range]) => `${pkg}@${range}`,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (commandArgs.length && args.dev) {
|
|
45
|
+
commandArgs.unshift("-D");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
commandArgs.push(...EXTRA_INSTALL_FLAGS[args.packageManager]);
|
|
49
|
+
|
|
50
|
+
const parsedCommand = await parseNi(args.packageManager, commandArgs);
|
|
51
|
+
|
|
52
|
+
if (!parsedCommand) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"Failed to begin dependency installation (could not parse command)",
|
|
55
|
+
{
|
|
56
|
+
cause: {
|
|
57
|
+
packageManager: args.packageManager,
|
|
58
|
+
dependencies: args.dependencies,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const command = resolveCommand(parsedCommand);
|
|
65
|
+
|
|
66
|
+
const execaProcess = execaCommand(command, {
|
|
67
|
+
encoding: "utf8",
|
|
68
|
+
...args.execa,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
execaProcess,
|
|
73
|
+
};
|
|
74
|
+
};
|