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
@@ -116,7 +116,7 @@ var NodeFile = class {
116
116
  }
117
117
  path;
118
118
  async getPhysicalIdentity() {
119
- const value = await fsPromises.stat(this.path).catch((error) => {
119
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
120
120
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
121
121
  return void 0;
122
122
  throw error;
@@ -129,7 +129,7 @@ var NodeFile = class {
129
129
  identity;
130
130
  name;
131
131
  async openReader() {
132
- const handle = await fsPromises.open(this.path, "r");
132
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
133
133
  let closed = false;
134
134
  try {
135
135
  const stats = await handle.stat();
@@ -169,7 +169,7 @@ var NodeFile = class {
169
169
  }
170
170
  async getLastModified() {
171
171
  try {
172
- return (await fsPromises.stat(this.path)).mtimeMs;
172
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
173
173
  } catch (error) {
174
174
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
175
175
  return void 0;
@@ -178,9 +178,14 @@ var NodeFile = class {
178
178
  }
179
179
  }
180
180
  async openWriter() {
181
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
181
+ await fsPromises.mkdir(
182
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
183
+ {
184
+ recursive: true
185
+ }
186
+ );
182
187
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
183
- const handle = await fsPromises.open(temporary, "wx");
188
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
184
189
  let closed = false;
185
190
  return {
186
191
  write: async (data) => {
@@ -195,14 +200,17 @@ var NodeFile = class {
195
200
  commit: async () => {
196
201
  if (!closed) {
197
202
  await handle.close();
198
- await fsPromises.rename(temporary, this.path);
203
+ await fsPromises.rename(
204
+ toNodeFilesystemPath(temporary),
205
+ toNodeFilesystemPath(this.path)
206
+ );
199
207
  }
200
208
  closed = true;
201
209
  },
202
210
  abort: async () => {
203
211
  if (!closed) {
204
212
  await handle.close();
205
- await fsPromises.rm(temporary, { force: true });
213
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
206
214
  }
207
215
  closed = true;
208
216
  }
@@ -249,7 +257,7 @@ var NodeDirectory = class _NodeDirectory {
249
257
  }
250
258
  path;
251
259
  async getPhysicalIdentity() {
252
- const value = await fsPromises.stat(this.path).catch((error) => {
260
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
253
261
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
254
262
  return void 0;
255
263
  throw error;
@@ -265,7 +273,7 @@ var NodeDirectory = class _NodeDirectory {
265
273
  assertChildName(name);
266
274
  const file = new NodeFile(pathModule.join(this.path, name));
267
275
  try {
268
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
276
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
269
277
  } catch (error) {
270
278
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
271
279
  return void 0;
@@ -274,7 +282,7 @@ var NodeDirectory = class _NodeDirectory {
274
282
  }
275
283
  async getLastModified() {
276
284
  try {
277
- return (await fsPromises.stat(this.path)).mtimeMs;
285
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
278
286
  } catch (error) {
279
287
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
280
288
  return void 0;
@@ -286,7 +294,7 @@ var NodeDirectory = class _NodeDirectory {
286
294
  assertChildName(name);
287
295
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
288
296
  try {
289
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
297
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
290
298
  } catch (error) {
291
299
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
292
300
  return void 0;
@@ -294,7 +302,7 @@ var NodeDirectory = class _NodeDirectory {
294
302
  }
295
303
  }
296
304
  async list() {
297
- const entries = await fsPromises.readdir(this.path, {
305
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
298
306
  withFileTypes: true
299
307
  });
300
308
  return entries.map(
@@ -303,26 +311,45 @@ var NodeDirectory = class _NodeDirectory {
303
311
  }
304
312
  async createFile(name) {
305
313
  assertChildName(name);
306
- await fsPromises.mkdir(this.path, { recursive: true });
314
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
315
+ recursive: true
316
+ });
307
317
  const file = new NodeFile(pathModule.join(this.path, name));
308
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
318
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
319
+ flag: "wx"
320
+ });
309
321
  return file;
310
322
  }
311
323
  async createDirectory(name) {
312
324
  assertChildName(name);
313
- await fsPromises.mkdir(this.path, { recursive: true });
325
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
326
+ recursive: true
327
+ });
314
328
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
315
- await fsPromises.mkdir(directory.path);
329
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
316
330
  return directory;
317
331
  }
318
332
  async remove(name, options) {
319
333
  assertChildName(name);
320
- await fsPromises.rm(pathModule.join(this.path, name), {
321
- force: true,
322
- recursive: options?.recursive === true
323
- });
334
+ await fsPromises.rm(
335
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
336
+ {
337
+ force: true,
338
+ recursive: options?.recursive === true
339
+ }
340
+ );
324
341
  }
325
342
  };
343
+ function toNodeFilesystemPath(path) {
344
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
345
+ return path;
346
+ }
347
+ const absolute = pathModule.resolve(path);
348
+ if (absolute.startsWith("\\\\")) {
349
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
350
+ }
351
+ return `\\\\?\\${absolute}`;
352
+ }
326
353
  function encodeNodeResourceIdentity(kind, path) {
327
354
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
328
355
  }
@@ -408,10 +435,14 @@ async function openNativeNodeDatabase(file, flags) {
408
435
  throw new TypeError("The Node database adapter requires a NodeFile");
409
436
  }
410
437
  return await new Promise((resolve4, reject) => {
411
- const database = new nodeSqlite3.Database(path, flags, (error) => {
412
- if (error) reject(error);
413
- else resolve4(database);
414
- });
438
+ const database = new nodeSqlite3.Database(
439
+ toNodeFilesystemPath(path),
440
+ flags,
441
+ (error) => {
442
+ if (error) reject(error);
443
+ else resolve4(database);
444
+ }
445
+ );
415
446
  });
416
447
  }
417
448
  async function openNodeZip(file, options = {}) {
@@ -419,7 +450,7 @@ async function openNodeZip(file, options = {}) {
419
450
  if (path === void 0) {
420
451
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
421
452
  }
422
- const handle = await fsPromises.open(path, "r");
453
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
423
454
  let size;
424
455
  try {
425
456
  size = (await handle.stat()).size;
@@ -734,6 +765,11 @@ async function writeNodeZip(file, entries) {
734
765
  }
735
766
  }
736
767
  async function addNodeZipEntries(zipFile, iterator, state) {
768
+ const stableZipOptions = {
769
+ compress: false,
770
+ forceDosTimestamp: true,
771
+ mtime: new Date(1980, 0, 2)
772
+ };
737
773
  while (!state.cancelled) {
738
774
  const result = await iterator.next();
739
775
  if (state.cancelled) return;
@@ -745,17 +781,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
745
781
  zipFile.addReadStream(
746
782
  createNodeFileReadStream(result.value.file),
747
783
  result.value.name,
748
- { compress: false }
784
+ stableZipOptions
749
785
  );
750
786
  } else if ("data" in result.value) {
751
787
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
752
- compress: false
788
+ ...stableZipOptions
753
789
  });
754
790
  } else {
755
791
  zipFile.addReadStream(
756
792
  createNodeRangeReadStream(result.value),
757
793
  result.value.name,
758
- { compress: false, size: result.value.size }
794
+ { ...stableZipOptions, size: result.value.size }
759
795
  );
760
796
  }
761
797
  }