wiki-graph-sdk 0.9.3 → 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 +241 -29
  2. package/dist/archives.cjs.map +1 -1
  3. package/dist/archives.d.ts +1 -1
  4. package/dist/archives.js +245 -29
  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 +244 -32
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +248 -32
  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
@@ -110,7 +110,7 @@ var NodeFile = class {
110
110
  }
111
111
  path;
112
112
  async getPhysicalIdentity() {
113
- const value = await fsPromises.stat(this.path).catch((error) => {
113
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
114
114
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
115
115
  return void 0;
116
116
  throw error;
@@ -123,7 +123,7 @@ var NodeFile = class {
123
123
  identity;
124
124
  name;
125
125
  async openReader() {
126
- const handle = await fsPromises.open(this.path, "r");
126
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
127
127
  let closed = false;
128
128
  try {
129
129
  const stats = await handle.stat();
@@ -163,7 +163,7 @@ var NodeFile = class {
163
163
  }
164
164
  async getLastModified() {
165
165
  try {
166
- return (await fsPromises.stat(this.path)).mtimeMs;
166
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
167
167
  } catch (error) {
168
168
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
169
169
  return void 0;
@@ -172,9 +172,14 @@ var NodeFile = class {
172
172
  }
173
173
  }
174
174
  async openWriter() {
175
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
175
+ await fsPromises.mkdir(
176
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
177
+ {
178
+ recursive: true
179
+ }
180
+ );
176
181
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
177
- const handle = await fsPromises.open(temporary, "wx");
182
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
178
183
  let closed = false;
179
184
  return {
180
185
  write: async (data) => {
@@ -189,14 +194,17 @@ var NodeFile = class {
189
194
  commit: async () => {
190
195
  if (!closed) {
191
196
  await handle.close();
192
- await fsPromises.rename(temporary, this.path);
197
+ await fsPromises.rename(
198
+ toNodeFilesystemPath(temporary),
199
+ toNodeFilesystemPath(this.path)
200
+ );
193
201
  }
194
202
  closed = true;
195
203
  },
196
204
  abort: async () => {
197
205
  if (!closed) {
198
206
  await handle.close();
199
- await fsPromises.rm(temporary, { force: true });
207
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
200
208
  }
201
209
  closed = true;
202
210
  }
@@ -243,7 +251,7 @@ var NodeDirectory = class _NodeDirectory {
243
251
  }
244
252
  path;
245
253
  async getPhysicalIdentity() {
246
- const value = await fsPromises.stat(this.path).catch((error) => {
254
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
247
255
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
248
256
  return void 0;
249
257
  throw error;
@@ -259,7 +267,7 @@ var NodeDirectory = class _NodeDirectory {
259
267
  assertChildName(name);
260
268
  const file = new NodeFile(pathModule.join(this.path, name));
261
269
  try {
262
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
270
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
263
271
  } catch (error) {
264
272
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
265
273
  return void 0;
@@ -268,7 +276,7 @@ var NodeDirectory = class _NodeDirectory {
268
276
  }
269
277
  async getLastModified() {
270
278
  try {
271
- return (await fsPromises.stat(this.path)).mtimeMs;
279
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
272
280
  } catch (error) {
273
281
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
274
282
  return void 0;
@@ -280,7 +288,7 @@ var NodeDirectory = class _NodeDirectory {
280
288
  assertChildName(name);
281
289
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
282
290
  try {
283
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
291
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
284
292
  } catch (error) {
285
293
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
286
294
  return void 0;
@@ -288,7 +296,7 @@ var NodeDirectory = class _NodeDirectory {
288
296
  }
289
297
  }
290
298
  async list() {
291
- const entries = await fsPromises.readdir(this.path, {
299
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
292
300
  withFileTypes: true
293
301
  });
294
302
  return entries.map(
@@ -297,26 +305,45 @@ var NodeDirectory = class _NodeDirectory {
297
305
  }
298
306
  async createFile(name) {
299
307
  assertChildName(name);
300
- await fsPromises.mkdir(this.path, { recursive: true });
308
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
309
+ recursive: true
310
+ });
301
311
  const file = new NodeFile(pathModule.join(this.path, name));
302
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
312
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
313
+ flag: "wx"
314
+ });
303
315
  return file;
304
316
  }
305
317
  async createDirectory(name) {
306
318
  assertChildName(name);
307
- await fsPromises.mkdir(this.path, { recursive: true });
319
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
320
+ recursive: true
321
+ });
308
322
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
309
- await fsPromises.mkdir(directory.path);
323
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
310
324
  return directory;
311
325
  }
312
326
  async remove(name, options) {
313
327
  assertChildName(name);
314
- await fsPromises.rm(pathModule.join(this.path, name), {
315
- force: true,
316
- recursive: options?.recursive === true
317
- });
328
+ await fsPromises.rm(
329
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
330
+ {
331
+ force: true,
332
+ recursive: options?.recursive === true
333
+ }
334
+ );
318
335
  }
319
336
  };
337
+ function toNodeFilesystemPath(path) {
338
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
339
+ return path;
340
+ }
341
+ const absolute = pathModule.resolve(path);
342
+ if (absolute.startsWith("\\\\")) {
343
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
344
+ }
345
+ return `\\\\?\\${absolute}`;
346
+ }
320
347
  function encodeNodeResourceIdentity(kind, path) {
321
348
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
322
349
  }
@@ -402,10 +429,14 @@ async function openNativeNodeDatabase(file, flags) {
402
429
  throw new TypeError("The Node database adapter requires a NodeFile");
403
430
  }
404
431
  return await new Promise((resolve4, reject) => {
405
- const database = new nodeSqlite3.Database(path, flags, (error) => {
406
- if (error) reject(error);
407
- else resolve4(database);
408
- });
432
+ const database = new nodeSqlite3.Database(
433
+ toNodeFilesystemPath(path),
434
+ flags,
435
+ (error) => {
436
+ if (error) reject(error);
437
+ else resolve4(database);
438
+ }
439
+ );
409
440
  });
410
441
  }
411
442
  async function openNodeZip(file, options = {}) {
@@ -413,7 +444,7 @@ async function openNodeZip(file, options = {}) {
413
444
  if (path === void 0) {
414
445
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
415
446
  }
416
- const handle = await fsPromises.open(path, "r");
447
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
417
448
  let size;
418
449
  try {
419
450
  size = (await handle.stat()).size;
@@ -728,6 +759,11 @@ async function writeNodeZip(file, entries) {
728
759
  }
729
760
  }
730
761
  async function addNodeZipEntries(zipFile, iterator, state) {
762
+ const stableZipOptions = {
763
+ compress: false,
764
+ forceDosTimestamp: true,
765
+ mtime: new Date(1980, 0, 2)
766
+ };
731
767
  while (!state.cancelled) {
732
768
  const result = await iterator.next();
733
769
  if (state.cancelled) return;
@@ -739,17 +775,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
739
775
  zipFile.addReadStream(
740
776
  createNodeFileReadStream(result.value.file),
741
777
  result.value.name,
742
- { compress: false }
778
+ stableZipOptions
743
779
  );
744
780
  } else if ("data" in result.value) {
745
781
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
746
- compress: false
782
+ ...stableZipOptions
747
783
  });
748
784
  } else {
749
785
  zipFile.addReadStream(
750
786
  createNodeRangeReadStream(result.value),
751
787
  result.value.name,
752
- { compress: false, size: result.value.size }
788
+ { ...stableZipOptions, size: result.value.size }
753
789
  );
754
790
  }
755
791
  }