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