@slicemachine/manager 0.20.8-alpha.BI-dt-2380-add-shared-onboarding.23 → 0.20.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.cjs +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +1 -1
- package/dist/_node_modules/cross-spawn/index.cjs +1 -1
- package/dist/_node_modules/cross-spawn/index.js +1 -1
- package/dist/_virtual/index2.cjs +4 -3
- package/dist/_virtual/index2.cjs.map +1 -1
- package/dist/_virtual/index2.js +4 -2
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.cjs +3 -4
- package/dist/_virtual/index3.cjs.map +1 -1
- package/dist/_virtual/index3.js +2 -4
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/constants/API_ENDPOINTS.cjs +3 -6
- package/dist/constants/API_ENDPOINTS.cjs.map +1 -1
- package/dist/constants/API_ENDPOINTS.d.ts +0 -1
- package/dist/constants/API_ENDPOINTS.js +3 -6
- package/dist/constants/API_ENDPOINTS.js.map +1 -1
- package/dist/lib/DecodeError.cjs +1 -15
- package/dist/lib/DecodeError.cjs.map +1 -1
- package/dist/lib/DecodeError.d.ts +1 -2
- package/dist/lib/DecodeError.js +1 -15
- package/dist/lib/DecodeError.js.map +1 -1
- package/dist/lib/decode.cjs +2 -13
- package/dist/lib/decode.cjs.map +1 -1
- package/dist/lib/decode.d.ts +1 -3
- package/dist/lib/decode.js +2 -13
- package/dist/lib/decode.js.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +0 -76
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +1 -8
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +1 -77
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
- package/dist/managers/prismicRepository/types.cjs +0 -26
- package/dist/managers/prismicRepository/types.cjs.map +1 -1
- package/dist/managers/prismicRepository/types.d.ts +0 -33
- package/dist/managers/prismicRepository/types.js +1 -27
- package/dist/managers/prismicRepository/types.js.map +1 -1
- package/dist/managers/telemetry/types.cjs +8 -14
- package/dist/managers/telemetry/types.cjs.map +1 -1
- package/dist/managers/telemetry/types.d.ts +13 -23
- package/dist/managers/telemetry/types.js +8 -14
- package/dist/managers/telemetry/types.js.map +1 -1
- package/package.json +2 -2
- package/src/constants/API_ENDPOINTS.ts +0 -6
- package/src/lib/DecodeError.ts +2 -21
- package/src/lib/decode.ts +4 -30
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +1 -112
- package/src/managers/prismicRepository/types.ts +0 -38
- package/src/managers/telemetry/types.ts +18 -41
- package/dist/_node_modules/zod/lib/index.cjs +0 -4030
- package/dist/_node_modules/zod/lib/index.cjs.map +0 -1
- package/dist/_node_modules/zod/lib/index.js +0 -4033
- package/dist/_node_modules/zod/lib/index.js.map +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("../../../../../../_virtual/_commonjsHelpers.cjs");
|
3
3
|
const client = require("../../../../../../_virtual/client2.cjs");
|
4
|
-
const index = require("../../../../../../_virtual/
|
4
|
+
const index = require("../../../../../../_virtual/index2.cjs");
|
5
5
|
const experimentCore_esm = require("../../../../../../_virtual/experiment-core.esm.cjs");
|
6
6
|
require("../assignment/assignment.cjs");
|
7
7
|
require("../assignment/assignment-filter.cjs");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { commonjsGlobal } from "../../../../../../_virtual/_commonjsHelpers.js";
|
2
2
|
import { __exports as client } from "../../../../../../_virtual/client2.js";
|
3
|
-
import require$$0 from "../../../../../../_virtual/
|
3
|
+
import require$$0 from "../../../../../../_virtual/index2.js";
|
4
4
|
import require$$1 from "../../../../../../_virtual/experiment-core.esm.js";
|
5
5
|
import "../assignment/assignment.js";
|
6
6
|
import "../assignment/assignment-filter.js";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("../../_virtual/_commonjsHelpers.cjs");
|
3
|
-
const index = require("../../_virtual/
|
3
|
+
const index = require("../../_virtual/index3.cjs");
|
4
4
|
const require$$0 = require("child_process");
|
5
5
|
const parse$1 = require("./lib/parse.cjs");
|
6
6
|
const enoent$1 = require("./lib/enoent.cjs");
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../_virtual/_commonjsHelpers.js";
|
2
|
-
import { __module as crossSpawn$1 } from "../../_virtual/
|
2
|
+
import { __module as crossSpawn$1 } from "../../_virtual/index3.js";
|
3
3
|
import require$$0 from "child_process";
|
4
4
|
import { p as parse_1 } from "./lib/parse.js";
|
5
5
|
import { e as enoent$1 } from "./lib/enoent.js";
|
package/dist/_virtual/index2.cjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers.cjs");
|
3
|
+
const index = require('./../_node_modules/@amplitude/analytics-node/lib/esm/index.cjs');
|
4
|
+
const require$$0 = /* @__PURE__ */ _commonjsHelpers.getAugmentedNamespace(index);
|
5
|
+
module.exports = require$$0;
|
5
6
|
//# sourceMappingURL=index2.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
package/dist/_virtual/index2.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
1
|
+
import { getAugmentedNamespace } from "./_commonjsHelpers.js";
|
2
|
+
import * as index from './../_node_modules/@amplitude/analytics-node/lib/esm/index.js';
|
3
|
+
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(index);
|
2
4
|
export {
|
3
|
-
|
5
|
+
require$$0 as default
|
4
6
|
};
|
5
7
|
//# sourceMappingURL=index2.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/_virtual/index3.cjs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
module.exports = require$$0;
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
var crossSpawn = { exports: {} };
|
4
|
+
exports.__module = crossSpawn;
|
6
5
|
//# sourceMappingURL=index3.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index3.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
import * as index from './../_node_modules/@amplitude/analytics-node/lib/esm/index.js';
|
3
|
-
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(index);
|
1
|
+
var crossSpawn = { exports: {} };
|
4
2
|
export {
|
5
|
-
|
3
|
+
crossSpawn as __module
|
6
4
|
};
|
7
5
|
//# sourceMappingURL=index3.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
@@ -13,8 +13,7 @@ const API_ENDPOINTS = (() => {
|
|
13
13
|
AwsAclProvider: trailingSlash.addTrailingSlash(process.env.acl_provider_endpoint),
|
14
14
|
PrismicEmbed: trailingSlash.removeTrailingSlash(process.env.oembed_endpoint ?? "https://oembed.wroom.io"),
|
15
15
|
PrismicUnsplash: trailingSlash.addTrailingSlash(process.env.unsplash_endpoint ?? "https://unsplash.wroom.io/"),
|
16
|
-
SliceMachineV1: trailingSlash.addTrailingSlash(process.env.slice_machine_v1_endpoint ?? "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/")
|
17
|
-
RepositoryService: trailingSlash.addTrailingSlash(process.env.repository_api ?? "https://repository.wroom.io/")
|
16
|
+
SliceMachineV1: trailingSlash.addTrailingSlash(process.env.slice_machine_v1_endpoint ?? "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/")
|
18
17
|
};
|
19
18
|
const missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {
|
20
19
|
return !apiEndpoints[key];
|
@@ -46,8 +45,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
46
45
|
AwsAclProvider: "https://2iamcvnxf4.execute-api.us-east-1.amazonaws.com/stage/",
|
47
46
|
PrismicEmbed: "https://oembed.wroom.io",
|
48
47
|
PrismicUnsplash: "https://unsplash.wroom.io/",
|
49
|
-
SliceMachineV1: "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/"
|
50
|
-
RepositoryService: "https://repository.wroom.io/"
|
48
|
+
SliceMachineV1: "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/"
|
51
49
|
};
|
52
50
|
}
|
53
51
|
case APPLICATION_MODE.APPLICATION_MODE.Production:
|
@@ -60,8 +58,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
60
58
|
AwsAclProvider: "https://0yyeb2g040.execute-api.us-east-1.amazonaws.com/prod/",
|
61
59
|
PrismicEmbed: "https://oembed.prismic.io",
|
62
60
|
PrismicUnsplash: "https://unsplash.prismic.io/",
|
63
|
-
SliceMachineV1: "https://sm-api.prismic.io/v1/"
|
64
|
-
RepositoryService: "https://repository.prismic.io/"
|
61
|
+
SliceMachineV1: "https://sm-api.prismic.io/v1/"
|
65
62
|
};
|
66
63
|
}
|
67
64
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"API_ENDPOINTS.cjs","sources":["../../../src/constants/API_ENDPOINTS.ts"],"sourcesContent":["import { addTrailingSlash, removeTrailingSlash } from \"../lib/trailingSlash\";\nimport { APPLICATION_MODE } from \"./APPLICATION_MODE\";\n\nexport type APIEndpoints = {\n\tPrismicWroom: string;\n\tPrismicAuthentication: string;\n\tPrismicModels: string;\n\tPrismicUser: string;\n\tAwsAclProvider: string;\n\tPrismicEmbed: string;\n\tPrismicUnsplash: string;\n\tSliceMachineV1: string;\n
|
1
|
+
{"version":3,"file":"API_ENDPOINTS.cjs","sources":["../../../src/constants/API_ENDPOINTS.ts"],"sourcesContent":["import { addTrailingSlash, removeTrailingSlash } from \"../lib/trailingSlash\";\nimport { APPLICATION_MODE } from \"./APPLICATION_MODE\";\n\nexport type APIEndpoints = {\n\tPrismicWroom: string;\n\tPrismicAuthentication: string;\n\tPrismicModels: string;\n\tPrismicUser: string;\n\tAwsAclProvider: string;\n\tPrismicEmbed: string;\n\tPrismicUnsplash: string;\n\tSliceMachineV1: string;\n};\n\nexport const API_ENDPOINTS: APIEndpoints = (() => {\n\tswitch (process.env.SM_ENV) {\n\t\tcase APPLICATION_MODE.Development: {\n\t\t\tconst apiEndpoints = {\n\t\t\t\tPrismicWroom: addTrailingSlash(process.env.wroom_endpoint),\n\t\t\t\tPrismicAuthentication: addTrailingSlash(\n\t\t\t\t\tprocess.env.authentication_server_endpoint,\n\t\t\t\t),\n\t\t\t\tPrismicModels: addTrailingSlash(process.env.customtypesapi_endpoint),\n\t\t\t\tPrismicUser: addTrailingSlash(process.env.user_service_endpoint),\n\t\t\t\tAwsAclProvider: addTrailingSlash(process.env.acl_provider_endpoint),\n\t\t\t\tPrismicEmbed: removeTrailingSlash(\n\t\t\t\t\tprocess.env.oembed_endpoint ?? \"https://oembed.wroom.io\",\n\t\t\t\t),\n\t\t\t\tPrismicUnsplash: addTrailingSlash(\n\t\t\t\t\tprocess.env.unsplash_endpoint ?? \"https://unsplash.wroom.io/\",\n\t\t\t\t),\n\t\t\t\tSliceMachineV1: addTrailingSlash(\n\t\t\t\t\tprocess.env.slice_machine_v1_endpoint ??\n\t\t\t\t\t\t\"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/\",\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tconst missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {\n\t\t\t\treturn !apiEndpoints[key as keyof typeof apiEndpoints];\n\t\t\t});\n\n\t\t\tif (missingAPIEndpoints.length > 0) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`You are running Slice Machine in development mode (SM_ENV=${\n\t\t\t\t\t\tAPPLICATION_MODE.Development\n\t\t\t\t\t}) where API endpoints are configured via environment variables.\n\nThe following endpoints were not configured: ${missingAPIEndpoints.join(\", \")}.\n\nConfigure them before continuing.`,\n\t\t\t\t);\n\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconsole.warn(`You are running Slice Machine in development mode (SM_ENV=${\n\t\t\t\tAPPLICATION_MODE.Development\n\t\t\t}).\n\nThe following API endpoints were configured via environment variables:\n${Object.entries(apiEndpoints)\n\t.map(([name, endpoint]) => ` - ${name}: ${endpoint}`)\n\t.join(\"\\n\")}\n\nThese endpoints are different than Slice Machine's normal endpoints and are not trusted.\n\nIf you didn't intend to run Slice Machine this way, stop it immediately and unset the SM_ENV environment variable.`);\n\n\t\t\treturn apiEndpoints as APIEndpoints;\n\t\t}\n\n\t\tcase APPLICATION_MODE.Staging: {\n\t\t\treturn {\n\t\t\t\tPrismicWroom: \"https://wroom.io/\",\n\t\t\t\tPrismicAuthentication: \"https://auth.wroom.io/\",\n\t\t\t\tPrismicModels: \"https://customtypes.wroom.io/\",\n\t\t\t\tPrismicUser: \"https://user-service.wroom.io/\",\n\t\t\t\tAwsAclProvider:\n\t\t\t\t\t\"https://2iamcvnxf4.execute-api.us-east-1.amazonaws.com/stage/\",\n\t\t\t\tPrismicEmbed: \"https://oembed.wroom.io\",\n\t\t\t\tPrismicUnsplash: \"https://unsplash.wroom.io/\",\n\t\t\t\tSliceMachineV1:\n\t\t\t\t\t\"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/\",\n\t\t\t};\n\t\t}\n\n\t\tcase APPLICATION_MODE.Production:\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tPrismicWroom: \"https://prismic.io/\",\n\t\t\t\tPrismicAuthentication: \"https://auth.prismic.io/\",\n\t\t\t\tPrismicModels: \"https://customtypes.prismic.io/\",\n\t\t\t\tPrismicUser: \"https://user-service.prismic.io/\",\n\t\t\t\tAwsAclProvider:\n\t\t\t\t\t\"https://0yyeb2g040.execute-api.us-east-1.amazonaws.com/prod/\",\n\t\t\t\tPrismicEmbed: \"https://oembed.prismic.io\",\n\t\t\t\tPrismicUnsplash: \"https://unsplash.prismic.io/\",\n\t\t\t\tSliceMachineV1: \"https://sm-api.prismic.io/v1/\",\n\t\t\t};\n\t\t}\n\t}\n})();\n"],"names":["APPLICATION_MODE","addTrailingSlash","removeTrailingSlash"],"mappings":";;;;AAcO,MAAM,iBAA+B,MAAK;AACxC,UAAA,QAAQ,IAAI,QAAQ;AAAA,IAC3B,KAAKA,iBAAAA,iBAAiB,aAAa;AAClC,YAAM,eAAe;AAAA,QACpB,cAAcC,cAAA,iBAAiB,QAAQ,IAAI,cAAc;AAAA,QACzD,uBAAuBA,cAAA,iBACtB,QAAQ,IAAI,8BAA8B;AAAA,QAE3C,eAAeA,cAAA,iBAAiB,QAAQ,IAAI,uBAAuB;AAAA,QACnE,aAAaA,cAAA,iBAAiB,QAAQ,IAAI,qBAAqB;AAAA,QAC/D,gBAAgBA,cAAA,iBAAiB,QAAQ,IAAI,qBAAqB;AAAA,QAClE,cAAcC,cAAAA,oBACb,QAAQ,IAAI,mBAAmB,yBAAyB;AAAA,QAEzD,iBAAiBD,cAAAA,iBAChB,QAAQ,IAAI,qBAAqB,4BAA4B;AAAA,QAE9D,gBAAgBA,cAAAA,iBACf,QAAQ,IAAI,6BACX,4DAA4D;AAAA,MAAA;AAI/D,YAAM,sBAAsB,OAAO,KAAK,YAAY,EAAE,OAAO,CAAC,QAAO;AAC7D,eAAA,CAAC,aAAa,GAAgC;AAAA,MAAA,CACrD;AAEG,UAAA,oBAAoB,SAAS,GAAG;AAC3B,gBAAA,MACP,6DACCD,iBAAAA,iBAAiB;AAAA;AAAA,+CAGwB,oBAAoB,KAAK,IAAI;AAAA;AAAA,kCAE1C;AAG9B,gBAAQ,KAAK,CAAC;AAAA,MACf;AAEQ,cAAA,KAAK,6DACZA,iBAAAA,iBAAiB;AAAA;AAAA;AAAA,EAInB,OAAO,QAAQ,YAAY,EAC3B,IAAI,CAAC,CAAC,MAAM,QAAQ,MAAM,OAAO,SAAS,UAAU,EACpD,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,mHAIwG;AAEzG,aAAA;AAAA,IACR;AAAA,IAEA,KAAKA,iBAAAA,iBAAiB,SAAS;AACvB,aAAA;AAAA,QACN,cAAc;AAAA,QACd,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,aAAa;AAAA,QACb,gBACC;AAAA,QACD,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,gBACC;AAAA,MAAA;AAAA,IAEH;AAAA,IAEA,KAAKA,iBAAAA,iBAAiB;AAAA,IACtB,SAAS;AACD,aAAA;AAAA,QACN,cAAc;AAAA,QACd,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,aAAa;AAAA,QACb,gBACC;AAAA,QACD,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,gBAAgB;AAAA,MAAA;AAAA,IAElB;AAAA,EACD;AACD;;"}
|
@@ -11,8 +11,7 @@ const API_ENDPOINTS = (() => {
|
|
11
11
|
AwsAclProvider: addTrailingSlash(process.env.acl_provider_endpoint),
|
12
12
|
PrismicEmbed: removeTrailingSlash(process.env.oembed_endpoint ?? "https://oembed.wroom.io"),
|
13
13
|
PrismicUnsplash: addTrailingSlash(process.env.unsplash_endpoint ?? "https://unsplash.wroom.io/"),
|
14
|
-
SliceMachineV1: addTrailingSlash(process.env.slice_machine_v1_endpoint ?? "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/")
|
15
|
-
RepositoryService: addTrailingSlash(process.env.repository_api ?? "https://repository.wroom.io/")
|
14
|
+
SliceMachineV1: addTrailingSlash(process.env.slice_machine_v1_endpoint ?? "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/")
|
16
15
|
};
|
17
16
|
const missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {
|
18
17
|
return !apiEndpoints[key];
|
@@ -44,8 +43,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
44
43
|
AwsAclProvider: "https://2iamcvnxf4.execute-api.us-east-1.amazonaws.com/stage/",
|
45
44
|
PrismicEmbed: "https://oembed.wroom.io",
|
46
45
|
PrismicUnsplash: "https://unsplash.wroom.io/",
|
47
|
-
SliceMachineV1: "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/"
|
48
|
-
RepositoryService: "https://repository.wroom.io/"
|
46
|
+
SliceMachineV1: "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/"
|
49
47
|
};
|
50
48
|
}
|
51
49
|
case APPLICATION_MODE.Production:
|
@@ -58,8 +56,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
58
56
|
AwsAclProvider: "https://0yyeb2g040.execute-api.us-east-1.amazonaws.com/prod/",
|
59
57
|
PrismicEmbed: "https://oembed.prismic.io",
|
60
58
|
PrismicUnsplash: "https://unsplash.prismic.io/",
|
61
|
-
SliceMachineV1: "https://sm-api.prismic.io/v1/"
|
62
|
-
RepositoryService: "https://repository.prismic.io/"
|
59
|
+
SliceMachineV1: "https://sm-api.prismic.io/v1/"
|
63
60
|
};
|
64
61
|
}
|
65
62
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"API_ENDPOINTS.js","sources":["../../../src/constants/API_ENDPOINTS.ts"],"sourcesContent":["import { addTrailingSlash, removeTrailingSlash } from \"../lib/trailingSlash\";\nimport { APPLICATION_MODE } from \"./APPLICATION_MODE\";\n\nexport type APIEndpoints = {\n\tPrismicWroom: string;\n\tPrismicAuthentication: string;\n\tPrismicModels: string;\n\tPrismicUser: string;\n\tAwsAclProvider: string;\n\tPrismicEmbed: string;\n\tPrismicUnsplash: string;\n\tSliceMachineV1: string;\n
|
1
|
+
{"version":3,"file":"API_ENDPOINTS.js","sources":["../../../src/constants/API_ENDPOINTS.ts"],"sourcesContent":["import { addTrailingSlash, removeTrailingSlash } from \"../lib/trailingSlash\";\nimport { APPLICATION_MODE } from \"./APPLICATION_MODE\";\n\nexport type APIEndpoints = {\n\tPrismicWroom: string;\n\tPrismicAuthentication: string;\n\tPrismicModels: string;\n\tPrismicUser: string;\n\tAwsAclProvider: string;\n\tPrismicEmbed: string;\n\tPrismicUnsplash: string;\n\tSliceMachineV1: string;\n};\n\nexport const API_ENDPOINTS: APIEndpoints = (() => {\n\tswitch (process.env.SM_ENV) {\n\t\tcase APPLICATION_MODE.Development: {\n\t\t\tconst apiEndpoints = {\n\t\t\t\tPrismicWroom: addTrailingSlash(process.env.wroom_endpoint),\n\t\t\t\tPrismicAuthentication: addTrailingSlash(\n\t\t\t\t\tprocess.env.authentication_server_endpoint,\n\t\t\t\t),\n\t\t\t\tPrismicModels: addTrailingSlash(process.env.customtypesapi_endpoint),\n\t\t\t\tPrismicUser: addTrailingSlash(process.env.user_service_endpoint),\n\t\t\t\tAwsAclProvider: addTrailingSlash(process.env.acl_provider_endpoint),\n\t\t\t\tPrismicEmbed: removeTrailingSlash(\n\t\t\t\t\tprocess.env.oembed_endpoint ?? \"https://oembed.wroom.io\",\n\t\t\t\t),\n\t\t\t\tPrismicUnsplash: addTrailingSlash(\n\t\t\t\t\tprocess.env.unsplash_endpoint ?? \"https://unsplash.wroom.io/\",\n\t\t\t\t),\n\t\t\t\tSliceMachineV1: addTrailingSlash(\n\t\t\t\t\tprocess.env.slice_machine_v1_endpoint ??\n\t\t\t\t\t\t\"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/\",\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tconst missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {\n\t\t\t\treturn !apiEndpoints[key as keyof typeof apiEndpoints];\n\t\t\t});\n\n\t\t\tif (missingAPIEndpoints.length > 0) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`You are running Slice Machine in development mode (SM_ENV=${\n\t\t\t\t\t\tAPPLICATION_MODE.Development\n\t\t\t\t\t}) where API endpoints are configured via environment variables.\n\nThe following endpoints were not configured: ${missingAPIEndpoints.join(\", \")}.\n\nConfigure them before continuing.`,\n\t\t\t\t);\n\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconsole.warn(`You are running Slice Machine in development mode (SM_ENV=${\n\t\t\t\tAPPLICATION_MODE.Development\n\t\t\t}).\n\nThe following API endpoints were configured via environment variables:\n${Object.entries(apiEndpoints)\n\t.map(([name, endpoint]) => ` - ${name}: ${endpoint}`)\n\t.join(\"\\n\")}\n\nThese endpoints are different than Slice Machine's normal endpoints and are not trusted.\n\nIf you didn't intend to run Slice Machine this way, stop it immediately and unset the SM_ENV environment variable.`);\n\n\t\t\treturn apiEndpoints as APIEndpoints;\n\t\t}\n\n\t\tcase APPLICATION_MODE.Staging: {\n\t\t\treturn {\n\t\t\t\tPrismicWroom: \"https://wroom.io/\",\n\t\t\t\tPrismicAuthentication: \"https://auth.wroom.io/\",\n\t\t\t\tPrismicModels: \"https://customtypes.wroom.io/\",\n\t\t\t\tPrismicUser: \"https://user-service.wroom.io/\",\n\t\t\t\tAwsAclProvider:\n\t\t\t\t\t\"https://2iamcvnxf4.execute-api.us-east-1.amazonaws.com/stage/\",\n\t\t\t\tPrismicEmbed: \"https://oembed.wroom.io\",\n\t\t\t\tPrismicUnsplash: \"https://unsplash.wroom.io/\",\n\t\t\t\tSliceMachineV1:\n\t\t\t\t\t\"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/\",\n\t\t\t};\n\t\t}\n\n\t\tcase APPLICATION_MODE.Production:\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tPrismicWroom: \"https://prismic.io/\",\n\t\t\t\tPrismicAuthentication: \"https://auth.prismic.io/\",\n\t\t\t\tPrismicModels: \"https://customtypes.prismic.io/\",\n\t\t\t\tPrismicUser: \"https://user-service.prismic.io/\",\n\t\t\t\tAwsAclProvider:\n\t\t\t\t\t\"https://0yyeb2g040.execute-api.us-east-1.amazonaws.com/prod/\",\n\t\t\t\tPrismicEmbed: \"https://oembed.prismic.io\",\n\t\t\t\tPrismicUnsplash: \"https://unsplash.prismic.io/\",\n\t\t\t\tSliceMachineV1: \"https://sm-api.prismic.io/v1/\",\n\t\t\t};\n\t\t}\n\t}\n})();\n"],"names":[],"mappings":";;AAcO,MAAM,iBAA+B,MAAK;AACxC,UAAA,QAAQ,IAAI,QAAQ;AAAA,IAC3B,KAAK,iBAAiB,aAAa;AAClC,YAAM,eAAe;AAAA,QACpB,cAAc,iBAAiB,QAAQ,IAAI,cAAc;AAAA,QACzD,uBAAuB,iBACtB,QAAQ,IAAI,8BAA8B;AAAA,QAE3C,eAAe,iBAAiB,QAAQ,IAAI,uBAAuB;AAAA,QACnE,aAAa,iBAAiB,QAAQ,IAAI,qBAAqB;AAAA,QAC/D,gBAAgB,iBAAiB,QAAQ,IAAI,qBAAqB;AAAA,QAClE,cAAc,oBACb,QAAQ,IAAI,mBAAmB,yBAAyB;AAAA,QAEzD,iBAAiB,iBAChB,QAAQ,IAAI,qBAAqB,4BAA4B;AAAA,QAE9D,gBAAgB,iBACf,QAAQ,IAAI,6BACX,4DAA4D;AAAA,MAAA;AAI/D,YAAM,sBAAsB,OAAO,KAAK,YAAY,EAAE,OAAO,CAAC,QAAO;AAC7D,eAAA,CAAC,aAAa,GAAgC;AAAA,MAAA,CACrD;AAEG,UAAA,oBAAoB,SAAS,GAAG;AAC3B,gBAAA,MACP,6DACC,iBAAiB;AAAA;AAAA,+CAGwB,oBAAoB,KAAK,IAAI;AAAA;AAAA,kCAE1C;AAG9B,gBAAQ,KAAK,CAAC;AAAA,MACf;AAEQ,cAAA,KAAK,6DACZ,iBAAiB;AAAA;AAAA;AAAA,EAInB,OAAO,QAAQ,YAAY,EAC3B,IAAI,CAAC,CAAC,MAAM,QAAQ,MAAM,OAAO,SAAS,UAAU,EACpD,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,mHAIwG;AAEzG,aAAA;AAAA,IACR;AAAA,IAEA,KAAK,iBAAiB,SAAS;AACvB,aAAA;AAAA,QACN,cAAc;AAAA,QACd,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,aAAa;AAAA,QACb,gBACC;AAAA,QACD,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,gBACC;AAAA,MAAA;AAAA,IAEH;AAAA,IAEA,KAAK,iBAAiB;AAAA,IACtB,SAAS;AACD,aAAA;AAAA,QACN,cAAc;AAAA,QACd,uBAAuB;AAAA,QACvB,eAAe;AAAA,QACf,aAAa;AAAA,QACb,gBACC;AAAA,QACD,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,gBAAgB;AAAA,MAAA;AAAA,IAElB;AAAA,EACD;AACD;"}
|
package/dist/lib/DecodeError.cjs
CHANGED
@@ -7,23 +7,9 @@ var __publicField = (obj, key, value) => {
|
|
7
7
|
};
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
9
9
|
const ioTsReporters = require("io-ts-reporters");
|
10
|
-
function isZodIssueArray(errors) {
|
11
|
-
return "path" in errors[0];
|
12
|
-
}
|
13
|
-
function formatZodErrors(errors) {
|
14
|
-
return errors.map((err) => {
|
15
|
-
const path = err.path.length > 0 ? ` at ${err.path.join(".")}` : "";
|
16
|
-
return `${err.message}${path}`;
|
17
|
-
});
|
18
|
-
}
|
19
10
|
class DecodeError extends Error {
|
20
11
|
constructor(args) {
|
21
|
-
|
22
|
-
if (isZodIssueArray(args.errors)) {
|
23
|
-
formattedErrors = formatZodErrors(args.errors);
|
24
|
-
} else {
|
25
|
-
formattedErrors = ioTsReporters.formatValidationErrors(args.errors);
|
26
|
-
}
|
12
|
+
const formattedErrors = ioTsReporters.formatValidationErrors(args.errors);
|
27
13
|
super(formattedErrors.join(", "));
|
28
14
|
__publicField(this, "name", "DecodeError");
|
29
15
|
__publicField(this, "input");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DecodeError.cjs","sources":["../../../src/lib/DecodeError.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { formatValidationErrors } from \"io-ts-reporters\";\
|
1
|
+
{"version":3,"file":"DecodeError.cjs","sources":["../../../src/lib/DecodeError.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { formatValidationErrors } from \"io-ts-reporters\";\n\ntype DecodeErrorConstructorArgs<TInput = unknown> = {\n\tinput: TInput;\n\terrors: t.Errors;\n};\n\nexport class DecodeError<TInput = unknown> extends Error {\n\tname = \"DecodeError\";\n\tinput: TInput;\n\terrors: string[];\n\n\tconstructor(args: DecodeErrorConstructorArgs<TInput>) {\n\t\tconst formattedErrors = formatValidationErrors(args.errors);\n\n\t\tsuper(formattedErrors.join(\", \"));\n\n\t\tthis.input = args.input;\n\t\tthis.errors = formattedErrors;\n\t}\n}\n"],"names":["formatValidationErrors"],"mappings":";;;;;;;;;AAQM,MAAO,oBAAsC,MAAK;AAAA,EAKvD,YAAY,MAAwC;AAC7C,UAAA,kBAAkBA,cAAAA,uBAAuB,KAAK,MAAM;AAEpD,UAAA,gBAAgB,KAAK,IAAI,CAAC;AAPjC,gCAAO;AACP;AACA;AAOC,SAAK,QAAQ,KAAK;AAClB,SAAK,SAAS;AAAA,EACf;AACA;;"}
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
|
-
import { ZodIssue } from "zod";
|
3
2
|
type DecodeErrorConstructorArgs<TInput = unknown> = {
|
4
3
|
input: TInput;
|
5
|
-
errors: t.Errors
|
4
|
+
errors: t.Errors;
|
6
5
|
};
|
7
6
|
export declare class DecodeError<TInput = unknown> extends Error {
|
8
7
|
name: string;
|
package/dist/lib/DecodeError.js
CHANGED
@@ -5,23 +5,9 @@ var __publicField = (obj, key, value) => {
|
|
5
5
|
return value;
|
6
6
|
};
|
7
7
|
import { formatValidationErrors } from "io-ts-reporters";
|
8
|
-
function isZodIssueArray(errors) {
|
9
|
-
return "path" in errors[0];
|
10
|
-
}
|
11
|
-
function formatZodErrors(errors) {
|
12
|
-
return errors.map((err) => {
|
13
|
-
const path = err.path.length > 0 ? ` at ${err.path.join(".")}` : "";
|
14
|
-
return `${err.message}${path}`;
|
15
|
-
});
|
16
|
-
}
|
17
8
|
class DecodeError extends Error {
|
18
9
|
constructor(args) {
|
19
|
-
|
20
|
-
if (isZodIssueArray(args.errors)) {
|
21
|
-
formattedErrors = formatZodErrors(args.errors);
|
22
|
-
} else {
|
23
|
-
formattedErrors = formatValidationErrors(args.errors);
|
24
|
-
}
|
10
|
+
const formattedErrors = formatValidationErrors(args.errors);
|
25
11
|
super(formattedErrors.join(", "));
|
26
12
|
__publicField(this, "name", "DecodeError");
|
27
13
|
__publicField(this, "input");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DecodeError.js","sources":["../../../src/lib/DecodeError.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { formatValidationErrors } from \"io-ts-reporters\";\
|
1
|
+
{"version":3,"file":"DecodeError.js","sources":["../../../src/lib/DecodeError.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport { formatValidationErrors } from \"io-ts-reporters\";\n\ntype DecodeErrorConstructorArgs<TInput = unknown> = {\n\tinput: TInput;\n\terrors: t.Errors;\n};\n\nexport class DecodeError<TInput = unknown> extends Error {\n\tname = \"DecodeError\";\n\tinput: TInput;\n\terrors: string[];\n\n\tconstructor(args: DecodeErrorConstructorArgs<TInput>) {\n\t\tconst formattedErrors = formatValidationErrors(args.errors);\n\n\t\tsuper(formattedErrors.join(\", \"));\n\n\t\tthis.input = args.input;\n\t\tthis.errors = formattedErrors;\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAQM,MAAO,oBAAsC,MAAK;AAAA,EAKvD,YAAY,MAAwC;AAC7C,UAAA,kBAAkB,uBAAuB,KAAK,MAAM;AAEpD,UAAA,gBAAgB,KAAK,IAAI,CAAC;AAPjC,gCAAO;AACP;AACA;AAOC,SAAK,QAAQ,KAAK;AAClB,SAAK,SAAS;AAAA,EACf;AACA;"}
|
package/dist/lib/decode.cjs
CHANGED
@@ -1,20 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
-
const index = require('./../_node_modules/zod/lib/index.cjs');
|
4
3
|
const Either = require('./../_node_modules/fp-ts/es6/Either.cjs');
|
5
4
|
const _function = require('./../_node_modules/fp-ts/es6/function.cjs');
|
6
5
|
const DecodeError = require("./DecodeError.cjs");
|
7
|
-
|
8
|
-
return typeof value.safeParse === "function" && value instanceof index.Schema;
|
9
|
-
}
|
10
|
-
function decode(codec, input) {
|
11
|
-
if (isZodSchema(codec)) {
|
12
|
-
const parsed = codec.safeParse(input);
|
13
|
-
if (parsed.success) {
|
14
|
-
return { value: parsed.data };
|
15
|
-
}
|
16
|
-
return { error: new DecodeError.DecodeError({ input, errors: parsed.error.errors }) };
|
17
|
-
}
|
6
|
+
const decode = (codec, input) => {
|
18
7
|
return _function.pipe(codec.decode(input), Either.foldW((errors) => {
|
19
8
|
return {
|
20
9
|
error: new DecodeError.DecodeError({ input, errors })
|
@@ -24,6 +13,6 @@ function decode(codec, input) {
|
|
24
13
|
value
|
25
14
|
};
|
26
15
|
}));
|
27
|
-
}
|
16
|
+
};
|
28
17
|
exports.decode = decode;
|
29
18
|
//# sourceMappingURL=decode.cjs.map
|
package/dist/lib/decode.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decode.cjs","sources":["../../../src/lib/decode.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport
|
1
|
+
{"version":3,"file":"decode.cjs","sources":["../../../src/lib/decode.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as E from \"fp-ts/Either\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { DecodeError } from \"./DecodeError\";\n\nexport type DecodeReturnType<A, _O, I> =\n\t| {\n\t\t\tvalue: A;\n\t\t\terror?: never;\n\t }\n\t| {\n\t\t\tvalue?: never;\n\t\t\terror: DecodeError<I>;\n\t };\n\nexport const decode = <A, O, I>(\n\tcodec: t.Type<A, O, I>,\n\tinput: I,\n): DecodeReturnType<A, O, I> => {\n\treturn pipe(\n\t\tcodec.decode(input),\n\t\tE.foldW(\n\t\t\t(errors) => {\n\t\t\t\treturn {\n\t\t\t\t\terror: new DecodeError({ input, errors }),\n\t\t\t\t};\n\t\t\t},\n\t\t\t(value) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t},\n\t\t),\n\t);\n};\n"],"names":["pipe","E.foldW","DecodeError"],"mappings":";;;;;AAgBa,MAAA,SAAS,CACrB,OACA,UAC8B;AACvB,SAAAA,UAAAA,KACN,MAAM,OAAO,KAAK,GAClBC,OAAAA,MACC,CAAC,WAAU;AACH,WAAA;AAAA,MACN,OAAO,IAAIC,YAAA,YAAY,EAAE,OAAO,QAAQ;AAAA,IAAA;AAAA,EAE1C,GACA,CAAC,UAAS;AACF,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAED,CAAA,CACD;AAEH;;"}
|
package/dist/lib/decode.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
|
-
import { ZodType, ZodTypeDef } from "zod";
|
3
2
|
import { DecodeError } from "./DecodeError";
|
4
3
|
export type DecodeReturnType<A, _O, I> = {
|
5
4
|
value: A;
|
@@ -8,5 +7,4 @@ export type DecodeReturnType<A, _O, I> = {
|
|
8
7
|
value?: never;
|
9
8
|
error: DecodeError<I>;
|
10
9
|
};
|
11
|
-
export declare
|
12
|
-
export declare function decode<A, O, I>(codec: t.Type<A, O, I> | ZodType<A, ZodTypeDef, unknown>, input: I): DecodeReturnType<A, O, I>;
|
10
|
+
export declare const decode: <A, O, I>(codec: t.Type<A, O, I>, input: I) => DecodeReturnType<A, O, I>;
|
package/dist/lib/decode.js
CHANGED
@@ -1,18 +1,7 @@
|
|
1
|
-
import { Schema as ZodType } from './../_node_modules/zod/lib/index.js';
|
2
1
|
import { foldW } from './../_node_modules/fp-ts/es6/Either.js';
|
3
2
|
import { pipe } from './../_node_modules/fp-ts/es6/function.js';
|
4
3
|
import { DecodeError } from "./DecodeError.js";
|
5
|
-
|
6
|
-
return typeof value.safeParse === "function" && value instanceof ZodType;
|
7
|
-
}
|
8
|
-
function decode(codec, input) {
|
9
|
-
if (isZodSchema(codec)) {
|
10
|
-
const parsed = codec.safeParse(input);
|
11
|
-
if (parsed.success) {
|
12
|
-
return { value: parsed.data };
|
13
|
-
}
|
14
|
-
return { error: new DecodeError({ input, errors: parsed.error.errors }) };
|
15
|
-
}
|
4
|
+
const decode = (codec, input) => {
|
16
5
|
return pipe(codec.decode(input), foldW((errors) => {
|
17
6
|
return {
|
18
7
|
error: new DecodeError({ input, errors })
|
@@ -22,7 +11,7 @@ function decode(codec, input) {
|
|
22
11
|
value
|
23
12
|
};
|
24
13
|
}));
|
25
|
-
}
|
14
|
+
};
|
26
15
|
export {
|
27
16
|
decode
|
28
17
|
};
|
package/dist/lib/decode.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decode.js","sources":["../../../src/lib/decode.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport
|
1
|
+
{"version":3,"file":"decode.js","sources":["../../../src/lib/decode.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as E from \"fp-ts/Either\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { DecodeError } from \"./DecodeError\";\n\nexport type DecodeReturnType<A, _O, I> =\n\t| {\n\t\t\tvalue: A;\n\t\t\terror?: never;\n\t }\n\t| {\n\t\t\tvalue?: never;\n\t\t\terror: DecodeError<I>;\n\t };\n\nexport const decode = <A, O, I>(\n\tcodec: t.Type<A, O, I>,\n\tinput: I,\n): DecodeReturnType<A, O, I> => {\n\treturn pipe(\n\t\tcodec.decode(input),\n\t\tE.foldW(\n\t\t\t(errors) => {\n\t\t\t\treturn {\n\t\t\t\t\terror: new DecodeError({ input, errors }),\n\t\t\t\t};\n\t\t\t},\n\t\t\t(value) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t},\n\t\t),\n\t);\n};\n"],"names":["E.foldW"],"mappings":";;;AAgBa,MAAA,SAAS,CACrB,OACA,UAC8B;AACvB,SAAA,KACN,MAAM,OAAO,KAAK,GAClBA,MACC,CAAC,WAAU;AACH,WAAA;AAAA,MACN,OAAO,IAAI,YAAY,EAAE,OAAO,QAAQ;AAAA,IAAA;AAAA,EAE1C,GACA,CAAC,UAAS;AACF,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAED,CAAA,CACD;AAEH;"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const t = require("io-ts");
|
4
|
-
const index = require('./../../_node_modules/zod/lib/index.cjs');
|
5
4
|
const fetch = require("../../lib/fetch.cjs");
|
6
5
|
const Either = require('./../../_node_modules/fp-ts/es6/Either.cjs');
|
7
6
|
const assertPluginsInitialized = require("../../lib/assertPluginsInitialized.cjs");
|
@@ -351,81 +350,6 @@ class PrismicRepositoryManager extends BaseManager.BaseManager {
|
|
351
350
|
throw new Error("Failed to fetch environments.");
|
352
351
|
}
|
353
352
|
}
|
354
|
-
async fetchOnboarding() {
|
355
|
-
const repositoryName = await this.project.getRepositoryName();
|
356
|
-
const url = new URL("/onboarding", API_ENDPOINTS.API_ENDPOINTS.RepositoryService);
|
357
|
-
url.searchParams.set("repository", repositoryName);
|
358
|
-
const res = await this._fetch({ url });
|
359
|
-
if (res.ok) {
|
360
|
-
const json = await res.json();
|
361
|
-
const { value, error } = decode.decode(types.OnboardingState, json);
|
362
|
-
if (error) {
|
363
|
-
throw new errors.UnexpectedDataError(`Failed to decode onboarding: ${error.errors.join(", ")}`);
|
364
|
-
}
|
365
|
-
if (value) {
|
366
|
-
return value;
|
367
|
-
}
|
368
|
-
}
|
369
|
-
switch (res.status) {
|
370
|
-
case 400:
|
371
|
-
case 401:
|
372
|
-
throw new errors.UnauthenticatedError();
|
373
|
-
case 403:
|
374
|
-
throw new errors.UnauthorizedError();
|
375
|
-
default:
|
376
|
-
throw new Error("Failed to fetch onboarding.");
|
377
|
-
}
|
378
|
-
}
|
379
|
-
async toggleOnboardingStep(stepId) {
|
380
|
-
const repositoryName = await this.project.getRepositoryName();
|
381
|
-
const url = new URL(`/onboarding/${stepId}/toggle`, API_ENDPOINTS.API_ENDPOINTS.RepositoryService);
|
382
|
-
url.searchParams.set("repository", repositoryName);
|
383
|
-
const res = await this._fetch({ url, method: "PATCH" });
|
384
|
-
if (res.ok) {
|
385
|
-
const json = await res.json();
|
386
|
-
const { value, error } = decode.decode(index.default.object({ completedSteps: index.default.array(index.default.string()) }), json);
|
387
|
-
if (error) {
|
388
|
-
throw new errors.UnexpectedDataError(`Failed to decode onboarding step toggle: ${error.errors.join(", ")}`);
|
389
|
-
}
|
390
|
-
if (value) {
|
391
|
-
return value;
|
392
|
-
}
|
393
|
-
}
|
394
|
-
switch (res.status) {
|
395
|
-
case 400:
|
396
|
-
case 401:
|
397
|
-
throw new errors.UnauthenticatedError();
|
398
|
-
case 403:
|
399
|
-
throw new errors.UnauthorizedError();
|
400
|
-
default:
|
401
|
-
throw new Error("Failed to toggle onboarding step.");
|
402
|
-
}
|
403
|
-
}
|
404
|
-
async toggleOnboarding() {
|
405
|
-
const repositoryName = await this.project.getRepositoryName();
|
406
|
-
const url = new URL("/onboarding/toggle", API_ENDPOINTS.API_ENDPOINTS.RepositoryService);
|
407
|
-
url.searchParams.set("repository", repositoryName);
|
408
|
-
const res = await this._fetch({ url, method: "PATCH" });
|
409
|
-
if (res.ok) {
|
410
|
-
const json = await res.json();
|
411
|
-
const { value, error } = decode.decode(index.default.object({ isDismissed: index.default.boolean() }), json);
|
412
|
-
if (error) {
|
413
|
-
throw new errors.UnexpectedDataError(`Failed to decode onboarding toggle: ${error.errors.join(", ")}`);
|
414
|
-
}
|
415
|
-
if (value) {
|
416
|
-
return value;
|
417
|
-
}
|
418
|
-
}
|
419
|
-
switch (res.status) {
|
420
|
-
case 400:
|
421
|
-
case 401:
|
422
|
-
throw new errors.UnauthenticatedError();
|
423
|
-
case 403:
|
424
|
-
throw new errors.UnauthorizedError();
|
425
|
-
default:
|
426
|
-
throw new Error("Failed to toggle onboarding guide.");
|
427
|
-
}
|
428
|
-
}
|
429
353
|
_decodeLimitOrThrow(potentialLimit, statusCode, limitType) {
|
430
354
|
return Either.fold(() => {
|
431
355
|
const error = {
|