@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,23 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
export enum PrismicRepositoryRole {
|
|
4
|
+
SuperUser = "SuperUser",
|
|
5
|
+
Administrator = "Administrator",
|
|
6
|
+
Owner = "Owner",
|
|
7
|
+
Manager = "Manager",
|
|
8
|
+
Publisher = "Publisher",
|
|
9
|
+
Writer = "Writer",
|
|
10
|
+
Readonly = "Readonly",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type PrismicRepositoryRoles = PrismicRepositoryRole;
|
|
14
|
+
|
|
15
|
+
export const PrismicRepositorySchema = z.object({
|
|
16
|
+
domain: z.string(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
role: z.union([
|
|
19
|
+
z.enum(PrismicRepositoryRole),
|
|
20
|
+
z.record(z.string(), z.enum(PrismicRepositoryRole)),
|
|
21
|
+
]),
|
|
22
|
+
});
|
|
23
|
+
export type PrismicRepository = z.infer<typeof PrismicRepositorySchema>;
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { detect as niDetect } from "@antfu/ni";
|
|
6
|
+
import { type ResultPromise } from "execa";
|
|
7
|
+
|
|
8
|
+
import { PRISMIC_CONFIG_FILENAME } from "../../constants/PRISMIC_CONFIG_FILENAME";
|
|
9
|
+
import { SLICEMACHINE_CONFIG_FILENAME } from "../../constants/SLICEMACHINE_CONFIG_FILENAME";
|
|
10
|
+
import { TS_CONFIG_FILENAME } from "../../constants/TS_CONFIG_FILENAME";
|
|
11
|
+
import { PrismicError, InternalError } from "../../errors";
|
|
12
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
13
|
+
import { decodePrismicConfig } from "../../lib/decodePrismicConfig";
|
|
14
|
+
import { format } from "../../lib/format";
|
|
15
|
+
import { installDependencies } from "../../lib/installDependencies";
|
|
16
|
+
import { locateFileUpward } from "../../lib/locateFileUpward";
|
|
17
|
+
import { PackageManager, PrismicConfig } from "../../types";
|
|
18
|
+
import { BaseManager } from "../BaseManager";
|
|
19
|
+
|
|
20
|
+
type ProjectManagerGetPrismicConfigPathArgs = {
|
|
21
|
+
ignoreCache?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type ProjectManagerGetRootArgs = {
|
|
25
|
+
ignoreCache?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type ProjectManagerCheckIsTypeScriptArgs = {
|
|
29
|
+
rootOverride?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type ProjectManagerWritePrismicConfigArgs = {
|
|
33
|
+
config: PrismicConfig;
|
|
34
|
+
path?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type ProjectManagerInitProjectArgs = {
|
|
38
|
+
log?: (message: string) => void;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type ProjectManagerDetectPackageManager = {
|
|
42
|
+
root?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type ProjectManagerInstallDependenciesArgs = {
|
|
46
|
+
dependencies: Record<string, string>;
|
|
47
|
+
dev?: boolean;
|
|
48
|
+
packageManager?: PackageManager;
|
|
49
|
+
log?: (message: string) => void;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type ProjectManagerInstallDependenciesReturnType = {
|
|
53
|
+
execaProcess: ResultPromise;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class ProjectManager extends BaseManager {
|
|
57
|
+
private _cachedRoot: string | undefined;
|
|
58
|
+
private _cachedPrismicConfigPath: string | undefined;
|
|
59
|
+
private _cachedPrismicConfig: PrismicConfig | undefined;
|
|
60
|
+
|
|
61
|
+
async getPrismicConfigPath(
|
|
62
|
+
args?: ProjectManagerGetPrismicConfigPathArgs,
|
|
63
|
+
): Promise<string> {
|
|
64
|
+
if (this._cachedPrismicConfigPath && !args?.ignoreCache) {
|
|
65
|
+
return this._cachedPrismicConfigPath;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
this._cachedPrismicConfigPath = await locateFileUpward(
|
|
70
|
+
PRISMIC_CONFIG_FILENAME,
|
|
71
|
+
{ startDir: this.cwd },
|
|
72
|
+
);
|
|
73
|
+
} catch {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`Could not find a ${PRISMIC_CONFIG_FILENAME} file. Please create a config file at the root of your project.`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return this._cachedPrismicConfigPath;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async getRoot(args?: ProjectManagerGetRootArgs): Promise<string> {
|
|
83
|
+
if (this._cachedRoot && !args?.ignoreCache) {
|
|
84
|
+
return this._cachedRoot;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const prismicConfigFilePath = await this.getPrismicConfigPath({
|
|
88
|
+
ignoreCache: args?.ignoreCache,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
this._cachedRoot = path.dirname(prismicConfigFilePath);
|
|
92
|
+
|
|
93
|
+
return this._cachedRoot;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async suggestRoot(): Promise<string> {
|
|
97
|
+
const suggestedRootPackageJSON = await locateFileUpward("package.json", {
|
|
98
|
+
startDir: this.cwd,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return path.dirname(suggestedRootPackageJSON);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async suggestPrismicConfigPath(): Promise<string> {
|
|
105
|
+
const suggestedRoot = await this.suggestRoot();
|
|
106
|
+
|
|
107
|
+
return path.resolve(suggestedRoot, PRISMIC_CONFIG_FILENAME);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async checkIsTypeScript(
|
|
111
|
+
args?: ProjectManagerCheckIsTypeScriptArgs,
|
|
112
|
+
): Promise<boolean> {
|
|
113
|
+
const root = args?.rootOverride || (await this.getRoot());
|
|
114
|
+
const rootTSConfigPath = path.resolve(root, TS_CONFIG_FILENAME);
|
|
115
|
+
|
|
116
|
+
// We just care if the file exists, we don't need access to it
|
|
117
|
+
return existsSync(rootTSConfigPath);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async getPrismicConfig(): Promise<PrismicConfig> {
|
|
121
|
+
if (this._cachedPrismicConfig) {
|
|
122
|
+
return this._cachedPrismicConfig;
|
|
123
|
+
} else {
|
|
124
|
+
return await this.loadPrismicConfig();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async writePrismicConfig(
|
|
129
|
+
args: ProjectManagerWritePrismicConfigArgs,
|
|
130
|
+
): Promise<void> {
|
|
131
|
+
const configFilePath = args.path || (await this.getPrismicConfigPath());
|
|
132
|
+
|
|
133
|
+
const config = await format(
|
|
134
|
+
JSON.stringify(args.config, null, 2),
|
|
135
|
+
configFilePath,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
await fs.writeFile(configFilePath, config, "utf-8");
|
|
139
|
+
|
|
140
|
+
// Clear config cache
|
|
141
|
+
delete this._cachedPrismicConfig;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async loadPrismicConfig(): Promise<PrismicConfig> {
|
|
145
|
+
const configFilePath = await this.getPrismicConfigPath();
|
|
146
|
+
|
|
147
|
+
let rawConfig: unknown | undefined;
|
|
148
|
+
try {
|
|
149
|
+
const contents = await fs.readFile(configFilePath, "utf8");
|
|
150
|
+
rawConfig = JSON.parse(contents);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (error instanceof SyntaxError) {
|
|
153
|
+
throw new PrismicError(
|
|
154
|
+
`Could not parse config file at ${configFilePath}.\n\nError Message: ${error.message}`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Noop, more specific error is thrown after
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!rawConfig) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
"No Prismic config found, please initialize your project with Prismic first.",
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const { value: prismicConfig, error } = decodePrismicConfig(rawConfig);
|
|
168
|
+
|
|
169
|
+
if (error) {
|
|
170
|
+
throw new Error(`Invalid Prismic config. ${error.errors.join(", ")}`, {
|
|
171
|
+
cause: { rawConfig },
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this._cachedPrismicConfig = prismicConfig;
|
|
176
|
+
|
|
177
|
+
return prismicConfig;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async getRepositoryName(): Promise<string> {
|
|
181
|
+
const prismicConfig = await this.getPrismicConfig();
|
|
182
|
+
|
|
183
|
+
return prismicConfig.repositoryName;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async checkLegacyConfigExists(): Promise<boolean> {
|
|
187
|
+
try {
|
|
188
|
+
await locateFileUpward(SLICEMACHINE_CONFIG_FILENAME, {
|
|
189
|
+
startDir: this.cwd,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
return true;
|
|
193
|
+
} catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async migrateLegacyConfig(): Promise<void> {
|
|
199
|
+
const suggestedRoot = await this.suggestRoot();
|
|
200
|
+
const legacyConfigPath = path.resolve(
|
|
201
|
+
suggestedRoot,
|
|
202
|
+
SLICEMACHINE_CONFIG_FILENAME,
|
|
203
|
+
);
|
|
204
|
+
const newConfigPath = path.resolve(suggestedRoot, PRISMIC_CONFIG_FILENAME);
|
|
205
|
+
|
|
206
|
+
// Check if legacy config exists
|
|
207
|
+
try {
|
|
208
|
+
await fs.access(legacyConfigPath);
|
|
209
|
+
} catch {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`Legacy config file ${SLICEMACHINE_CONFIG_FILENAME} not found.`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Check if new config already exists
|
|
216
|
+
try {
|
|
217
|
+
await fs.access(newConfigPath);
|
|
218
|
+
throw new Error(
|
|
219
|
+
`Cannot migrate: ${PRISMIC_CONFIG_FILENAME} already exists.`,
|
|
220
|
+
);
|
|
221
|
+
} catch {
|
|
222
|
+
// File doesn't exist, which is what we want
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const legacyConfigContent = await fs.readFile(legacyConfigPath, "utf8");
|
|
226
|
+
|
|
227
|
+
// Parse and validate the config
|
|
228
|
+
let rawConfig: unknown;
|
|
229
|
+
try {
|
|
230
|
+
rawConfig = JSON.parse(legacyConfigContent);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
if (error instanceof SyntaxError) {
|
|
233
|
+
throw new PrismicError(
|
|
234
|
+
`Could not parse legacy config file at ${legacyConfigPath}.\n\nError Message: ${error.message}`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const { value: prismicConfig, error } = decodePrismicConfig(rawConfig);
|
|
241
|
+
|
|
242
|
+
if (error) {
|
|
243
|
+
throw new Error(
|
|
244
|
+
`Invalid legacy Prismic config. ${error.errors.join(", ")}`,
|
|
245
|
+
{
|
|
246
|
+
cause: { rawConfig },
|
|
247
|
+
},
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Format and write the new config
|
|
252
|
+
const formattedConfig = await format(
|
|
253
|
+
JSON.stringify(prismicConfig, null, 2),
|
|
254
|
+
newConfigPath,
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
await fs.writeFile(newConfigPath, formattedConfig, "utf-8");
|
|
258
|
+
|
|
259
|
+
// Remove legacy config file
|
|
260
|
+
await fs.unlink(legacyConfigPath);
|
|
261
|
+
|
|
262
|
+
// Clear caches
|
|
263
|
+
delete this._cachedPrismicConfig;
|
|
264
|
+
delete this._cachedPrismicConfigPath;
|
|
265
|
+
delete this._cachedRoot;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async initProject(args?: ProjectManagerInitProjectArgs): Promise<void> {
|
|
269
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
270
|
+
|
|
271
|
+
// eslint-disable-next-line no-console
|
|
272
|
+
const log = args?.log || console.log.bind(this);
|
|
273
|
+
|
|
274
|
+
const { errors } = await this.pluginSystemRunner.callHook("project:init", {
|
|
275
|
+
log,
|
|
276
|
+
installDependencies: async (args) => {
|
|
277
|
+
const { execaProcess } = await this.installDependencies({
|
|
278
|
+
dependencies: args.dependencies,
|
|
279
|
+
dev: args.dev,
|
|
280
|
+
log,
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
await execaProcess;
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
if (errors.length > 0) {
|
|
288
|
+
throw new PrismicError(
|
|
289
|
+
`Failed to initialize project: ${errors.join(", ")}`,
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async detectPackageManager(
|
|
295
|
+
args?: ProjectManagerDetectPackageManager,
|
|
296
|
+
): Promise<PackageManager> {
|
|
297
|
+
const projectRoot = args?.root || (await this.getRoot());
|
|
298
|
+
|
|
299
|
+
const packageManager = await niDetect({
|
|
300
|
+
autoInstall: true,
|
|
301
|
+
cwd: projectRoot,
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
return packageManager || "npm";
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async installDependencies(
|
|
308
|
+
args: ProjectManagerInstallDependenciesArgs,
|
|
309
|
+
): Promise<ProjectManagerInstallDependenciesReturnType> {
|
|
310
|
+
const packageManager =
|
|
311
|
+
args.packageManager || (await this.detectPackageManager());
|
|
312
|
+
|
|
313
|
+
// eslint-disable-next-line no-console
|
|
314
|
+
const log = args.log || console.log.bind(this);
|
|
315
|
+
|
|
316
|
+
const wrappedLogger = (data: Buffer | string | null) => {
|
|
317
|
+
if (data instanceof Buffer) {
|
|
318
|
+
log(data.toString());
|
|
319
|
+
} else if (typeof data === "string") {
|
|
320
|
+
log(data);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
const { execaProcess } = await installDependencies({
|
|
326
|
+
packageManager,
|
|
327
|
+
dependencies: args.dependencies,
|
|
328
|
+
dev: args.dev,
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
// Don't clutter console with logs when process is non TTY (CI, etc.)
|
|
332
|
+
if (process.stdout.isTTY || process.env.NODE_ENV === "test") {
|
|
333
|
+
execaProcess.stdout?.on("data", wrappedLogger);
|
|
334
|
+
}
|
|
335
|
+
execaProcess.stderr?.on("data", wrappedLogger);
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
execaProcess,
|
|
339
|
+
};
|
|
340
|
+
} catch (error) {
|
|
341
|
+
if (
|
|
342
|
+
error instanceof Error &&
|
|
343
|
+
"shortMessage" in error &&
|
|
344
|
+
"stderr" in error
|
|
345
|
+
) {
|
|
346
|
+
throw new InternalError("Package installation failed", {
|
|
347
|
+
cause: error,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
throw error;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import * as prismicCustomTypesClient from "@prismicio/custom-types-client";
|
|
2
|
+
import {
|
|
3
|
+
CallHookReturnType,
|
|
4
|
+
HookError,
|
|
5
|
+
SliceCreateHook,
|
|
6
|
+
SliceCreateHookData,
|
|
7
|
+
SliceLibraryReadHookData,
|
|
8
|
+
SliceReadHookData,
|
|
9
|
+
SliceRenameHook,
|
|
10
|
+
SliceRenameHookData,
|
|
11
|
+
SliceUpdateHook,
|
|
12
|
+
} from "@prismicio/plugin-kit";
|
|
13
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
14
|
+
import fetch from "node-fetch";
|
|
15
|
+
import * as z from "zod";
|
|
16
|
+
|
|
17
|
+
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
18
|
+
import { PRISMIC_CLI_USER_AGENT } from "../../constants/PRISMIC_CLI_USER_AGENT";
|
|
19
|
+
import { DecodeError } from "../../lib/DecodeError";
|
|
20
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
21
|
+
import { decodeHookResult } from "../../lib/decodeHookResult";
|
|
22
|
+
import { SharedSliceSchema } from "../../lib/typesInternalSchemas";
|
|
23
|
+
import { OnlyHookErrors } from "../../types";
|
|
24
|
+
import { BaseManager } from "../BaseManager";
|
|
25
|
+
|
|
26
|
+
type SlicesManagerReadSliceLibraryReturnType = {
|
|
27
|
+
sliceIDs: string[];
|
|
28
|
+
errors: (DecodeError | HookError)[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type SlicesManagerReadAllSliceLibrariesReturnType = {
|
|
32
|
+
libraries: {
|
|
33
|
+
libraryID: string;
|
|
34
|
+
sliceIDs: string[] | undefined;
|
|
35
|
+
}[];
|
|
36
|
+
errors: (DecodeError | HookError)[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type PrismicManagerReadAllSlicesForLibraryArgs = {
|
|
40
|
+
libraryID: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type PrismicManagerUpdateSliceArgs = {
|
|
44
|
+
libraryID: string;
|
|
45
|
+
model: TypesInternal.SharedSlice;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type PrismicManagerReadAllSlicesForLibraryReturnType = {
|
|
49
|
+
models: { model: TypesInternal.SharedSlice }[];
|
|
50
|
+
errors: (DecodeError | HookError)[];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type PrismicManagerReadAllSlicesReturnType = {
|
|
54
|
+
models: {
|
|
55
|
+
libraryID: string;
|
|
56
|
+
model: TypesInternal.SharedSlice;
|
|
57
|
+
}[];
|
|
58
|
+
errors: (DecodeError | HookError)[];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type PrismicManagerReadSliceReturnType = {
|
|
62
|
+
model: TypesInternal.SharedSlice | undefined;
|
|
63
|
+
errors: (DecodeError | HookError)[];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type PrismicManagerDeleteSliceArgs = {
|
|
67
|
+
libraryID: string;
|
|
68
|
+
sliceID: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type PrismicManagerDeleteSliceReturnType = {
|
|
72
|
+
errors: (DecodeError | HookError)[];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export class SlicesManager extends BaseManager {
|
|
76
|
+
async readSliceLibrary(
|
|
77
|
+
args: SliceLibraryReadHookData,
|
|
78
|
+
): Promise<SlicesManagerReadSliceLibraryReturnType> {
|
|
79
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
80
|
+
|
|
81
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
82
|
+
"slice-library:read",
|
|
83
|
+
args,
|
|
84
|
+
);
|
|
85
|
+
const { data, errors } = decodeHookResult(
|
|
86
|
+
z.object({
|
|
87
|
+
id: z.string(),
|
|
88
|
+
sliceIDs: z.array(z.string()),
|
|
89
|
+
}),
|
|
90
|
+
hookResult,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
sliceIDs: data[0]?.sliceIDs ?? [],
|
|
95
|
+
errors: errors,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async getDefaultLibraryID(): Promise<string> {
|
|
100
|
+
const prismicConfig = await this.project.getPrismicConfig();
|
|
101
|
+
const libraryIDs = prismicConfig.libraries || [];
|
|
102
|
+
|
|
103
|
+
return libraryIDs[0];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async readAllSliceLibraries(): Promise<SlicesManagerReadAllSliceLibrariesReturnType> {
|
|
107
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
108
|
+
|
|
109
|
+
const prismicConfig = await this.project.getPrismicConfig();
|
|
110
|
+
const libraryIDs = prismicConfig.libraries || [];
|
|
111
|
+
|
|
112
|
+
const res: SlicesManagerReadAllSliceLibrariesReturnType = {
|
|
113
|
+
libraries: [],
|
|
114
|
+
errors: [],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
for (const libraryID of libraryIDs) {
|
|
118
|
+
const { sliceIDs, errors } = await this.readSliceLibrary({
|
|
119
|
+
libraryID,
|
|
120
|
+
});
|
|
121
|
+
res.errors = [...res.errors, ...errors];
|
|
122
|
+
|
|
123
|
+
res.libraries.push({
|
|
124
|
+
libraryID,
|
|
125
|
+
sliceIDs,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return res;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async readAllSlicesForLibrary(
|
|
133
|
+
args: PrismicManagerReadAllSlicesForLibraryArgs,
|
|
134
|
+
): Promise<PrismicManagerReadAllSlicesForLibraryReturnType> {
|
|
135
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
136
|
+
|
|
137
|
+
const res: PrismicManagerReadAllSlicesForLibraryReturnType = {
|
|
138
|
+
models: [],
|
|
139
|
+
errors: [],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const { sliceIDs, errors } = await this.readSliceLibrary({
|
|
143
|
+
libraryID: args.libraryID,
|
|
144
|
+
});
|
|
145
|
+
res.errors.push(...errors);
|
|
146
|
+
|
|
147
|
+
if (sliceIDs) {
|
|
148
|
+
for (const sliceID of sliceIDs) {
|
|
149
|
+
const { model, errors } = await this.readSlice({
|
|
150
|
+
libraryID: args.libraryID,
|
|
151
|
+
sliceID,
|
|
152
|
+
});
|
|
153
|
+
res.errors.push(...errors);
|
|
154
|
+
|
|
155
|
+
if (model) {
|
|
156
|
+
res.models.push({ model });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return res;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async readAllSlices(): Promise<PrismicManagerReadAllSlicesReturnType> {
|
|
165
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
166
|
+
|
|
167
|
+
const prismicConfig = await this.project.getPrismicConfig();
|
|
168
|
+
const libraryIDs = prismicConfig.libraries || [];
|
|
169
|
+
|
|
170
|
+
const res: PrismicManagerReadAllSlicesReturnType = {
|
|
171
|
+
models: [],
|
|
172
|
+
errors: [],
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
for (const libraryID of libraryIDs) {
|
|
176
|
+
const { models, errors } = await this.readAllSlicesForLibrary({
|
|
177
|
+
libraryID,
|
|
178
|
+
});
|
|
179
|
+
res.errors.push(...errors);
|
|
180
|
+
|
|
181
|
+
for (const model of models) {
|
|
182
|
+
res.models.push({
|
|
183
|
+
libraryID,
|
|
184
|
+
model: model.model,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return res;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async createSlice(
|
|
193
|
+
args: SliceCreateHookData,
|
|
194
|
+
): Promise<OnlyHookErrors<CallHookReturnType<SliceCreateHook>>> {
|
|
195
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
196
|
+
|
|
197
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
198
|
+
"slice:create",
|
|
199
|
+
args,
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
errors: hookResult.errors,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async readSlice(
|
|
208
|
+
args: SliceReadHookData,
|
|
209
|
+
): Promise<PrismicManagerReadSliceReturnType> {
|
|
210
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
211
|
+
|
|
212
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
213
|
+
"slice:read",
|
|
214
|
+
args,
|
|
215
|
+
);
|
|
216
|
+
const { data, errors } = decodeHookResult(
|
|
217
|
+
z.object({
|
|
218
|
+
model: SharedSliceSchema,
|
|
219
|
+
}),
|
|
220
|
+
hookResult,
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
model: data[0]?.model,
|
|
225
|
+
errors: errors.map((error) => {
|
|
226
|
+
error.message = `Failed to decode slice model with id '${args.sliceID}': ${error.message}`;
|
|
227
|
+
|
|
228
|
+
return error;
|
|
229
|
+
}),
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async updateSlice(
|
|
234
|
+
args: PrismicManagerUpdateSliceArgs,
|
|
235
|
+
): Promise<OnlyHookErrors<CallHookReturnType<SliceUpdateHook>>> {
|
|
236
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
237
|
+
|
|
238
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
239
|
+
"slice:update",
|
|
240
|
+
args,
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
errors: [...hookResult.errors],
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async renameSlice(
|
|
249
|
+
args: SliceRenameHookData,
|
|
250
|
+
): Promise<OnlyHookErrors<CallHookReturnType<SliceRenameHook>>> {
|
|
251
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
252
|
+
|
|
253
|
+
const hookResult = await this.pluginSystemRunner.callHook(
|
|
254
|
+
"slice:rename",
|
|
255
|
+
args,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
errors: hookResult.errors,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async deleteSlice(
|
|
264
|
+
args: PrismicManagerDeleteSliceArgs,
|
|
265
|
+
): Promise<PrismicManagerDeleteSliceReturnType> {
|
|
266
|
+
assertPluginsInitialized(this.pluginSystemRunner);
|
|
267
|
+
|
|
268
|
+
const { model, errors: readSliceErrors } = await this.readSlice({
|
|
269
|
+
libraryID: args.libraryID,
|
|
270
|
+
sliceID: args.sliceID,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
if (model) {
|
|
274
|
+
const { errors: deleteSliceErrors } =
|
|
275
|
+
await this.pluginSystemRunner.callHook("slice:delete", {
|
|
276
|
+
model,
|
|
277
|
+
libraryID: args.libraryID,
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
return {
|
|
281
|
+
errors: deleteSliceErrors,
|
|
282
|
+
};
|
|
283
|
+
} else {
|
|
284
|
+
return {
|
|
285
|
+
errors: readSliceErrors,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async fetchRemoteSlices(): Promise<TypesInternal.SharedSlice[]> {
|
|
291
|
+
const authenticationToken = await this.user.getAuthenticationToken();
|
|
292
|
+
const repositoryName = await this.project.getRepositoryName();
|
|
293
|
+
|
|
294
|
+
const client = prismicCustomTypesClient.createClient({
|
|
295
|
+
endpoint: API_ENDPOINTS.PrismicLegacyCustomTypesApi,
|
|
296
|
+
repositoryName,
|
|
297
|
+
token: authenticationToken,
|
|
298
|
+
fetch,
|
|
299
|
+
fetchOptions: {
|
|
300
|
+
headers: {
|
|
301
|
+
"User-Agent": PRISMIC_CLI_USER_AGENT,
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
return await client.getAllSharedSlices();
|
|
307
|
+
}
|
|
308
|
+
}
|