@pkcprotocol/pkc-js 0.0.50 → 0.0.51

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.
Files changed (61) hide show
  1. package/dist/browser/generated-version.d.ts +1 -1
  2. package/dist/browser/generated-version.js +1 -1
  3. package/dist/browser/pkc/pkc.d.ts +2 -3
  4. package/dist/browser/pkc/pkc.js +16 -41
  5. package/dist/browser/pkc/pkc.js.map +1 -1
  6. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +1 -0
  7. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +4 -0
  8. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +1 -0
  9. package/dist/browser/runtime/node/address-rewriter-db.d.ts +32 -0
  10. package/dist/browser/runtime/node/address-rewriter-db.js +156 -0
  11. package/dist/browser/runtime/node/address-rewriter-db.js.map +1 -0
  12. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.d.ts +46 -0
  13. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js +512 -0
  14. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js.map +1 -0
  15. package/dist/browser/runtime/node/community/local-community/cleanup.js +21 -0
  16. package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
  17. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +4 -0
  18. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js +249 -0
  19. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -0
  20. package/dist/bundled/bundle-manifest.json +43 -26
  21. package/dist/bundled/chunks/{helia-for-pkc-CoiCnGzf.js → helia-for-pkc-CUP6OHZK.js} +2 -2
  22. package/dist/bundled/chunks/{local-community-DiTjNeA_.js → local-community-CvqLy6Ae.js} +1 -1
  23. package/dist/bundled/chunks/{local-community-PMOePYFy.js → local-community-V8zNa5f6.js} +11 -2
  24. package/dist/bundled/chunks/{node-2IRJmtOa.js → node-Cb3oyWdO.js} +2799 -360
  25. package/dist/bundled/chunks/{rpc-local-community-DUD2jTEu.js → rpc-local-community-DpGUOcjz.js} +1 -1
  26. package/dist/bundled/chunks/{schema-DEqa38Xx.js → schema-8LB1qzJT.js} +1 -1
  27. package/dist/bundled/chunks/{util-CcKyKVLs.js → util-f6LWGHSl.js} +1 -1
  28. package/dist/bundled/index.js +1 -1
  29. package/dist/bundled/rpc/src/index.js +4 -4
  30. package/dist/node/generated-version.d.ts +1 -1
  31. package/dist/node/generated-version.js +1 -1
  32. package/dist/node/pkc/pkc.d.ts +2 -3
  33. package/dist/node/pkc/pkc.js +16 -41
  34. package/dist/node/pkc/pkc.js.map +1 -1
  35. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +1 -0
  36. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +4 -0
  37. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +1 -0
  38. package/dist/node/runtime/node/address-rewriter-db.d.ts +32 -0
  39. package/dist/node/runtime/node/address-rewriter-db.js +156 -0
  40. package/dist/node/runtime/node/address-rewriter-db.js.map +1 -0
  41. package/dist/node/runtime/node/addresses-rewriter-proxy-server.d.ts +46 -0
  42. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js +512 -0
  43. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js.map +1 -0
  44. package/dist/node/runtime/node/community/local-community/cleanup.js +21 -0
  45. package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
  46. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +4 -0
  47. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js +249 -0
  48. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -0
  49. package/package.json +2 -2
  50. package/dist/browser/runtime/browser/setup-kubo-http-routers.d.ts +0 -2
  51. package/dist/browser/runtime/browser/setup-kubo-http-routers.js +0 -14
  52. package/dist/browser/runtime/browser/setup-kubo-http-routers.js.map +0 -1
  53. package/dist/browser/runtime/node/setup-kubo-http-routers.d.ts +0 -10
  54. package/dist/browser/runtime/node/setup-kubo-http-routers.js +0 -347
  55. package/dist/browser/runtime/node/setup-kubo-http-routers.js.map +0 -1
  56. package/dist/node/runtime/browser/setup-kubo-http-routers.d.ts +0 -2
  57. package/dist/node/runtime/browser/setup-kubo-http-routers.js +0 -14
  58. package/dist/node/runtime/browser/setup-kubo-http-routers.js.map +0 -1
  59. package/dist/node/runtime/node/setup-kubo-http-routers.d.ts +0 -10
  60. package/dist/node/runtime/node/setup-kubo-http-routers.js +0 -347
  61. package/dist/node/runtime/node/setup-kubo-http-routers.js.map +0 -1
@@ -0,0 +1,249 @@
1
+ import retry from "retry";
2
+ import { AddressesRewriterProxyServer } from "./addresses-rewriter-proxy-server.js";
3
+ import Logger from "../../logger.js";
4
+ import { PKCError } from "../../pkc-error.js";
5
+ import * as remeda from "remeda";
6
+ import tcpPortUsed from "tcp-port-used";
7
+ function _mergeRouterConfigs(existingConfig, newConfig) {
8
+ if (!existingConfig?.Routers)
9
+ return newConfig;
10
+ const existingRoutersByEndpoint = new Map();
11
+ Object.entries(existingConfig.Routers).forEach(([routerName, router]) => {
12
+ if (router.Parameters?.Endpoint) {
13
+ existingRoutersByEndpoint.set(router.Parameters.Endpoint, { routerName, router });
14
+ }
15
+ });
16
+ const mergedRouters = { ...newConfig.Routers };
17
+ Object.entries(newConfig.Routers).forEach(([newRouterName, newRouter]) => {
18
+ if (newRouter.Parameters?.Endpoint) {
19
+ const existing = existingRoutersByEndpoint.get(newRouter.Parameters.Endpoint);
20
+ if (existing) {
21
+ mergedRouters[newRouterName] = {
22
+ ...existing.router,
23
+ ...newRouter,
24
+ Parameters: { ...existing.router.Parameters, ...newRouter.Parameters }
25
+ };
26
+ }
27
+ }
28
+ });
29
+ return {
30
+ ...newConfig,
31
+ Routers: mergedRouters
32
+ };
33
+ }
34
+ async function _setProvideDhtSweepEnabledOnKuboNode(kuboClient, sweepEnabled) {
35
+ const log = Logger("pkc-js:pkc:_init:retrySettingHttpRoutersOnIpfsNodes:setProvideDhtSweepEnabledOnIpfsNode");
36
+ const configKey = "Provide.DHT.SweepEnabled";
37
+ const url = `${kuboClient._clientOptions.url}/config?arg=${configKey}&arg=${JSON.stringify(sweepEnabled)}&json=true`;
38
+ try {
39
+ await fetch(url, { method: "POST", headers: kuboClient._clientOptions.headers });
40
+ }
41
+ catch (e) {
42
+ const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
43
+ fullUrl: url,
44
+ actualError: e,
45
+ kuboEndpoint: kuboClient._clientOptions.url,
46
+ configKey,
47
+ configValueToBeSet: sweepEnabled
48
+ });
49
+ log.error(e);
50
+ throw error;
51
+ }
52
+ log.trace("Succeeded in setting config key", configKey, "on node", kuboClient._clientOptions.url, "to be", sweepEnabled);
53
+ }
54
+ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
55
+ const log = Logger("pkc-js:pkc:_init:retrySettingHttpRoutersOnIpfsNodes:setHttpRouterOptionsOnIpfsNode");
56
+ const routingKey = "Routing";
57
+ let routingConfigBeforeChanging;
58
+ try {
59
+ routingConfigBeforeChanging = await kuboClient._client.config.get(routingKey);
60
+ }
61
+ catch (e) {
62
+ const error = new PKCError("ERR_FAILED_TO_GET_CONFIG_ON_KUBO_NODE", {
63
+ actualError: e,
64
+ kuboEndpoint: kuboClient._clientOptions.url,
65
+ configKey: routingKey
66
+ });
67
+ log.error(e);
68
+ throw error;
69
+ }
70
+ const mergedRoutingValue = _mergeRouterConfigs(routingConfigBeforeChanging, routingValue);
71
+ const url = `${kuboClient._clientOptions.url}/config?arg=${routingKey}&arg=${JSON.stringify(mergedRoutingValue)}&json=true`;
72
+ try {
73
+ await fetch(url, { method: "POST", headers: kuboClient._clientOptions.headers });
74
+ }
75
+ catch (e) {
76
+ const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
77
+ fullUrl: url,
78
+ actualError: e,
79
+ kuboEndpoint: kuboClient._clientOptions.url,
80
+ configKey: routingKey,
81
+ configValueToBeSet: mergedRoutingValue
82
+ });
83
+ log.error(e);
84
+ throw error;
85
+ }
86
+ log.trace("Succeeded in setting config key", routingKey, "on node", kuboClient._clientOptions.url, "to be", mergedRoutingValue);
87
+ await _setProvideDhtSweepEnabledOnKuboNode(kuboClient, false);
88
+ const endpointsBefore = Object.values(routingConfigBeforeChanging?.Routers || {})
89
+ .map((router) => router.Parameters?.Endpoint)
90
+ .filter((endpoint) => endpoint !== undefined);
91
+ const endpointsAfter = Object.values(mergedRoutingValue.Routers)
92
+ .map((router) => router.Parameters?.Endpoint)
93
+ .filter((endpoint) => endpoint !== undefined);
94
+ if (!remeda.isDeepEqual(endpointsBefore.sort(), endpointsAfter.sort())) {
95
+ log("Config on kubo node has been changed. PKC-js will send shutdown command to node", kuboClient._clientOptions.url, "Clients of pkc-js should restart ipfs node");
96
+ const shutdownUrl = `${kuboClient._clientOptions.url}/shutdown`;
97
+ try {
98
+ await fetch(shutdownUrl, { method: "POST", headers: kuboClient._clientOptions.headers });
99
+ }
100
+ catch (e) {
101
+ const error = new PKCError("ERR_FAILED_TO_SHUTDOWN_KUBO_NODE", {
102
+ actualError: e,
103
+ kuboEndpoint: kuboClient._clientOptions.url,
104
+ shutdownUrl
105
+ });
106
+ log.error(e);
107
+ throw error;
108
+ }
109
+ }
110
+ }
111
+ async function _getStartedProxyUrl(pkc, httpRouterUrl) {
112
+ if (pkc.destroyed)
113
+ return undefined;
114
+ const mappingKeyName = `httprouter_proxy_${httpRouterUrl}`;
115
+ try {
116
+ const urlOfProxyOfHttpRouter = await pkc._storage.getItem(mappingKeyName);
117
+ if (pkc.destroyed)
118
+ return undefined;
119
+ if (urlOfProxyOfHttpRouter) {
120
+ const proxyHttpUrl = new URL(urlOfProxyOfHttpRouter);
121
+ if (await tcpPortUsed.check(Number(proxyHttpUrl.port), "127.0.0.1"))
122
+ return urlOfProxyOfHttpRouter;
123
+ if (pkc.destroyed)
124
+ return undefined;
125
+ await pkc._storage.removeItem(mappingKeyName);
126
+ }
127
+ return undefined;
128
+ }
129
+ catch (error) {
130
+ if (pkc.destroyed && error instanceof Error && error.message.includes("database connection is not open")) {
131
+ return undefined;
132
+ }
133
+ throw error;
134
+ }
135
+ }
136
+ export async function setupKuboAddressesRewriterAndHttpRouters(pkc) {
137
+ if (pkc.destroyed) {
138
+ return {
139
+ destroy: async () => { }
140
+ };
141
+ }
142
+ if (!Array.isArray(pkc.kuboRpcClientsOptions) || pkc.kuboRpcClientsOptions.length <= 0)
143
+ throw Error("need ipfs http client to be defined");
144
+ if (!Array.isArray(pkc.httpRoutersOptions) || pkc.httpRoutersOptions.length <= 0)
145
+ throw Error("Need http router options to defined");
146
+ const log = Logger("pkc-js:node:setupKuboAddressesRewriterAndHttpRouters");
147
+ // Set up http proxies first to rewrite addresses
148
+ const httpRouterProxyUrls = [];
149
+ const proxyServers = [];
150
+ let addressesRewriterStartPort = 19575; // use port 19575 as first port, looks like IPRTR (IPFS ROUTER)
151
+ for (const httpRouter of pkc.httpRoutersOptions) {
152
+ if (pkc.destroyed)
153
+ break;
154
+ const startedProxyUrl = await _getStartedProxyUrl(pkc, httpRouter);
155
+ if (startedProxyUrl) {
156
+ // Intentionally not tracked in proxyServers: this proxy was started by a previous PKC
157
+ // instance in the same process and persisted via storage. We have no server handle to it
158
+ // and must not destroy() it on teardown, since another instance may still rely on it. It
159
+ // is bounded (one proxy per httpRouter, reusing the same stored URL) and lives until the
160
+ // process exits, so this is reuse by design, not a leak.
161
+ httpRouterProxyUrls.push(startedProxyUrl);
162
+ continue;
163
+ }
164
+ // launch the proxy server
165
+ let port = addressesRewriterStartPort;
166
+ const hostname = "127.0.0.1";
167
+ while (await tcpPortUsed.check(port, hostname))
168
+ // keep increasing port till we find an empty port
169
+ port++;
170
+ const addressesRewriterProxyServer = new AddressesRewriterProxyServer({
171
+ kuboClients: Object.values(pkc.clients.kuboRpcClients).map((kubo) => kubo._client),
172
+ port,
173
+ hostname,
174
+ proxyTargetUrl: httpRouter,
175
+ pkc
176
+ });
177
+ await addressesRewriterProxyServer.listen();
178
+ if (pkc.destroyed) {
179
+ await addressesRewriterProxyServer.destroy();
180
+ break;
181
+ }
182
+ proxyServers.push(addressesRewriterProxyServer);
183
+ // save the proxy urls to use them later
184
+ const httpRouterProxyUrl = `http://${hostname}:${port}`;
185
+ httpRouterProxyUrls.push(httpRouterProxyUrl);
186
+ }
187
+ httpRouterProxyUrls.sort(); // make sure it's always the same order
188
+ // Set up http routers to use proxies
189
+ const kuboClients = pkc.clients.kuboRpcClients;
190
+ const parallelRouters = [];
191
+ const httpRoutersConfig = {
192
+ HttpRoutersParallel: { Type: "parallel", Parameters: { Routers: parallelRouters } },
193
+ HttpRouterNotSupported: { Type: "http", Parameters: { Endpoint: "http://kubohttprouternotsupported" } }
194
+ };
195
+ for (const [i, httpRouterUrl] of httpRouterProxyUrls.entries()) {
196
+ const RouterName = `HttpRouter${i + 1}`;
197
+ httpRoutersConfig[RouterName] = {
198
+ Type: "http",
199
+ Parameters: {
200
+ Endpoint: httpRouterUrl
201
+ }
202
+ };
203
+ parallelRouters[i] = {
204
+ RouterName: RouterName,
205
+ IgnoreErrors: true,
206
+ Timeout: "10s"
207
+ };
208
+ }
209
+ const httpRoutersMethodsConfig = {
210
+ "find-providers": { RouterName: "HttpRoutersParallel" },
211
+ provide: { RouterName: "HttpRoutersParallel" },
212
+ // not supported by pkc trackers
213
+ "find-peers": { RouterName: "HttpRouterNotSupported" },
214
+ "get-ipns": { RouterName: "HttpRouterNotSupported" },
215
+ "put-ipns": { RouterName: "HttpRouterNotSupported" }
216
+ };
217
+ const routingValue = {
218
+ Type: "custom",
219
+ Methods: httpRoutersMethodsConfig,
220
+ Routers: httpRoutersConfig
221
+ };
222
+ // Cap the backoff: with forever:true and no maxTimeout the exponential delay grows unbounded
223
+ // (hours between attempts after enough failures), which would stall router setup indefinitely.
224
+ const settingOptionRetryOption = retry.operation({ forever: true, factor: 2, maxTimeout: 60 * 1000 });
225
+ const setHttpRouterOnAllNodes = new Promise((resolve) => {
226
+ settingOptionRetryOption.attempt(async (curAttempt) => {
227
+ for (const kuboClient of Object.values(kuboClients)) {
228
+ try {
229
+ await _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue);
230
+ }
231
+ catch (e) {
232
+ settingOptionRetryOption.retry(e);
233
+ return;
234
+ }
235
+ }
236
+ resolve(1);
237
+ });
238
+ });
239
+ await setHttpRouterOnAllNodes;
240
+ settingOptionRetryOption.stop();
241
+ return {
242
+ destroy: async () => {
243
+ for (const proxyServer of proxyServers) {
244
+ await proxyServer.destroy();
245
+ }
246
+ }
247
+ };
248
+ }
249
+ //# sourceMappingURL=setup-kubo-address-rewriter-and-http-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-kubo-address-rewriter-and-http-router.js","sourceRoot":"","sources":["../../../../src/runtime/browser/setup-kubo-address-rewriter-and-http-router.ts"],"names":[],"mappings":"AACA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,WAAW,MAAM,eAAe,CAAC;AAgBxC,SAAS,mBAAmB,CAAC,cAA6C,EAAE,SAA4B;IACpG,IAAI,CAAC,cAAc,EAAE,OAAO;QAAE,OAAO,SAAS,CAAC;IAE/C,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA2D,CAAC;IACrG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE;QACpE,IAAI,MAAM,CAAC,UAAU,EAAE,QAAQ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EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAEtG,MAAM,uBAAuB,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpD,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YAClD,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClD,IAAI,CAAC;oBACD,MAAM,+BAA+B,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;gBACpE,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,wBAAwB,CAAC,KAAK,CAAQ,CAAC,CAAC,CAAC;oBACzC,OAAO;gBACX,CAAC;YACL,CAAC;YACD,OAAO,CAAC,CAAC,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,uBAAuB,CAAC;IAC9B,wBAAwB,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO;QACH,OAAO,EAAE,KAAK,IAAI,EAAE;YAChB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;gBACrC,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -14,7 +14,7 @@
14
14
  "node:module"
15
15
  ],
16
16
  "dynamicImports": [
17
- "chunks/node-2IRJmtOa.js"
17
+ "chunks/node-Cb3oyWdO.js"
18
18
  ],
19
19
  "inputs": [
20
20
  "dist/node/runtime/node/compile-cache.js",
@@ -24,7 +24,7 @@
24
24
  "index.js": {
25
25
  "isEntry": true,
26
26
  "imports": [
27
- "chunks/node-2IRJmtOa.js"
27
+ "chunks/node-Cb3oyWdO.js"
28
28
  ],
29
29
  "dynamicImports": [],
30
30
  "inputs": []
@@ -32,10 +32,10 @@
32
32
  "rpc/src/index.js": {
33
33
  "isEntry": true,
34
34
  "imports": [
35
- "chunks/schema-DEqa38Xx.js",
36
- "chunks/rpc-local-community-DUD2jTEu.js",
37
- "chunks/node-2IRJmtOa.js",
38
- "chunks/local-community-PMOePYFy.js",
35
+ "chunks/schema-8LB1qzJT.js",
36
+ "chunks/rpc-local-community-DpGUOcjz.js",
37
+ "chunks/node-Cb3oyWdO.js",
38
+ "chunks/local-community-V8zNa5f6.js",
39
39
  "node:url",
40
40
  "path",
41
41
  "assert",
@@ -54,11 +54,11 @@
54
54
  "dist/node/rpc/src/index.js"
55
55
  ]
56
56
  },
57
- "chunks/helia-for-pkc-CoiCnGzf.js": {
57
+ "chunks/helia-for-pkc-CUP6OHZK.js": {
58
58
  "isEntry": false,
59
59
  "imports": [
60
- "chunks/schema-DEqa38Xx.js",
61
- "chunks/util-CcKyKVLs.js",
60
+ "chunks/schema-8LB1qzJT.js",
61
+ "chunks/util-f6LWGHSl.js",
62
62
  "multiformats/cid",
63
63
  "@libp2p/interface",
64
64
  "@libp2p/peer-id",
@@ -83,19 +83,19 @@
83
83
  "dist/node/helia/helia-for-pkc.js"
84
84
  ]
85
85
  },
86
- "chunks/local-community-DiTjNeA_.js": {
86
+ "chunks/local-community-CvqLy6Ae.js": {
87
87
  "isEntry": false,
88
88
  "imports": [
89
- "chunks/local-community-PMOePYFy.js"
89
+ "chunks/local-community-V8zNa5f6.js"
90
90
  ],
91
91
  "dynamicImports": [],
92
92
  "inputs": []
93
93
  },
94
- "chunks/local-community-PMOePYFy.js": {
94
+ "chunks/local-community-V8zNa5f6.js": {
95
95
  "isEntry": false,
96
96
  "imports": [
97
- "chunks/schema-DEqa38Xx.js",
98
- "chunks/rpc-local-community-DUD2jTEu.js",
97
+ "chunks/schema-8LB1qzJT.js",
98
+ "chunks/rpc-local-community-DpGUOcjz.js",
99
99
  "node:crypto",
100
100
  "node:url",
101
101
  "node:path",
@@ -142,23 +142,27 @@
142
142
  "dist/node/runtime/node/community/local-community.js"
143
143
  ]
144
144
  },
145
- "chunks/node-2IRJmtOa.js": {
145
+ "chunks/node-Cb3oyWdO.js": {
146
146
  "isEntry": false,
147
147
  "imports": [
148
- "chunks/schema-DEqa38Xx.js",
149
- "chunks/rpc-local-community-DUD2jTEu.js",
150
- "chunks/util-CcKyKVLs.js",
148
+ "chunks/schema-8LB1qzJT.js",
149
+ "chunks/rpc-local-community-DpGUOcjz.js",
150
+ "chunks/util-f6LWGHSl.js",
151
+ "node:http",
152
+ "node:fs/promises",
153
+ "node:path",
151
154
  "path",
152
155
  "assert",
153
156
  "fs",
157
+ "node:https",
154
158
  "better-sqlite3",
155
159
  "typestub-ipfs-only-hash",
156
160
  "events",
157
161
  "rpc-websockets"
158
162
  ],
159
163
  "dynamicImports": [
160
- "chunks/helia-for-pkc-CoiCnGzf.js",
161
- "chunks/local-community-PMOePYFy.js"
164
+ "chunks/helia-for-pkc-CUP6OHZK.js",
165
+ "chunks/local-community-V8zNa5f6.js"
162
166
  ],
163
167
  "inputs": [
164
168
  "node_modules/zod/v4/locales/en.js",
@@ -191,7 +195,20 @@
191
195
  "dist/node/runtime/node/sqlite-lru-cache.js",
192
196
  "dist/node/runtime/node/lru-storage.js",
193
197
  "dist/node/publications/comment-moderation/comment-moderation.js",
194
- "dist/node/runtime/node/setup-kubo-http-routers.js",
198
+ "dist/node/runtime/node/address-rewriter-db.js",
199
+ "dist/node/runtime/node/addresses-rewriter-proxy-server.js",
200
+ "node_modules/deep-is/index.js",
201
+ "node_modules/is2/node_modules/ip-regex/index.js",
202
+ "node_modules/is2/package.json",
203
+ "node_modules/is-url/index.js",
204
+ "node_modules/is2/index.js",
205
+ "node_modules/tcp-port-used/node_modules/ms/index.js",
206
+ "node_modules/tcp-port-used/node_modules/debug/src/common.js",
207
+ "node_modules/tcp-port-used/node_modules/debug/src/browser.js",
208
+ "node_modules/tcp-port-used/node_modules/debug/src/node.js",
209
+ "node_modules/tcp-port-used/node_modules/debug/src/index.js",
210
+ "node_modules/tcp-port-used/index.js",
211
+ "dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js",
195
212
  "dist/node/publications/community-edit/community-edit.js",
196
213
  "dist/node/pkc/pkc.js",
197
214
  "dist/node/runtime/browser/native-functions.js",
@@ -199,10 +216,10 @@
199
216
  "dist/node/index.js"
200
217
  ]
201
218
  },
202
- "chunks/rpc-local-community-DUD2jTEu.js": {
219
+ "chunks/rpc-local-community-DpGUOcjz.js": {
203
220
  "isEntry": false,
204
221
  "imports": [
205
- "chunks/schema-DEqa38Xx.js",
222
+ "chunks/schema-8LB1qzJT.js",
206
223
  "node:crypto",
207
224
  "node:url",
208
225
  "node:dns",
@@ -734,7 +751,7 @@
734
751
  "dist/node/community/rpc-local-community.js"
735
752
  ]
736
753
  },
737
- "chunks/schema-DEqa38Xx.js": {
754
+ "chunks/schema-8LB1qzJT.js": {
738
755
  "isEntry": false,
739
756
  "imports": [
740
757
  "node:module",
@@ -1278,10 +1295,10 @@
1278
1295
  "dist/node/pubsub-messages/schema.js"
1279
1296
  ]
1280
1297
  },
1281
- "chunks/util-CcKyKVLs.js": {
1298
+ "chunks/util-f6LWGHSl.js": {
1282
1299
  "isEntry": false,
1283
1300
  "imports": [
1284
- "chunks/schema-DEqa38Xx.js"
1301
+ "chunks/schema-8LB1qzJT.js"
1285
1302
  ],
1286
1303
  "dynamicImports": [],
1287
1304
  "inputs": [
@@ -1,5 +1,5 @@
1
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-DEqa38Xx.js";
2
- import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-CcKyKVLs.js";
1
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-8LB1qzJT.js";
2
+ import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-f6LWGHSl.js";
3
3
  import { CID } from "multiformats/cid";
4
4
  import { NotFoundError } from "@libp2p/interface";
5
5
  import { peerIdFromString } from "@libp2p/peer-id";
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-PMOePYFy.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-V8zNa5f6.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,5 +1,5 @@
1
- import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-DEqa38Xx.js";
2
- import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-DUD2jTEu.js";
1
+ import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-8LB1qzJT.js";
2
+ import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-DpGUOcjz.js";
3
3
  import { randomFillSync, randomUUID } from "node:crypto";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import path from "node:path";
@@ -277,6 +277,15 @@ async function cleanUpIpfsRepoRarely(community, force = false) {
277
277
  if (Math.random() < 1e-5 || force) {
278
278
  let gcCids = 0;
279
279
  const kuboRpc = community._clientsManager.getDefaultKuboRpcClient();
280
+ try {
281
+ await pTimeout(kuboRpc._client.files.flush("/"), {
282
+ milliseconds: 15e3,
283
+ message: "Timed out flushing MFS root before repo.gc"
284
+ });
285
+ } catch (e) {
286
+ log.error("Skipping repo.gc: failed to flush MFS root beforehand (ipfs/kubo#10842 safeguard)", e);
287
+ return;
288
+ }
280
289
  try {
281
290
  for await (const res of kuboRpc._client.repo.gc({ quiet: true })) if (res.cid) gcCids++;
282
291
  else log.error("Failed to GC ipfs repo due to error", res.err);