@opentabs-dev/opentabs-plugin-microsoft-word 0.0.82 → 0.0.84

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.
@@ -50,6 +50,18 @@
50
50
  };
51
51
 
52
52
  // node_modules/@opentabs-dev/plugin-sdk/dist/fetch.js
53
+ var parseRetryAfterMs = (value) => {
54
+ const seconds = Number(value);
55
+ if (!Number.isNaN(seconds) && seconds >= 0) {
56
+ return seconds * 1e3;
57
+ }
58
+ const date5 = Date.parse(value);
59
+ if (!Number.isNaN(date5)) {
60
+ const ms = date5 - Date.now();
61
+ return ms > 0 ? ms : void 0;
62
+ }
63
+ return void 0;
64
+ };
53
65
  var buildQueryString = (params) => {
54
66
  const searchParams = new URLSearchParams();
55
67
  for (const [key, value] of Object.entries(params)) {
@@ -390,7 +402,7 @@
390
402
  }
391
403
  if (!tokenKeys.accessToken) return null;
392
404
  for (const key of tokenKeys.accessToken) {
393
- if (!key.includes("graph.microsoft.com")) continue;
405
+ if (!/(?:^|[\s/])graph\.microsoft\.com(?:[/\s]|$)/.test(key)) continue;
394
406
  const raw = getLocalStorage(key);
395
407
  if (!raw) continue;
396
408
  try {
@@ -452,7 +464,7 @@
452
464
  if (response.status === 204) return {};
453
465
  if (response.status === 429) {
454
466
  const retryAfter = response.headers.get("Retry-After");
455
- const retryMs = retryAfter ? Number.parseInt(retryAfter, 10) * 1e3 : void 0;
467
+ const retryMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : void 0;
456
468
  throw ToolError.rateLimited("Microsoft Graph API rate limit exceeded.", retryMs);
457
469
  }
458
470
  if (response.status === 401 || response.status === 403) {
@@ -14270,7 +14282,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14270
14282
  const rawData = zipBytes.slice(dataStart, dataStart + compressedSize);
14271
14283
  if (name === filename) {
14272
14284
  if (compressionMethod === 8) {
14273
- return decompressDeflateRaw(rawData);
14285
+ const bytes = await decompressDeflateRaw(rawData);
14286
+ return new TextDecoder().decode(bytes);
14274
14287
  }
14275
14288
  return new TextDecoder().decode(rawData);
14276
14289
  }
@@ -14299,7 +14312,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14299
14312
  result.set(chunk, pos);
14300
14313
  pos += chunk.length;
14301
14314
  }
14302
- return new TextDecoder().decode(result);
14315
+ return result;
14303
14316
  }
14304
14317
  function extractTextFromDocumentXml(xml) {
14305
14318
  const paraBlocks = xml.split(/<\/w:p>/);
@@ -14336,8 +14349,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14336
14349
  const rawData = zipBytes.slice(dataStart, dataStart + compressedSize);
14337
14350
  let data;
14338
14351
  if (compressionMethod === 8) {
14339
- const text = await decompressDeflateRaw(rawData);
14340
- data = new TextEncoder().encode(text);
14352
+ data = await decompressDeflateRaw(rawData);
14341
14353
  } else {
14342
14354
  data = rawData;
14343
14355
  }
@@ -15656,7 +15668,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15656
15668
  };
15657
15669
  var src_default = new MicrosoftWordPlugin();
15658
15670
 
15659
- // dist/_adapter_entry_2cbbc49c-1592-4c09-8369-a549a6abd2ef.ts
15671
+ // dist/_adapter_entry_c7b8da2d-bcbb-4c80-a0a7-a7595582231a.ts
15660
15672
  if (!globalThis.__openTabs) {
15661
15673
  globalThis.__openTabs = {};
15662
15674
  } else {
@@ -15872,5 +15884,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15872
15884
  };
15873
15885
  delete src_default.onDeactivate;
15874
15886
  }
15875
- })();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["microsoft-word"]){var a=o.adapters["microsoft-word"];a.__adapterHash="9e1fea915957246f5fcb6bf43e2795908e38ea025ee2bb4b2535990addef937e";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"microsoft-word",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
15887
+ })();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["microsoft-word"]){var a=o.adapters["microsoft-word"];a.__adapterHash="72636bbcd69a3f6d2b73321cb175e5608091f25ca51fc86ac2651d71970000a2";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"microsoft-word",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
15876
15888
  //# sourceMappingURL=adapter.iife.js.map