@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,53 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { castArray } from "./castArray";
|
|
5
|
+
|
|
6
|
+
type LocateFileUpwardConfig = {
|
|
7
|
+
startDir?: string;
|
|
8
|
+
stopDir?: string;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
_originalStartDir?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const locateFileUpward = async (
|
|
16
|
+
filePathOrPaths: string | readonly string[],
|
|
17
|
+
{
|
|
18
|
+
startDir = process.cwd(),
|
|
19
|
+
stopDir = path.resolve(startDir, "/"),
|
|
20
|
+
_originalStartDir,
|
|
21
|
+
}: LocateFileUpwardConfig = {},
|
|
22
|
+
): Promise<string> => {
|
|
23
|
+
const originalStartDir = _originalStartDir ?? startDir;
|
|
24
|
+
|
|
25
|
+
const filePaths = castArray(filePathOrPaths);
|
|
26
|
+
|
|
27
|
+
for (const filePath of filePaths) {
|
|
28
|
+
const resolvedFilePath = path.resolve(startDir, filePath);
|
|
29
|
+
try {
|
|
30
|
+
await fs.access(resolvedFilePath);
|
|
31
|
+
|
|
32
|
+
return resolvedFilePath;
|
|
33
|
+
} catch {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (startDir === stopDir) {
|
|
39
|
+
const formattedFilePaths = filePaths
|
|
40
|
+
.map((filePath) => "`" + filePath + "`")
|
|
41
|
+
.join(" or ");
|
|
42
|
+
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Could not locate ${formattedFilePaths} between \`${originalStartDir}\` and \`${stopDir}\`.`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return locateFileUpward(filePathOrPaths, {
|
|
49
|
+
startDir: path.resolve(startDir, ".."),
|
|
50
|
+
stopDir,
|
|
51
|
+
_originalStartDir: originalStartDir,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
|
|
3
|
+
import * as rc9 from "rc9";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
|
|
6
|
+
import { decode } from "./decode";
|
|
7
|
+
|
|
8
|
+
const PRISMICRC = ".prismicrc";
|
|
9
|
+
|
|
10
|
+
const PrismicrcSchema = z.object({
|
|
11
|
+
telemetry: z.boolean().optional(),
|
|
12
|
+
});
|
|
13
|
+
type Prismicrc = z.infer<typeof PrismicrcSchema>;
|
|
14
|
+
|
|
15
|
+
export const readRawPrismicrc = (dir?: string): Prismicrc => {
|
|
16
|
+
const rawPrismicrc = dir
|
|
17
|
+
? rc9.read({ dir, name: PRISMICRC })
|
|
18
|
+
: rc9.readUser(PRISMICRC);
|
|
19
|
+
|
|
20
|
+
const { value: prismicrc, error } = decode(PrismicrcSchema, rawPrismicrc);
|
|
21
|
+
|
|
22
|
+
if (error) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Failed to parse ${
|
|
25
|
+
dir ? path.resolve(dir, PRISMICRC) : `~/${PRISMICRC}`
|
|
26
|
+
}: ${error.errors.join(", ")}`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return prismicrc;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const readPrismicrc = (dir: string): Prismicrc => {
|
|
34
|
+
const userPrismicrc = readRawPrismicrc();
|
|
35
|
+
const projectPrismicrc = readRawPrismicrc(dir);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...userPrismicrc,
|
|
39
|
+
...projectPrismicrc,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Zod schema wrapper for TypesInternal.CustomType. Uses io-ts validation
|
|
6
|
+
* internally but exposes a Zod-compatible interface.
|
|
7
|
+
*/
|
|
8
|
+
export const CustomTypeSchema: z.ZodType<TypesInternal.CustomType> = z
|
|
9
|
+
.unknown()
|
|
10
|
+
.transform((val, ctx) => {
|
|
11
|
+
const result = TypesInternal.CustomType.decode(val);
|
|
12
|
+
if (result._tag === "Right") {
|
|
13
|
+
return result.right;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ctx.addIssue({
|
|
17
|
+
code: z.ZodIssueCode.custom,
|
|
18
|
+
message: "Invalid custom type.",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return z.NEVER;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Zod schema wrapper for TypesInternal.SharedSlice. Uses io-ts validation
|
|
26
|
+
* internally but exposes a Zod-compatible interface.
|
|
27
|
+
*/
|
|
28
|
+
export const SharedSliceSchema: z.ZodType<TypesInternal.SharedSlice> = z
|
|
29
|
+
.unknown()
|
|
30
|
+
.transform((val, ctx) => {
|
|
31
|
+
const result = TypesInternal.SharedSlice.decode(val);
|
|
32
|
+
if (result._tag === "Right") {
|
|
33
|
+
return result.right;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
ctx.addIssue({
|
|
37
|
+
code: z.ZodIssueCode.custom,
|
|
38
|
+
message: "Invalid shared slice.",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return z.NEVER;
|
|
42
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PluginSystemRunner } from "@prismicio/plugin-kit";
|
|
2
|
+
|
|
3
|
+
import { PrismicAuthManager } from "../auth/PrismicAuthManager";
|
|
4
|
+
|
|
5
|
+
import { PrismicManager } from "./PrismicManager";
|
|
6
|
+
import { CustomTypesManager } from "./customTypes/CustomTypesManager";
|
|
7
|
+
import { PluginsManager } from "./plugins/PluginsManager";
|
|
8
|
+
import { PrismicRepositoryManager } from "./prismicRepository/PrismicRepositoryManager";
|
|
9
|
+
import { ProjectManager } from "./project/ProjectManager";
|
|
10
|
+
import { SlicesManager } from "./slices/SlicesManager";
|
|
11
|
+
import { TelemetryManager } from "./telemetry/TelemetryManager";
|
|
12
|
+
import { UserManager } from "./user/UserManager";
|
|
13
|
+
import { VersionsManager } from "./versions/VersionsManager";
|
|
14
|
+
|
|
15
|
+
export abstract class BaseManager {
|
|
16
|
+
private _prismicManager: PrismicManager;
|
|
17
|
+
|
|
18
|
+
constructor(prismicManager: PrismicManager) {
|
|
19
|
+
this._prismicManager = prismicManager;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected get prismicAuthManager(): PrismicAuthManager {
|
|
23
|
+
return this._prismicManager.getPrismicAuthManager();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected get pluginSystemRunner(): PluginSystemRunner | undefined {
|
|
27
|
+
return this._prismicManager.getPluginSystemRunner();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected set pluginSystemRunner(
|
|
31
|
+
pluginSystemRunner: PluginSystemRunner | undefined,
|
|
32
|
+
) {
|
|
33
|
+
// @ts-expect-error - _pluginSystemRunner is private. We
|
|
34
|
+
// are intentially ignoring its privacy to allow Manager
|
|
35
|
+
// classes to access a shared plugin runner via protected
|
|
36
|
+
// getters and setters.
|
|
37
|
+
this._prismicManager._pluginSystemRunner = pluginSystemRunner;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected get cwd(): string {
|
|
41
|
+
return this._prismicManager.cwd;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Protected instance prevents circular intellisense
|
|
45
|
+
// e.g. prismicManager.user.user.user
|
|
46
|
+
protected get user(): UserManager {
|
|
47
|
+
return this._prismicManager.user;
|
|
48
|
+
}
|
|
49
|
+
protected get prismicRepository(): PrismicRepositoryManager {
|
|
50
|
+
return this._prismicManager.prismicRepository;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected get plugins(): PluginsManager {
|
|
54
|
+
return this._prismicManager.plugins;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected get project(): ProjectManager {
|
|
58
|
+
return this._prismicManager.project;
|
|
59
|
+
}
|
|
60
|
+
protected get customTypes(): CustomTypesManager {
|
|
61
|
+
return this._prismicManager.customTypes;
|
|
62
|
+
}
|
|
63
|
+
protected get slices(): SlicesManager {
|
|
64
|
+
return this._prismicManager.slices;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
protected get versions(): VersionsManager {
|
|
68
|
+
return this._prismicManager.versions;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected get telemetry(): TelemetryManager {
|
|
72
|
+
return this._prismicManager.telemetry;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Plugin, PluginSystemRunner } from "@prismicio/plugin-kit";
|
|
2
|
+
|
|
3
|
+
import { PrismicAuthManager } from "../auth/PrismicAuthManager";
|
|
4
|
+
import { createPrismicAuthManager } from "../auth/createPrismicAuthManager";
|
|
5
|
+
import { API_ENDPOINTS, APIEndpoints } from "../constants/API_ENDPOINTS";
|
|
6
|
+
|
|
7
|
+
import { CustomTypesManager } from "./customTypes/CustomTypesManager";
|
|
8
|
+
import { PluginsManager } from "./plugins/PluginsManager";
|
|
9
|
+
import { PrismicRepositoryManager } from "./prismicRepository/PrismicRepositoryManager";
|
|
10
|
+
import { ProjectManager } from "./project/ProjectManager";
|
|
11
|
+
import { SlicesManager } from "./slices/SlicesManager";
|
|
12
|
+
import { TelemetryManager } from "./telemetry/TelemetryManager";
|
|
13
|
+
import { UserManager } from "./user/UserManager";
|
|
14
|
+
import { VersionsManager } from "./versions/VersionsManager";
|
|
15
|
+
|
|
16
|
+
type PrismicManagerConstructorArgs = {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
nativePlugins?: Record<string, Plugin>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export class PrismicManager {
|
|
22
|
+
private _pluginSystemRunner: PluginSystemRunner | undefined = undefined;
|
|
23
|
+
private _prismicAuthManager: PrismicAuthManager;
|
|
24
|
+
|
|
25
|
+
cwd: string;
|
|
26
|
+
|
|
27
|
+
customTypes: CustomTypesManager;
|
|
28
|
+
plugins: PluginsManager;
|
|
29
|
+
prismicRepository: PrismicRepositoryManager;
|
|
30
|
+
project: ProjectManager;
|
|
31
|
+
slices: SlicesManager;
|
|
32
|
+
telemetry: TelemetryManager;
|
|
33
|
+
user: UserManager;
|
|
34
|
+
versions: VersionsManager;
|
|
35
|
+
|
|
36
|
+
constructor(args?: PrismicManagerConstructorArgs) {
|
|
37
|
+
// _prismicAuthManager must be set at least before UserManager
|
|
38
|
+
// is instantiated. It depends on the PrismicAuthManager for
|
|
39
|
+
// authentication-related methods.
|
|
40
|
+
this._prismicAuthManager = createPrismicAuthManager();
|
|
41
|
+
|
|
42
|
+
this.user = new UserManager(this);
|
|
43
|
+
this.prismicRepository = new PrismicRepositoryManager(this);
|
|
44
|
+
|
|
45
|
+
this.plugins = new PluginsManager(this, {
|
|
46
|
+
nativePlugins: args?.nativePlugins,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
this.project = new ProjectManager(this);
|
|
50
|
+
this.customTypes = new CustomTypesManager(this);
|
|
51
|
+
this.slices = new SlicesManager(this);
|
|
52
|
+
|
|
53
|
+
this.versions = new VersionsManager(this);
|
|
54
|
+
|
|
55
|
+
this.telemetry = new TelemetryManager(this);
|
|
56
|
+
|
|
57
|
+
this.cwd = args?.cwd ?? process.cwd();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The `_pluginSystemRunner` property is hidden behind a function to
|
|
61
|
+
// discourage access. Using a function deliberately breaks the pattern
|
|
62
|
+
// of other child managers that are accessible as properties, like
|
|
63
|
+
// `project`, `plugins`, etc. We do not treat PluginSystemRunner
|
|
64
|
+
// as a child manager.
|
|
65
|
+
getPluginSystemRunner(): PluginSystemRunner | undefined {
|
|
66
|
+
return this._pluginSystemRunner;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// The `_prismicAuthManager` property is hidden behind a function to
|
|
70
|
+
// discourage access. Using a function deliberately breaks the pattern
|
|
71
|
+
// of other child managers that are accessible as properties, like
|
|
72
|
+
// `project`, `plugins`, etc. We do not treat PrismicAuthManager as a
|
|
73
|
+
// child manager.
|
|
74
|
+
getPrismicAuthManager(): PrismicAuthManager {
|
|
75
|
+
return this._prismicAuthManager;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getAPIEndpoints(): APIEndpoints {
|
|
79
|
+
return API_ENDPOINTS;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PrismicManager } from "./PrismicManager";
|
|
2
|
+
|
|
3
|
+
type CreatePrismicManagerArgs = ConstructorParameters<typeof PrismicManager>;
|
|
4
|
+
|
|
5
|
+
export const createPrismicManager = (
|
|
6
|
+
...args: CreatePrismicManagerArgs
|
|
7
|
+
): PrismicManager => {
|
|
8
|
+
return new PrismicManager(...args);
|
|
9
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import * as prismicCustomTypesClient from "@prismicio/custom-types-client";
|
|
2
|
+
import {
|
|
3
|
+
CallHookReturnType,
|
|
4
|
+
CustomTypeCreateHook,
|
|
5
|
+
CustomTypeCreateHookData,
|
|
6
|
+
CustomTypeReadHookData,
|
|
7
|
+
CustomTypeRenameHook,
|
|
8
|
+
CustomTypeRenameHookData,
|
|
9
|
+
CustomTypeUpdateHookData,
|
|
10
|
+
HookError,
|
|
11
|
+
} from "@prismicio/plugin-kit";
|
|
12
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
13
|
+
import fetch from "node-fetch";
|
|
14
|
+
import * as z from "zod";
|
|
15
|
+
|
|
16
|
+
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
17
|
+
import { PRISMIC_CLI_USER_AGENT } from "../../constants/PRISMIC_CLI_USER_AGENT";
|
|
18
|
+
import { DecodeError } from "../../lib/DecodeError";
|
|
19
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
20
|
+
import { decodeHookResult } from "../../lib/decodeHookResult";
|
|
21
|
+
import { CustomTypeSchema } from "../../lib/typesInternalSchemas";
|
|
22
|
+
import { OnlyHookErrors } from "../../types";
|
|
23
|
+
import { BaseManager } from "../BaseManager";
|
|
24
|
+
|
|
25
|
+
import { type CustomTypeFormat } from "./types";
|
|
26
|
+
|
|
27
|
+
type PrismicManagerReadCustomTypeLibraryReturnType = {
|
|
28
|
+
ids: string[];
|
|
29
|
+
errors: (DecodeError | HookError)[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type CustomTypesManagerReadAllCustomTypesArgs = {
|
|
33
|
+
format: CustomTypeFormat;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type PrismicManagerReadAllCustomTypeReturnType = {
|
|
37
|
+
models: { model: TypesInternal.CustomType }[];
|
|
38
|
+
errors: (DecodeError | HookError)[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type PrismicManagerReadCustomTypeReturnType = {
|
|
42
|
+
model: TypesInternal.CustomType | undefined;
|
|
43
|
+
errors: (DecodeError | HookError)[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type PrismicManagerUpdateCustomTypeArgs = CustomTypeUpdateHookData;
|
|
47
|
+
|
|
48
|
+
type CustomTypesManagerDeleteCustomTypeArgs = {
|
|
49
|
+
id: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type CustomTypesManagerDeleteCustomTypeReturnType = {
|
|
53
|
+
errors: (DecodeError | HookError)[];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type CustomTypesManagerUpdateCustomTypeReturnType = {
|
|
57
|
+
errors: (DecodeError | HookError)[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export class CustomTypesManager extends BaseManager {
|
|
61
|
+
async readCustomTypeLibrary(): Promise<PrismicManagerReadCustomTypeLibraryReturnType> {
|
|
62
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
63
|
+
|
|
64
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
65
|
+
"custom-type-library:read",
|
|
66
|
+
undefined,
|
|
67
|
+
);
|
|
68
|
+
const { data, errors } = decodeHookResult(
|
|
69
|
+
z.object({
|
|
70
|
+
ids: z.array(z.string()),
|
|
71
|
+
}),
|
|
72
|
+
hookResult,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
ids: data[0]?.ids || [],
|
|
77
|
+
errors,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async readAllCustomTypes(
|
|
82
|
+
args?: CustomTypesManagerReadAllCustomTypesArgs,
|
|
83
|
+
): Promise<PrismicManagerReadAllCustomTypeReturnType> {
|
|
84
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
85
|
+
|
|
86
|
+
const res: PrismicManagerReadAllCustomTypeReturnType = {
|
|
87
|
+
models: [],
|
|
88
|
+
errors: [],
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const { ids, errors } = await this.readCustomTypeLibrary();
|
|
92
|
+
res.errors = [...res.errors, ...errors];
|
|
93
|
+
|
|
94
|
+
if (ids) {
|
|
95
|
+
for (const id of ids) {
|
|
96
|
+
const { model, errors } = await this.readCustomType({ id });
|
|
97
|
+
res.errors = [...res.errors, ...errors];
|
|
98
|
+
|
|
99
|
+
if (model && (!args || args.format === model.format)) {
|
|
100
|
+
res.models.push({ model });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return res;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async createCustomType(
|
|
109
|
+
args: CustomTypeCreateHookData,
|
|
110
|
+
): Promise<OnlyHookErrors<CallHookReturnType<CustomTypeCreateHook>>> {
|
|
111
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
112
|
+
|
|
113
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
114
|
+
"custom-type:create",
|
|
115
|
+
args,
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
errors: hookResult.errors,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async readCustomType(
|
|
124
|
+
args: CustomTypeReadHookData,
|
|
125
|
+
): Promise<PrismicManagerReadCustomTypeReturnType> {
|
|
126
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
127
|
+
|
|
128
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
129
|
+
"custom-type:read",
|
|
130
|
+
args,
|
|
131
|
+
);
|
|
132
|
+
const { data, errors } = decodeHookResult(
|
|
133
|
+
z.object({
|
|
134
|
+
model: CustomTypeSchema,
|
|
135
|
+
}),
|
|
136
|
+
hookResult,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
model: data[0]?.model,
|
|
141
|
+
errors,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async updateCustomType(
|
|
146
|
+
args: PrismicManagerUpdateCustomTypeArgs,
|
|
147
|
+
): Promise<CustomTypesManagerUpdateCustomTypeReturnType> {
|
|
148
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
149
|
+
const { model } = args;
|
|
150
|
+
|
|
151
|
+
const customTypeUpdateResult = await this.pluginSystemRunner.callHook(
|
|
152
|
+
"custom-type:update",
|
|
153
|
+
{ model },
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
if (customTypeUpdateResult.errors.length > 0) {
|
|
157
|
+
return { errors: customTypeUpdateResult.errors };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return { errors: [] };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async renameCustomType(
|
|
164
|
+
args: CustomTypeRenameHookData,
|
|
165
|
+
): Promise<OnlyHookErrors<CallHookReturnType<CustomTypeRenameHook>>> {
|
|
166
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
167
|
+
|
|
168
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
169
|
+
"custom-type:rename",
|
|
170
|
+
args,
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
errors: hookResult.errors,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
async deleteCustomType(
|
|
179
|
+
args: CustomTypesManagerDeleteCustomTypeArgs,
|
|
180
|
+
): Promise<CustomTypesManagerDeleteCustomTypeReturnType> {
|
|
181
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
182
|
+
|
|
183
|
+
const { model, errors: readCustomTypeErrors } = await this.readCustomType({
|
|
184
|
+
id: args.id,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (model) {
|
|
188
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
189
|
+
"custom-type:delete",
|
|
190
|
+
{ model },
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
errors: hookResult.errors,
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
return {
|
|
198
|
+
errors: readCustomTypeErrors,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async fetchRemoteCustomTypes(): Promise<TypesInternal.CustomType[]> {
|
|
204
|
+
const authenticationToken = await this.user.getAuthenticationToken();
|
|
205
|
+
const repositoryName = await this.project.getRepositoryName();
|
|
206
|
+
|
|
207
|
+
const client = prismicCustomTypesClient.createClient({
|
|
208
|
+
endpoint: API_ENDPOINTS.PrismicLegacyCustomTypesApi,
|
|
209
|
+
repositoryName,
|
|
210
|
+
token: authenticationToken,
|
|
211
|
+
fetch,
|
|
212
|
+
fetchOptions: {
|
|
213
|
+
headers: {
|
|
214
|
+
"User-Agent": PRISMIC_CLI_USER_AGENT,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
return await client.getAllCustomTypes();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPluginSystemRunner,
|
|
3
|
+
Plugin,
|
|
4
|
+
PluginSystemRunner,
|
|
5
|
+
} from "@prismicio/plugin-kit";
|
|
6
|
+
|
|
7
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
8
|
+
import { BaseManager } from "../BaseManager";
|
|
9
|
+
import { PrismicManager } from "../PrismicManager";
|
|
10
|
+
|
|
11
|
+
type PluginsManagerConfig = {
|
|
12
|
+
nativePlugins?: Record<string, Plugin>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class PluginsManager extends BaseManager {
|
|
16
|
+
private _nativePlugins: Record<string, Plugin>;
|
|
17
|
+
|
|
18
|
+
constructor(prismicManager: PrismicManager, config: PluginsManagerConfig) {
|
|
19
|
+
super(prismicManager);
|
|
20
|
+
|
|
21
|
+
this._nativePlugins = config.nativePlugins ?? {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async initPlugins(): Promise<void> {
|
|
25
|
+
const projectRoot = await this.project.getRoot();
|
|
26
|
+
const prismicConfig = await this.project.getPrismicConfig();
|
|
27
|
+
|
|
28
|
+
this.pluginSystemRunner = createPluginSystemRunner({
|
|
29
|
+
project: {
|
|
30
|
+
root: projectRoot,
|
|
31
|
+
config: prismicConfig,
|
|
32
|
+
},
|
|
33
|
+
nativePlugins: this._nativePlugins,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
await this.pluginSystemRunner.init();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
dangerouslyCallHook: PluginSystemRunner["callHook"] = (...args) => {
|
|
40
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
41
|
+
|
|
42
|
+
return this.pluginSystemRunner.callHook(...args);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import fetch, { Response } from "node-fetch";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
5
|
+
import { PRISMIC_CLI_USER_AGENT } from "../../constants/PRISMIC_CLI_USER_AGENT";
|
|
6
|
+
import { decode } from "../../lib/decode";
|
|
7
|
+
import { BaseManager } from "../BaseManager";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
PrismicRepository,
|
|
11
|
+
PrismicRepositoryRole,
|
|
12
|
+
PrismicRepositorySchema,
|
|
13
|
+
} from "./types";
|
|
14
|
+
|
|
15
|
+
type PrismicRepositoryManagerCheckExistsArgs = {
|
|
16
|
+
domain: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class PrismicRepositoryManager extends BaseManager {
|
|
20
|
+
async readAll(): Promise<PrismicRepository[]> {
|
|
21
|
+
const url = new URL("./repositories", API_ENDPOINTS.PrismicLegacyUserApi);
|
|
22
|
+
const res = await this._fetch({ url });
|
|
23
|
+
|
|
24
|
+
if (res.ok) {
|
|
25
|
+
const json = await res.json();
|
|
26
|
+
const { value: repositories, error } = decode(
|
|
27
|
+
z.array(PrismicRepositorySchema),
|
|
28
|
+
json,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (error) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Failed to decode repositories: ${error.errors.join(", ")}`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return repositories;
|
|
38
|
+
} else {
|
|
39
|
+
const text = await res.text();
|
|
40
|
+
throw new Error(`Failed to read repositories`, { cause: text });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
hasWriteAccess(repository: PrismicRepository): boolean {
|
|
45
|
+
switch (repository.role) {
|
|
46
|
+
case PrismicRepositoryRole.SuperUser:
|
|
47
|
+
case PrismicRepositoryRole.Owner:
|
|
48
|
+
case PrismicRepositoryRole.Administrator:
|
|
49
|
+
return true;
|
|
50
|
+
|
|
51
|
+
default:
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async checkExists(
|
|
57
|
+
args: PrismicRepositoryManagerCheckExistsArgs,
|
|
58
|
+
): Promise<boolean> {
|
|
59
|
+
const url = new URL(
|
|
60
|
+
`./app/dashboard/repositories/${args.domain}/exists`,
|
|
61
|
+
API_ENDPOINTS.PrismicWroom,
|
|
62
|
+
);
|
|
63
|
+
const res = await this._fetch({
|
|
64
|
+
url,
|
|
65
|
+
skipAuthentication: true,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const text = await res.text();
|
|
69
|
+
|
|
70
|
+
if (res.ok) {
|
|
71
|
+
return text === "false"; // Endpoint returns `false` when repository exists
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`Failed to check repository existence for domain \`${args.domain}\``,
|
|
75
|
+
{ cause: text },
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private async _fetch(args: {
|
|
81
|
+
url: URL;
|
|
82
|
+
method?: "GET" | "POST" | "PATCH";
|
|
83
|
+
body?: unknown;
|
|
84
|
+
repository?: string;
|
|
85
|
+
skipAuthentication?: boolean;
|
|
86
|
+
}): Promise<Response> {
|
|
87
|
+
let token;
|
|
88
|
+
try {
|
|
89
|
+
token = await this.user.getAuthenticationToken();
|
|
90
|
+
} catch (e) {
|
|
91
|
+
if (!args.skipAuthentication) {
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const extraHeaders: Record<string, string> = {};
|
|
97
|
+
|
|
98
|
+
if (args.body) {
|
|
99
|
+
extraHeaders["Content-Type"] = "application/json";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (args.repository) {
|
|
103
|
+
extraHeaders.repository = args.repository;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return await fetch(args.url.toString(), {
|
|
107
|
+
method: args.method,
|
|
108
|
+
body: args.body ? JSON.stringify(args.body) : undefined,
|
|
109
|
+
headers: {
|
|
110
|
+
...(token !== undefined
|
|
111
|
+
? {
|
|
112
|
+
Authorization: `Bearer ${token}`,
|
|
113
|
+
}
|
|
114
|
+
: {}),
|
|
115
|
+
"User-Agent": PRISMIC_CLI_USER_AGENT,
|
|
116
|
+
...extraHeaders,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|