@slicemachine/manager 0.0.0-alpha.dev-new-release-process.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/README.md +85 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.cjs +68 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.js +68 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.cjs +43 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.js +43 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.cjs +804 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.js +804 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.cjs +354 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.js +354 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.cjs +14 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.js +14 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.cjs +65 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.js +65 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/decode.cjs +14 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/decode.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/decode.js +14 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/decode.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/encode.cjs +13 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/encode.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/encode.js +13 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/encode.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.cjs +91 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.js +91 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.cjs +31 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.js +31 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.cjs +7 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.js +7 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.cjs +23 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.js +23 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.js.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.cjs +132 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.cjs.map +1 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.js +132 -0
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.js.map +1 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.cjs +135 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.cjs.map +1 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js +136 -0
- package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js.map +1 -0
- package/dist/_node_modules/common-tags/es/commaLists/commaLists.cjs +7 -0
- package/dist/_node_modules/common-tags/es/commaLists/commaLists.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/commaListsAnd/commaListsAnd.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/commaListsOr/commaListsOr.cjs.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.cjs +9 -0
- package/dist/_node_modules/common-tags/es/html/html.cjs.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.cjs +32 -0
- package/dist/_node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/inlineLists/inlineLists.cjs.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.cjs +6 -0
- package/dist/_node_modules/common-tags/es/oneLine/oneLine.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.cjs.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.cjs +7 -0
- package/dist/_node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.cjs.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.cjs +6 -0
- package/dist/_node_modules/common-tags/es/oneLineTrim/oneLineTrim.cjs.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.cjs +19 -0
- package/dist/_node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.cjs.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.cjs +13 -0
- package/dist/_node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.cjs.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.cjs +17 -0
- package/dist/_node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.cjs.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.cjs +9 -0
- package/dist/_node_modules/common-tags/es/safeHtml/safeHtml.cjs.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.cjs +17 -0
- package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.cjs.map +1 -0
- package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js +18 -0
- package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.cjs +8 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.cjs.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js +9 -0
- package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js.map +1 -0
- package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.cjs +35 -0
- package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.cjs.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.cjs +6 -0
- package/dist/_node_modules/common-tags/es/stripIndents/stripIndents.cjs.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.cjs +21 -0
- package/dist/_node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.cjs.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/cross-spawn/index.cjs +30 -0
- package/dist/_node_modules/cross-spawn/index.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/index.js +31 -0
- package/dist/_node_modules/cross-spawn/index.js.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/enoent.cjs +47 -0
- package/dist/_node_modules/cross-spawn/lib/enoent.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/enoent.js +47 -0
- package/dist/_node_modules/cross-spawn/lib/enoent.js.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/parse.cjs +64 -0
- package/dist/_node_modules/cross-spawn/lib/parse.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/parse.js +64 -0
- package/dist/_node_modules/cross-spawn/lib/parse.js.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/escape.cjs +22 -0
- package/dist/_node_modules/cross-spawn/lib/util/escape.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/escape.js +23 -0
- package/dist/_node_modules/cross-spawn/lib/util/escape.js.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.cjs +21 -0
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.js +21 -0
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.js.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.cjs +42 -0
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.cjs.map +1 -0
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.js +42 -0
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.js.map +1 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs +41 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.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/execa/_node_modules/get-stream/buffer-stream.cjs +43 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/buffer-stream.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/buffer-stream.js +43 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/buffer-stream.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/index.cjs +59 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/index.js +60 -0
- package/dist/_node_modules/execa/_node_modules/get-stream/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/core.cjs +275 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/core.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/core.js +275 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/core.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/main.cjs +53 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/main.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/main.js +53 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/main.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/realtime.cjs +18 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/realtime.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/realtime.js +18 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/realtime.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/signals.cjs +27 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/signals.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/signals.js +27 -0
- package/dist/_node_modules/execa/_node_modules/human-signals/build/src/signals.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/is-stream/index.cjs +11 -0
- package/dist/_node_modules/execa/_node_modules/is-stream/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/is-stream/index.js +11 -0
- package/dist/_node_modules/execa/_node_modules/is-stream/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/mimic-fn/index.cjs +46 -0
- package/dist/_node_modules/execa/_node_modules/mimic-fn/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/mimic-fn/index.js +47 -0
- package/dist/_node_modules/execa/_node_modules/mimic-fn/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/npm-run-path/index.cjs +34 -0
- package/dist/_node_modules/execa/_node_modules/npm-run-path/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/npm-run-path/index.js +34 -0
- package/dist/_node_modules/execa/_node_modules/npm-run-path/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/onetime/index.cjs +32 -0
- package/dist/_node_modules/execa/_node_modules/onetime/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/onetime/index.js +33 -0
- package/dist/_node_modules/execa/_node_modules/onetime/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/path-key/index.cjs +13 -0
- package/dist/_node_modules/execa/_node_modules/path-key/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/path-key/index.js +14 -0
- package/dist/_node_modules/execa/_node_modules/path-key/index.js.map +1 -0
- package/dist/_node_modules/execa/_node_modules/strip-final-newline/index.cjs +14 -0
- package/dist/_node_modules/execa/_node_modules/strip-final-newline/index.cjs.map +1 -0
- package/dist/_node_modules/execa/_node_modules/strip-final-newline/index.js +15 -0
- package/dist/_node_modules/execa/_node_modules/strip-final-newline/index.js.map +1 -0
- package/dist/_node_modules/execa/index.cjs +147 -0
- package/dist/_node_modules/execa/index.cjs.map +1 -0
- package/dist/_node_modules/execa/index.js +147 -0
- package/dist/_node_modules/execa/index.js.map +1 -0
- package/dist/_node_modules/execa/lib/command.cjs +37 -0
- package/dist/_node_modules/execa/lib/command.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/command.js +37 -0
- package/dist/_node_modules/execa/lib/command.js.map +1 -0
- package/dist/_node_modules/execa/lib/error.cjs +73 -0
- package/dist/_node_modules/execa/lib/error.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/error.js +73 -0
- package/dist/_node_modules/execa/lib/error.js.map +1 -0
- package/dist/_node_modules/execa/lib/kill.cjs +80 -0
- package/dist/_node_modules/execa/lib/kill.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/kill.js +80 -0
- package/dist/_node_modules/execa/lib/kill.js.map +1 -0
- package/dist/_node_modules/execa/lib/pipe.cjs +37 -0
- package/dist/_node_modules/execa/lib/pipe.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/pipe.js +37 -0
- package/dist/_node_modules/execa/lib/pipe.js.map +1 -0
- package/dist/_node_modules/execa/lib/promise.cjs +30 -0
- package/dist/_node_modules/execa/lib/promise.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/promise.js +30 -0
- package/dist/_node_modules/execa/lib/promise.js.map +1 -0
- package/dist/_node_modules/execa/lib/stdio.cjs +26 -0
- package/dist/_node_modules/execa/lib/stdio.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/stdio.js +26 -0
- package/dist/_node_modules/execa/lib/stdio.js.map +1 -0
- package/dist/_node_modules/execa/lib/stream.cjs +81 -0
- package/dist/_node_modules/execa/lib/stream.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/stream.js +81 -0
- package/dist/_node_modules/execa/lib/stream.js.map +1 -0
- package/dist/_node_modules/execa/lib/verbose.cjs +20 -0
- package/dist/_node_modules/execa/lib/verbose.cjs.map +1 -0
- package/dist/_node_modules/execa/lib/verbose.js +20 -0
- package/dist/_node_modules/execa/lib/verbose.js.map +1 -0
- package/dist/_node_modules/fetch-blob/file.cjs +61 -0
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/file.js +61 -0
- package/dist/_node_modules/fetch-blob/file.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.cjs +223 -0
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/index.js +223 -0
- package/dist/_node_modules/fetch-blob/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.cjs +43 -0
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.js +42 -0
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/_node_modules/file-type/core.cjs +1234 -0
- package/dist/_node_modules/file-type/core.cjs.map +1 -0
- package/dist/_node_modules/file-type/core.js +1234 -0
- package/dist/_node_modules/file-type/core.js.map +1 -0
- package/dist/_node_modules/file-type/supported.cjs +308 -0
- package/dist/_node_modules/file-type/supported.cjs.map +1 -0
- package/dist/_node_modules/file-type/supported.js +308 -0
- package/dist/_node_modules/file-type/supported.js.map +1 -0
- package/dist/_node_modules/file-type/util.cjs +27 -0
- package/dist/_node_modules/file-type/util.cjs.map +1 -0
- package/dist/_node_modules/file-type/util.js +27 -0
- package/dist/_node_modules/file-type/util.js.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs +116 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js +116 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/_node_modules/fp-ts/es6/Either.cjs +18 -0
- package/dist/_node_modules/fp-ts/es6/Either.cjs.map +1 -0
- package/dist/_node_modules/fp-ts/es6/Either.js +18 -0
- package/dist/_node_modules/fp-ts/es6/Either.js.map +1 -0
- package/dist/_node_modules/fp-ts/es6/function.cjs +44 -0
- package/dist/_node_modules/fp-ts/es6/function.cjs.map +1 -0
- package/dist/_node_modules/fp-ts/es6/function.js +44 -0
- package/dist/_node_modules/fp-ts/es6/function.js.map +1 -0
- package/dist/_node_modules/fp-ts/es6/internal.cjs +18 -0
- package/dist/_node_modules/fp-ts/es6/internal.cjs.map +1 -0
- package/dist/_node_modules/fp-ts/es6/internal.js +18 -0
- package/dist/_node_modules/fp-ts/es6/internal.js.map +1 -0
- package/dist/_node_modules/get-port/index.cjs +113 -0
- package/dist/_node_modules/get-port/index.cjs.map +1 -0
- package/dist/_node_modules/get-port/index.js +114 -0
- package/dist/_node_modules/get-port/index.js.map +1 -0
- package/dist/_node_modules/isexe/index.cjs +56 -0
- package/dist/_node_modules/isexe/index.cjs.map +1 -0
- package/dist/_node_modules/isexe/index.js +56 -0
- package/dist/_node_modules/isexe/index.js.map +1 -0
- package/dist/_node_modules/isexe/mode.cjs +40 -0
- package/dist/_node_modules/isexe/mode.cjs.map +1 -0
- package/dist/_node_modules/isexe/mode.js +40 -0
- package/dist/_node_modules/isexe/mode.js.map +1 -0
- package/dist/_node_modules/isexe/windows.cjs +47 -0
- package/dist/_node_modules/isexe/windows.cjs.map +1 -0
- package/dist/_node_modules/isexe/windows.js +47 -0
- package/dist/_node_modules/isexe/windows.js.map +1 -0
- package/dist/_node_modules/merge-stream/index.cjs +39 -0
- package/dist/_node_modules/merge-stream/index.cjs.map +1 -0
- package/dist/_node_modules/merge-stream/index.js +40 -0
- package/dist/_node_modules/merge-stream/index.js.map +1 -0
- package/dist/_node_modules/node-domexception/index.cjs +11 -0
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
- package/dist/_node_modules/node-domexception/index.js +10 -0
- package/dist/_node_modules/node-domexception/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.cjs +262 -0
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.js +262 -0
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs +10 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.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.cjs +17 -0
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.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.cjs +19 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.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.cjs +190 -0
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.js +190 -0
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.cjs +292 -0
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.js +292 -0
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.cjs +206 -0
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.js +206 -0
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.cjs +122 -0
- package/dist/_node_modules/node-fetch/src/response.cjs.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.cjs +12 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.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.cjs +8 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.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.cjs +28 -0
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.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.cjs +356 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.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.cjs +149 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.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/p-limit/_node_modules/yocto-queue/index.cjs +89 -0
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.cjs.map +1 -0
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js +90 -0
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js.map +1 -0
- package/dist/_node_modules/p-limit/index.cjs +53 -0
- package/dist/_node_modules/p-limit/index.cjs.map +1 -0
- package/dist/_node_modules/p-limit/index.js +54 -0
- package/dist/_node_modules/p-limit/index.js.map +1 -0
- package/dist/_node_modules/path-key/index.cjs +16 -0
- package/dist/_node_modules/path-key/index.cjs.map +1 -0
- package/dist/_node_modules/path-key/index.js +16 -0
- package/dist/_node_modules/path-key/index.js.map +1 -0
- package/dist/_node_modules/peek-readable/lib/EndOfFileStream.cjs +11 -0
- package/dist/_node_modules/peek-readable/lib/EndOfFileStream.cjs.map +1 -0
- package/dist/_node_modules/peek-readable/lib/EndOfFileStream.js +11 -0
- package/dist/_node_modules/peek-readable/lib/EndOfFileStream.js.map +1 -0
- package/dist/_node_modules/r19/dist/R19Error.cjs +25 -0
- package/dist/_node_modules/r19/dist/R19Error.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/R19Error.js +25 -0
- package/dist/_node_modules/r19/dist/R19Error.js.map +1 -0
- package/dist/_node_modules/r19/dist/client/createRPCClient.cjs +90 -0
- package/dist/_node_modules/r19/dist/client/createRPCClient.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/client/createRPCClient.js +90 -0
- package/dist/_node_modules/r19/dist/client/createRPCClient.js.map +1 -0
- package/dist/_node_modules/r19/dist/createRPCMiddleware.cjs +36 -0
- package/dist/_node_modules/r19/dist/createRPCMiddleware.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/createRPCMiddleware.js +36 -0
- package/dist/_node_modules/r19/dist/createRPCMiddleware.js.map +1 -0
- package/dist/_node_modules/r19/dist/handleRPCRequest.cjs +121 -0
- package/dist/_node_modules/r19/dist/handleRPCRequest.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/handleRPCRequest.js +121 -0
- package/dist/_node_modules/r19/dist/handleRPCRequest.js.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isErrorLike.cjs +7 -0
- package/dist/_node_modules/r19/dist/lib/isErrorLike.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isErrorLike.js +7 -0
- package/dist/_node_modules/r19/dist/lib/isErrorLike.js.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isPlainObject.cjs +11 -0
- package/dist/_node_modules/r19/dist/lib/isPlainObject.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isPlainObject.js +11 -0
- package/dist/_node_modules/r19/dist/lib/isPlainObject.js.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isR19ErrorLike.cjs +8 -0
- package/dist/_node_modules/r19/dist/lib/isR19ErrorLike.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/lib/isR19ErrorLike.js +8 -0
- package/dist/_node_modules/r19/dist/lib/isR19ErrorLike.js.map +1 -0
- package/dist/_node_modules/r19/dist/lib/replaceLeaves.cjs +28 -0
- package/dist/_node_modules/r19/dist/lib/replaceLeaves.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/lib/replaceLeaves.js +28 -0
- package/dist/_node_modules/r19/dist/lib/replaceLeaves.js.map +1 -0
- package/dist/_node_modules/r19/dist/proceduresFromInstance.cjs +33 -0
- package/dist/_node_modules/r19/dist/proceduresFromInstance.cjs.map +1 -0
- package/dist/_node_modules/r19/dist/proceduresFromInstance.js +33 -0
- package/dist/_node_modules/r19/dist/proceduresFromInstance.js.map +1 -0
- package/dist/_node_modules/shebang-command/index.cjs +18 -0
- package/dist/_node_modules/shebang-command/index.cjs.map +1 -0
- package/dist/_node_modules/shebang-command/index.js +18 -0
- package/dist/_node_modules/shebang-command/index.js.map +1 -0
- package/dist/_node_modules/shebang-regex/index.cjs +5 -0
- package/dist/_node_modules/shebang-regex/index.cjs.map +1 -0
- package/dist/_node_modules/shebang-regex/index.js +5 -0
- package/dist/_node_modules/shebang-regex/index.js.map +1 -0
- package/dist/_node_modules/signal-exit/index.cjs +150 -0
- package/dist/_node_modules/signal-exit/index.cjs.map +1 -0
- package/dist/_node_modules/signal-exit/index.js +151 -0
- package/dist/_node_modules/signal-exit/index.js.map +1 -0
- package/dist/_node_modules/signal-exit/signals.cjs +45 -0
- package/dist/_node_modules/signal-exit/signals.cjs.map +1 -0
- package/dist/_node_modules/signal-exit/signals.js +45 -0
- package/dist/_node_modules/signal-exit/signals.js.map +1 -0
- package/dist/_node_modules/strtok3/lib/AbstractTokenizer.cjs +98 -0
- package/dist/_node_modules/strtok3/lib/AbstractTokenizer.cjs.map +1 -0
- package/dist/_node_modules/strtok3/lib/AbstractTokenizer.js +98 -0
- package/dist/_node_modules/strtok3/lib/AbstractTokenizer.js.map +1 -0
- package/dist/_node_modules/strtok3/lib/BufferTokenizer.cjs +53 -0
- package/dist/_node_modules/strtok3/lib/BufferTokenizer.cjs.map +1 -0
- package/dist/_node_modules/strtok3/lib/BufferTokenizer.js +53 -0
- package/dist/_node_modules/strtok3/lib/BufferTokenizer.js.map +1 -0
- package/dist/_node_modules/strtok3/lib/core.cjs +9 -0
- package/dist/_node_modules/strtok3/lib/core.cjs.map +1 -0
- package/dist/_node_modules/strtok3/lib/core.js +9 -0
- package/dist/_node_modules/strtok3/lib/core.js.map +1 -0
- package/dist/_node_modules/token-types/lib/index.cjs +94 -0
- package/dist/_node_modules/token-types/lib/index.cjs.map +1 -0
- package/dist/_node_modules/token-types/lib/index.js +94 -0
- package/dist/_node_modules/token-types/lib/index.js.map +1 -0
- package/dist/_node_modules/unist-util-is/lib/index.cjs +76 -0
- package/dist/_node_modules/unist-util-is/lib/index.cjs.map +1 -0
- package/dist/_node_modules/unist-util-is/lib/index.js +76 -0
- package/dist/_node_modules/unist-util-is/lib/index.js.map +1 -0
- package/dist/_node_modules/unist-util-visit/lib/index.cjs +39 -0
- package/dist/_node_modules/unist-util-visit/lib/index.cjs.map +1 -0
- package/dist/_node_modules/unist-util-visit/lib/index.js +40 -0
- package/dist/_node_modules/unist-util-visit/lib/index.js.map +1 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/color.browser.cjs +7 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/color.browser.cjs.map +1 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/color.browser.js +7 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/color.browser.js.map +1 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/index.cjs +86 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/index.cjs.map +1 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/index.js +86 -0
- package/dist/_node_modules/unist-util-visit-parents/lib/index.js.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +3822 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3822 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/_node_modules/which/which.cjs +96 -0
- package/dist/_node_modules/which/which.cjs.map +1 -0
- package/dist/_node_modules/which/which.js +96 -0
- package/dist/_node_modules/which/which.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +9 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/escape.cjs +5 -0
- package/dist/_virtual/escape.cjs.map +1 -0
- package/dist/_virtual/escape.js +5 -0
- package/dist/_virtual/escape.js.map +1 -0
- package/dist/_virtual/index.cjs +5 -0
- package/dist/_virtual/index.cjs.map +1 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.cjs +5 -0
- package/dist/_virtual/index2.cjs.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.cjs +5 -0
- package/dist/_virtual/index3.cjs.map +1 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.cjs +5 -0
- package/dist/_virtual/index4.cjs.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/ponyfill.es2018.cjs +5 -0
- package/dist/_virtual/ponyfill.es2018.cjs.map +1 -0
- package/dist/_virtual/ponyfill.es2018.js +5 -0
- package/dist/_virtual/ponyfill.es2018.js.map +1 -0
- package/dist/_virtual/signals.cjs +5 -0
- package/dist/_virtual/signals.cjs.map +1 -0
- package/dist/_virtual/signals.js +5 -0
- package/dist/_virtual/signals.js.map +1 -0
- package/dist/auth/PrismicAuthManager.cjs +291 -0
- package/dist/auth/PrismicAuthManager.cjs.map +1 -0
- package/dist/auth/PrismicAuthManager.d.ts +58 -0
- package/dist/auth/PrismicAuthManager.js +269 -0
- package/dist/auth/PrismicAuthManager.js.map +1 -0
- package/dist/auth/createPrismicAuthManager.cjs +8 -0
- package/dist/auth/createPrismicAuthManager.cjs.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.cjs +51 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.cjs.map +1 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.d.ts +14 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.js +34 -0
- package/dist/auth/createPrismicAuthManagerMiddleware.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client.cjs +21 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.js +21 -0
- package/dist/client.js.map +1 -0
- package/dist/constants/API_ENDPOINTS.cjs +55 -0
- package/dist/constants/API_ENDPOINTS.cjs.map +1 -0
- package/dist/constants/API_ENDPOINTS.d.ts +11 -0
- package/dist/constants/API_ENDPOINTS.js +55 -0
- package/dist/constants/API_ENDPOINTS.js.map +1 -0
- package/dist/constants/API_TOKENS.cjs +18 -0
- package/dist/constants/API_TOKENS.cjs.map +1 -0
- package/dist/constants/API_TOKENS.d.ts +5 -0
- package/dist/constants/API_TOKENS.js +18 -0
- package/dist/constants/API_TOKENS.js.map +1 -0
- package/dist/constants/APPLICATION_MODE.cjs +9 -0
- package/dist/constants/APPLICATION_MODE.cjs.map +1 -0
- package/dist/constants/APPLICATION_MODE.d.ts +5 -0
- package/dist/constants/APPLICATION_MODE.js +9 -0
- package/dist/constants/APPLICATION_MODE.js.map +1 -0
- package/dist/constants/DEFAULT_SLICE_SCREENSHOT_URL.cjs +5 -0
- package/dist/constants/DEFAULT_SLICE_SCREENSHOT_URL.cjs.map +1 -0
- package/dist/constants/DEFAULT_SLICE_SCREENSHOT_URL.d.ts +5 -0
- package/dist/constants/DEFAULT_SLICE_SCREENSHOT_URL.js +5 -0
- package/dist/constants/DEFAULT_SLICE_SCREENSHOT_URL.js.map +1 -0
- package/dist/constants/REPOSITORY_NAME_VALIDATION.cjs +8 -0
- package/dist/constants/REPOSITORY_NAME_VALIDATION.cjs.map +1 -0
- package/dist/constants/REPOSITORY_NAME_VALIDATION.d.ts +4 -0
- package/dist/constants/REPOSITORY_NAME_VALIDATION.js +8 -0
- package/dist/constants/REPOSITORY_NAME_VALIDATION.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_CONFIG_FILENAME.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_CONFIG_FILENAME.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_CONFIG_FILENAME.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_CONFIG_FILENAME.js +5 -0
- package/dist/constants/SLICE_MACHINE_CONFIG_FILENAME.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.js +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.js +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.js +5 -0
- package/dist/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.js +5 -0
- package/dist/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.js.map +1 -0
- package/dist/constants/SLICE_MACHINE_USER_AGENT.cjs +5 -0
- package/dist/constants/SLICE_MACHINE_USER_AGENT.cjs.map +1 -0
- package/dist/constants/SLICE_MACHINE_USER_AGENT.d.ts +1 -0
- package/dist/constants/SLICE_MACHINE_USER_AGENT.js +5 -0
- package/dist/constants/SLICE_MACHINE_USER_AGENT.js.map +1 -0
- package/dist/constants/TS_CONFIG_FILENAME.cjs +5 -0
- package/dist/constants/TS_CONFIG_FILENAME.cjs.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/constants/VERSION_KIND.cjs +10 -0
- package/dist/constants/VERSION_KIND.cjs.map +1 -0
- package/dist/constants/VERSION_KIND.d.ts +6 -0
- package/dist/constants/VERSION_KIND.js +10 -0
- package/dist/constants/VERSION_KIND.js.map +1 -0
- package/dist/errors.cjs +101 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +101 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/DecodeError.cjs +22 -0
- package/dist/lib/DecodeError.cjs.map +1 -0
- package/dist/lib/DecodeError.d.ts +12 -0
- package/dist/lib/DecodeError.js +22 -0
- package/dist/lib/DecodeError.js.map +1 -0
- package/dist/lib/assertPluginsInitialized.cjs +9 -0
- package/dist/lib/assertPluginsInitialized.cjs.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/bufferCodec.cjs +24 -0
- package/dist/lib/bufferCodec.cjs.map +1 -0
- package/dist/lib/bufferCodec.d.ts +4 -0
- package/dist/lib/bufferCodec.js +7 -0
- package/dist/lib/bufferCodec.js.map +1 -0
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.cjs +9 -0
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.cjs.map +1 -0
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.d.ts +4 -0
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.js +9 -0
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.js.map +1 -0
- package/dist/lib/castArray.cjs +7 -0
- package/dist/lib/castArray.cjs.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/checkIsURLAccessible.d.ts +1 -0
- package/dist/lib/createContentDigest.cjs +25 -0
- package/dist/lib/createContentDigest.cjs.map +1 -0
- package/dist/lib/createContentDigest.d.ts +9 -0
- package/dist/lib/createContentDigest.js +8 -0
- package/dist/lib/createContentDigest.js.map +1 -0
- package/dist/lib/decode.cjs +18 -0
- package/dist/lib/decode.cjs.map +1 -0
- package/dist/lib/decode.d.ts +10 -0
- package/dist/lib/decode.js +18 -0
- package/dist/lib/decode.js.map +1 -0
- package/dist/lib/decodeHookResult.cjs +21 -0
- package/dist/lib/decodeHookResult.cjs.map +1 -0
- package/dist/lib/decodeHookResult.d.ts +10 -0
- package/dist/lib/decodeHookResult.js +21 -0
- package/dist/lib/decodeHookResult.js.map +1 -0
- package/dist/lib/decodePackageJSON.cjs +29 -0
- package/dist/lib/decodePackageJSON.cjs.map +1 -0
- package/dist/lib/decodePackageJSON.d.ts +12 -0
- package/dist/lib/decodePackageJSON.js +12 -0
- package/dist/lib/decodePackageJSON.js.map +1 -0
- package/dist/lib/decodeSliceMachineConfig.cjs +50 -0
- package/dist/lib/decodeSliceMachineConfig.cjs.map +1 -0
- package/dist/lib/decodeSliceMachineConfig.d.ts +3 -0
- package/dist/lib/decodeSliceMachineConfig.js +33 -0
- package/dist/lib/decodeSliceMachineConfig.js.map +1 -0
- package/dist/lib/fetch.cjs +36 -0
- package/dist/lib/fetch.cjs.map +1 -0
- package/dist/lib/fetch.d.ts +15 -0
- package/dist/lib/fetch.js +18 -0
- package/dist/lib/fetch.js.map +1 -0
- package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs +105 -0
- package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs.map +1 -0
- package/dist/lib/fetchGitHubReleaseBodyForRelease.d.ts +21 -0
- package/dist/lib/fetchGitHubReleaseBodyForRelease.js +88 -0
- package/dist/lib/fetchGitHubReleaseBodyForRelease.js.map +1 -0
- package/dist/lib/fetchNPMPackageVersions.cjs +41 -0
- package/dist/lib/fetchNPMPackageVersions.cjs.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.cjs +33 -0
- package/dist/lib/format.cjs.map +1 -0
- package/dist/lib/format.d.ts +12 -0
- package/dist/lib/format.js +33 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/functionCodec.cjs +29 -0
- package/dist/lib/functionCodec.cjs.map +1 -0
- package/dist/lib/functionCodec.d.ts +2 -0
- package/dist/lib/functionCodec.js +12 -0
- package/dist/lib/functionCodec.js.map +1 -0
- package/dist/lib/installDependencies.cjs +38 -0
- package/dist/lib/installDependencies.cjs.map +1 -0
- package/dist/lib/installDependencies.d.ts +13 -0
- package/dist/lib/installDependencies.js +38 -0
- package/dist/lib/installDependencies.js.map +1 -0
- package/dist/lib/locateFileUpward.cjs +47 -0
- package/dist/lib/locateFileUpward.cjs.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/markdownToHTML.cjs +91 -0
- package/dist/lib/markdownToHTML.cjs.map +1 -0
- package/dist/lib/markdownToHTML.d.ts +1 -0
- package/dist/lib/markdownToHTML.js +69 -0
- package/dist/lib/markdownToHTML.js.map +1 -0
- package/dist/lib/mockSlice.cjs +32 -0
- package/dist/lib/mockSlice.cjs.map +1 -0
- package/dist/lib/mockSlice.d.ts +9 -0
- package/dist/lib/mockSlice.js +32 -0
- package/dist/lib/mockSlice.js.map +1 -0
- package/dist/lib/prismicrc.cjs +48 -0
- package/dist/lib/prismicrc.cjs.map +1 -0
- package/dist/lib/prismicrc.d.ts +10 -0
- package/dist/lib/prismicrc.js +29 -0
- package/dist/lib/prismicrc.js.map +1 -0
- package/dist/lib/serializeCookies.cjs +29 -0
- package/dist/lib/serializeCookies.cjs.map +1 -0
- package/dist/lib/serializeCookies.d.ts +6 -0
- package/dist/lib/serializeCookies.js +29 -0
- package/dist/lib/serializeCookies.js.map +1 -0
- package/dist/lib/trailingSlash.cjs +11 -0
- package/dist/lib/trailingSlash.cjs.map +1 -0
- package/dist/lib/trailingSlash.d.ts +2 -0
- package/dist/lib/trailingSlash.js +11 -0
- package/dist/lib/trailingSlash.js.map +1 -0
- package/dist/managers/BaseManager.cjs +69 -0
- package/dist/managers/BaseManager.cjs.map +1 -0
- package/dist/managers/BaseManager.d.ts +37 -0
- package/dist/managers/BaseManager.js +69 -0
- package/dist/managers/BaseManager.js.map +1 -0
- package/dist/managers/SliceMachineManager.cjs +251 -0
- package/dist/managers/SliceMachineManager.cjs.map +1 -0
- package/dist/managers/SliceMachineManager.d.ts +99 -0
- package/dist/managers/SliceMachineManager.js +251 -0
- package/dist/managers/SliceMachineManager.js.map +1 -0
- package/dist/managers/createSliceMachineManager.cjs +8 -0
- package/dist/managers/createSliceMachineManager.cjs.map +1 -0
- package/dist/managers/createSliceMachineManager.d.ts +5 -0
- package/dist/managers/createSliceMachineManager.js +8 -0
- package/dist/managers/createSliceMachineManager.js.map +1 -0
- package/dist/managers/createSliceMachineManagerClient.cjs +11 -0
- package/dist/managers/createSliceMachineManagerClient.cjs.map +1 -0
- package/dist/managers/createSliceMachineManagerClient.d.ts +8 -0
- package/dist/managers/createSliceMachineManagerClient.js +11 -0
- package/dist/managers/createSliceMachineManagerClient.js.map +1 -0
- package/dist/managers/createSliceMachineManagerMiddleware.cjs +44 -0
- package/dist/managers/createSliceMachineManagerMiddleware.cjs.map +1 -0
- package/dist/managers/createSliceMachineManagerMiddleware.d.ts +15 -0
- package/dist/managers/createSliceMachineManagerMiddleware.js +44 -0
- package/dist/managers/createSliceMachineManagerMiddleware.js.map +1 -0
- package/dist/managers/customTypes/CustomTypesManager.cjs +190 -0
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -0
- package/dist/managers/customTypes/CustomTypesManager.d.ts +61 -0
- package/dist/managers/customTypes/CustomTypesManager.js +172 -0
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -0
- package/dist/managers/customTypes/types.d.ts +2 -0
- package/dist/managers/documentation/DocumentationManager.cjs +42 -0
- package/dist/managers/documentation/DocumentationManager.cjs.map +1 -0
- package/dist/managers/documentation/DocumentationManager.d.ts +11 -0
- package/dist/managers/documentation/DocumentationManager.js +25 -0
- package/dist/managers/documentation/DocumentationManager.js.map +1 -0
- package/dist/managers/plugins/PluginsManager.cjs +36 -0
- package/dist/managers/plugins/PluginsManager.cjs.map +1 -0
- package/dist/managers/plugins/PluginsManager.d.ts +13 -0
- package/dist/managers/plugins/PluginsManager.js +36 -0
- package/dist/managers/plugins/PluginsManager.js.map +1 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +404 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +36 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +387 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -0
- package/dist/managers/prismicRepository/sortEnvironments.cjs +36 -0
- package/dist/managers/prismicRepository/sortEnvironments.cjs.map +1 -0
- package/dist/managers/prismicRepository/sortEnvironments.d.ts +17 -0
- package/dist/managers/prismicRepository/sortEnvironments.js +36 -0
- package/dist/managers/prismicRepository/sortEnvironments.js.map +1 -0
- package/dist/managers/prismicRepository/types.cjs +78 -0
- package/dist/managers/prismicRepository/types.cjs.map +1 -0
- package/dist/managers/prismicRepository/types.d.ts +148 -0
- package/dist/managers/prismicRepository/types.js +63 -0
- package/dist/managers/prismicRepository/types.js.map +1 -0
- package/dist/managers/project/ProjectManager.cjs +273 -0
- package/dist/managers/project/ProjectManager.cjs.map +1 -0
- package/dist/managers/project/ProjectManager.d.ts +84 -0
- package/dist/managers/project/ProjectManager.js +254 -0
- package/dist/managers/project/ProjectManager.js.map +1 -0
- package/dist/managers/screenshots/ScreenshotsManager.cjs +164 -0
- package/dist/managers/screenshots/ScreenshotsManager.cjs.map +1 -0
- package/dist/managers/screenshots/ScreenshotsManager.d.ts +20 -0
- package/dist/managers/screenshots/ScreenshotsManager.js +147 -0
- package/dist/managers/screenshots/ScreenshotsManager.js.map +1 -0
- package/dist/managers/simulator/SimulatorManager.cjs +105 -0
- package/dist/managers/simulator/SimulatorManager.cjs.map +1 -0
- package/dist/managers/simulator/SimulatorManager.d.ts +38 -0
- package/dist/managers/simulator/SimulatorManager.js +88 -0
- package/dist/managers/simulator/SimulatorManager.js.map +1 -0
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.cjs +139 -0
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.cjs.map +1 -0
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.d.ts +27 -0
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.js +122 -0
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.js.map +1 -0
- package/dist/managers/slices/SlicesManager.cjs +652 -0
- package/dist/managers/slices/SlicesManager.cjs.map +1 -0
- package/dist/managers/slices/SlicesManager.d.ts +178 -0
- package/dist/managers/slices/SlicesManager.js +634 -0
- package/dist/managers/slices/SlicesManager.js.map +1 -0
- package/dist/managers/snippets/SnippetsManager.cjs +41 -0
- package/dist/managers/snippets/SnippetsManager.cjs.map +1 -0
- package/dist/managers/snippets/SnippetsManager.d.ts +11 -0
- package/dist/managers/snippets/SnippetsManager.js +24 -0
- package/dist/managers/snippets/SnippetsManager.js.map +1 -0
- package/dist/managers/telemetry/TelemetryManager.cjs +154 -0
- package/dist/managers/telemetry/TelemetryManager.cjs.map +1 -0
- package/dist/managers/telemetry/TelemetryManager.d.ts +29 -0
- package/dist/managers/telemetry/TelemetryManager.js +154 -0
- package/dist/managers/telemetry/TelemetryManager.js.map +1 -0
- package/dist/managers/telemetry/types.cjs +57 -0
- package/dist/managers/telemetry/types.cjs.map +1 -0
- package/dist/managers/telemetry/types.d.ts +165 -0
- package/dist/managers/telemetry/types.js +57 -0
- package/dist/managers/telemetry/types.js.map +1 -0
- package/dist/managers/user/UserManager.cjs +29 -0
- package/dist/managers/user/UserManager.cjs.map +1 -0
- package/dist/managers/user/UserManager.d.ts +40 -0
- package/dist/managers/user/UserManager.js +29 -0
- package/dist/managers/user/UserManager.js.map +1 -0
- package/dist/managers/versions/VersionsManager.cjs +140 -0
- package/dist/managers/versions/VersionsManager.cjs.map +1 -0
- package/dist/managers/versions/VersionsManager.d.ts +22 -0
- package/dist/managers/versions/VersionsManager.js +122 -0
- package/dist/managers/versions/VersionsManager.js.map +1 -0
- package/dist/managers/versions/types.d.ts +5 -0
- package/dist/test/createSliceMachineManagerMSWHandler.cjs +18 -0
- package/dist/test/createSliceMachineManagerMSWHandler.cjs.map +1 -0
- package/dist/test/createSliceMachineManagerMSWHandler.d.ts +7 -0
- package/dist/test/createSliceMachineManagerMSWHandler.js +18 -0
- package/dist/test/createSliceMachineManagerMSWHandler.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test.cjs +5 -0
- package/dist/test.cjs.map +1 -0
- package/dist/test.js +5 -0
- package/dist/test.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/package.json +140 -0
- package/src/auth/PrismicAuthManager.ts +412 -0
- package/src/auth/createPrismicAuthManager.ts +11 -0
- package/src/auth/createPrismicAuthManagerMiddleware.ts +72 -0
- package/src/client/index.ts +35 -0
- package/src/constants/API_ENDPOINTS.ts +86 -0
- package/src/constants/API_TOKENS.ts +19 -0
- package/src/constants/APPLICATION_MODE.ts +5 -0
- package/src/constants/DEFAULT_SLICE_SCREENSHOT_URL.ts +6 -0
- package/src/constants/REPOSITORY_NAME_VALIDATION.ts +4 -0
- package/src/constants/SLICE_MACHINE_CONFIG_FILENAME.ts +1 -0
- package/src/constants/SLICE_MACHINE_GITHUB_PACKAGE_NAME.ts +1 -0
- package/src/constants/SLICE_MACHINE_GITHUB_REPOSITORY_NAME.ts +1 -0
- package/src/constants/SLICE_MACHINE_GITHUB_REPOSITORY_ORGANIZATION.ts +1 -0
- package/src/constants/SLICE_MACHINE_NPM_PACKAGE_NAME.ts +1 -0
- package/src/constants/SLICE_MACHINE_USER_AGENT.ts +1 -0
- package/src/constants/TS_CONFIG_FILENAME.ts +1 -0
- package/src/constants/VERSION_KIND.ts +6 -0
- package/src/errors.ts +85 -0
- package/src/index.ts +46 -0
- package/src/lib/DecodeError.ts +22 -0
- package/src/lib/assertPluginsInitialized.ts +11 -0
- package/src/lib/bufferCodec.ts +10 -0
- package/src/lib/buildPrismicRepositoryAPIEndpoint.ts +16 -0
- package/src/lib/castArray.ts +3 -0
- package/src/lib/checkIsURLAccessible.ts +7 -0
- package/src/lib/createContentDigest.ts +12 -0
- package/src/lib/decode.ts +36 -0
- package/src/lib/decodeHookResult.ts +36 -0
- package/src/lib/decodePackageJSON.ts +18 -0
- package/src/lib/decodeSliceMachineConfig.ts +39 -0
- package/src/lib/fetch.ts +46 -0
- package/src/lib/fetchGitHubReleaseBodyForRelease.ts +146 -0
- package/src/lib/fetchNPMPackageVersions.ts +46 -0
- package/src/lib/format.ts +34 -0
- package/src/lib/functionCodec.ts +16 -0
- package/src/lib/installDependencies.ts +65 -0
- package/src/lib/locateFileUpward.ts +53 -0
- package/src/lib/markdownToHTML.ts +116 -0
- package/src/lib/mockSlice.ts +50 -0
- package/src/lib/prismicrc.ts +64 -0
- package/src/lib/serializeCookies.ts +45 -0
- package/src/lib/trailingSlash.ts +9 -0
- package/src/managers/BaseManager.ts +100 -0
- package/src/managers/SliceMachineManager.ts +399 -0
- package/src/managers/createSliceMachineManager.ts +11 -0
- package/src/managers/createSliceMachineManagerClient.ts +23 -0
- package/src/managers/createSliceMachineManagerMiddleware.ts +78 -0
- package/src/managers/customTypes/CustomTypesManager.ts +332 -0
- package/src/managers/customTypes/types.ts +3 -0
- package/src/managers/documentation/DocumentationManager.ts +44 -0
- package/src/managers/plugins/PluginsManager.ts +48 -0
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +569 -0
- package/src/managers/prismicRepository/sortEnvironments.ts +55 -0
- package/src/managers/prismicRepository/types.ts +169 -0
- package/src/managers/project/ProjectManager.ts +443 -0
- package/src/managers/screenshots/ScreenshotsManager.ts +199 -0
- package/src/managers/simulator/SimulatorManager.ts +161 -0
- package/src/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.ts +201 -0
- package/src/managers/slices/SlicesManager.ts +1105 -0
- package/src/managers/snippets/SnippetsManager.ts +45 -0
- package/src/managers/telemetry/TelemetryManager.ts +248 -0
- package/src/managers/telemetry/types.ts +283 -0
- package/src/managers/user/UserManager.ts +39 -0
- package/src/managers/versions/VersionsManager.ts +167 -0
- package/src/managers/versions/types.ts +6 -0
- package/src/test/createSliceMachineManagerMSWHandler.ts +29 -0
- package/src/test/index.ts +2 -0
- package/src/types.ts +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenshotsManager.js","sources":["../../../../src/managers/screenshots/ScreenshotsManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { fileTypeFromBuffer } from \"file-type\";\nimport pLimit from \"p-limit\";\nimport fetch, { FormData, Blob, Response } from \"../../lib/fetch\";\n\nimport { createContentDigest } from \"../../lib/createContentDigest\";\nimport { decode } from \"../../lib/decode\";\n\nimport { S3ACL } from \"../../types\";\nimport { SLICE_MACHINE_USER_AGENT } from \"../../constants/SLICE_MACHINE_USER_AGENT\";\nimport { API_ENDPOINTS } from \"../../constants/API_ENDPOINTS\";\n\nimport { BaseManager } from \"../BaseManager\";\n\nfunction assertS3ACLInitialized(\n\ts3ACL: S3ACL | undefined,\n): asserts s3ACL is NonNullable<typeof s3ACL> {\n\tif (s3ACL == undefined) {\n\t\tthrow new Error(\n\t\t\t\"An S3 ACL has not been initialized. Run `SliceMachineManager.screenshots.prototype.initS3ACL()` before re-calling this method.\",\n\t\t);\n\t}\n}\n\nconst uploadScreenshotLimit = pLimit(10);\n\ntype ScreenshotsManagerUploadScreenshotArgs = {\n\tdata: Buffer;\n\tkeyPrefix?: string;\n};\n\ntype ScreenshotsManagerUploadScreenshotReturnType = {\n\turl: string;\n};\n\ntype ScreenshotsManagerDeleteScreenshotFolderArgs = {\n\tsliceID: string;\n};\n\nexport class ScreenshotsManager extends BaseManager {\n\tprivate _s3ACL: S3ACL | undefined;\n\n\tasync initS3ACL(): Promise<void> {\n\t\t// TODO: we need to find a way to create a new AWS ACL only when necessary (e.g., when it has expired).\n\t\t// if (this._s3ACL) {\n\t\t// \treturn;\n\t\t// }\n\n\t\tconst awsACLURL = new URL(\"create\", API_ENDPOINTS.AwsAclProvider);\n\t\tconst awsACLRes = await this._fetch({ url: awsACLURL });\n\n\t\tconst awsACLText = await awsACLRes.text();\n\t\tlet awsACLJSON: unknown;\n\t\ttry {\n\t\t\tawsACLJSON = JSON.parse(awsACLText);\n\t\t} catch (error) {\n\t\t\t// Response is not JSON\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid AWS ACL response from ${awsACLURL}: ${awsACLText}`,\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst { value: awsACL, error } = decode(\n\t\t\tt.intersection([\n\t\t\t\tt.type({\n\t\t\t\t\tvalues: t.type({\n\t\t\t\t\t\turl: t.string,\n\t\t\t\t\t\tfields: t.record(t.string, t.string),\n\t\t\t\t\t}),\n\t\t\t\t\timgixEndpoint: t.string,\n\t\t\t\t}),\n\t\t\t\tt.partial({\n\t\t\t\t\tmessage: t.string,\n\t\t\t\t\tMessage: t.string,\n\t\t\t\t\terror: t.string,\n\t\t\t\t}),\n\t\t\t]),\n\t\t\tawsACLJSON,\n\t\t);\n\n\t\tif (error) {\n\t\t\tthrow new Error(`Invalid AWS ACL response from ${awsACLURL}`, {\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\n\t\tconst errorMessage = awsACL.error || awsACL.message || awsACL.Message;\n\t\tif (errorMessage) {\n\t\t\tthrow new Error(`Failed to create an AWS ACL: ${errorMessage}`, {\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\n\t\tthis._s3ACL = {\n\t\t\tuploadEndpoint: awsACL.values.url,\n\t\t\trequiredFormDataFields: awsACL.values.fields,\n\t\t\timgixEndpoint: awsACL.imgixEndpoint,\n\t\t};\n\t}\n\n\tasync uploadScreenshot(\n\t\targs: ScreenshotsManagerUploadScreenshotArgs,\n\t): Promise<ScreenshotsManagerUploadScreenshotReturnType> {\n\t\tassertS3ACLInitialized(this._s3ACL);\n\n\t\tconst formData = new FormData();\n\n\t\tfor (const requiredFormDataFieldKey in this._s3ACL.requiredFormDataFields) {\n\t\t\tformData.append(\n\t\t\t\trequiredFormDataFieldKey,\n\t\t\t\tthis._s3ACL.requiredFormDataFields[requiredFormDataFieldKey],\n\t\t\t);\n\t\t}\n\n\t\tconst contentDigest = createContentDigest(args.data);\n\t\tconst fileType = await fileTypeFromBuffer(args.data);\n\t\tconst fileName = fileType\n\t\t\t? `${contentDigest}.${fileType.ext}`\n\t\t\t: contentDigest;\n\t\tconst key = args.keyPrefix ? `${args.keyPrefix}/${fileName}` : fileName;\n\n\t\tformData.set(\"key\", key);\n\n\t\tif (fileType) {\n\t\t\tformData.set(\"Content-Type\", fileType.mime);\n\t\t}\n\n\t\tformData.set(\"file\", new Blob([args.data], { type: fileType?.mime }));\n\n\t\tconst s3ACLEndpoint = this._s3ACL.uploadEndpoint;\n\t\tconst res = await uploadScreenshotLimit(() =>\n\t\t\tfetch(s3ACLEndpoint, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData,\n\t\t\t}),\n\t\t);\n\n\t\tif (res.ok) {\n\t\t\tconst url = new URL(key, this._s3ACL.imgixEndpoint);\n\t\t\turl.searchParams.set(\"auto\", \"compress,format\");\n\n\t\t\treturn {\n\t\t\t\turl: url.toString(),\n\t\t\t};\n\t\t} else {\n\t\t\tconst text = await res.text();\n\t\t\tthrow new Error(\n\t\t\t\t`Unable to upload screenshot with status code: ${res.status}`,\n\t\t\t\t{\n\t\t\t\t\tcause: text,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tasync deleteScreenshotFolder(\n\t\targs: ScreenshotsManagerDeleteScreenshotFolderArgs,\n\t): Promise<void> {\n\t\tconst res = await this._fetch({\n\t\t\t// We're sending `args.sliceID` as `sliceName` because it's inconsistently\n\t\t\t// named in the ACL Provider API.\n\t\t\tbody: { sliceName: args.sliceID },\n\t\t\tmethod: \"POST\",\n\t\t\turl: new URL(\"delete-folder\", API_ENDPOINTS.AwsAclProvider),\n\t\t});\n\t\tif (!res.ok) {\n\t\t\tconst text = await res.text();\n\t\t\tthrow new Error(\n\t\t\t\t`Unable to delete screenshot folder with status code: ${res.status}`,\n\t\t\t\t{\n\t\t\t\t\tcause: text,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate async _fetch(args: {\n\t\turl: URL;\n\t\tmethod?: \"GET\" | \"POST\";\n\t\tbody?: unknown;\n\t}): Promise<Response> {\n\t\tconst authenticationToken = await this.user.getAuthenticationToken();\n\t\tconst repositoryName = await this.project.getRepositoryName();\n\n\t\treturn await fetch(args.url, {\n\t\t\tbody: args.body ? JSON.stringify(args.body) : undefined,\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${authenticationToken}`,\n\t\t\t\tRepository: repositoryName,\n\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t...(args.body ? { \"Content-Type\": \"application/json\" } : {}),\n\t\t\t},\n\t\t\tmethod: args.method,\n\t\t});\n\t}\n}\n"],"names":["error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,uBACR,OAAwB;AAExB,MAAI,SAAS,QAAW;AACjB,UAAA,IAAI,MACT,gIAAgI;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AC,IAAI,IAAI;AACN,YAAA,OAAO,MAAM,IAAI;AACvB,YAAM,IAAI,MACT,wDAAwD,IAAI,UAC5D;AAAA,QACC,OAAO;AAAA,MAAA,CACP;AAAA,IAEF;AAAA,EACF;AAAA,EAEQ,MAAM,OAAO,MAIpB;AACA,UAAM,sBAAsB,MAAM,KAAK,KAAK,uBAAsB;AAClE,UAAM,iBAAiB,MAAM,KAAK,QAAQ,kBAAiB;AAEpD,WAAA,MAAM,MAAM,KAAK,KAAK;AAAA,MAC5B,MAAM,KAAK,OAAO,KAAK,UAAU,KAAK,IAAI,IAAI;AAAA,MAC9C,SAAS;AAAA,QACR,eAAe,UAAU;AAAA,QACzB,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,GAAI,KAAK,OAAO,EAAE,gBAAgB,uBAAuB;MACzD;AAAA,MACD,QAAQ,KAAK;AAAA,IAAA,CACb;AAAA,EACF;AACA;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const t = require("io-ts");
|
|
4
|
+
const fetch = require("../../lib/fetch.cjs");
|
|
5
|
+
const assertPluginsInitialized = require("../../lib/assertPluginsInitialized.cjs");
|
|
6
|
+
const castArray = require("../../lib/castArray.cjs");
|
|
7
|
+
const decode = require("../../lib/decode.cjs");
|
|
8
|
+
const decodeHookResult = require("../../lib/decodeHookResult.cjs");
|
|
9
|
+
const functionCodec = require("../../lib/functionCodec.cjs");
|
|
10
|
+
const markdownToHTML = require("../../lib/markdownToHTML.cjs");
|
|
11
|
+
const errors = require("../../errors.cjs");
|
|
12
|
+
const BaseManager = require("../BaseManager.cjs");
|
|
13
|
+
function _interopNamespaceDefault(e) {
|
|
14
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
15
|
+
if (e) {
|
|
16
|
+
for (const k in e) {
|
|
17
|
+
if (k !== "default") {
|
|
18
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: () => e[k]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
const t__namespace = /* @__PURE__ */ _interopNamespaceDefault(t);
|
|
30
|
+
const sliceSimulatorSetupStepCodec = t__namespace.intersection([
|
|
31
|
+
t__namespace.type({
|
|
32
|
+
title: t__namespace.string,
|
|
33
|
+
body: t__namespace.string
|
|
34
|
+
}),
|
|
35
|
+
t__namespace.partial({
|
|
36
|
+
description: t__namespace.string,
|
|
37
|
+
validate: functionCodec.functionCodec
|
|
38
|
+
})
|
|
39
|
+
]);
|
|
40
|
+
const SliceSimulatorSetupStepValidationMessageCodec = t__namespace.type({
|
|
41
|
+
title: t__namespace.string,
|
|
42
|
+
message: t__namespace.string
|
|
43
|
+
});
|
|
44
|
+
class SimulatorManager extends BaseManager.BaseManager {
|
|
45
|
+
async getLocalSliceSimulatorURL() {
|
|
46
|
+
const sliceMachineConfig = await this.project.getSliceMachineConfig();
|
|
47
|
+
return sliceMachineConfig.localSliceSimulatorURL;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @throws {@link UnexpectedDataError} Thrown if the project is not configured
|
|
51
|
+
* with a Slice Simulator URL.
|
|
52
|
+
*/
|
|
53
|
+
async checkIsLocalSliceSimulatorURLAccessible() {
|
|
54
|
+
const localSliceSimulatorURL = await this.getLocalSliceSimulatorURL();
|
|
55
|
+
if (!localSliceSimulatorURL) {
|
|
56
|
+
throw new errors.UnexpectedDataError("The project has not been configured with a Slice Simulator URL. Add a `localSliceSimulatorURL` property to your project's configuration to fix this error.");
|
|
57
|
+
}
|
|
58
|
+
const res = await fetch.default(localSliceSimulatorURL);
|
|
59
|
+
return res.ok;
|
|
60
|
+
}
|
|
61
|
+
async readSliceSimulatorSetupSteps() {
|
|
62
|
+
assertPluginsInitialized.assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
63
|
+
const hookResult = await this.sliceMachinePluginRunner.callHook("slice-simulator:setup:read", void 0);
|
|
64
|
+
const { data, errors: errors2 } = decodeHookResult.decodeHookResult(t__namespace.array(sliceSimulatorSetupStepCodec), hookResult);
|
|
65
|
+
const steps = await Promise.all(data[0].map(async (step) => {
|
|
66
|
+
const bodyHTML = await markdownToHTML.markdownToHTML(step.body);
|
|
67
|
+
const res = {
|
|
68
|
+
title: step.title,
|
|
69
|
+
description: step.description,
|
|
70
|
+
body: bodyHTML,
|
|
71
|
+
isComplete: void 0,
|
|
72
|
+
validationMessages: []
|
|
73
|
+
};
|
|
74
|
+
if (step.validate) {
|
|
75
|
+
const validationResult = await step.validate();
|
|
76
|
+
const { value: validationMessages, error } = decode.decode(t__namespace.array(SliceSimulatorSetupStepValidationMessageCodec), validationResult == null ? [] : castArray.castArray(validationResult));
|
|
77
|
+
if (error) {
|
|
78
|
+
return res;
|
|
79
|
+
}
|
|
80
|
+
const isComplete = validationMessages.length < 1;
|
|
81
|
+
const processedValidationMessages = await Promise.all(validationMessages.map(async (validationMessage) => {
|
|
82
|
+
const messageHTML = await markdownToHTML.markdownToHTML(validationMessage.message);
|
|
83
|
+
return {
|
|
84
|
+
...validationMessage,
|
|
85
|
+
message: messageHTML
|
|
86
|
+
};
|
|
87
|
+
}));
|
|
88
|
+
res.isComplete = isComplete;
|
|
89
|
+
res.validationMessages = processedValidationMessages;
|
|
90
|
+
}
|
|
91
|
+
return res;
|
|
92
|
+
}));
|
|
93
|
+
return {
|
|
94
|
+
steps,
|
|
95
|
+
errors: errors2
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
supportsSliceSimulator() {
|
|
99
|
+
assertPluginsInitialized.assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
100
|
+
const hooks = this.sliceMachinePluginRunner.hooksForType("slice-simulator:setup:read");
|
|
101
|
+
return hooks.length > 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.SimulatorManager = SimulatorManager;
|
|
105
|
+
//# sourceMappingURL=SimulatorManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimulatorManager.cjs","sources":["../../../../src/managers/simulator/SimulatorManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { HookError } from \"@slicemachine/plugin-kit\";\nimport fetch from \"../../lib/fetch\";\n\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { castArray } from \"../../lib/castArray\";\nimport { decode } from \"../../lib/decode\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { functionCodec } from \"../../lib/functionCodec\";\nimport { markdownToHTML } from \"../../lib/markdownToHTML\";\n\nimport { UnexpectedDataError } from \"../../errors\";\n\nimport { BaseManager } from \"../BaseManager\";\n\nconst sliceSimulatorSetupStepCodec = t.intersection([\n\tt.type({\n\t\ttitle: t.string,\n\t\tbody: t.string,\n\t}),\n\tt.partial({\n\t\tdescription: t.string,\n\t\tvalidate: functionCodec,\n\t}),\n]);\n\nconst SliceSimulatorSetupStepValidationMessageCodec = t.type({\n\ttitle: t.string,\n\tmessage: t.string,\n});\ntype SliceSimulatorSetupStepValidationMessageCodec = t.TypeOf<\n\ttypeof SliceSimulatorSetupStepValidationMessageCodec\n>;\n\nexport type SimulatorManagerReadSliceSimulatorSetupStep = {\n\ttitle: string;\n\tdescription?: string;\n\tbody: string;\n\t/**\n\t * Determines if the step is completed.\n\t *\n\t * This proeprty is `undefined` if the project's adapter does not provide a\n\t * validation function for the step; we cannot know if the step is complete\n\t * without a validator.\n\t */\n\tisComplete: boolean | undefined;\n\tvalidationMessages: SliceSimulatorSetupStepValidationMessageCodec[];\n};\n\nexport type SimulatorManagerReadSliceSimulatorSetupStepsReturnType = {\n\tsteps: SimulatorManagerReadSliceSimulatorSetupStep[];\n\terrors: (DecodeError | HookError)[];\n};\n\nexport class SimulatorManager extends BaseManager {\n\tasync getLocalSliceSimulatorURL(): Promise<string | undefined> {\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\n\t\treturn sliceMachineConfig.localSliceSimulatorURL;\n\t}\n\n\t/**\n\t * @throws {@link UnexpectedDataError} Thrown if the project is not configured\n\t * with a Slice Simulator URL.\n\t */\n\tasync checkIsLocalSliceSimulatorURLAccessible(): Promise<boolean> {\n\t\tconst localSliceSimulatorURL = await this.getLocalSliceSimulatorURL();\n\n\t\tif (!localSliceSimulatorURL) {\n\t\t\tthrow new UnexpectedDataError(\n\t\t\t\t\"The project has not been configured with a Slice Simulator URL. Add a `localSliceSimulatorURL` property to your project's configuration to fix this error.\",\n\t\t\t);\n\t\t}\n\n\t\tconst res = await fetch(localSliceSimulatorURL);\n\n\t\treturn res.ok;\n\t}\n\n\tasync readSliceSimulatorSetupSteps(): Promise<SimulatorManagerReadSliceSimulatorSetupStepsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-simulator:setup:read\",\n\t\t\tundefined,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.array(sliceSimulatorSetupStepCodec),\n\t\t\thookResult,\n\t\t);\n\n\t\tconst steps = await Promise.all(\n\t\t\tdata[0].map(async (step) => {\n\t\t\t\tconst bodyHTML = await markdownToHTML(step.body);\n\n\t\t\t\tconst res: SimulatorManagerReadSliceSimulatorSetupStep = {\n\t\t\t\t\ttitle: step.title,\n\t\t\t\t\tdescription: step.description,\n\t\t\t\t\tbody: bodyHTML,\n\t\t\t\t\tisComplete: undefined,\n\t\t\t\t\tvalidationMessages: [],\n\t\t\t\t};\n\n\t\t\t\tif (step.validate) {\n\t\t\t\t\tconst validationResult = await step.validate();\n\t\t\t\t\tconst { value: validationMessages, error } = decode(\n\t\t\t\t\t\tt.array(SliceSimulatorSetupStepValidationMessageCodec),\n\t\t\t\t\t\tvalidationResult == null ? [] : castArray(validationResult),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\t// TODO: We may want to do\n\t\t\t\t\t\t// something with the error,\n\t\t\t\t\t\t// like log to the console.\n\t\t\t\t\t\t// This branch should only be\n\t\t\t\t\t\t// reached if the adapter\n\t\t\t\t\t\t// returns invalid data.\n\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isComplete = validationMessages.length < 1;\n\n\t\t\t\t\tconst processedValidationMessages = await Promise.all(\n\t\t\t\t\t\tvalidationMessages.map(async (validationMessage) => {\n\t\t\t\t\t\t\tconst messageHTML = await markdownToHTML(\n\t\t\t\t\t\t\t\tvalidationMessage.message,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...validationMessage,\n\t\t\t\t\t\t\t\tmessage: messageHTML,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\n\t\t\t\t\tres.isComplete = isComplete;\n\t\t\t\t\tres.validationMessages = processedValidationMessages;\n\t\t\t\t}\n\n\t\t\t\treturn res;\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\tsteps,\n\t\t\terrors,\n\t\t};\n\t}\n\n\tsupportsSliceSimulator(): boolean {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hooks = this.sliceMachinePluginRunner.hooksForType(\n\t\t\t\"slice-simulator:setup:read\",\n\t\t);\n\n\t\treturn hooks.length > 0;\n\t}\n}\n"],"names":["t","functionCodec","BaseManager","UnexpectedDataError","fetch","assertPluginsInitialized","errors","decodeHookResult","markdownToHTML","decode","castArray"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,+BAA+BA,aAAE,aAAa;AAAA,EACnDA,aAAE,KAAK;AAAA,IACN,OAAOA,aAAE;AAA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oBAAoB,OAAO,CAAK,IAAAU,UAAA,UAAU,gBAAgB,CAAC;AAG5D,YAAI,OAAO;AAQH,iBAAA;AAAA,QACP;AAEK,cAAA,aAAa,mBAAmB,SAAS;AAE/C,cAAM,8BAA8B,MAAM,QAAQ,IACjD,mBAAmB,IAAI,OAAO,sBAAqB;AAClD,gBAAM,cAAc,MAAMF,eAAAA,eACzB,kBAAkB,OAAO;AAGnB,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,SAAS;AAAA,UAAA;AAAA,QAEV,CAAA,CAAC;AAGH,YAAI,aAAa;AACjB,YAAI,qBAAqB;AAAA,MACzB;AAEM,aAAA;AAAA,IACP,CAAA,CAAC;AAGI,WAAA;AAAA,MACN;AAAA,MACA,QAAAF;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,yBAAsB;AACrBD,sDAAyB,KAAK,wBAAwB;AAEtD,UAAM,QAAQ,KAAK,yBAAyB,aAC3C,4BAA4B;AAG7B,WAAO,MAAM,SAAS;AAAA,EACvB;AACA;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { HookError } from "@slicemachine/plugin-kit";
|
|
3
|
+
import { DecodeError } from "../../lib/DecodeError";
|
|
4
|
+
import { BaseManager } from "../BaseManager";
|
|
5
|
+
declare const SliceSimulatorSetupStepValidationMessageCodec: t.TypeC<{
|
|
6
|
+
title: t.StringC;
|
|
7
|
+
message: t.StringC;
|
|
8
|
+
}>;
|
|
9
|
+
type SliceSimulatorSetupStepValidationMessageCodec = t.TypeOf<typeof SliceSimulatorSetupStepValidationMessageCodec>;
|
|
10
|
+
export type SimulatorManagerReadSliceSimulatorSetupStep = {
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
body: string;
|
|
14
|
+
/**
|
|
15
|
+
* Determines if the step is completed.
|
|
16
|
+
*
|
|
17
|
+
* This proeprty is `undefined` if the project's adapter does not provide a
|
|
18
|
+
* validation function for the step; we cannot know if the step is complete
|
|
19
|
+
* without a validator.
|
|
20
|
+
*/
|
|
21
|
+
isComplete: boolean | undefined;
|
|
22
|
+
validationMessages: SliceSimulatorSetupStepValidationMessageCodec[];
|
|
23
|
+
};
|
|
24
|
+
export type SimulatorManagerReadSliceSimulatorSetupStepsReturnType = {
|
|
25
|
+
steps: SimulatorManagerReadSliceSimulatorSetupStep[];
|
|
26
|
+
errors: (DecodeError | HookError)[];
|
|
27
|
+
};
|
|
28
|
+
export declare class SimulatorManager extends BaseManager {
|
|
29
|
+
getLocalSliceSimulatorURL(): Promise<string | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* @throws {@link UnexpectedDataError} Thrown if the project is not configured
|
|
32
|
+
* with a Slice Simulator URL.
|
|
33
|
+
*/
|
|
34
|
+
checkIsLocalSliceSimulatorURLAccessible(): Promise<boolean>;
|
|
35
|
+
readSliceSimulatorSetupSteps(): Promise<SimulatorManagerReadSliceSimulatorSetupStepsReturnType>;
|
|
36
|
+
supportsSliceSimulator(): boolean;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import fetch from "../../lib/fetch.js";
|
|
3
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized.js";
|
|
4
|
+
import { castArray } from "../../lib/castArray.js";
|
|
5
|
+
import { decode } from "../../lib/decode.js";
|
|
6
|
+
import { decodeHookResult } from "../../lib/decodeHookResult.js";
|
|
7
|
+
import { functionCodec } from "../../lib/functionCodec.js";
|
|
8
|
+
import { markdownToHTML } from "../../lib/markdownToHTML.js";
|
|
9
|
+
import { UnexpectedDataError } from "../../errors.js";
|
|
10
|
+
import { BaseManager } from "../BaseManager.js";
|
|
11
|
+
const sliceSimulatorSetupStepCodec = t.intersection([
|
|
12
|
+
t.type({
|
|
13
|
+
title: t.string,
|
|
14
|
+
body: t.string
|
|
15
|
+
}),
|
|
16
|
+
t.partial({
|
|
17
|
+
description: t.string,
|
|
18
|
+
validate: functionCodec
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
const SliceSimulatorSetupStepValidationMessageCodec = t.type({
|
|
22
|
+
title: t.string,
|
|
23
|
+
message: t.string
|
|
24
|
+
});
|
|
25
|
+
class SimulatorManager extends BaseManager {
|
|
26
|
+
async getLocalSliceSimulatorURL() {
|
|
27
|
+
const sliceMachineConfig = await this.project.getSliceMachineConfig();
|
|
28
|
+
return sliceMachineConfig.localSliceSimulatorURL;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @throws {@link UnexpectedDataError} Thrown if the project is not configured
|
|
32
|
+
* with a Slice Simulator URL.
|
|
33
|
+
*/
|
|
34
|
+
async checkIsLocalSliceSimulatorURLAccessible() {
|
|
35
|
+
const localSliceSimulatorURL = await this.getLocalSliceSimulatorURL();
|
|
36
|
+
if (!localSliceSimulatorURL) {
|
|
37
|
+
throw new UnexpectedDataError("The project has not been configured with a Slice Simulator URL. Add a `localSliceSimulatorURL` property to your project's configuration to fix this error.");
|
|
38
|
+
}
|
|
39
|
+
const res = await fetch(localSliceSimulatorURL);
|
|
40
|
+
return res.ok;
|
|
41
|
+
}
|
|
42
|
+
async readSliceSimulatorSetupSteps() {
|
|
43
|
+
assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
44
|
+
const hookResult = await this.sliceMachinePluginRunner.callHook("slice-simulator:setup:read", void 0);
|
|
45
|
+
const { data, errors } = decodeHookResult(t.array(sliceSimulatorSetupStepCodec), hookResult);
|
|
46
|
+
const steps = await Promise.all(data[0].map(async (step) => {
|
|
47
|
+
const bodyHTML = await markdownToHTML(step.body);
|
|
48
|
+
const res = {
|
|
49
|
+
title: step.title,
|
|
50
|
+
description: step.description,
|
|
51
|
+
body: bodyHTML,
|
|
52
|
+
isComplete: void 0,
|
|
53
|
+
validationMessages: []
|
|
54
|
+
};
|
|
55
|
+
if (step.validate) {
|
|
56
|
+
const validationResult = await step.validate();
|
|
57
|
+
const { value: validationMessages, error } = decode(t.array(SliceSimulatorSetupStepValidationMessageCodec), validationResult == null ? [] : castArray(validationResult));
|
|
58
|
+
if (error) {
|
|
59
|
+
return res;
|
|
60
|
+
}
|
|
61
|
+
const isComplete = validationMessages.length < 1;
|
|
62
|
+
const processedValidationMessages = await Promise.all(validationMessages.map(async (validationMessage) => {
|
|
63
|
+
const messageHTML = await markdownToHTML(validationMessage.message);
|
|
64
|
+
return {
|
|
65
|
+
...validationMessage,
|
|
66
|
+
message: messageHTML
|
|
67
|
+
};
|
|
68
|
+
}));
|
|
69
|
+
res.isComplete = isComplete;
|
|
70
|
+
res.validationMessages = processedValidationMessages;
|
|
71
|
+
}
|
|
72
|
+
return res;
|
|
73
|
+
}));
|
|
74
|
+
return {
|
|
75
|
+
steps,
|
|
76
|
+
errors
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
supportsSliceSimulator() {
|
|
80
|
+
assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
81
|
+
const hooks = this.sliceMachinePluginRunner.hooksForType("slice-simulator:setup:read");
|
|
82
|
+
return hooks.length > 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
SimulatorManager
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=SimulatorManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimulatorManager.js","sources":["../../../../src/managers/simulator/SimulatorManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { HookError } from \"@slicemachine/plugin-kit\";\nimport fetch from \"../../lib/fetch\";\n\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { castArray } from \"../../lib/castArray\";\nimport { decode } from \"../../lib/decode\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { functionCodec } from \"../../lib/functionCodec\";\nimport { markdownToHTML } from \"../../lib/markdownToHTML\";\n\nimport { UnexpectedDataError } from \"../../errors\";\n\nimport { BaseManager } from \"../BaseManager\";\n\nconst sliceSimulatorSetupStepCodec = t.intersection([\n\tt.type({\n\t\ttitle: t.string,\n\t\tbody: t.string,\n\t}),\n\tt.partial({\n\t\tdescription: t.string,\n\t\tvalidate: functionCodec,\n\t}),\n]);\n\nconst SliceSimulatorSetupStepValidationMessageCodec = t.type({\n\ttitle: t.string,\n\tmessage: t.string,\n});\ntype SliceSimulatorSetupStepValidationMessageCodec = t.TypeOf<\n\ttypeof SliceSimulatorSetupStepValidationMessageCodec\n>;\n\nexport type SimulatorManagerReadSliceSimulatorSetupStep = {\n\ttitle: string;\n\tdescription?: string;\n\tbody: string;\n\t/**\n\t * Determines if the step is completed.\n\t *\n\t * This proeprty is `undefined` if the project's adapter does not provide a\n\t * validation function for the step; we cannot know if the step is complete\n\t * without a validator.\n\t */\n\tisComplete: boolean | undefined;\n\tvalidationMessages: SliceSimulatorSetupStepValidationMessageCodec[];\n};\n\nexport type SimulatorManagerReadSliceSimulatorSetupStepsReturnType = {\n\tsteps: SimulatorManagerReadSliceSimulatorSetupStep[];\n\terrors: (DecodeError | HookError)[];\n};\n\nexport class SimulatorManager extends BaseManager {\n\tasync getLocalSliceSimulatorURL(): Promise<string | undefined> {\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\n\t\treturn sliceMachineConfig.localSliceSimulatorURL;\n\t}\n\n\t/**\n\t * @throws {@link UnexpectedDataError} Thrown if the project is not configured\n\t * with a Slice Simulator URL.\n\t */\n\tasync checkIsLocalSliceSimulatorURLAccessible(): Promise<boolean> {\n\t\tconst localSliceSimulatorURL = await this.getLocalSliceSimulatorURL();\n\n\t\tif (!localSliceSimulatorURL) {\n\t\t\tthrow new UnexpectedDataError(\n\t\t\t\t\"The project has not been configured with a Slice Simulator URL. Add a `localSliceSimulatorURL` property to your project's configuration to fix this error.\",\n\t\t\t);\n\t\t}\n\n\t\tconst res = await fetch(localSliceSimulatorURL);\n\n\t\treturn res.ok;\n\t}\n\n\tasync readSliceSimulatorSetupSteps(): Promise<SimulatorManagerReadSliceSimulatorSetupStepsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-simulator:setup:read\",\n\t\t\tundefined,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.array(sliceSimulatorSetupStepCodec),\n\t\t\thookResult,\n\t\t);\n\n\t\tconst steps = await Promise.all(\n\t\t\tdata[0].map(async (step) => {\n\t\t\t\tconst bodyHTML = await markdownToHTML(step.body);\n\n\t\t\t\tconst res: SimulatorManagerReadSliceSimulatorSetupStep = {\n\t\t\t\t\ttitle: step.title,\n\t\t\t\t\tdescription: step.description,\n\t\t\t\t\tbody: bodyHTML,\n\t\t\t\t\tisComplete: undefined,\n\t\t\t\t\tvalidationMessages: [],\n\t\t\t\t};\n\n\t\t\t\tif (step.validate) {\n\t\t\t\t\tconst validationResult = await step.validate();\n\t\t\t\t\tconst { value: validationMessages, error } = decode(\n\t\t\t\t\t\tt.array(SliceSimulatorSetupStepValidationMessageCodec),\n\t\t\t\t\t\tvalidationResult == null ? [] : castArray(validationResult),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\t// TODO: We may want to do\n\t\t\t\t\t\t// something with the error,\n\t\t\t\t\t\t// like log to the console.\n\t\t\t\t\t\t// This branch should only be\n\t\t\t\t\t\t// reached if the adapter\n\t\t\t\t\t\t// returns invalid data.\n\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isComplete = validationMessages.length < 1;\n\n\t\t\t\t\tconst processedValidationMessages = await Promise.all(\n\t\t\t\t\t\tvalidationMessages.map(async (validationMessage) => {\n\t\t\t\t\t\t\tconst messageHTML = await markdownToHTML(\n\t\t\t\t\t\t\t\tvalidationMessage.message,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...validationMessage,\n\t\t\t\t\t\t\t\tmessage: messageHTML,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\n\t\t\t\t\tres.isComplete = isComplete;\n\t\t\t\t\tres.validationMessages = processedValidationMessages;\n\t\t\t\t}\n\n\t\t\t\treturn res;\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\tsteps,\n\t\t\terrors,\n\t\t};\n\t}\n\n\tsupportsSliceSimulator(): boolean {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hooks = this.sliceMachinePluginRunner.hooksForType(\n\t\t\t\"slice-simulator:setup:read\",\n\t\t);\n\n\t\treturn hooks.length > 0;\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;AAgBA,MAAM,+BAA+B,EAAE,aAAa;AAAA,EACnD,EAAE,KAAK;AAAA,IACN,OAAO,EAAE;AAAA,IACT,MAAM,EAAE;AAAA,EAAA,CACR;AAAA,EACD,EAAE,QAAQ;AAAA,IACT,aAAa,EAAE;AAAA,IACf,UAAU;AAAA,EAAA,CACV;AACD,CAAA;AAED,MAAM,gDAAgD,EAAE,KAAK;AAAA,EAC5D,OAAO,EAAE;AAAA,EACT,SAAS,EAAE;AACX,CAAA;AAyBK,MAAO,yBAAyB,YAAW;AAAA,EAChD,MAAM,4BAAyB;AAC9B,UAAM,qBAAqB,MAAM,KAAK,QAAQ,sBAAqB;AAEnE,WAAO,mBAAmB;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,0CAAuC;AACtC,UAAA,yBAAyB,MAAM,KAAK;AAE1C,QAAI,CAAC,wBAAwB;AACtB,YAAA,IAAI,oBACT,4JAA4J;AAAA,IAE7J;AAEK,UAAA,MAAM,MAAM,MAAM,sBAAsB;AAE9C,WAAO,IAAI;AAAA,EACZ;AAAA,EAEA,MAAM,+BAA4B;AACjC,6BAAyB,KAAK,wBAAwB;AAEtD,UAAM,aAAa,MAAM,KAAK,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");
|
|
4
|
+
const BaseManager = require("../BaseManager.cjs");
|
|
5
|
+
const assertPluginsInitialized = require("../../lib/assertPluginsInitialized.cjs");
|
|
6
|
+
const decodeHookResult = require("../../lib/decodeHookResult.cjs");
|
|
7
|
+
const customtypes = require("@prismicio/types-internal/lib/customtypes");
|
|
8
|
+
const content = require("@prismicio/types-internal/lib/content");
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
if (k !== "default") {
|
|
14
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: () => e[k]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
const t__namespace = /* @__PURE__ */ _interopNamespaceDefault(t);
|
|
26
|
+
const readHookCodec = t__namespace.type({
|
|
27
|
+
templates: t__namespace.array(t__namespace.type({
|
|
28
|
+
model: customtypes.SharedSlice,
|
|
29
|
+
componentContentsTemplate: t__namespace.string,
|
|
30
|
+
mocks: t__namespace.array(content.SharedSliceContent),
|
|
31
|
+
screenshots: t__namespace.record(t__namespace.string, t__namespace.any)
|
|
32
|
+
}))
|
|
33
|
+
});
|
|
34
|
+
const replacePascalNameToReplace = (template, name) => template.replaceAll("PascalNameToReplace", name);
|
|
35
|
+
class SliceTemplateLibraryManager extends BaseManager.BaseManager {
|
|
36
|
+
async readLibrary(args) {
|
|
37
|
+
assertPluginsInitialized.assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
38
|
+
const hookResult = await this.sliceMachinePluginRunner.callHook("slice-template-library:read", args);
|
|
39
|
+
const { data, errors } = decodeHookResult.decodeHookResult(readHookCodec, hookResult);
|
|
40
|
+
return {
|
|
41
|
+
templates: data.flat().flatMap((item) => item.templates.map((t2) => ({
|
|
42
|
+
model: t2.model,
|
|
43
|
+
screenshots: t2.screenshots
|
|
44
|
+
}))),
|
|
45
|
+
errors
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async createSlices(args) {
|
|
49
|
+
assertPluginsInitialized.assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
50
|
+
const hookReadResult = await this.sliceMachinePluginRunner.callHook("slice-template-library:read", args);
|
|
51
|
+
const { data: readData, errors: readErrors } = decodeHookResult.decodeHookResult(readHookCodec, hookReadResult);
|
|
52
|
+
const templates = readData.flat().flatMap((item) => item.templates);
|
|
53
|
+
if (readErrors.length > 0) {
|
|
54
|
+
return {
|
|
55
|
+
errors: readErrors
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const { models: allSlices, errors: readAllSlicesErrors } = await this.slices.readAllSlices();
|
|
59
|
+
if (readAllSlicesErrors.length > 0) {
|
|
60
|
+
return {
|
|
61
|
+
errors: readAllSlicesErrors
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const existingIds = allSlices.map((slice) => slice.model.id);
|
|
65
|
+
const getNextAvailableSlice = (baseId) => {
|
|
66
|
+
let nextId = baseId;
|
|
67
|
+
let counter = 1;
|
|
68
|
+
while (existingIds.includes(nextId)) {
|
|
69
|
+
counter++;
|
|
70
|
+
nextId = `${baseId}_${counter}`;
|
|
71
|
+
}
|
|
72
|
+
existingIds.push(nextId);
|
|
73
|
+
return { id: nextId, counter };
|
|
74
|
+
};
|
|
75
|
+
const slicesToCreate = templates.map((template) => {
|
|
76
|
+
const { id, counter } = getNextAvailableSlice(template.model.id);
|
|
77
|
+
return {
|
|
78
|
+
...template,
|
|
79
|
+
model: {
|
|
80
|
+
...template.model,
|
|
81
|
+
id,
|
|
82
|
+
name: counter > 1 ? template.model.name + counter : template.model.name
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
const { libraries, errors: readAllSliceLibrariesErrors } = await this.slices.readAllSliceLibraries();
|
|
87
|
+
if (readAllSliceLibrariesErrors.length > 0) {
|
|
88
|
+
return {
|
|
89
|
+
errors: readAllSliceLibrariesErrors
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const targetLibrary = libraries[0];
|
|
93
|
+
const creationPromises = slicesToCreate.map((slice) => {
|
|
94
|
+
return this.slices.createSlice({
|
|
95
|
+
libraryID: targetLibrary.libraryID,
|
|
96
|
+
model: slice.model,
|
|
97
|
+
componentContents: replacePascalNameToReplace(slice.componentContentsTemplate, slice.model.name)
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const creationResults = await Promise.all(creationPromises);
|
|
101
|
+
const creationErrors = creationResults.flatMap((result) => result.errors);
|
|
102
|
+
if (creationErrors.length > 0) {
|
|
103
|
+
return {
|
|
104
|
+
errors: creationErrors
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const mocksPromises = slicesToCreate.map((slice) => {
|
|
108
|
+
return this.slices.updateSliceMocks({
|
|
109
|
+
libraryID: targetLibrary.libraryID,
|
|
110
|
+
sliceID: slice.model.id,
|
|
111
|
+
mocks: slice.mocks
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
const mocksResults = await Promise.all(mocksPromises);
|
|
115
|
+
const sliceScreenshotsPromises = slicesToCreate.map((slice) => {
|
|
116
|
+
const screenshotPromises = Object.entries(slice.screenshots).map(([variationID, data]) => {
|
|
117
|
+
return this.slices.updateSliceScreenshot({
|
|
118
|
+
libraryID: targetLibrary.libraryID,
|
|
119
|
+
sliceID: slice.model.id,
|
|
120
|
+
variationID,
|
|
121
|
+
data
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
return Promise.all(screenshotPromises);
|
|
125
|
+
});
|
|
126
|
+
const sliceScreenshotsResults = await Promise.all(sliceScreenshotsPromises);
|
|
127
|
+
const mocksErrors = mocksResults.flatMap((result) => result.errors);
|
|
128
|
+
const screenshotErrors = sliceScreenshotsResults.flatMap((result) => result.flat().flatMap((r) => r.errors));
|
|
129
|
+
const sliceIDs = slicesToCreate.map((slice) => slice.model.id);
|
|
130
|
+
return {
|
|
131
|
+
errors: [...mocksErrors, ...screenshotErrors],
|
|
132
|
+
data: {
|
|
133
|
+
sliceIDs
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.SliceTemplateLibraryManager = SliceTemplateLibraryManager;
|
|
139
|
+
//# sourceMappingURL=SliceTemplateLibraryManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceTemplateLibraryManager.cjs","sources":["../../../../src/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { HookError } from \"@slicemachine/plugin-kit\";\nimport { BaseManager } from \"../BaseManager\";\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\ntype SliceTemplateLibraryManagerReadLibraryReturnType = {\n\ttemplates: {\n\t\tmodel: SharedSlice;\n\t\tscreenshots: Record<string, Buffer>;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceTemplateLibraryManagerCreateSlicesReturnType = {\n\tdata?: {\n\t\tsliceIDs: string[];\n\t};\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceTemplateLibraryReadLibraryData = {\n\ttemplateIDs?: string[];\n};\n\ntype SliceTemplateLibraryCreateSlicesData = SliceTemplateLibraryReadLibraryData;\n\nconst readHookCodec = t.type({\n\ttemplates: t.array(\n\t\tt.type({\n\t\t\tmodel: SharedSlice,\n\t\t\tcomponentContentsTemplate: t.string,\n\t\t\tmocks: t.array(SharedSliceContent),\n\t\t\tscreenshots: t.record(t.string, t.any),\n\t\t}),\n\t),\n});\n\nconst replacePascalNameToReplace = (template: string, name: string) =>\n\ttemplate.replaceAll(\"PascalNameToReplace\", name);\n\nexport class SliceTemplateLibraryManager extends BaseManager {\n\tasync readLibrary(\n\t\targs: SliceTemplateLibraryReadLibraryData,\n\t): Promise<SliceTemplateLibraryManagerReadLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-template-library:read\",\n\t\t\targs,\n\t\t);\n\n\t\tconst { data, errors } = decodeHookResult(readHookCodec, hookResult);\n\n\t\treturn {\n\t\t\ttemplates: data.flat().flatMap((item) =>\n\t\t\t\titem.templates.map((t) => ({\n\t\t\t\t\tmodel: t.model,\n\t\t\t\t\tscreenshots: t.screenshots,\n\t\t\t\t})),\n\t\t\t),\n\t\t\terrors,\n\t\t};\n\t}\n\tasync createSlices(\n\t\targs: SliceTemplateLibraryCreateSlicesData,\n\t): Promise<SliceTemplateLibraryManagerCreateSlicesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// Reading all available slice templates\n\t\tconst hookReadResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-template-library:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data: readData, errors: readErrors } = decodeHookResult(\n\t\t\treadHookCodec,\n\t\t\thookReadResult,\n\t\t);\n\t\tconst templates = readData.flat().flatMap((item) => item.templates);\n\t\tif (readErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readErrors,\n\t\t\t};\n\t\t}\n\n\t\t// Extract all existing slice IDs into an array\n\t\tconst { models: allSlices, errors: readAllSlicesErrors } =\n\t\t\tawait this.slices.readAllSlices();\n\t\tif (readAllSlicesErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readAllSlicesErrors,\n\t\t\t};\n\t\t}\n\t\tconst existingIds: string[] = allSlices.map((slice) => slice.model.id);\n\n\t\t// Create a function to get the next available ID based on the baseId\n\t\tconst getNextAvailableSlice = (baseId: string) => {\n\t\t\tlet nextId = baseId;\n\t\t\tlet counter = 1;\n\t\t\twhile (existingIds.includes(nextId)) {\n\t\t\t\tcounter++;\n\t\t\t\tnextId = `${baseId}_${counter}`;\n\t\t\t}\n\t\t\texistingIds.push(nextId);\n\n\t\t\treturn { id: nextId, counter };\n\t\t};\n\n\t\t// Extract the slices to create from the template ids given in args\n\t\tconst slicesToCreate = templates.map((template) => {\n\t\t\tconst { id, counter } = getNextAvailableSlice(template.model.id);\n\n\t\t\treturn {\n\t\t\t\t...template,\n\t\t\t\tmodel: {\n\t\t\t\t\t...template.model,\n\t\t\t\t\tid,\n\t\t\t\t\tname:\n\t\t\t\t\t\tcounter > 1 ? template.model.name + counter : template.model.name,\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\t// Get target library\n\t\t// Note: We only support adding template to the first library at the moment\n\t\tconst { libraries, errors: readAllSliceLibrariesErrors } =\n\t\t\tawait this.slices.readAllSliceLibraries();\n\t\tif (readAllSliceLibrariesErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readAllSliceLibrariesErrors,\n\t\t\t};\n\t\t}\n\t\tconst targetLibrary = libraries[0];\n\n\t\t// Initiate the slice creation process for all slices\n\t\tconst creationPromises = slicesToCreate.map((slice) => {\n\t\t\treturn this.slices.createSlice({\n\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\tmodel: slice.model,\n\t\t\t\tcomponentContents: replacePascalNameToReplace(\n\t\t\t\t\tslice.componentContentsTemplate,\n\t\t\t\t\tslice.model.name,\n\t\t\t\t),\n\t\t\t});\n\t\t});\n\n\t\t// Wait for all slices to be created\n\t\tconst creationResults = await Promise.all(creationPromises);\n\t\t// Check for any errors in the creation results\n\t\tconst creationErrors = creationResults.flatMap((result) => result.errors);\n\t\tif (creationErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: creationErrors,\n\t\t\t};\n\t\t}\n\n\t\tconst mocksPromises = slicesToCreate.map((slice) => {\n\t\t\treturn this.slices.updateSliceMocks({\n\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\tsliceID: slice.model.id,\n\t\t\t\tmocks: slice.mocks,\n\t\t\t});\n\t\t});\n\n\t\tconst mocksResults = await Promise.all(mocksPromises);\n\n\t\tconst sliceScreenshotsPromises = slicesToCreate.map((slice) => {\n\t\t\tconst screenshotPromises = Object.entries(slice.screenshots).map(\n\t\t\t\t([variationID, data]) => {\n\t\t\t\t\treturn this.slices.updateSliceScreenshot({\n\t\t\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\t\t\tsliceID: slice.model.id,\n\t\t\t\t\t\tvariationID,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn Promise.all(screenshotPromises);\n\t\t});\n\n\t\tconst sliceScreenshotsResults = await Promise.all(sliceScreenshotsPromises);\n\t\tconst mocksErrors = mocksResults.flatMap((result) => result.errors);\n\t\tconst screenshotErrors = sliceScreenshotsResults.flatMap((result) =>\n\t\t\tresult.flat().flatMap((r) => r.errors),\n\t\t);\n\n\t\t// Extract the slice IDs from the creation results (assuming each result has an ID)\n\t\tconst sliceIDs = slicesToCreate.map((slice) => slice.model.id);\n\n\t\treturn {\n\t\t\terrors: [...mocksErrors, ...screenshotErrors],\n\t\t\tdata: {\n\t\t\t\tsliceIDs,\n\t\t\t},\n\t\t};\n\t}\n}\n"],"names":["t","SharedSlice","SharedSliceContent","BaseManager","assertPluginsInitialized","decodeHookResult"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,gBAAgBA,aAAE,KAAK;AAAA,EAC5B,WAAWA,aAAE,MACZA,aAAE,KAAK;AAAA,IACN,OAAOC,YAAA;AAAA,IACP,2BAA2BD,aAAE;AAAA,IAC7B,OAAOA,aAAE,MAAME,0BAAkB;AAAA,IACjC,aAAaF,a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,CAAC,UAAS;AACvD,YAAA,qBAAqB,OAAO,QAAQ,MAAM,WAAW,EAAE,IAC5D,CAAC,CAAC,aAAa,IAAI,MAAK;AAChB,eAAA,KAAK,OAAO,sBAAsB;AAAA,UACxC,WAAW,cAAc;AAAA,UACzB,SAAS,MAAM,MAAM;AAAA,UACrB;AAAA,UACA;AAAA,QAAA,CACA;AAAA,MAAA,CACD;AAGK,aAAA,QAAQ,IAAI,kBAAkB;AAAA,IAAA,CACrC;AAED,UAAM,0BAA0B,MAAM,QAAQ,IAAI,wBAAwB;AAC1E,UAAM,cAAc,aAAa,QAAQ,CAAC,WAAW,OAAO,MAAM;AAClE,UAAM,mBAAmB,wBAAwB,QAAQ,CAAC,WACzD,OAAO,KAAM,EAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;AAIvC,UAAM,WAAW,eAAe,IAAI,CAAC,UAAU,MAAM,MAAM,EAAE;AAEtD,WAAA;AAAA,MACN,QAAQ,CAAC,GAAG,aAAa,GAAG,gBAAgB;AAAA,MAC5C,MAAM;AAAA,QACL;AAAA,MACA;AAAA,IAAA;AAAA,EAEH;AACA;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { HookError } from "@slicemachine/plugin-kit";
|
|
3
|
+
import { BaseManager } from "../BaseManager";
|
|
4
|
+
import { DecodeError } from "../../lib/DecodeError";
|
|
5
|
+
import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
6
|
+
type SliceTemplateLibraryManagerReadLibraryReturnType = {
|
|
7
|
+
templates: {
|
|
8
|
+
model: SharedSlice;
|
|
9
|
+
screenshots: Record<string, Buffer>;
|
|
10
|
+
}[];
|
|
11
|
+
errors: (DecodeError | HookError)[];
|
|
12
|
+
};
|
|
13
|
+
type SliceTemplateLibraryManagerCreateSlicesReturnType = {
|
|
14
|
+
data?: {
|
|
15
|
+
sliceIDs: string[];
|
|
16
|
+
};
|
|
17
|
+
errors: (DecodeError | HookError)[];
|
|
18
|
+
};
|
|
19
|
+
type SliceTemplateLibraryReadLibraryData = {
|
|
20
|
+
templateIDs?: string[];
|
|
21
|
+
};
|
|
22
|
+
type SliceTemplateLibraryCreateSlicesData = SliceTemplateLibraryReadLibraryData;
|
|
23
|
+
export declare class SliceTemplateLibraryManager extends BaseManager {
|
|
24
|
+
readLibrary(args: SliceTemplateLibraryReadLibraryData): Promise<SliceTemplateLibraryManagerReadLibraryReturnType>;
|
|
25
|
+
createSlices(args: SliceTemplateLibraryCreateSlicesData): Promise<SliceTemplateLibraryManagerCreateSlicesReturnType>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { BaseManager } from "../BaseManager.js";
|
|
3
|
+
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized.js";
|
|
4
|
+
import { decodeHookResult } from "../../lib/decodeHookResult.js";
|
|
5
|
+
import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
6
|
+
import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
|
|
7
|
+
const readHookCodec = t.type({
|
|
8
|
+
templates: t.array(t.type({
|
|
9
|
+
model: SharedSlice,
|
|
10
|
+
componentContentsTemplate: t.string,
|
|
11
|
+
mocks: t.array(SharedSliceContent),
|
|
12
|
+
screenshots: t.record(t.string, t.any)
|
|
13
|
+
}))
|
|
14
|
+
});
|
|
15
|
+
const replacePascalNameToReplace = (template, name) => template.replaceAll("PascalNameToReplace", name);
|
|
16
|
+
class SliceTemplateLibraryManager extends BaseManager {
|
|
17
|
+
async readLibrary(args) {
|
|
18
|
+
assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
19
|
+
const hookResult = await this.sliceMachinePluginRunner.callHook("slice-template-library:read", args);
|
|
20
|
+
const { data, errors } = decodeHookResult(readHookCodec, hookResult);
|
|
21
|
+
return {
|
|
22
|
+
templates: data.flat().flatMap((item) => item.templates.map((t2) => ({
|
|
23
|
+
model: t2.model,
|
|
24
|
+
screenshots: t2.screenshots
|
|
25
|
+
}))),
|
|
26
|
+
errors
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async createSlices(args) {
|
|
30
|
+
assertPluginsInitialized(this.sliceMachinePluginRunner);
|
|
31
|
+
const hookReadResult = await this.sliceMachinePluginRunner.callHook("slice-template-library:read", args);
|
|
32
|
+
const { data: readData, errors: readErrors } = decodeHookResult(readHookCodec, hookReadResult);
|
|
33
|
+
const templates = readData.flat().flatMap((item) => item.templates);
|
|
34
|
+
if (readErrors.length > 0) {
|
|
35
|
+
return {
|
|
36
|
+
errors: readErrors
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const { models: allSlices, errors: readAllSlicesErrors } = await this.slices.readAllSlices();
|
|
40
|
+
if (readAllSlicesErrors.length > 0) {
|
|
41
|
+
return {
|
|
42
|
+
errors: readAllSlicesErrors
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const existingIds = allSlices.map((slice) => slice.model.id);
|
|
46
|
+
const getNextAvailableSlice = (baseId) => {
|
|
47
|
+
let nextId = baseId;
|
|
48
|
+
let counter = 1;
|
|
49
|
+
while (existingIds.includes(nextId)) {
|
|
50
|
+
counter++;
|
|
51
|
+
nextId = `${baseId}_${counter}`;
|
|
52
|
+
}
|
|
53
|
+
existingIds.push(nextId);
|
|
54
|
+
return { id: nextId, counter };
|
|
55
|
+
};
|
|
56
|
+
const slicesToCreate = templates.map((template) => {
|
|
57
|
+
const { id, counter } = getNextAvailableSlice(template.model.id);
|
|
58
|
+
return {
|
|
59
|
+
...template,
|
|
60
|
+
model: {
|
|
61
|
+
...template.model,
|
|
62
|
+
id,
|
|
63
|
+
name: counter > 1 ? template.model.name + counter : template.model.name
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const { libraries, errors: readAllSliceLibrariesErrors } = await this.slices.readAllSliceLibraries();
|
|
68
|
+
if (readAllSliceLibrariesErrors.length > 0) {
|
|
69
|
+
return {
|
|
70
|
+
errors: readAllSliceLibrariesErrors
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const targetLibrary = libraries[0];
|
|
74
|
+
const creationPromises = slicesToCreate.map((slice) => {
|
|
75
|
+
return this.slices.createSlice({
|
|
76
|
+
libraryID: targetLibrary.libraryID,
|
|
77
|
+
model: slice.model,
|
|
78
|
+
componentContents: replacePascalNameToReplace(slice.componentContentsTemplate, slice.model.name)
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
const creationResults = await Promise.all(creationPromises);
|
|
82
|
+
const creationErrors = creationResults.flatMap((result) => result.errors);
|
|
83
|
+
if (creationErrors.length > 0) {
|
|
84
|
+
return {
|
|
85
|
+
errors: creationErrors
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const mocksPromises = slicesToCreate.map((slice) => {
|
|
89
|
+
return this.slices.updateSliceMocks({
|
|
90
|
+
libraryID: targetLibrary.libraryID,
|
|
91
|
+
sliceID: slice.model.id,
|
|
92
|
+
mocks: slice.mocks
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const mocksResults = await Promise.all(mocksPromises);
|
|
96
|
+
const sliceScreenshotsPromises = slicesToCreate.map((slice) => {
|
|
97
|
+
const screenshotPromises = Object.entries(slice.screenshots).map(([variationID, data]) => {
|
|
98
|
+
return this.slices.updateSliceScreenshot({
|
|
99
|
+
libraryID: targetLibrary.libraryID,
|
|
100
|
+
sliceID: slice.model.id,
|
|
101
|
+
variationID,
|
|
102
|
+
data
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return Promise.all(screenshotPromises);
|
|
106
|
+
});
|
|
107
|
+
const sliceScreenshotsResults = await Promise.all(sliceScreenshotsPromises);
|
|
108
|
+
const mocksErrors = mocksResults.flatMap((result) => result.errors);
|
|
109
|
+
const screenshotErrors = sliceScreenshotsResults.flatMap((result) => result.flat().flatMap((r) => r.errors));
|
|
110
|
+
const sliceIDs = slicesToCreate.map((slice) => slice.model.id);
|
|
111
|
+
return {
|
|
112
|
+
errors: [...mocksErrors, ...screenshotErrors],
|
|
113
|
+
data: {
|
|
114
|
+
sliceIDs
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
SliceTemplateLibraryManager
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=SliceTemplateLibraryManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceTemplateLibraryManager.js","sources":["../../../../src/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { HookError } from \"@slicemachine/plugin-kit\";\nimport { BaseManager } from \"../BaseManager\";\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\ntype SliceTemplateLibraryManagerReadLibraryReturnType = {\n\ttemplates: {\n\t\tmodel: SharedSlice;\n\t\tscreenshots: Record<string, Buffer>;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceTemplateLibraryManagerCreateSlicesReturnType = {\n\tdata?: {\n\t\tsliceIDs: string[];\n\t};\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceTemplateLibraryReadLibraryData = {\n\ttemplateIDs?: string[];\n};\n\ntype SliceTemplateLibraryCreateSlicesData = SliceTemplateLibraryReadLibraryData;\n\nconst readHookCodec = t.type({\n\ttemplates: t.array(\n\t\tt.type({\n\t\t\tmodel: SharedSlice,\n\t\t\tcomponentContentsTemplate: t.string,\n\t\t\tmocks: t.array(SharedSliceContent),\n\t\t\tscreenshots: t.record(t.string, t.any),\n\t\t}),\n\t),\n});\n\nconst replacePascalNameToReplace = (template: string, name: string) =>\n\ttemplate.replaceAll(\"PascalNameToReplace\", name);\n\nexport class SliceTemplateLibraryManager extends BaseManager {\n\tasync readLibrary(\n\t\targs: SliceTemplateLibraryReadLibraryData,\n\t): Promise<SliceTemplateLibraryManagerReadLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-template-library:read\",\n\t\t\targs,\n\t\t);\n\n\t\tconst { data, errors } = decodeHookResult(readHookCodec, hookResult);\n\n\t\treturn {\n\t\t\ttemplates: data.flat().flatMap((item) =>\n\t\t\t\titem.templates.map((t) => ({\n\t\t\t\t\tmodel: t.model,\n\t\t\t\t\tscreenshots: t.screenshots,\n\t\t\t\t})),\n\t\t\t),\n\t\t\terrors,\n\t\t};\n\t}\n\tasync createSlices(\n\t\targs: SliceTemplateLibraryCreateSlicesData,\n\t): Promise<SliceTemplateLibraryManagerCreateSlicesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// Reading all available slice templates\n\t\tconst hookReadResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-template-library:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data: readData, errors: readErrors } = decodeHookResult(\n\t\t\treadHookCodec,\n\t\t\thookReadResult,\n\t\t);\n\t\tconst templates = readData.flat().flatMap((item) => item.templates);\n\t\tif (readErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readErrors,\n\t\t\t};\n\t\t}\n\n\t\t// Extract all existing slice IDs into an array\n\t\tconst { models: allSlices, errors: readAllSlicesErrors } =\n\t\t\tawait this.slices.readAllSlices();\n\t\tif (readAllSlicesErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readAllSlicesErrors,\n\t\t\t};\n\t\t}\n\t\tconst existingIds: string[] = allSlices.map((slice) => slice.model.id);\n\n\t\t// Create a function to get the next available ID based on the baseId\n\t\tconst getNextAvailableSlice = (baseId: string) => {\n\t\t\tlet nextId = baseId;\n\t\t\tlet counter = 1;\n\t\t\twhile (existingIds.includes(nextId)) {\n\t\t\t\tcounter++;\n\t\t\t\tnextId = `${baseId}_${counter}`;\n\t\t\t}\n\t\t\texistingIds.push(nextId);\n\n\t\t\treturn { id: nextId, counter };\n\t\t};\n\n\t\t// Extract the slices to create from the template ids given in args\n\t\tconst slicesToCreate = templates.map((template) => {\n\t\t\tconst { id, counter } = getNextAvailableSlice(template.model.id);\n\n\t\t\treturn {\n\t\t\t\t...template,\n\t\t\t\tmodel: {\n\t\t\t\t\t...template.model,\n\t\t\t\t\tid,\n\t\t\t\t\tname:\n\t\t\t\t\t\tcounter > 1 ? template.model.name + counter : template.model.name,\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\t// Get target library\n\t\t// Note: We only support adding template to the first library at the moment\n\t\tconst { libraries, errors: readAllSliceLibrariesErrors } =\n\t\t\tawait this.slices.readAllSliceLibraries();\n\t\tif (readAllSliceLibrariesErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: readAllSliceLibrariesErrors,\n\t\t\t};\n\t\t}\n\t\tconst targetLibrary = libraries[0];\n\n\t\t// Initiate the slice creation process for all slices\n\t\tconst creationPromises = slicesToCreate.map((slice) => {\n\t\t\treturn this.slices.createSlice({\n\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\tmodel: slice.model,\n\t\t\t\tcomponentContents: replacePascalNameToReplace(\n\t\t\t\t\tslice.componentContentsTemplate,\n\t\t\t\t\tslice.model.name,\n\t\t\t\t),\n\t\t\t});\n\t\t});\n\n\t\t// Wait for all slices to be created\n\t\tconst creationResults = await Promise.all(creationPromises);\n\t\t// Check for any errors in the creation results\n\t\tconst creationErrors = creationResults.flatMap((result) => result.errors);\n\t\tif (creationErrors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: creationErrors,\n\t\t\t};\n\t\t}\n\n\t\tconst mocksPromises = slicesToCreate.map((slice) => {\n\t\t\treturn this.slices.updateSliceMocks({\n\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\tsliceID: slice.model.id,\n\t\t\t\tmocks: slice.mocks,\n\t\t\t});\n\t\t});\n\n\t\tconst mocksResults = await Promise.all(mocksPromises);\n\n\t\tconst sliceScreenshotsPromises = slicesToCreate.map((slice) => {\n\t\t\tconst screenshotPromises = Object.entries(slice.screenshots).map(\n\t\t\t\t([variationID, data]) => {\n\t\t\t\t\treturn this.slices.updateSliceScreenshot({\n\t\t\t\t\t\tlibraryID: targetLibrary.libraryID,\n\t\t\t\t\t\tsliceID: slice.model.id,\n\t\t\t\t\t\tvariationID,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn Promise.all(screenshotPromises);\n\t\t});\n\n\t\tconst sliceScreenshotsResults = await Promise.all(sliceScreenshotsPromises);\n\t\tconst mocksErrors = mocksResults.flatMap((result) => result.errors);\n\t\tconst screenshotErrors = sliceScreenshotsResults.flatMap((result) =>\n\t\t\tresult.flat().flatMap((r) => r.errors),\n\t\t);\n\n\t\t// Extract the slice IDs from the creation results (assuming each result has an ID)\n\t\tconst sliceIDs = slicesToCreate.map((slice) => slice.model.id);\n\n\t\treturn {\n\t\t\terrors: [...mocksErrors, ...screenshotErrors],\n\t\t\tdata: {\n\t\t\t\tsliceIDs,\n\t\t\t},\n\t\t};\n\t}\n}\n"],"names":["t"],"mappings":";;;;;;AA8BA,MAAM,gBAAgB,EAAE,KAAK;AAAA,EAC5B,WAAW,EAAE,MACZ,EAAE,KAAK;AAAA,IACN,OAAO;AAAA,IACP,2BAA2B,EAAE;AAAA,IAC7B,OAAO,EAAE,MAAM,kBAAkB;AAAA,IACjC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG;AAAA,EAAA,CACrC,CAAC;AAEH,CAAA;AAED,MAAM,6BAA6B,CAAC,UAAkB,SACrD,SAAS,WAAW,uBAAuB,IAAI;AAE1C,MAAO,oCAAoC,YAAW;AAA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