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