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
@@ -97,7 +97,7 @@ var NodeFile = class {
97
97
  }
98
98
  path;
99
99
  async getPhysicalIdentity() {
100
- const value = await fsPromises.stat(this.path).catch((error) => {
100
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
101
101
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
102
102
  return void 0;
103
103
  throw error;
@@ -110,7 +110,7 @@ var NodeFile = class {
110
110
  identity;
111
111
  name;
112
112
  async openReader() {
113
- const handle = await fsPromises.open(this.path, "r");
113
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
114
114
  let closed = false;
115
115
  try {
116
116
  const stats = await handle.stat();
@@ -150,7 +150,7 @@ var NodeFile = class {
150
150
  }
151
151
  async getLastModified() {
152
152
  try {
153
- return (await fsPromises.stat(this.path)).mtimeMs;
153
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
154
154
  } catch (error) {
155
155
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
156
156
  return void 0;
@@ -159,9 +159,14 @@ var NodeFile = class {
159
159
  }
160
160
  }
161
161
  async openWriter() {
162
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
162
+ await fsPromises.mkdir(
163
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
164
+ {
165
+ recursive: true
166
+ }
167
+ );
163
168
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
164
- const handle = await fsPromises.open(temporary, "wx");
169
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
165
170
  let closed = false;
166
171
  return {
167
172
  write: async (data) => {
@@ -176,14 +181,17 @@ var NodeFile = class {
176
181
  commit: async () => {
177
182
  if (!closed) {
178
183
  await handle.close();
179
- await fsPromises.rename(temporary, this.path);
184
+ await fsPromises.rename(
185
+ toNodeFilesystemPath(temporary),
186
+ toNodeFilesystemPath(this.path)
187
+ );
180
188
  }
181
189
  closed = true;
182
190
  },
183
191
  abort: async () => {
184
192
  if (!closed) {
185
193
  await handle.close();
186
- await fsPromises.rm(temporary, { force: true });
194
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
187
195
  }
188
196
  closed = true;
189
197
  }
@@ -230,7 +238,7 @@ var NodeDirectory = class _NodeDirectory {
230
238
  }
231
239
  path;
232
240
  async getPhysicalIdentity() {
233
- const value = await fsPromises.stat(this.path).catch((error) => {
241
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
234
242
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
235
243
  return void 0;
236
244
  throw error;
@@ -246,7 +254,7 @@ var NodeDirectory = class _NodeDirectory {
246
254
  assertChildName(name);
247
255
  const file = new NodeFile(pathModule.join(this.path, name));
248
256
  try {
249
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
257
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
250
258
  } catch (error) {
251
259
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
252
260
  return void 0;
@@ -255,7 +263,7 @@ var NodeDirectory = class _NodeDirectory {
255
263
  }
256
264
  async getLastModified() {
257
265
  try {
258
- return (await fsPromises.stat(this.path)).mtimeMs;
266
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
259
267
  } catch (error) {
260
268
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
261
269
  return void 0;
@@ -267,7 +275,7 @@ var NodeDirectory = class _NodeDirectory {
267
275
  assertChildName(name);
268
276
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
269
277
  try {
270
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
278
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
271
279
  } catch (error) {
272
280
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
273
281
  return void 0;
@@ -275,7 +283,7 @@ var NodeDirectory = class _NodeDirectory {
275
283
  }
276
284
  }
277
285
  async list() {
278
- const entries = await fsPromises.readdir(this.path, {
286
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
279
287
  withFileTypes: true
280
288
  });
281
289
  return entries.map(
@@ -284,26 +292,45 @@ var NodeDirectory = class _NodeDirectory {
284
292
  }
285
293
  async createFile(name) {
286
294
  assertChildName(name);
287
- await fsPromises.mkdir(this.path, { recursive: true });
295
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
296
+ recursive: true
297
+ });
288
298
  const file = new NodeFile(pathModule.join(this.path, name));
289
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
299
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
300
+ flag: "wx"
301
+ });
290
302
  return file;
291
303
  }
292
304
  async createDirectory(name) {
293
305
  assertChildName(name);
294
- await fsPromises.mkdir(this.path, { recursive: true });
306
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
307
+ recursive: true
308
+ });
295
309
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
296
- await fsPromises.mkdir(directory.path);
310
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
297
311
  return directory;
298
312
  }
299
313
  async remove(name, options) {
300
314
  assertChildName(name);
301
- await fsPromises.rm(pathModule.join(this.path, name), {
302
- force: true,
303
- recursive: options?.recursive === true
304
- });
315
+ await fsPromises.rm(
316
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
317
+ {
318
+ force: true,
319
+ recursive: options?.recursive === true
320
+ }
321
+ );
305
322
  }
306
323
  };
324
+ function toNodeFilesystemPath(path) {
325
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
326
+ return path;
327
+ }
328
+ const absolute = pathModule.resolve(path);
329
+ if (absolute.startsWith("\\\\")) {
330
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
331
+ }
332
+ return `\\\\?\\${absolute}`;
333
+ }
307
334
  function encodeNodeResourceIdentity(kind, path) {
308
335
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
309
336
  }
@@ -389,10 +416,14 @@ async function openNativeNodeDatabase(file, flags) {
389
416
  throw new TypeError("The Node database adapter requires a NodeFile");
390
417
  }
391
418
  return await new Promise((resolve4, reject) => {
392
- const database = new nodeSqlite3.Database(path, flags, (error) => {
393
- if (error) reject(error);
394
- else resolve4(database);
395
- });
419
+ const database = new nodeSqlite3.Database(
420
+ toNodeFilesystemPath(path),
421
+ flags,
422
+ (error) => {
423
+ if (error) reject(error);
424
+ else resolve4(database);
425
+ }
426
+ );
396
427
  });
397
428
  }
398
429
  async function openNodeZip(file, options = {}) {
@@ -400,7 +431,7 @@ async function openNodeZip(file, options = {}) {
400
431
  if (path === void 0) {
401
432
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
402
433
  }
403
- const handle = await fsPromises.open(path, "r");
434
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
404
435
  let size;
405
436
  try {
406
437
  size = (await handle.stat()).size;
@@ -715,6 +746,11 @@ async function writeNodeZip(file, entries) {
715
746
  }
716
747
  }
717
748
  async function addNodeZipEntries(zipFile, iterator, state) {
749
+ const stableZipOptions = {
750
+ compress: false,
751
+ forceDosTimestamp: true,
752
+ mtime: new Date(1980, 0, 2)
753
+ };
718
754
  while (!state.cancelled) {
719
755
  const result = await iterator.next();
720
756
  if (state.cancelled) return;
@@ -726,17 +762,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
726
762
  zipFile.addReadStream(
727
763
  createNodeFileReadStream(result.value.file),
728
764
  result.value.name,
729
- { compress: false }
765
+ stableZipOptions
730
766
  );
731
767
  } else if ("data" in result.value) {
732
768
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
733
- compress: false
769
+ ...stableZipOptions
734
770
  });
735
771
  } else {
736
772
  zipFile.addReadStream(
737
773
  createNodeRangeReadStream(result.value),
738
774
  result.value.name,
739
- { compress: false, size: result.value.size }
775
+ { ...stableZipOptions, size: result.value.size }
740
776
  );
741
777
  }
742
778
  }