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.js CHANGED
@@ -46,7 +46,7 @@ var NodeFile = class {
46
46
  }
47
47
  path;
48
48
  async getPhysicalIdentity() {
49
- const value = await fsPromises.stat(this.path).catch((error) => {
49
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
50
50
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
51
51
  return void 0;
52
52
  throw error;
@@ -59,7 +59,7 @@ var NodeFile = class {
59
59
  identity;
60
60
  name;
61
61
  async openReader() {
62
- const handle = await fsPromises.open(this.path, "r");
62
+ const handle = await fsPromises.open(toNodeFilesystemPath(this.path), "r");
63
63
  let closed = false;
64
64
  try {
65
65
  const stats = await handle.stat();
@@ -99,7 +99,7 @@ var NodeFile = class {
99
99
  }
100
100
  async getLastModified() {
101
101
  try {
102
- return (await fsPromises.stat(this.path)).mtimeMs;
102
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
103
103
  } catch (error) {
104
104
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
105
105
  return void 0;
@@ -108,9 +108,14 @@ var NodeFile = class {
108
108
  }
109
109
  }
110
110
  async openWriter() {
111
- await fsPromises.mkdir(pathModule.dirname(this.path), { recursive: true });
111
+ await fsPromises.mkdir(
112
+ toNodeFilesystemPath(pathModule.dirname(this.path)),
113
+ {
114
+ recursive: true
115
+ }
116
+ );
112
117
  const temporary = `${this.path}.tmp-${crypto.randomUUID()}`;
113
- const handle = await fsPromises.open(temporary, "wx");
118
+ const handle = await fsPromises.open(toNodeFilesystemPath(temporary), "wx");
114
119
  let closed = false;
115
120
  return {
116
121
  write: async (data) => {
@@ -125,14 +130,17 @@ var NodeFile = class {
125
130
  commit: async () => {
126
131
  if (!closed) {
127
132
  await handle.close();
128
- await fsPromises.rename(temporary, this.path);
133
+ await fsPromises.rename(
134
+ toNodeFilesystemPath(temporary),
135
+ toNodeFilesystemPath(this.path)
136
+ );
129
137
  }
130
138
  closed = true;
131
139
  },
132
140
  abort: async () => {
133
141
  if (!closed) {
134
142
  await handle.close();
135
- await fsPromises.rm(temporary, { force: true });
143
+ await fsPromises.rm(toNodeFilesystemPath(temporary), { force: true });
136
144
  }
137
145
  closed = true;
138
146
  }
@@ -179,7 +187,7 @@ var NodeDirectory = class _NodeDirectory {
179
187
  }
180
188
  path;
181
189
  async getPhysicalIdentity() {
182
- const value = await fsPromises.stat(this.path).catch((error) => {
190
+ const value = await fsPromises.stat(toNodeFilesystemPath(this.path)).catch((error) => {
183
191
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
184
192
  return void 0;
185
193
  throw error;
@@ -195,7 +203,7 @@ var NodeDirectory = class _NodeDirectory {
195
203
  assertChildName(name);
196
204
  const file = new NodeFile(pathModule.join(this.path, name));
197
205
  try {
198
- return (await fsPromises.stat(file.path)).isFile() ? file : void 0;
206
+ return (await fsPromises.stat(toNodeFilesystemPath(file.path))).isFile() ? file : void 0;
199
207
  } catch (error) {
200
208
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
201
209
  return void 0;
@@ -204,7 +212,7 @@ var NodeDirectory = class _NodeDirectory {
204
212
  }
205
213
  async getLastModified() {
206
214
  try {
207
- return (await fsPromises.stat(this.path)).mtimeMs;
215
+ return (await fsPromises.stat(toNodeFilesystemPath(this.path))).mtimeMs;
208
216
  } catch (error) {
209
217
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
210
218
  return void 0;
@@ -216,7 +224,7 @@ var NodeDirectory = class _NodeDirectory {
216
224
  assertChildName(name);
217
225
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
218
226
  try {
219
- return (await fsPromises.stat(directory.path)).isDirectory() ? directory : void 0;
227
+ return (await fsPromises.stat(toNodeFilesystemPath(directory.path))).isDirectory() ? directory : void 0;
220
228
  } catch (error) {
221
229
  if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
222
230
  return void 0;
@@ -224,7 +232,7 @@ var NodeDirectory = class _NodeDirectory {
224
232
  }
225
233
  }
226
234
  async list() {
227
- const entries = await fsPromises.readdir(this.path, {
235
+ const entries = await fsPromises.readdir(toNodeFilesystemPath(this.path), {
228
236
  withFileTypes: true
229
237
  });
230
238
  return entries.map(
@@ -233,26 +241,45 @@ var NodeDirectory = class _NodeDirectory {
233
241
  }
234
242
  async createFile(name) {
235
243
  assertChildName(name);
236
- await fsPromises.mkdir(this.path, { recursive: true });
244
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
245
+ recursive: true
246
+ });
237
247
  const file = new NodeFile(pathModule.join(this.path, name));
238
- await fsPromises.writeFile(file.path, "", { flag: "wx" });
248
+ await fsPromises.writeFile(toNodeFilesystemPath(file.path), "", {
249
+ flag: "wx"
250
+ });
239
251
  return file;
240
252
  }
241
253
  async createDirectory(name) {
242
254
  assertChildName(name);
243
- await fsPromises.mkdir(this.path, { recursive: true });
255
+ await fsPromises.mkdir(toNodeFilesystemPath(this.path), {
256
+ recursive: true
257
+ });
244
258
  const directory = new _NodeDirectory(pathModule.join(this.path, name));
245
- await fsPromises.mkdir(directory.path);
259
+ await fsPromises.mkdir(toNodeFilesystemPath(directory.path));
246
260
  return directory;
247
261
  }
248
262
  async remove(name, options) {
249
263
  assertChildName(name);
250
- await fsPromises.rm(pathModule.join(this.path, name), {
251
- force: true,
252
- recursive: options?.recursive === true
253
- });
264
+ await fsPromises.rm(
265
+ toNodeFilesystemPath(pathModule.join(this.path, name)),
266
+ {
267
+ force: true,
268
+ recursive: options?.recursive === true
269
+ }
270
+ );
254
271
  }
255
272
  };
273
+ function toNodeFilesystemPath(path) {
274
+ if (nodeProcess.platform !== "win32" || path.startsWith("\\\\?\\")) {
275
+ return path;
276
+ }
277
+ const absolute = pathModule.resolve(path);
278
+ if (absolute.startsWith("\\\\")) {
279
+ return `\\\\?\\UNC\\${absolute.slice(2)}`;
280
+ }
281
+ return `\\\\?\\${absolute}`;
282
+ }
256
283
  function encodeNodeResourceIdentity(kind, path) {
257
284
  return `node-${kind}:${Buffer.from(pathModule.resolve(path), "utf8").toString("base64url")}`;
258
285
  }
@@ -338,10 +365,14 @@ async function openNativeNodeDatabase(file, flags) {
338
365
  throw new TypeError("The Node database adapter requires a NodeFile");
339
366
  }
340
367
  return await new Promise((resolve4, reject) => {
341
- const database = new nodeSqlite3.Database(path, flags, (error) => {
342
- if (error) reject(error);
343
- else resolve4(database);
344
- });
368
+ const database = new nodeSqlite3.Database(
369
+ toNodeFilesystemPath(path),
370
+ flags,
371
+ (error) => {
372
+ if (error) reject(error);
373
+ else resolve4(database);
374
+ }
375
+ );
345
376
  });
346
377
  }
347
378
  async function openNodeZip(file, options = {}) {
@@ -349,7 +380,7 @@ async function openNodeZip(file, options = {}) {
349
380
  if (path === void 0) {
350
381
  throw new TypeError("The Node ZIP adapter requires a NodeFile");
351
382
  }
352
- const handle = await fsPromises.open(path, "r");
383
+ const handle = await fsPromises.open(toNodeFilesystemPath(path), "r");
353
384
  let size;
354
385
  try {
355
386
  size = (await handle.stat()).size;
@@ -664,6 +695,11 @@ async function writeNodeZip(file, entries) {
664
695
  }
665
696
  }
666
697
  async function addNodeZipEntries(zipFile, iterator, state) {
698
+ const stableZipOptions = {
699
+ compress: false,
700
+ forceDosTimestamp: true,
701
+ mtime: new Date(1980, 0, 2)
702
+ };
667
703
  while (!state.cancelled) {
668
704
  const result = await iterator.next();
669
705
  if (state.cancelled) return;
@@ -675,17 +711,17 @@ async function addNodeZipEntries(zipFile, iterator, state) {
675
711
  zipFile.addReadStream(
676
712
  createNodeFileReadStream(result.value.file),
677
713
  result.value.name,
678
- { compress: false }
714
+ stableZipOptions
679
715
  );
680
716
  } else if ("data" in result.value) {
681
717
  zipFile.addBuffer(Buffer.from(result.value.data), result.value.name, {
682
- compress: false
718
+ ...stableZipOptions
683
719
  });
684
720
  } else {
685
721
  zipFile.addReadStream(
686
722
  createNodeRangeReadStream(result.value),
687
723
  result.value.name,
688
- { compress: false, size: result.value.size }
724
+ { ...stableZipOptions, size: result.value.size }
689
725
  );
690
726
  }
691
727
  }