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
@@ -102,7 +102,7 @@ var NodeFile = class {
102
102
  }
103
103
  path;
104
104
  async getPhysicalIdentity() {
105
- const value = await fsPromises.stat(this.path).catch((error) => {
105
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
106
106
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
107
107
  return void 0;
108
108
  throw error;
@@ -115,7 +115,7 @@ var NodeFile = class {
115
115
  identity;
116
116
  name;
117
117
  async openReader() {
118
- const handle = await fsPromises.open(this.path, "r");
118
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
119
119
  let closed = false;
120
120
  try {
121
121
  const stats = await handle.stat();
@@ -155,7 +155,7 @@ var NodeFile = class {
155
155
  }
156
156
  async getLastModified() {
157
157
  try {
158
- return (await fsPromises.stat(this.path)).mtimeMs;
158
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
159
159
  } catch (error) {
160
160
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
161
161
  return void 0;
@@ -164,9 +164,14 @@ var NodeFile = class {
164
164
  }
165
165
  }
166
166
  async openWriter() {
167
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
167
+ await fsPromises.mkdir(
168
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
169
+ {
170
+ recursive: true
171
+ }
172
+ );
168
173
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
169
- const handle = await fsPromises.open(temporary, "wx");
174
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
170
175
  let closed = false;
171
176
  return {
172
177
  write: async (data) => {
@@ -181,14 +186,17 @@ var NodeFile = class {
181
186
  commit: async () => {
182
187
  if (!closed) {
183
188
  await handle.close();
184
- await fsPromises.rename(temporary, this.path);
189
+ await fsPromises.rename(
190
+ toNodeFilesystemPath(temporary),
191
+ toNodeFilesystemPath(this.path)
192
+ );
185
193
  }
186
194
  closed = true;
187
195
  },
188
196
  abort: async () => {
189
197
  if (!closed) {
190
198
  await handle.close();
191
- await fsPromises.rm(temporary, { force: true });
199
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
192
200
  }
193
201
  closed = true;
194
202
  }
@@ -235,7 +243,7 @@ var NodeDirectory = class _NodeDirectory {
235
243
  }
236
244
  path;
237
245
  async getPhysicalIdentity() {
238
- const value = await fsPromises.stat(this.path).catch((error) => {
246
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
239
247
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
240
248
  return void 0;
241
249
  throw error;
@@ -251,7 +259,7 @@ var NodeDirectory = class _NodeDirectory {
251
259
  assertChildName(name);
252
260
  const file = new NodeFile(pathModule.join(this.path, name));
253
261
  try {
254
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
262
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
255
263
  } catch (error) {
256
264
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
257
265
  return void 0;
@@ -260,7 +268,7 @@ var NodeDirectory = class _NodeDirectory {
260
268
  }
261
269
  async getLastModified() {
262
270
  try {
263
- return (await fsPromises.stat(this.path)).mtimeMs;
271
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
264
272
  } catch (error) {
265
273
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
266
274
  return void 0;
@@ -272,7 +280,7 @@ var NodeDirectory = class _NodeDirectory {
272
280
  assertChildName(name);
273
281
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
274
282
  try {
275
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
283
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
276
284
  } catch (error) {
277
285
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
278
286
  return void 0;
@@ -280,7 +288,7 @@ var NodeDirectory = class _NodeDirectory {
280
288
  }
281
289
  }
282
290
  async list() {
283
- const entries = await fsPromises.readdir(this.path, {
291
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
284
292
  withFileTypes: true
285
293
  });
286
294
  return entries.map(
@@ -289,26 +297,45 @@ var NodeDirectory = class _NodeDirectory {
289
297
  }
290
298
  async createFile(name) {
291
299
  assertChildName(name);
292
- await fsPromises.mkdir(this.path, { recursive: true });
300
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
301
+ recursive: true
302
+ });
293
303
  const file = new NodeFile(pathModule.join(this.path, name));
294
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
304
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
305
+ flag: "wx"
306
+ });
295
307
  return file;
296
308
  }
297
309
  async createDirectory(name) {
298
310
  assertChildName(name);
299
- await fsPromises.mkdir(this.path, { recursive: true });
311
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
312
+ recursive: true
313
+ });
300
314
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
301
- await fsPromises.mkdir(directory.path);
315
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
302
316
  return directory;
303
317
  }
304
318
  async remove(name, options) {
305
319
  assertChildName(name);
306
- await fsPromises.rm(pathModule.join(this.path, name), {
307
- force: true,
308
- recursive: options?.recursive === true
309
- });
320
+ await fsPromises.rm(
321
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
322
+ {
323
+ force: true,
324
+ recursive: options?.recursive === true
325
+ }
326
+ );
310
327
  }
311
328
  };
329
+ function toNodeFilesystemPath(path) {
330
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
331
+ return path;
332
+ }
333
+ const absolute = pathModule.resolve(path);
334
+ if (absolute.startsWith("\\\\")) {
335
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
336
+ }
337
+ return `\\\\?\\${absolute}`;
338
+ }
312
339
  function encodeNodeResourceIdentity(kind, path) {
313
340
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
314
341
  }
@@ -386,10 +413,14 @@ async function openNativeNodeDatabase(file, flags) {
386
413
  throw new TypeError("The Node database adapter requires a NodeFile");
387
414
  }
388
415
  return await new Promise((resolve2, reject) => {
389
- const database = new nodeSqlite3.Database(path, flags, (error) => {
390
- if (error) reject(error);
391
- else resolve2(database);
392
- });
416
+ const database = new nodeSqlite3.Database(
417
+ toNodeFilesystemPath(path),
418
+ flags,
419
+ (error) => {
420
+ if (error) reject(error);
421
+ else resolve2(database);
422
+ }
423
+ );
393
424
  });
394
425
  }
395
426
  async function openNodeZip(file, options = {}) {
@@ -397,7 +428,7 @@ async function openNodeZip(file, options = {}) {
397
428
  if (path === void 0) {
398
429
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
399
430
  }
400
- const handle = await fsPromises.open(path, "r");
431
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
401
432
  let size;
402
433
  try {
403
434
  size = (await handle.stat()).size;
@@ -712,6 +743,11 @@ async function writeNodeZip(file, entries) {
712
743
  }
713
744
  }
714
745
  async function addNodeZipEntries(zipFile, iterator, state) {
746
+ const stableZipOptions = {
747
+ compress: false,
748
+ forceDosTimestamp: true,
749
+ mtime: new Date(1980, 0, 2)
750
+ };
715
751
  while (!state.cancelled) {
716
752
  const result = await iterator.next();
717
753
  if (state.cancelled) return;
@@ -723,17 +759,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
723
759
  zipFile.addReadStream(
724
760
  createNodeFileReadStream(result.value.file),
725
761
  result.value.name,
726
- { compress: false }
762
+ stableZipOptions
727
763
  );
728
764
  } else if ("data" in result.value) {
729
765
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
730
- compress: false
766
+ ...stableZipOptions
731
767
  });
732
768
  } else {
733
769
  zipFile.addReadStream(
734
770
  createNodeRangeReadStream(result.value),
735
771
  result.value.name,
736
- { compress: false, size: result.value.size }
772
+ { ...stableZipOptions, size: result.value.size }
737
773
  );
738
774
  }
739
775
  }