@burdenoff/mcp-libs 2026.1031.3 → 2026.1101.2

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 (110) hide show
  1. package/README.md +30 -0
  2. package/dist/{chunk-FVLIANOQ.js → chunk-LUXDBCVJ.js} +3 -3
  3. package/dist/{chunk-FVLIANOQ.js.map → chunk-LUXDBCVJ.js.map} +1 -1
  4. package/dist/{chunk-76RGHRRS.js → chunk-WYCRYHHY.js} +83 -33
  5. package/dist/chunk-WYCRYHHY.js.map +1 -0
  6. package/dist/core/auth/store.d.ts +1 -0
  7. package/dist/core/gql/client.d.ts +6 -0
  8. package/dist/core/index.cjs +83 -30
  9. package/dist/core/index.cjs.map +1 -1
  10. package/dist/core/index.d.ts +2 -2
  11. package/dist/core/index.js +1 -1
  12. package/dist/index.cjs +80 -30
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/modules/adaptercloud/index.js +1 -1
  16. package/dist/modules/adaptercloud/tools/shared.d.ts +91 -13
  17. package/dist/modules/artistrybase/index.js +1 -1
  18. package/dist/modules/artistrybase/tools/shared.d.ts +80 -12
  19. package/dist/modules/assethandler/index.js +1 -1
  20. package/dist/modules/assethandler/tools/shared.d.ts +52 -8
  21. package/dist/modules/atheletebridge/index.js +1 -1
  22. package/dist/modules/atheletebridge/tools/shared.d.ts +83 -12
  23. package/dist/modules/auth/index.js +3 -3
  24. package/dist/modules/billing/index.js +1 -1
  25. package/dist/modules/brainyrich/index.js +1 -1
  26. package/dist/modules/brainyrich/tools/shared.d.ts +102 -14
  27. package/dist/modules/buildmyiq/index.js +1 -1
  28. package/dist/modules/buildmyiq/tools/shared.d.ts +75 -12
  29. package/dist/modules/channels/index.js +1 -1
  30. package/dist/modules/collabkin/index.js +1 -1
  31. package/dist/modules/collabkin/tools/shared.d.ts +66 -10
  32. package/dist/modules/comradecircle/index.js +1 -1
  33. package/dist/modules/comradecircle/tools/shared.d.ts +78 -14
  34. package/dist/modules/conversations/index.js +1 -1
  35. package/dist/modules/coolandlovely/index.js +1 -1
  36. package/dist/modules/coolandlovely/tools/shared.d.ts +76 -19
  37. package/dist/modules/cosmicintersection/index.js +1 -1
  38. package/dist/modules/cosmicintersection/tools/shared.d.ts +94 -13
  39. package/dist/modules/crewfoundry/index.js +1 -1
  40. package/dist/modules/devportal/index.js +1 -1
  41. package/dist/modules/ecoimpacthub/index.js +1 -1
  42. package/dist/modules/ecoimpacthub/tools/shared.d.ts +130 -17
  43. package/dist/modules/eventfullymanaged/index.js +1 -1
  44. package/dist/modules/export/index.js +1 -1
  45. package/dist/modules/files/index.js +1 -1
  46. package/dist/modules/fluidgrids/durable-operations.d.ts +23 -0
  47. package/dist/modules/fluidgrids/index.cjs +566 -13
  48. package/dist/modules/fluidgrids/index.cjs.map +1 -1
  49. package/dist/modules/fluidgrids/index.js +490 -12
  50. package/dist/modules/fluidgrids/index.js.map +1 -1
  51. package/dist/modules/fluidgrids/operations.d.ts +4 -3
  52. package/dist/modules/fluidgrids/tools/durable.d.ts +3 -0
  53. package/dist/modules/ggnomad/index.js +1 -1
  54. package/dist/modules/ggnomad/tools/shared.d.ts +23 -3
  55. package/dist/modules/govcitizenhub/index.js +1 -1
  56. package/dist/modules/govcitizenhub/tools/shared.d.ts +68 -10
  57. package/dist/modules/groups/index.js +1 -1
  58. package/dist/modules/headshotmarketing/index.js +1 -1
  59. package/dist/modules/headshotmarketing/tools/shared.d.ts +299 -42
  60. package/dist/modules/health/index.js +1 -1
  61. package/dist/modules/healthybowl/index.js +1 -1
  62. package/dist/modules/healthybowl/tools/shared.d.ts +5 -1
  63. package/dist/modules/hookmovies/index.js +1 -1
  64. package/dist/modules/hookmovies/tools/shared.d.ts +93 -13
  65. package/dist/modules/housingvista/index.js +1 -1
  66. package/dist/modules/housingvista/tools/shared.d.ts +15 -2
  67. package/dist/modules/integrations/index.js +1 -1
  68. package/dist/modules/intelwatchtower/index.js +1 -1
  69. package/dist/modules/intelwatchtower/tools/shared.d.ts +121 -16
  70. package/dist/modules/kadaikodi/index.js +1 -1
  71. package/dist/modules/kadaikodi/tools/shared.d.ts +52 -7
  72. package/dist/modules/labsofscience/index.js +1 -1
  73. package/dist/modules/labsofscience/tools/shared.d.ts +85 -13
  74. package/dist/modules/manufacturedops/index.js +1 -1
  75. package/dist/modules/manufacturedops/tools/shared.d.ts +95 -14
  76. package/dist/modules/movethewheels/index.js +1 -1
  77. package/dist/modules/movethewheels/tools/shared.d.ts +111 -14
  78. package/dist/modules/mybodyshield/index.js +1 -1
  79. package/dist/modules/mybodyshield/tools/shared.d.ts +84 -12
  80. package/dist/modules/notifications/index.js +1 -1
  81. package/dist/modules/organizations/index.js +1 -1
  82. package/dist/modules/planmagnet/index.js +1 -1
  83. package/dist/modules/planmagnet/tools/shared.d.ts +231 -31
  84. package/dist/modules/products/index.js +1 -1
  85. package/dist/modules/proserviceworld/index.js +1 -1
  86. package/dist/modules/proserviceworld/tools/shared.d.ts +53 -9
  87. package/dist/modules/rbac/index.js +1 -1
  88. package/dist/modules/sandbox/index.js +1 -1
  89. package/dist/modules/scheduler/index.js +1 -1
  90. package/dist/modules/security/index.js +1 -1
  91. package/dist/modules/semanticfed/index.js +1 -1
  92. package/dist/modules/semanticfed/tools/shared.d.ts +87 -12
  93. package/dist/modules/store/index.js +1 -1
  94. package/dist/modules/subscriberbot/index.js +1 -1
  95. package/dist/modules/subscriberbot/tools/shared.d.ts +157 -19
  96. package/dist/modules/support/index.js +1 -1
  97. package/dist/modules/tags/index.js +1 -1
  98. package/dist/modules/technospam/index.js +1 -1
  99. package/dist/modules/technospam/tools/shared.d.ts +63 -10
  100. package/dist/modules/theculturepost/index.js +1 -1
  101. package/dist/modules/theculturepost/tools/shared.d.ts +63 -8
  102. package/dist/modules/theglobalfuel/index.js +1 -1
  103. package/dist/modules/theglobalfuel/tools/shared.d.ts +117 -14
  104. package/dist/modules/timecampus/index.js +1 -1
  105. package/dist/modules/timecampus/tools/shared.d.ts +131 -21
  106. package/dist/modules/tours/index.js +1 -1
  107. package/dist/modules/vibecontrols/index.js +2 -2
  108. package/dist/modules/workspaces/index.js +1 -1
  109. package/package.json +16 -15
  110. package/dist/chunk-76RGHRRS.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -18,6 +18,31 @@ var fetch__default = /*#__PURE__*/_interopDefault(fetch);
18
18
 
19
19
  // src/core/auth/store.ts
20
20
  var TOKEN_BUFFER_MS = 5 * 60 * 1e3;
21
+ function decodeJwtPayload(token) {
22
+ if (!token) return null;
23
+ const parts = token.split(".");
24
+ if (parts.length !== 3) return null;
25
+ try {
26
+ const payload = JSON.parse(
27
+ Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8")
28
+ );
29
+ return payload && typeof payload === "object" ? payload : null;
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+ function jwtExpiryMs(token) {
35
+ const exp = decodeJwtPayload(token)?.exp;
36
+ return typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : null;
37
+ }
38
+ function accessTokenExpiry(auth) {
39
+ if (!auth) return null;
40
+ return auth.expiresAt ?? jwtExpiryMs(auth.accessToken);
41
+ }
42
+ function workspaceTokenExpiry(auth) {
43
+ if (!auth?.workspaceToken) return auth?.workspaceTokenExpiresAt ?? null;
44
+ return auth.workspaceTokenExpiresAt ?? jwtExpiryMs(auth.workspaceToken);
45
+ }
21
46
  function createAuthStore(configDir, authFileName2 = "auth.json") {
22
47
  const authFile = path.join(configDir, authFileName2);
23
48
  function ensureConfigDir() {
@@ -49,24 +74,24 @@ function createAuthStore(configDir, authFileName2 = "auth.json") {
49
74
  }
50
75
  }
51
76
  function isTokenExpired() {
52
- const auth = read();
53
- if (!auth?.expiresAt) return false;
54
- return Date.now() >= auth.expiresAt;
77
+ const expiresAt = accessTokenExpiry(read());
78
+ if (!expiresAt) return false;
79
+ return Date.now() >= expiresAt;
55
80
  }
56
81
  function isTokenExpiringSoon() {
57
- const auth = read();
58
- if (!auth?.expiresAt) return false;
59
- return Date.now() + TOKEN_BUFFER_MS >= auth.expiresAt;
82
+ const expiresAt = accessTokenExpiry(read());
83
+ if (!expiresAt) return false;
84
+ return Date.now() + TOKEN_BUFFER_MS >= expiresAt;
60
85
  }
61
86
  function isWorkspaceTokenExpired() {
62
- const auth = read();
63
- if (!auth?.workspaceTokenExpiresAt) return false;
64
- return Date.now() >= auth.workspaceTokenExpiresAt;
87
+ const expiresAt = workspaceTokenExpiry(read());
88
+ if (!expiresAt) return false;
89
+ return Date.now() >= expiresAt;
65
90
  }
66
91
  function isWorkspaceTokenExpiringSoon() {
67
- const auth = read();
68
- if (!auth?.workspaceTokenExpiresAt) return false;
69
- return Date.now() + TOKEN_BUFFER_MS >= auth.workspaceTokenExpiresAt;
92
+ const expiresAt = workspaceTokenExpiry(read());
93
+ if (!expiresAt) return false;
94
+ return Date.now() + TOKEN_BUFFER_MS >= expiresAt;
70
95
  }
71
96
  function isAuthenticated() {
72
97
  const auth = read();
@@ -75,19 +100,8 @@ function createAuthStore(configDir, authFileName2 = "auth.json") {
75
100
  return !isTokenExpired();
76
101
  }
77
102
  function getActorUserId() {
78
- const auth = read();
79
- const token = auth?.accessToken;
80
- if (!token) return null;
81
- const parts = token.split(".");
82
- if (parts.length !== 3) return null;
83
- try {
84
- const payload = JSON.parse(
85
- Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8")
86
- );
87
- return typeof payload.sub === "string" ? payload.sub : null;
88
- } catch {
89
- return null;
90
- }
103
+ const sub = decodeJwtPayload(read()?.accessToken)?.sub;
104
+ return typeof sub === "string" ? sub : null;
91
105
  }
92
106
  return {
93
107
  read,
@@ -258,6 +272,30 @@ function isNetworkOrServerError(error) {
258
272
  }
259
273
  return false;
260
274
  }
275
+ var GqlRequestError = class extends Error {
276
+ status;
277
+ authFailure;
278
+ constructor(message, status, authFailure) {
279
+ super(message);
280
+ this.name = "GqlRequestError";
281
+ this.status = status;
282
+ this.authFailure = authFailure;
283
+ }
284
+ };
285
+ function toGqlRequestError(error) {
286
+ let status;
287
+ let authFailure;
288
+ if (error && typeof error === "object" && "response" in error) {
289
+ const resp = error.response;
290
+ if (typeof resp?.status === "number") status = resp.status;
291
+ const failure = resp?.errors?.find((e) => typeof e.extensions?.authFailure === "string")?.extensions?.authFailure;
292
+ if (typeof failure === "string") authFailure = failure;
293
+ }
294
+ return new GqlRequestError(extractGqlErrorMessage(error), status, authFailure);
295
+ }
296
+ function isExpiredCredentialError(error) {
297
+ return error instanceof GqlRequestError && error.authFailure === "CREDENTIAL_EXPIRED";
298
+ }
261
299
  function extractGqlErrorMessage(error) {
262
300
  if (error && typeof error === "object" && "response" in error) {
263
301
  const resp = error;
@@ -310,7 +348,7 @@ async function executeWithRetry(client, document, variables) {
310
348
  break;
311
349
  }
312
350
  }
313
- throw new Error(extractGqlErrorMessage(lastError));
351
+ throw toGqlRequestError(lastError);
314
352
  }
315
353
  function createGqlClients(config, authStore) {
316
354
  let workspaceClient = null;
@@ -372,7 +410,7 @@ function createGqlClients(config, authStore) {
372
410
  }
373
411
  async function refreshWorkspaceToken() {
374
412
  const auth = authStore.read();
375
- if (!auth?.accessToken || !auth.workspaceId || !auth.organizationId) return;
413
+ if (!auth?.accessToken || !auth.workspaceId || !auth.organizationId) return false;
376
414
  const cfg = config.read();
377
415
  try {
378
416
  const result = await issueWorkspaceToken(
@@ -387,7 +425,9 @@ function createGqlClients(config, authStore) {
387
425
  workspaceTokenExpiresAt: new Date(result.expiresAt).getTime()
388
426
  });
389
427
  workspaceClient = null;
428
+ return true;
390
429
  } catch {
430
+ return false;
391
431
  }
392
432
  }
393
433
  async function ensureFreshTokens() {
@@ -400,12 +440,22 @@ function createGqlClients(config, authStore) {
400
440
  await refreshWorkspaceToken();
401
441
  }
402
442
  }
443
+ async function requestWorkspace(document, variables) {
444
+ const { workspace: ws } = workspaceClient ? { workspace: workspaceClient } : init();
445
+ ws.setHeaders(getWorkspaceHeaders(authStore.read()));
446
+ return executeWithRetry(ws, document, variables);
447
+ }
403
448
  const workspace = {
404
449
  async request(document, variables) {
405
450
  await ensureFreshTokens();
406
- const { workspace: ws } = workspaceClient ? { workspace: workspaceClient } : init();
407
- ws.setHeaders(getWorkspaceHeaders(authStore.read()));
408
- return executeWithRetry(ws, document, variables);
451
+ try {
452
+ return await requestWorkspace(document, variables);
453
+ } catch (error) {
454
+ if (!isExpiredCredentialError(error) || authStore.read()?.apiKey) throw error;
455
+ if (authStore.isTokenExpiringSoon()) await refreshPlatformToken();
456
+ if (!await refreshWorkspaceToken()) throw error;
457
+ return requestWorkspace(document, variables);
458
+ }
409
459
  }
410
460
  };
411
461
  const global = {