@lumeweb/pinner 0.1.6 → 0.1.8
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/esm/api/generated/content/content.msw.d.ts +16 -2
- package/dist/esm/api/generated/content/content.msw.js +1 -1
- package/dist/esm/api/generated/dns/dns.msw.d.ts +38 -2
- package/dist/esm/api/generated/dns/dns.msw.js +1 -1
- package/dist/esm/api/generated/files/files.msw.d.ts +9 -2
- package/dist/esm/api/generated/files/files.msw.js +1 -1
- package/dist/esm/api/generated/gateway/gateway.msw.d.ts +8 -2
- package/dist/esm/api/generated/gateway/gateway.msw.js +1 -1
- package/dist/esm/api/generated/internal/internal.msw.d.ts +5 -2
- package/dist/esm/api/generated/internal/internal.msw.js +1 -1
- package/dist/esm/api/generated/ipns/ipns.msw.d.ts +22 -2
- package/dist/esm/api/generated/ipns/ipns.msw.js +1 -1
- package/dist/esm/api/generated/pinning/pinning.msw.d.ts +15 -2
- package/dist/esm/api/generated/pinning/pinning.msw.js +1 -1
- package/dist/esm/api/generated/schemas/blockMetaResponse.d.ts +46 -0
- package/dist/esm/api/generated/schemas/bulkDeleteResponse.d.ts +9 -0
- package/dist/esm/api/generated/schemas/bulkRecordsResponse.d.ts +9 -0
- package/dist/esm/api/generated/schemas/component.d.ts +42 -0
- package/dist/esm/api/generated/schemas/errorResponse.d.ts +42 -0
- package/dist/esm/api/generated/schemas/fileManagerItem.d.ts +51 -0
- package/dist/esm/api/generated/schemas/fileManagerItemResponse.d.ts +10 -0
- package/dist/esm/api/generated/schemas/gatewayWebsiteResponse.d.ts +45 -0
- package/dist/esm/api/generated/schemas/gatewayWebsiteStatusResponse.d.ts +45 -0
- package/dist/esm/api/generated/schemas/infoResponse.d.ts +44 -0
- package/dist/esm/api/generated/schemas/multiaddr.d.ts +7 -0
- package/dist/esm/api/generated/schemas/pinRequest.d.ts +12 -0
- package/dist/esm/api/generated/schemas/pinRequestMeta.d.ts +42 -0
- package/dist/esm/api/generated/schemas/pinResultsResponse.d.ts +10 -0
- package/dist/esm/api/generated/schemas/pinStatusResponse.d.ts +16 -0
- package/dist/esm/api/generated/schemas/pinStatusResponseInfo.d.ts +42 -0
- package/dist/esm/api/generated/schemas/recordResponse.d.ts +47 -0
- package/dist/esm/api/generated/schemas/recordResponseResponse.d.ts +10 -0
- package/dist/esm/api/generated/schemas/recordResult.d.ts +45 -0
- package/dist/esm/api/generated/schemas/validationResponse.d.ts +45 -0
- package/dist/esm/api/generated/schemas/zoneListResponse.d.ts +48 -0
- package/dist/esm/api/generated/schemas/zoneListResponseResponse.d.ts +10 -0
- package/dist/esm/api/generated/schemas/zoneResponse.d.ts +48 -0
- package/dist/esm/api/generated/tus/tus.msw.d.ts +10 -2
- package/dist/esm/api/generated/tus/tus.msw.js +1 -1
- package/dist/esm/api/generated/websites/websites.msw.d.ts +23 -2
- package/dist/esm/api/generated/websites/websites.msw.js +1 -1
- package/dist/esm/api/mocks.d.ts +10 -0
- package/dist/esm/api/mocks.js +11 -0
- package/dist/esm/upload/tus-upload.js +0 -2
- package/dist/esm/upload/tus-upload.js.map +1 -1
- package/package.json +6 -6
- package/dist/esm/_virtual/_rolldown/runtime.js +0 -8
- package/dist/esm/api/generated/index.msw.d.ts +0 -10
- package/dist/esm/api/generated/index.msw.js +0 -11
- package/dist/esm/utils/tus-patch.js +0 -51
- package/dist/esm/utils/tus-patch.js.map +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { isNodeEnvironment } from "./env.js";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/tus-patch.ts
|
|
5
|
-
/**
|
|
6
|
-
* Runtime patch for tus-js-client's NodeHttpStack Request class.
|
|
7
|
-
*
|
|
8
|
-
* PROBLEM:
|
|
9
|
-
* Code using onBeforeRequest hook may need to call abort() on the request
|
|
10
|
-
* before send() is called. However, the Request class only sets this._request
|
|
11
|
-
* inside the send() method, so getUnderlyingObject() returns null before send().
|
|
12
|
-
*
|
|
13
|
-
* SOLUTION:
|
|
14
|
-
* Patch the Request class to initialize a dummy _request object with an abort()
|
|
15
|
-
* method immediately when the request is created.
|
|
16
|
-
*
|
|
17
|
-
* NOTE:
|
|
18
|
-
* This patch is only needed in Node.js environments. In browser environments,
|
|
19
|
-
* the tus-js-client uses a different HTTP stack that doesn't have this issue.
|
|
20
|
-
*/
|
|
21
|
-
function patchTusNodeHttpStack() {
|
|
22
|
-
if (!isNodeEnvironment()) return;
|
|
23
|
-
try {
|
|
24
|
-
const tusHttpStackModule = __require("tus-js-client/lib.es5/node/httpStack.js");
|
|
25
|
-
if (!tusHttpStackModule || !tusHttpStackModule.default) {
|
|
26
|
-
console.warn("[tus-patch] tus-js-client NodeHttpStack not found, patch skipped");
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const NodeHttpStack = tusHttpStackModule.default;
|
|
30
|
-
const originalCreateRequest = NodeHttpStack.prototype.createRequest;
|
|
31
|
-
if (typeof originalCreateRequest !== "function") {
|
|
32
|
-
console.warn("[tus-patch] createRequest method not found, patch skipped");
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
NodeHttpStack.prototype.createRequest = function(method, url) {
|
|
36
|
-
const request = originalCreateRequest.call(this, method, url);
|
|
37
|
-
request._request = {
|
|
38
|
-
abort: () => {},
|
|
39
|
-
destroyed: false
|
|
40
|
-
};
|
|
41
|
-
return request;
|
|
42
|
-
};
|
|
43
|
-
console.debug("[tus-patch] Successfully patched tus-js-client NodeHttpStack");
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.warn("[tus-patch] Failed to patch tus-js-client:", error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
export { patchTusNodeHttpStack };
|
|
51
|
-
//# sourceMappingURL=tus-patch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tus-patch.js","names":[],"sources":["../../../src/utils/tus-patch.ts"],"sourcesContent":["/**\n * Runtime patch for tus-js-client's NodeHttpStack Request class.\n *\n * PROBLEM:\n * Code using onBeforeRequest hook may need to call abort() on the request\n * before send() is called. However, the Request class only sets this._request\n * inside the send() method, so getUnderlyingObject() returns null before send().\n *\n * SOLUTION:\n * Patch the Request class to initialize a dummy _request object with an abort()\n * method immediately when the request is created.\n *\n * NOTE:\n * This patch is only needed in Node.js environments. In browser environments,\n * the tus-js-client uses a different HTTP stack that doesn't have this issue.\n */\n\nimport { isNodeEnvironment } from \"./env\";\n\n// Track whether the patch has been applied to prevent multiple patches\nlet isPatched = false;\n\nexport function patchTusNodeHttpStack(): void {\n // Prevent multiple patches\n if (isPatched) {\n return;\n }\n\n // Only apply patch in Node.js environments\n if (!isNodeEnvironment()) {\n return;\n }\n\n // Find the tus-js-client NodeHttpStack module\n // It exports the default as NodeHttpStack with a nested Request class\n try {\n // Use dynamic require() to avoid bundling issues\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tusHttpStackModule = require(\"tus-js-client/lib.es5/node/httpStack\");\n\n if (!tusHttpStackModule || !tusHttpStackModule.default) {\n console.warn(\n \"[tus-patch] tus-js-client NodeHttpStack not found, patch skipped\",\n );\n return;\n }\n\n const NodeHttpStack = tusHttpStackModule.default;\n\n // Get the original createRequest method\n const originalCreateRequest = NodeHttpStack.prototype.createRequest;\n\n if (typeof originalCreateRequest !== \"function\") {\n console.warn(\"[tus-patch] createRequest method not found, patch skipped\");\n return;\n }\n\n // Patch createRequest to set up a dummy _request on the Request instance\n NodeHttpStack.prototype.createRequest = function (\n method: string,\n url: string,\n ) {\n // Call the original createRequest to get the Request instance\n const request = originalCreateRequest.call(this, method, url);\n\n // Set a dummy _request object with an abort() method\n // This allows getUnderlyingObject().abort() to work before send() is called\n request._request = {\n abort: () => {\n // No-op abort before actual request is created\n // The real request will be created in send() and this will be replaced\n },\n // Preserve any existing properties that might be checked\n destroyed: false,\n };\n\n return request;\n };\n\n console.debug(\n \"[tus-patch] Successfully patched tus-js-client NodeHttpStack\",\n );\n } catch (error) {\n console.warn(\"[tus-patch] Failed to patch tus-js-client:\", error);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,wBAA8B;AAO5C,KAAI,CAAC,mBAAmB,CACtB;AAKF,KAAI;EAGF,MAAM,+BAA6B,0CAAuC;AAE1E,MAAI,CAAC,sBAAsB,CAAC,mBAAmB,SAAS;AACtD,WAAQ,KACN,mEACD;AACD;;EAGF,MAAM,gBAAgB,mBAAmB;EAGzC,MAAM,wBAAwB,cAAc,UAAU;AAEtD,MAAI,OAAO,0BAA0B,YAAY;AAC/C,WAAQ,KAAK,4DAA4D;AACzE;;AAIF,gBAAc,UAAU,gBAAgB,SACtC,QACA,KACA;GAEA,MAAM,UAAU,sBAAsB,KAAK,MAAM,QAAQ,IAAI;AAI7D,WAAQ,WAAW;IACjB,aAAa;IAKb,WAAW;IACZ;AAED,UAAO;;AAGT,UAAQ,MACN,+DACD;UACM,OAAO;AACd,UAAQ,KAAK,8CAA8C,MAAM"}
|