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
package/dist/worker.cjs CHANGED
@@ -68,7 +68,7 @@ var NodeFile = class {
68
68
  }
69
69
  path;
70
70
  async getPhysicalIdentity() {
71
- const value = await fsPromises.stat(this.path).catch((error) => {
71
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
72
72
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
73
73
  return void 0;
74
74
  throw error;
@@ -81,7 +81,7 @@ var NodeFile = class {
81
81
  identity;
82
82
  name;
83
83
  async openReader() {
84
- const handle = await fsPromises.open(this.path, "r");
84
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
85
85
  let closed = false;
86
86
  try {
87
87
  const stats = await handle.stat();
@@ -121,7 +121,7 @@ var NodeFile = class {
121
121
  }
122
122
  async getLastModified() {
123
123
  try {
124
- return (await fsPromises.stat(this.path)).mtimeMs;
124
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
125
125
  } catch (error) {
126
126
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
127
127
  return void 0;
@@ -130,9 +130,14 @@ var NodeFile = class {
130
130
  }
131
131
  }
132
132
  async openWriter() {
133
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
133
+ await fsPromises.mkdir(
134
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
135
+ {
136
+ recursive: true
137
+ }
138
+ );
134
139
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
135
- const handle = await fsPromises.open(temporary, "wx");
140
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
136
141
  let closed = false;
137
142
  return {
138
143
  write: async (data) => {
@@ -147,14 +152,17 @@ var NodeFile = class {
147
152
  commit: async () => {
148
153
  if (!closed) {
149
154
  await handle.close();
150
- await fsPromises.rename(temporary, this.path);
155
+ await fsPromises.rename(
156
+ toNodeFilesystemPath(temporary),
157
+ toNodeFilesystemPath(this.path)
158
+ );
151
159
  }
152
160
  closed = true;
153
161
  },
154
162
  abort: async () => {
155
163
  if (!closed) {
156
164
  await handle.close();
157
- await fsPromises.rm(temporary, { force: true });
165
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
158
166
  }
159
167
  closed = true;
160
168
  }
@@ -201,7 +209,7 @@ var NodeDirectory = class _NodeDirectory {
201
209
  }
202
210
  path;
203
211
  async getPhysicalIdentity() {
204
- const value = await fsPromises.stat(this.path).catch((error) => {
212
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
205
213
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
206
214
  return void 0;
207
215
  throw error;
@@ -217,7 +225,7 @@ var NodeDirectory = class _NodeDirectory {
217
225
  assertChildName(name);
218
226
  const file = new NodeFile(pathModule.join(this.path, name));
219
227
  try {
220
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
228
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
221
229
  } catch (error) {
222
230
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
223
231
  return void 0;
@@ -226,7 +234,7 @@ var NodeDirectory = class _NodeDirectory {
226
234
  }
227
235
  async getLastModified() {
228
236
  try {
229
- return (await fsPromises.stat(this.path)).mtimeMs;
237
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
230
238
  } catch (error) {
231
239
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
232
240
  return void 0;
@@ -238,7 +246,7 @@ var NodeDirectory = class _NodeDirectory {
238
246
  assertChildName(name);
239
247
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
240
248
  try {
241
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
249
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
242
250
  } catch (error) {
243
251
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
244
252
  return void 0;
@@ -246,7 +254,7 @@ var NodeDirectory = class _NodeDirectory {
246
254
  }
247
255
  }
248
256
  async list() {
249
- const entries = await fsPromises.readdir(this.path, {
257
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
250
258
  withFileTypes: true
251
259
  });
252
260
  return entries.map(
@@ -255,26 +263,45 @@ var NodeDirectory = class _NodeDirectory {
255
263
  }
256
264
  async createFile(name) {
257
265
  assertChildName(name);
258
- await fsPromises.mkdir(this.path, { recursive: true });
266
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
267
+ recursive: true
268
+ });
259
269
  const file = new NodeFile(pathModule.join(this.path, name));
260
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
270
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
271
+ flag: "wx"
272
+ });
261
273
  return file;
262
274
  }
263
275
  async createDirectory(name) {
264
276
  assertChildName(name);
265
- await fsPromises.mkdir(this.path, { recursive: true });
277
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
278
+ recursive: true
279
+ });
266
280
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
267
- await fsPromises.mkdir(directory.path);
281
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
268
282
  return directory;
269
283
  }
270
284
  async remove(name, options) {
271
285
  assertChildName(name);
272
- await fsPromises.rm(pathModule.join(this.path, name), {
273
- force: true,
274
- recursive: options?.recursive === true
275
- });
286
+ await fsPromises.rm(
287
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
288
+ {
289
+ force: true,
290
+ recursive: options?.recursive === true
291
+ }
292
+ );
276
293
  }
277
294
  };
295
+ function toNodeFilesystemPath(path) {
296
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
297
+ return path;
298
+ }
299
+ const absolute = pathModule.resolve(path);
300
+ if (absolute.startsWith("\\\\")) {
301
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
302
+ }
303
+ return `\\\\?\\${absolute}`;
304
+ }
278
305
  function encodeNodeResourceIdentity(kind, path) {
279
306
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
280
307
  }
@@ -360,10 +387,14 @@ async function openNativeNodeDatabase(file, flags) {
360
387
  throw new TypeError("The Node database adapter requires a NodeFile");
361
388
  }
362
389
  return await new Promise((resolve4, reject) => {
363
- const database = new nodeSqlite3.Database(path, flags, (error) => {
364
- if (error) reject(error);
365
- else resolve4(database);
366
- });
390
+ const database = new nodeSqlite3.Database(
391
+ toNodeFilesystemPath(path),
392
+ flags,
393
+ (error) => {
394
+ if (error) reject(error);
395
+ else resolve4(database);
396
+ }
397
+ );
367
398
  });
368
399
  }
369
400
  async function openNodeZip(file, options = {}) {
@@ -371,7 +402,7 @@ async function openNodeZip(file, options = {}) {
371
402
  if (path === void 0) {
372
403
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
373
404
  }
374
- const handle = await fsPromises.open(path, "r");
405
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
375
406
  let size;
376
407
  try {
377
408
  size = (await handle.stat()).size;
@@ -686,6 +717,11 @@ async function writeNodeZip(file, entries) {
686
717
  }
687
718
  }
688
719
  async function addNodeZipEntries(zipFile, iterator, state) {
720
+ const stableZipOptions = {
721
+ compress: false,
722
+ forceDosTimestamp: true,
723
+ mtime: new Date(1980, 0, 2)
724
+ };
689
725
  while (!state.cancelled) {
690
726
  const result = await iterator.next();
691
727
  if (state.cancelled) return;
@@ -697,17 +733,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
697
733
  zipFile.addReadStream(
698
734
  createNodeFileReadStream(result.value.file),
699
735
  result.value.name,
700
- { compress: false }
736
+ stableZipOptions
701
737
  );
702
738
  } else if ("data" in result.value) {
703
739
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
704
- compress: false
740
+ ...stableZipOptions
705
741
  });
706
742
  } else {
707
743
  zipFile.addReadStream(
708
744
  createNodeRangeReadStream(result.value),
709
745
  result.value.name,
710
- { compress: false, size: result.value.size }
746
+ { ...stableZipOptions, size: result.value.size }
711
747
  );
712
748
  }
713
749
  }