@slicemachine/manager 0.2.2-dev-page-types.1 → 0.2.2-dev-page-types.3
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/node-fetch/src/index.js +2 -2
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -1
- package/dist/auth/PrismicAuthManager.cjs +4 -4
- package/dist/auth/PrismicAuthManager.cjs.map +1 -1
- package/dist/auth/PrismicAuthManager.js +1 -1
- package/dist/auth/PrismicAuthManager.js.map +1 -1
- package/dist/lib/checkIsURLAccessible.cjs +2 -2
- package/dist/lib/checkIsURLAccessible.cjs.map +1 -1
- package/dist/lib/checkIsURLAccessible.js +1 -1
- package/dist/lib/checkIsURLAccessible.js.map +1 -1
- 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 +3 -3
- package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs.map +1 -1
- package/dist/lib/fetchGitHubReleaseBodyForRelease.js +1 -1
- package/dist/lib/fetchGitHubReleaseBodyForRelease.js.map +1 -1
- package/dist/lib/fetchNPMPackageVersions.cjs +2 -2
- package/dist/lib/fetchNPMPackageVersions.cjs.map +1 -1
- package/dist/lib/fetchNPMPackageVersions.js +1 -1
- package/dist/lib/fetchNPMPackageVersions.js.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.cjs +7 -4
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.js +5 -2
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +2 -2
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
- package/dist/managers/screenshots/ScreenshotsManager.cjs +8 -4
- package/dist/managers/screenshots/ScreenshotsManager.cjs.map +1 -1
- package/dist/managers/screenshots/ScreenshotsManager.js +6 -2
- package/dist/managers/screenshots/ScreenshotsManager.js.map +1 -1
- package/dist/managers/simulator/SimulatorManager.cjs +2 -2
- package/dist/managers/simulator/SimulatorManager.cjs.map +1 -1
- package/dist/managers/simulator/SimulatorManager.js +1 -1
- package/dist/managers/simulator/SimulatorManager.js.map +1 -1
- package/dist/managers/slices/SlicesManager.cjs +10 -7
- package/dist/managers/slices/SlicesManager.cjs.map +1 -1
- package/dist/managers/slices/SlicesManager.d.ts +1 -1
- package/dist/managers/slices/SlicesManager.js +8 -5
- package/dist/managers/slices/SlicesManager.js.map +1 -1
- package/package.json +4 -4
- package/src/auth/PrismicAuthManager.ts +1 -1
- package/src/lib/checkIsURLAccessible.ts +1 -1
- package/src/lib/fetch.ts +46 -0
- package/src/lib/fetchGitHubReleaseBodyForRelease.ts +1 -1
- package/src/lib/fetchNPMPackageVersions.ts +1 -1
- package/src/managers/customTypes/CustomTypesManager.ts +6 -3
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +1 -1
- package/src/managers/screenshots/ScreenshotsManager.ts +1 -1
- package/src/managers/simulator/SimulatorManager.ts +1 -1
- package/src/managers/slices/SlicesManager.ts +8 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/manager",
|
|
3
|
-
"version": "0.2.2-dev-page-types.
|
|
3
|
+
"version": "0.2.2-dev-page-types.3",
|
|
4
4
|
"description": "Manage all aspects of a Slice Machine project.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@antfu/ni": "^0.20.0",
|
|
65
|
-
"@prismicio/custom-types-client": "
|
|
65
|
+
"@prismicio/custom-types-client": "1.2.0-alpha.0",
|
|
66
66
|
"@prismicio/mocks": "2.0.0-alpha.2",
|
|
67
67
|
"@prismicio/types-internal": "2.0.0-alpha.9",
|
|
68
|
-
"@slicemachine/plugin-kit": "0.2.1-dev-page-types.
|
|
68
|
+
"@slicemachine/plugin-kit": "0.2.1-dev-page-types.3",
|
|
69
69
|
"@wooorm/starry-night": "^1.6.0",
|
|
70
70
|
"analytics-node": "^6.2.0",
|
|
71
71
|
"cookie": "^0.5.0",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"publishConfig": {
|
|
139
139
|
"access": "public"
|
|
140
140
|
},
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "d2c2d77cb89aba03b05df7647420fb20cc6aa7fb"
|
|
142
142
|
}
|
package/src/lib/fetch.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// This temporary wrapper around `node-fetch` fixes an issue where quick
|
|
2
|
+
// consecutive network requests cause failed requests.
|
|
3
|
+
//
|
|
4
|
+
// See https://github.com/node-fetch/node-fetch/issues/1735 for more details.
|
|
5
|
+
//
|
|
6
|
+
// TODO: Remove this wrapper and replace all imports with `node-fetch` if https://github.com/node-fetch/node-fetch/pull/1736 is merged.
|
|
7
|
+
|
|
8
|
+
import * as http from "node:http";
|
|
9
|
+
import * as https from "node:https";
|
|
10
|
+
import baseFetch from "node-fetch";
|
|
11
|
+
|
|
12
|
+
export * from "node-fetch";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The default HTTP Agent with `keepAlive: true` used in `fetch()` requests.
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_HTTP_AGENT = new http.Agent({ keepAlive: true });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The default HTTPS Agent with `keepAlive: true` used in `fetch()` requests.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_HTTPS_AGENT = new https.Agent({ keepAlive: true });
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Patched `fetch()` from `node-fetch` that fixes a bug where quick consecutive
|
|
26
|
+
* network requests cause failed requests.
|
|
27
|
+
*
|
|
28
|
+
* Use this `fetch()` in place of `node-fetch`'s `fetch()`.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* `fetch()` is patched by setting an HTTP/HTTPS Agent with `keepAlive: true`.
|
|
32
|
+
* If you need to assign an Agent, be sure to retain the `keepAlive: true`
|
|
33
|
+
* option.
|
|
34
|
+
*/
|
|
35
|
+
const fetch: typeof baseFetch = (url, init) => {
|
|
36
|
+
return baseFetch(url, {
|
|
37
|
+
agent: (parsedURL) => {
|
|
38
|
+
return parsedURL.protocol === "http:"
|
|
39
|
+
? DEFAULT_HTTP_AGENT
|
|
40
|
+
: DEFAULT_HTTPS_AGENT;
|
|
41
|
+
},
|
|
42
|
+
...init,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default fetch;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import fetch from "node-fetch";
|
|
3
2
|
import * as prismicCustomTypesClient from "@prismicio/custom-types-client";
|
|
4
3
|
import { CustomType } from "@prismicio/types-internal/lib/customtypes";
|
|
5
4
|
import {
|
|
@@ -17,12 +16,14 @@ import {
|
|
|
17
16
|
import { DecodeError } from "../../lib/DecodeError";
|
|
18
17
|
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
19
18
|
import { decodeHookResult } from "../../lib/decodeHookResult";
|
|
19
|
+
import fetch from "../../lib/fetch";
|
|
20
20
|
|
|
21
|
-
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
22
21
|
import { OnlyHookErrors } from "../../types";
|
|
22
|
+
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
23
|
+
import { SLICE_MACHINE_USER_AGENT } from "../../constants/SLICE_MACHINE_USER_AGENT";
|
|
24
|
+
import { UnauthorizedError } from "../../errors";
|
|
23
25
|
|
|
24
26
|
import { BaseManager } from "../BaseManager";
|
|
25
|
-
import { UnauthorizedError } from "../../errors";
|
|
26
27
|
|
|
27
28
|
type SliceMachineManagerReadCustomTypeLibraryReturnType = {
|
|
28
29
|
ids: string[];
|
|
@@ -226,6 +227,7 @@ export class CustomTypesManager extends BaseManager {
|
|
|
226
227
|
endpoint: API_ENDPOINTS.PrismicModels,
|
|
227
228
|
repositoryName: sliceMachineConfig.repositoryName,
|
|
228
229
|
token: authenticationToken,
|
|
230
|
+
userAgent: SLICE_MACHINE_USER_AGENT,
|
|
229
231
|
fetch,
|
|
230
232
|
});
|
|
231
233
|
|
|
@@ -310,6 +312,7 @@ export class CustomTypesManager extends BaseManager {
|
|
|
310
312
|
endpoint: API_ENDPOINTS.PrismicModels,
|
|
311
313
|
repositoryName: sliceMachineConfig.repositoryName,
|
|
312
314
|
token: authenticationToken,
|
|
315
|
+
userAgent: SLICE_MACHINE_USER_AGENT,
|
|
313
316
|
fetch,
|
|
314
317
|
});
|
|
315
318
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { fileTypeFromBuffer } from "file-type";
|
|
3
|
-
import fetch, { FormData, Blob, Response } from "
|
|
3
|
+
import fetch, { FormData, Blob, Response } from "../../lib/fetch";
|
|
4
4
|
// puppeteer is lazy-loaded in captureSliceSimulatorScreenshot
|
|
5
5
|
import type { BrowserContext, Viewport } from "puppeteer";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { HookError } from "@slicemachine/plugin-kit";
|
|
3
|
-
import fetch from "
|
|
3
|
+
import fetch from "../../lib/fetch";
|
|
4
4
|
|
|
5
5
|
import { DecodeError } from "../../lib/DecodeError";
|
|
6
6
|
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import fetch from "node-fetch";
|
|
3
2
|
import * as prismicCustomTypesClient from "@prismicio/custom-types-client";
|
|
4
3
|
import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
|
|
4
|
+
import { SliceComparator } from "@prismicio/types-internal/lib/customtypes/diff";
|
|
5
|
+
import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
5
6
|
import {
|
|
6
7
|
CallHookReturnType,
|
|
7
8
|
HookError,
|
|
@@ -19,17 +20,17 @@ import { DecodeError } from "../../lib/DecodeError";
|
|
|
19
20
|
import { assertPluginsInitialized } from "../../lib/assertPluginsInitialized";
|
|
20
21
|
import { bufferCodec } from "../../lib/bufferCodec";
|
|
21
22
|
import { decodeHookResult } from "../../lib/decodeHookResult";
|
|
23
|
+
import { createContentDigest } from "../../lib/createContentDigest";
|
|
24
|
+
import { mockSlice } from "../../lib/mockSlice";
|
|
25
|
+
import fetch from "../../lib/fetch";
|
|
22
26
|
|
|
23
27
|
import { OnlyHookErrors } from "../../types";
|
|
24
28
|
import { DEFAULT_SLICE_SCREENSHOT_URL } from "../../constants/DEFAULT_SLICE_SCREENSHOT_URL";
|
|
29
|
+
import { SLICE_MACHINE_USER_AGENT } from "../../constants/SLICE_MACHINE_USER_AGENT";
|
|
25
30
|
import { API_ENDPOINTS } from "../../constants/API_ENDPOINTS";
|
|
26
31
|
import { UnauthenticatedError, UnauthorizedError } from "../../errors";
|
|
27
32
|
|
|
28
33
|
import { BaseManager } from "../BaseManager";
|
|
29
|
-
import { createContentDigest } from "../../lib/createContentDigest";
|
|
30
|
-
import { mockSlice } from "../../lib/mockSlice";
|
|
31
|
-
import { SliceComparator } from "@prismicio/types-internal/lib/customtypes/diff";
|
|
32
|
-
import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
33
34
|
|
|
34
35
|
type SlicesManagerReadSliceLibraryReturnType = {
|
|
35
36
|
sliceIDs: string[];
|
|
@@ -434,6 +435,7 @@ export class SlicesManager extends BaseManager {
|
|
|
434
435
|
endpoint: API_ENDPOINTS.PrismicModels,
|
|
435
436
|
repositoryName: sliceMachineConfig.repositoryName,
|
|
436
437
|
token: authenticationToken,
|
|
438
|
+
userAgent: SLICE_MACHINE_USER_AGENT,
|
|
437
439
|
fetch,
|
|
438
440
|
});
|
|
439
441
|
|
|
@@ -630,6 +632,7 @@ export class SlicesManager extends BaseManager {
|
|
|
630
632
|
endpoint: API_ENDPOINTS.PrismicModels,
|
|
631
633
|
repositoryName: sliceMachineConfig.repositoryName,
|
|
632
634
|
token: authenticationToken,
|
|
635
|
+
userAgent: SLICE_MACHINE_USER_AGENT,
|
|
633
636
|
fetch,
|
|
634
637
|
});
|
|
635
638
|
|