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/embedding.js CHANGED
@@ -75,7 +75,7 @@ var NodeFile = class {
75
75
  }
76
76
  path;
77
77
  async getPhysicalIdentity() {
78
- const value = await fsPromises.stat(this.path).catch((error) => {
78
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
79
79
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
80
80
  return void 0;
81
81
  throw error;
@@ -88,7 +88,7 @@ var NodeFile = class {
88
88
  identity;
89
89
  name;
90
90
  async openReader() {
91
- const handle = await fsPromises.open(this.path, "r");
91
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
92
92
  let closed = false;
93
93
  try {
94
94
  const stats = await handle.stat();
@@ -128,7 +128,7 @@ var NodeFile = class {
128
128
  }
129
129
  async getLastModified() {
130
130
  try {
131
- return (await fsPromises.stat(this.path)).mtimeMs;
131
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
132
132
  } catch (error) {
133
133
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
134
134
  return void 0;
@@ -137,9 +137,14 @@ var NodeFile = class {
137
137
  }
138
138
  }
139
139
  async openWriter() {
140
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
140
+ await fsPromises.mkdir(
141
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
142
+ {
143
+ recursive: true
144
+ }
145
+ );
141
146
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
142
- const handle = await fsPromises.open(temporary, "wx");
147
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
143
148
  let closed = false;
144
149
  return {
145
150
  write: async (data) => {
@@ -154,14 +159,17 @@ var NodeFile = class {
154
159
  commit: async () => {
155
160
  if (!closed) {
156
161
  await handle.close();
157
- await fsPromises.rename(temporary, this.path);
162
+ await fsPromises.rename(
163
+ toNodeFilesystemPath(temporary),
164
+ toNodeFilesystemPath(this.path)
165
+ );
158
166
  }
159
167
  closed = true;
160
168
  },
161
169
  abort: async () => {
162
170
  if (!closed) {
163
171
  await handle.close();
164
- await fsPromises.rm(temporary, { force: true });
172
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
165
173
  }
166
174
  closed = true;
167
175
  }
@@ -208,7 +216,7 @@ var NodeDirectory = class _NodeDirectory {
208
216
  }
209
217
  path;
210
218
  async getPhysicalIdentity() {
211
- const value = await fsPromises.stat(this.path).catch((error) => {
219
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
212
220
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
213
221
  return void 0;
214
222
  throw error;
@@ -224,7 +232,7 @@ var NodeDirectory = class _NodeDirectory {
224
232
  assertChildName(name);
225
233
  const file = new NodeFile(pathModule.join(this.path, name));
226
234
  try {
227
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
235
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
228
236
  } catch (error) {
229
237
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
230
238
  return void 0;
@@ -233,7 +241,7 @@ var NodeDirectory = class _NodeDirectory {
233
241
  }
234
242
  async getLastModified() {
235
243
  try {
236
- return (await fsPromises.stat(this.path)).mtimeMs;
244
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
237
245
  } catch (error) {
238
246
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
239
247
  return void 0;
@@ -245,7 +253,7 @@ var NodeDirectory = class _NodeDirectory {
245
253
  assertChildName(name);
246
254
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
247
255
  try {
248
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
256
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
249
257
  } catch (error) {
250
258
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
251
259
  return void 0;
@@ -253,7 +261,7 @@ var NodeDirectory = class _NodeDirectory {
253
261
  }
254
262
  }
255
263
  async list() {
256
- const entries = await fsPromises.readdir(this.path, {
264
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
257
265
  withFileTypes: true
258
266
  });
259
267
  return entries.map(
@@ -262,26 +270,45 @@ var NodeDirectory = class _NodeDirectory {
262
270
  }
263
271
  async createFile(name) {
264
272
  assertChildName(name);
265
- await fsPromises.mkdir(this.path, { recursive: true });
273
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
274
+ recursive: true
275
+ });
266
276
  const file = new NodeFile(pathModule.join(this.path, name));
267
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
277
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
278
+ flag: "wx"
279
+ });
268
280
  return file;
269
281
  }
270
282
  async createDirectory(name) {
271
283
  assertChildName(name);
272
- await fsPromises.mkdir(this.path, { recursive: true });
284
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
285
+ recursive: true
286
+ });
273
287
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
274
- await fsPromises.mkdir(directory.path);
288
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
275
289
  return directory;
276
290
  }
277
291
  async remove(name, options) {
278
292
  assertChildName(name);
279
- await fsPromises.rm(pathModule.join(this.path, name), {
280
- force: true,
281
- recursive: options?.recursive === true
282
- });
293
+ await fsPromises.rm(
294
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
295
+ {
296
+ force: true,
297
+ recursive: options?.recursive === true
298
+ }
299
+ );
283
300
  }
284
301
  };
302
+ function toNodeFilesystemPath(path) {
303
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
304
+ return path;
305
+ }
306
+ const absolute = pathModule.resolve(path);
307
+ if (absolute.startsWith("\\\\")) {
308
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
309
+ }
310
+ return `\\\\?\\${absolute}`;
311
+ }
285
312
  function encodeNodeResourceIdentity(kind, path) {
286
313
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
287
314
  }
@@ -359,10 +386,14 @@ async function openNativeNodeDatabase(file, flags) {
359
386
  throw new TypeError("The Node database adapter requires a NodeFile");
360
387
  }
361
388
  return await new Promise((resolve2, reject) => {
362
- const database = new nodeSqlite3.Database(path, flags, (error) => {
363
- if (error) reject(error);
364
- else resolve2(database);
365
- });
389
+ const database = new nodeSqlite3.Database(
390
+ toNodeFilesystemPath(path),
391
+ flags,
392
+ (error) => {
393
+ if (error) reject(error);
394
+ else resolve2(database);
395
+ }
396
+ );
366
397
  });
367
398
  }
368
399
  async function openNodeZip(file, options = {}) {
@@ -370,7 +401,7 @@ async function openNodeZip(file, options = {}) {
370
401
  if (path === void 0) {
371
402
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
372
403
  }
373
- const handle = await fsPromises.open(path, "r");
404
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
374
405
  let size;
375
406
  try {
376
407
  size = (await handle.stat()).size;
@@ -685,6 +716,11 @@ async function writeNodeZip(file, entries) {
685
716
  }
686
717
  }
687
718
  async function addNodeZipEntries(zipFile, iterator, state) {
719
+ const stableZipOptions = {
720
+ compress: false,
721
+ forceDosTimestamp: true,
722
+ mtime: new Date(1980, 0, 2)
723
+ };
688
724
  while (!state.cancelled) {
689
725
  const result = await iterator.next();
690
726
  if (state.cancelled) return;
@@ -696,17 +732,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
696
732
  zipFile.addReadStream(
697
733
  createNodeFileReadStream(result.value.file),
698
734
  result.value.name,
699
- { compress: false }
735
+ stableZipOptions
700
736
  );
701
737
  } else if ("data" in result.value) {
702
738
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
703
- compress: false
739
+ ...stableZipOptions
704
740
  });
705
741
  } else {
706
742
  zipFile.addReadStream(
707
743
  createNodeRangeReadStream(result.value),
708
744
  result.value.name,
709
- { compress: false, size: result.value.size }
745
+ { ...stableZipOptions, size: result.value.size }
710
746
  );
711
747
  }
712
748
  }