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
package/dist/stage.js CHANGED
@@ -86,7 +86,7 @@ var NodeFile = class {
86
86
  }
87
87
  path;
88
88
  async getPhysicalIdentity() {
89
- const value = await fsPromises.stat(this.path).catch((error) => {
89
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
90
90
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
91
91
  return void 0;
92
92
  throw error;
@@ -99,7 +99,7 @@ var NodeFile = class {
99
99
  identity;
100
100
  name;
101
101
  async openReader() {
102
- const handle = await fsPromises.open(this.path, "r");
102
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
103
103
  let closed = false;
104
104
  try {
105
105
  const stats = await handle.stat();
@@ -139,7 +139,7 @@ var NodeFile = class {
139
139
  }
140
140
  async getLastModified() {
141
141
  try {
142
- return (await fsPromises.stat(this.path)).mtimeMs;
142
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
143
143
  } catch (error) {
144
144
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
145
145
  return void 0;
@@ -148,9 +148,14 @@ var NodeFile = class {
148
148
  }
149
149
  }
150
150
  async openWriter() {
151
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
151
+ await fsPromises.mkdir(
152
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
153
+ {
154
+ recursive: true
155
+ }
156
+ );
152
157
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
153
- const handle = await fsPromises.open(temporary, "wx");
158
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
154
159
  let closed = false;
155
160
  return {
156
161
  write: async (data) => {
@@ -165,14 +170,17 @@ var NodeFile = class {
165
170
  commit: async () => {
166
171
  if (!closed) {
167
172
  await handle.close();
168
- await fsPromises.rename(temporary, this.path);
173
+ await fsPromises.rename(
174
+ toNodeFilesystemPath(temporary),
175
+ toNodeFilesystemPath(this.path)
176
+ );
169
177
  }
170
178
  closed = true;
171
179
  },
172
180
  abort: async () => {
173
181
  if (!closed) {
174
182
  await handle.close();
175
- await fsPromises.rm(temporary, { force: true });
183
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
176
184
  }
177
185
  closed = true;
178
186
  }
@@ -219,7 +227,7 @@ var NodeDirectory = class _NodeDirectory {
219
227
  }
220
228
  path;
221
229
  async getPhysicalIdentity() {
222
- const value = await fsPromises.stat(this.path).catch((error) => {
230
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
223
231
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
224
232
  return void 0;
225
233
  throw error;
@@ -235,7 +243,7 @@ var NodeDirectory = class _NodeDirectory {
235
243
  assertChildName(name);
236
244
  const file = new NodeFile(pathModule.join(this.path, name));
237
245
  try {
238
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
246
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
239
247
  } catch (error) {
240
248
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
241
249
  return void 0;
@@ -244,7 +252,7 @@ var NodeDirectory = class _NodeDirectory {
244
252
  }
245
253
  async getLastModified() {
246
254
  try {
247
- return (await fsPromises.stat(this.path)).mtimeMs;
255
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
248
256
  } catch (error) {
249
257
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
250
258
  return void 0;
@@ -256,7 +264,7 @@ var NodeDirectory = class _NodeDirectory {
256
264
  assertChildName(name);
257
265
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
258
266
  try {
259
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
267
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
260
268
  } catch (error) {
261
269
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
262
270
  return void 0;
@@ -264,7 +272,7 @@ var NodeDirectory = class _NodeDirectory {
264
272
  }
265
273
  }
266
274
  async list() {
267
- const entries = await fsPromises.readdir(this.path, {
275
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
268
276
  withFileTypes: true
269
277
  });
270
278
  return entries.map(
@@ -273,26 +281,45 @@ var NodeDirectory = class _NodeDirectory {
273
281
  }
274
282
  async createFile(name) {
275
283
  assertChildName(name);
276
- await fsPromises.mkdir(this.path, { recursive: true });
284
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
285
+ recursive: true
286
+ });
277
287
  const file = new NodeFile(pathModule.join(this.path, name));
278
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
288
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
289
+ flag: "wx"
290
+ });
279
291
  return file;
280
292
  }
281
293
  async createDirectory(name) {
282
294
  assertChildName(name);
283
- await fsPromises.mkdir(this.path, { recursive: true });
295
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
296
+ recursive: true
297
+ });
284
298
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
285
- await fsPromises.mkdir(directory.path);
299
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
286
300
  return directory;
287
301
  }
288
302
  async remove(name, options) {
289
303
  assertChildName(name);
290
- await fsPromises.rm(pathModule.join(this.path, name), {
291
- force: true,
292
- recursive: options?.recursive === true
293
- });
304
+ await fsPromises.rm(
305
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
306
+ {
307
+ force: true,
308
+ recursive: options?.recursive === true
309
+ }
310
+ );
294
311
  }
295
312
  };
313
+ function toNodeFilesystemPath(path) {
314
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
315
+ return path;
316
+ }
317
+ const absolute = pathModule.resolve(path);
318
+ if (absolute.startsWith("\\\\")) {
319
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
320
+ }
321
+ return `\\\\?\\${absolute}`;
322
+ }
296
323
  function encodeNodeResourceIdentity(kind, path) {
297
324
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
298
325
  }
@@ -370,10 +397,14 @@ async function openNativeNodeDatabase(file, flags) {
370
397
  throw new TypeError("The Node database adapter requires a NodeFile");
371
398
  }
372
399
  return await new Promise((resolve2, reject) => {
373
- const database = new nodeSqlite3.Database(path, flags, (error) => {
374
- if (error) reject(error);
375
- else resolve2(database);
376
- });
400
+ const database = new nodeSqlite3.Database(
401
+ toNodeFilesystemPath(path),
402
+ flags,
403
+ (error) => {
404
+ if (error) reject(error);
405
+ else resolve2(database);
406
+ }
407
+ );
377
408
  });
378
409
  }
379
410
  async function openNodeZip(file, options = {}) {
@@ -381,7 +412,7 @@ async function openNodeZip(file, options = {}) {
381
412
  if (path === void 0) {
382
413
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
383
414
  }
384
- const handle = await fsPromises.open(path, "r");
415
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
385
416
  let size;
386
417
  try {
387
418
  size = (await handle.stat()).size;
@@ -696,6 +727,11 @@ async function writeNodeZip(file, entries) {
696
727
  }
697
728
  }
698
729
  async function addNodeZipEntries(zipFile, iterator, state) {
730
+ const stableZipOptions = {
731
+ compress: false,
732
+ forceDosTimestamp: true,
733
+ mtime: new Date(1980, 0, 2)
734
+ };
699
735
  while (!state.cancelled) {
700
736
  const result = await iterator.next();
701
737
  if (state.cancelled) return;
@@ -707,17 +743,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
707
743
  zipFile.addReadStream(
708
744
  createNodeFileReadStream(result.value.file),
709
745
  result.value.name,
710
- { compress: false }
746
+ stableZipOptions
711
747
  );
712
748
  } else if ("data" in result.value) {
713
749
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
714
- compress: false
750
+ ...stableZipOptions
715
751
  });
716
752
  } else {
717
753
  zipFile.addReadStream(
718
754
  createNodeRangeReadStream(result.value),
719
755
  result.value.name,
720
- { compress: false, size: result.value.size }
756
+ { ...stableZipOptions, size: result.value.size }
721
757
  );
722
758
  }
723
759
  }