wiki-graph-sdk 0.9.4 → 0.9.5

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 (52) hide show
  1. package/dist/archives.cjs +237 -28
  2. package/dist/archives.cjs.map +1 -1
  3. package/dist/archives.d.ts +1 -1
  4. package/dist/archives.js +240 -28
  5. package/dist/archives.js.map +1 -1
  6. package/dist/conversions.cjs +64 -28
  7. package/dist/conversions.cjs.map +1 -1
  8. package/dist/conversions.js +64 -28
  9. package/dist/conversions.js.map +1 -1
  10. package/dist/default-worker.cjs +64 -28
  11. package/dist/default-worker.cjs.map +1 -1
  12. package/dist/default-worker.js +64 -28
  13. package/dist/default-worker.js.map +1 -1
  14. package/dist/embedding.cjs +64 -28
  15. package/dist/embedding.cjs.map +1 -1
  16. package/dist/embedding.js +64 -28
  17. package/dist/embedding.js.map +1 -1
  18. package/dist/gc.cjs +64 -28
  19. package/dist/gc.cjs.map +1 -1
  20. package/dist/gc.js +64 -28
  21. package/dist/gc.js.map +1 -1
  22. package/dist/{index-DQzLAnjf.d.ts → index-4YX4dv6Y.d.ts} +38 -2
  23. package/dist/index.cjs +240 -31
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +243 -31
  27. package/dist/index.js.map +1 -1
  28. package/dist/local-config.cjs +64 -28
  29. package/dist/local-config.cjs.map +1 -1
  30. package/dist/local-config.js +64 -28
  31. package/dist/local-config.js.map +1 -1
  32. package/dist/maintenance.cjs +64 -28
  33. package/dist/maintenance.cjs.map +1 -1
  34. package/dist/maintenance.js +64 -28
  35. package/dist/maintenance.js.map +1 -1
  36. package/dist/node-platform.cjs +64 -28
  37. package/dist/node-platform.cjs.map +1 -1
  38. package/dist/node-platform.js +64 -28
  39. package/dist/node-platform.js.map +1 -1
  40. package/dist/runtime-config.cjs +64 -28
  41. package/dist/runtime-config.cjs.map +1 -1
  42. package/dist/runtime-config.js +64 -28
  43. package/dist/runtime-config.js.map +1 -1
  44. package/dist/stage.cjs +64 -28
  45. package/dist/stage.cjs.map +1 -1
  46. package/dist/stage.js +64 -28
  47. package/dist/stage.js.map +1 -1
  48. package/dist/worker.cjs +64 -28
  49. package/dist/worker.cjs.map +1 -1
  50. package/dist/worker.js +64 -28
  51. package/dist/worker.js.map +1 -1
  52. package/package.json +2 -2
@@ -138,7 +138,7 @@ var NodeFile = class {
138
138
  }
139
139
  path;
140
140
  async getPhysicalIdentity() {
141
- const value = await fsPromises.stat(this.path).catch((error) => {
141
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
142
142
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
143
143
  return void 0;
144
144
  throw error;
@@ -151,7 +151,7 @@ var NodeFile = class {
151
151
  identity;
152
152
  name;
153
153
  async openReader() {
154
- const handle = await fsPromises.open(this.path, "r");
154
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
155
155
  let closed = false;
156
156
  try {
157
157
  const stats = await handle.stat();
@@ -191,7 +191,7 @@ var NodeFile = class {
191
191
  }
192
192
  async getLastModified() {
193
193
  try {
194
- return (await fsPromises.stat(this.path)).mtimeMs;
194
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
195
195
  } catch (error) {
196
196
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
197
197
  return void 0;
@@ -200,9 +200,14 @@ var NodeFile = class {
200
200
  }
201
201
  }
202
202
  async openWriter() {
203
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
203
+ await fsPromises.mkdir(
204
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
205
+ {
206
+ recursive: true
207
+ }
208
+ );
204
209
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
205
- const handle = await fsPromises.open(temporary, "wx");
210
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
206
211
  let closed = false;
207
212
  return {
208
213
  write: async (data) => {
@@ -217,14 +222,17 @@ var NodeFile = class {
217
222
  commit: async () => {
218
223
  if (!closed) {
219
224
  await handle.close();
220
- await fsPromises.rename(temporary, this.path);
225
+ await fsPromises.rename(
226
+ toNodeFilesystemPath(temporary),
227
+ toNodeFilesystemPath(this.path)
228
+ );
221
229
  }
222
230
  closed = true;
223
231
  },
224
232
  abort: async () => {
225
233
  if (!closed) {
226
234
  await handle.close();
227
- await fsPromises.rm(temporary, { force: true });
235
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
228
236
  }
229
237
  closed = true;
230
238
  }
@@ -271,7 +279,7 @@ var NodeDirectory = class _NodeDirectory {
271
279
  }
272
280
  path;
273
281
  async getPhysicalIdentity() {
274
- const value = await fsPromises.stat(this.path).catch((error) => {
282
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
275
283
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
276
284
  return void 0;
277
285
  throw error;
@@ -287,7 +295,7 @@ var NodeDirectory = class _NodeDirectory {
287
295
  assertChildName(name);
288
296
  const file = new NodeFile(pathModule.join(this.path, name));
289
297
  try {
290
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
298
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
291
299
  } catch (error) {
292
300
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
293
301
  return void 0;
@@ -296,7 +304,7 @@ var NodeDirectory = class _NodeDirectory {
296
304
  }
297
305
  async getLastModified() {
298
306
  try {
299
- return (await fsPromises.stat(this.path)).mtimeMs;
307
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
300
308
  } catch (error) {
301
309
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
302
310
  return void 0;
@@ -308,7 +316,7 @@ var NodeDirectory = class _NodeDirectory {
308
316
  assertChildName(name);
309
317
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
310
318
  try {
311
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
319
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
312
320
  } catch (error) {
313
321
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
314
322
  return void 0;
@@ -316,7 +324,7 @@ var NodeDirectory = class _NodeDirectory {
316
324
  }
317
325
  }
318
326
  async list() {
319
- const entries = await fsPromises.readdir(this.path, {
327
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
320
328
  withFileTypes: true
321
329
  });
322
330
  return entries.map(
@@ -325,26 +333,45 @@ var NodeDirectory = class _NodeDirectory {
325
333
  }
326
334
  async createFile(name) {
327
335
  assertChildName(name);
328
- await fsPromises.mkdir(this.path, { recursive: true });
336
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
337
+ recursive: true
338
+ });
329
339
  const file = new NodeFile(pathModule.join(this.path, name));
330
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
340
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
341
+ flag: "wx"
342
+ });
331
343
  return file;
332
344
  }
333
345
  async createDirectory(name) {
334
346
  assertChildName(name);
335
- await fsPromises.mkdir(this.path, { recursive: true });
347
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
348
+ recursive: true
349
+ });
336
350
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
337
- await fsPromises.mkdir(directory.path);
351
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
338
352
  return directory;
339
353
  }
340
354
  async remove(name, options) {
341
355
  assertChildName(name);
342
- await fsPromises.rm(pathModule.join(this.path, name), {
343
- force: true,
344
- recursive: options?.recursive === true
345
- });
356
+ await fsPromises.rm(
357
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
358
+ {
359
+ force: true,
360
+ recursive: options?.recursive === true
361
+ }
362
+ );
346
363
  }
347
364
  };
365
+ function toNodeFilesystemPath(path) {
366
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
367
+ return path;
368
+ }
369
+ const absolute = pathModule.resolve(path);
370
+ if (absolute.startsWith("\\\\")) {
371
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
372
+ }
373
+ return `\\\\?\\${absolute}`;
374
+ }
348
375
  function encodeNodeResourceIdentity(kind, path) {
349
376
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
350
377
  }
@@ -430,10 +457,14 @@ async function openNativeNodeDatabase(file, flags) {
430
457
  throw new TypeError("The Node database adapter requires a NodeFile");
431
458
  }
432
459
  return await new Promise((resolve4, reject) => {
433
- const database = new nodeSqlite3.Database(path, flags, (error) => {
434
- if (error) reject(error);
435
- else resolve4(database);
436
- });
460
+ const database = new nodeSqlite3.Database(
461
+ toNodeFilesystemPath(path),
462
+ flags,
463
+ (error) => {
464
+ if (error) reject(error);
465
+ else resolve4(database);
466
+ }
467
+ );
437
468
  });
438
469
  }
439
470
  async function openNodeZip(file, options = {}) {
@@ -441,7 +472,7 @@ async function openNodeZip(file, options = {}) {
441
472
  if (path === void 0) {
442
473
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
443
474
  }
444
- const handle = await fsPromises.open(path, "r");
475
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
445
476
  let size;
446
477
  try {
447
478
  size = (await handle.stat()).size;
@@ -756,6 +787,11 @@ async function writeNodeZip(file, entries) {
756
787
  }
757
788
  }
758
789
  async function addNodeZipEntries(zipFile, iterator, state) {
790
+ const stableZipOptions = {
791
+ compress: false,
792
+ forceDosTimestamp: true,
793
+ mtime: new Date(1980, 0, 2)
794
+ };
759
795
  while (!state.cancelled) {
760
796
  const result = await iterator.next();
761
797
  if (state.cancelled) return;
@@ -767,17 +803,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
767
803
  zipFile.addReadStream(
768
804
  createNodeFileReadStream(result.value.file),
769
805
  result.value.name,
770
- { compress: false }
806
+ stableZipOptions
771
807
  );
772
808
  } else if ("data" in result.value) {
773
809
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
774
- compress: false
810
+ ...stableZipOptions
775
811
  });
776
812
  } else {
777
813
  zipFile.addReadStream(
778
814
  createNodeRangeReadStream(result.value),
779
815
  result.value.name,
780
- { compress: false, size: result.value.size }
816
+ { ...stableZipOptions, size: result.value.size }
781
817
  );
782
818
  }
783
819
  }