@tangle-network/agent-integrations 0.53.17 → 0.53.18

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.
@@ -668,8 +668,8 @@ function signSigV4(input) {
668
668
  function amzDateNow(date = /* @__PURE__ */ new Date()) {
669
669
  return date.toISOString().replace(/[:-]|\.\d{3}/g, "");
670
670
  }
671
- function hashSha256Hex(data3) {
672
- return createHash("sha256").update(data3, "utf8").digest("hex");
671
+ function hashSha256Hex(data4) {
672
+ return createHash("sha256").update(data4, "utf8").digest("hex");
673
673
  }
674
674
  function deriveSigningKey(secretAccessKey, dateStamp, region, service) {
675
675
  const kDate = createHmac("sha256", `AWS4${secretAccessKey}`).update(dateStamp, "utf8").digest();
@@ -728,11 +728,11 @@ function declarativeRestConnector(spec) {
728
728
  const op = readOperation(spec, inv.capabilityName, "read");
729
729
  const response = await executeRestRequest(spec, op.request, inv, requiredArgsOf(op.parameters));
730
730
  if (response.outcome === "rate-limited") {
731
- const retryAfterMs = response.retryAfterMs ?? DEFAULT_RETRY_AFTER_MS;
731
+ const retryAfterMs2 = response.retryAfterMs ?? DEFAULT_RETRY_AFTER_MS;
732
732
  throw new ProviderRateLimited(
733
- `${spec.displayName} ${inv.capabilityName} rate limit (429); retry after ${retryAfterMs}ms`,
733
+ `${spec.displayName} ${inv.capabilityName} rate limit (429); retry after ${retryAfterMs2}ms`,
734
734
  inv.source.id,
735
- { status: 429, body: response.data, retryAfterMs }
735
+ { status: 429, body: response.data, retryAfterMs: retryAfterMs2 }
736
736
  );
737
737
  }
738
738
  if (response.outcome === "conflict") {
@@ -775,10 +775,10 @@ function declarativeRestConnector(spec) {
775
775
  };
776
776
  return adapter;
777
777
  }
778
- function validateTestResponse(spec, test, data3) {
778
+ function validateTestResponse(spec, test, data4) {
779
779
  const expectations = Array.isArray(test.expectResponse) ? test.expectResponse : test.expectResponse ? [test.expectResponse] : [];
780
780
  for (const expectation of expectations) {
781
- const actual = readPathFromUnknown(data3, expectation.path);
781
+ const actual = readPathFromUnknown(data4, expectation.path);
782
782
  if (!isJsonEqual(actual, expectation.equals)) {
783
783
  throw new Error(
784
784
  `${spec.displayName} test response expected ${expectation.path}=${formatValue(expectation.equals)}, got ${formatValue(actual)}`
@@ -849,27 +849,27 @@ function mutationResultFromTransport(displayName, response) {
849
849
  idempotentReplay: false
850
850
  };
851
851
  }
852
- async function executeRestRequest(spec, request2, inv, requiredArgs) {
852
+ async function executeRestRequest(spec, request3, inv, requiredArgs) {
853
853
  const placement = spec.credentialPlacement ?? { kind: "bearer" };
854
854
  const aws = placement.kind === "aws-sigv4" ? parseAwsCredentialBundle(inv.source.credentials) : void 0;
855
855
  const awsRegion = aws ? resolveAwsRegion(aws, inv.source.metadata, placement) : void 0;
856
- let baseUrl2 = resolveBaseUrl(
856
+ let baseUrl3 = resolveBaseUrl(
857
857
  spec.baseUrl,
858
858
  inv.source.metadata,
859
859
  spec.allowedBaseUrls,
860
860
  spec.allowedBaseUrlSuffixes,
861
861
  spec.requirePublicHttpsBaseUrl
862
862
  );
863
- if (aws) baseUrl2 = applyRegionTemplate(baseUrl2, awsRegion, aws.endpoint);
863
+ if (aws) baseUrl3 = applyRegionTemplate(baseUrl3, awsRegion, aws.endpoint);
864
864
  const scope = renderScope(inv, aws?.bucket ? { bucket: aws.bucket } : void 0);
865
- const renderedPath = interpolate(request2.path, scope).replace(/^\/+/, "");
866
- const baseWithSlash = baseUrl2.endsWith("/") ? baseUrl2 : `${baseUrl2}/`;
865
+ const renderedPath = interpolate(request3.path, scope).replace(/^\/+/, "");
866
+ const baseWithSlash = baseUrl3.endsWith("/") ? baseUrl3 : `${baseUrl3}/`;
867
867
  const url = new URL(renderedPath, baseWithSlash);
868
- for (const [key, value] of Object.entries(request2.query ?? {})) {
868
+ for (const [key, value] of Object.entries(request3.query ?? {})) {
869
869
  const rendered = renderQueryValue(value, scope);
870
870
  if (rendered !== void 0 && rendered !== "") url.searchParams.set(key, String(rendered));
871
871
  }
872
- const requestHeaders = request2.headers ?? {};
872
+ const requestHeaders = request3.headers ?? {};
873
873
  const hostOverride = aws ? Object.entries(requestHeaders).find(([key]) => key.toLowerCase() === "host")?.[1] : void 0;
874
874
  const renderableHeaders = hostOverride ? Object.fromEntries(Object.entries(requestHeaders).filter(([key]) => key.toLowerCase() !== "host")) : requestHeaders;
875
875
  const headers = {
@@ -885,11 +885,11 @@ async function executeRestRequest(spec, request2, inv, requiredArgs) {
885
885
  }
886
886
  if (hostOverride) url.host = hostOverride.replace(/\{region\}/g, awsRegion);
887
887
  if (inv.expectedEtag) headers["if-match"] = inv.expectedEtag;
888
- const sendsBody = request2.method !== "GET" && (request2.method !== "DELETE" || request2.body !== void 0);
888
+ const sendsBody = request3.method !== "GET" && (request3.method !== "DELETE" || request3.body !== void 0);
889
889
  if (sendsBody && getHeaderCI(headers, "content-type") === void 0) {
890
890
  headers["content-type"] = "application/json";
891
891
  }
892
- let resolvedBody = sendsBody ? resolveBody(request2.body, inv.args, scope, requiredArgs) : void 0;
892
+ let resolvedBody = sendsBody ? resolveBody(request3.body, inv.args, scope, requiredArgs) : void 0;
893
893
  if (placement.kind === "structured-json-body") {
894
894
  if (!resolvedBody || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
895
895
  throw new Error(`${spec.kind}: structured JSON credentials require an object request body`);
@@ -907,7 +907,7 @@ async function executeRestRequest(spec, request2, inv, requiredArgs) {
907
907
  const bodyString = sendsBody ? JSON.stringify(resolvedBody) : void 0;
908
908
  if (placement.kind === "aws-sigv4") {
909
909
  signAwsRequest(headers, url, {
910
- method: request2.method,
910
+ method: request3.method,
911
911
  body: bodyString ?? "",
912
912
  service: placement.service,
913
913
  region: awsRegion,
@@ -917,7 +917,7 @@ async function executeRestRequest(spec, request2, inv, requiredArgs) {
917
917
  applyCredentials(headers, url, placement, inv.source.credentials);
918
918
  }
919
919
  const res = await fetch(url, {
920
- method: request2.method,
920
+ method: request3.method,
921
921
  headers,
922
922
  body: bodyString,
923
923
  signal: AbortSignal.timeout(2e4)
@@ -945,36 +945,36 @@ async function executeRestRequest(spec, request2, inv, requiredArgs) {
945
945
  retryAfterMs: retryAfterMsFromHeader(res.headers.get("retry-after"))
946
946
  };
947
947
  }
948
- if (request2.existenceCheck && (res.status === 204 || res.status === 404)) {
948
+ if (request3.existenceCheck && (res.status === 204 || res.status === 404)) {
949
949
  return { data: { exists: res.status === 204 } };
950
950
  }
951
951
  if (!res.ok) {
952
952
  const text2 = redactCredentialText(await safeErrorText(res), inv.source.credentials);
953
- throw new Error(`${spec.kind} ${request2.method} ${url.pathname} HTTP ${res.status}: ${text2.slice(0, 300)}`);
953
+ throw new Error(`${spec.kind} ${request3.method} ${url.pathname} HTTP ${res.status}: ${text2.slice(0, 300)}`);
954
954
  }
955
955
  const text = await res.text();
956
- let data3 = null;
956
+ let data4 = null;
957
957
  if (text) {
958
958
  try {
959
- data3 = JSON.parse(text);
959
+ data4 = JSON.parse(text);
960
960
  } catch {
961
- data3 = { raw: text };
961
+ data4 = { raw: text };
962
962
  }
963
963
  }
964
- return { data: data3, etag: res.headers.get("etag") ?? void 0 };
964
+ return { data: data4, etag: res.headers.get("etag") ?? void 0 };
965
965
  }
966
- function resolveBaseUrl(baseUrl2, metadata, allowedBaseUrls, allowedBaseUrlSuffixes, requirePublicHttpsBaseUrl) {
966
+ function resolveBaseUrl(baseUrl3, metadata, allowedBaseUrls, allowedBaseUrlSuffixes, requirePublicHttpsBaseUrl) {
967
967
  let resolved;
968
- if (typeof baseUrl2 === "string") {
969
- resolved = baseUrl2;
968
+ if (typeof baseUrl3 === "string") {
969
+ resolved = baseUrl3;
970
970
  } else {
971
- const value = metadata[baseUrl2.metadataKey];
971
+ const value = metadata[baseUrl3.metadataKey];
972
972
  if (typeof value === "string" && value.trim()) {
973
973
  resolved = value;
974
- } else if (baseUrl2.fallback) {
975
- resolved = baseUrl2.fallback;
974
+ } else if (baseUrl3.fallback) {
975
+ resolved = baseUrl3.fallback;
976
976
  } else {
977
- throw new Error(`missing metadata.${baseUrl2.metadataKey} base URL`);
977
+ throw new Error(`missing metadata.${baseUrl3.metadataKey} base URL`);
978
978
  }
979
979
  }
980
980
  const exactAllowed = allowedBaseUrls?.some((candidate) => sameUrl(candidate, resolved)) ?? false;
@@ -1103,9 +1103,9 @@ function resolveAwsRegion(bundle, metadata, placement) {
1103
1103
  if (typeof metadata.region === "string" && metadata.region.trim()) return metadata.region;
1104
1104
  return placement.defaultRegion ?? "us-east-1";
1105
1105
  }
1106
- function applyRegionTemplate(baseUrl2, region, endpoint) {
1106
+ function applyRegionTemplate(baseUrl3, region, endpoint) {
1107
1107
  if (endpoint) return endpoint;
1108
- return baseUrl2.replace(/\{region\}/g, region);
1108
+ return baseUrl3.replace(/\{region\}/g, region);
1109
1109
  }
1110
1110
  function getHeaderCI(headers, name) {
1111
1111
  const lower = name.toLowerCase();
@@ -9792,7 +9792,7 @@ function readDocuSealCredentials(creds) {
9792
9792
  throw new Error("docuseal: expected api-key credentials (apiKey + optional webhookSecret)");
9793
9793
  }
9794
9794
  function docuseal(opts = {}) {
9795
- const baseUrl2 = (opts.baseUrl ?? DEFAULT_BASE).replace(/\/$/, "");
9795
+ const baseUrl3 = (opts.baseUrl ?? DEFAULT_BASE).replace(/\/$/, "");
9796
9796
  const timeoutMs = opts.timeoutMs ?? 3e4;
9797
9797
  const adapter = {
9798
9798
  manifest: {
@@ -9868,7 +9868,7 @@ function docuseal(opts = {}) {
9868
9868
  }
9869
9869
  const { apiKey } = readDocuSealCredentials(inv.source.credentials);
9870
9870
  const { submissionId } = inv.args;
9871
- const res = await fetch(`${baseUrl2}/submissions/${encodeURIComponent(submissionId)}`, {
9871
+ const res = await fetch(`${baseUrl3}/submissions/${encodeURIComponent(submissionId)}`, {
9872
9872
  headers: { "X-Auth-Token": apiKey, accept: "application/json" },
9873
9873
  signal: AbortSignal.timeout(timeoutMs)
9874
9874
  });
@@ -9889,8 +9889,8 @@ function docuseal(opts = {}) {
9889
9889
  },
9890
9890
  async executeMutation(inv) {
9891
9891
  const { apiKey } = readDocuSealCredentials(inv.source.credentials);
9892
- if (inv.capabilityName === "create_submission") return createSubmission(inv, apiKey, baseUrl2, timeoutMs);
9893
- if (inv.capabilityName === "void_submission") return voidSubmission(inv, apiKey, baseUrl2, timeoutMs);
9892
+ if (inv.capabilityName === "create_submission") return createSubmission(inv, apiKey, baseUrl3, timeoutMs);
9893
+ if (inv.capabilityName === "void_submission") return voidSubmission(inv, apiKey, baseUrl3, timeoutMs);
9894
9894
  throw new Error(`docuseal: unknown mutation capability ${inv.capabilityName}`);
9895
9895
  },
9896
9896
  verifySignature({ rawBody, headers, source }) {
@@ -9935,7 +9935,7 @@ function docuseal(opts = {}) {
9935
9935
  async test(source) {
9936
9936
  try {
9937
9937
  const { apiKey } = readDocuSealCredentials(source.credentials);
9938
- const res = await fetch(`${baseUrl2}/templates?limit=1`, {
9938
+ const res = await fetch(`${baseUrl3}/templates?limit=1`, {
9939
9939
  headers: { "X-Auth-Token": apiKey },
9940
9940
  signal: AbortSignal.timeout(8e3)
9941
9941
  });
@@ -9969,7 +9969,7 @@ function normalizeSubmission(s) {
9969
9969
  }))
9970
9970
  };
9971
9971
  }
9972
- async function createSubmission(inv, apiKey, baseUrl2, timeoutMs) {
9972
+ async function createSubmission(inv, apiKey, baseUrl3, timeoutMs) {
9973
9973
  const { templateId, submitters, sendEmail, message } = inv.args;
9974
9974
  const body = {
9975
9975
  template_id: templateId,
@@ -9983,7 +9983,7 @@ async function createSubmission(inv, apiKey, baseUrl2, timeoutMs) {
9983
9983
  values: s.values
9984
9984
  }))
9985
9985
  };
9986
- const res = await fetch(`${baseUrl2}/submissions`, {
9986
+ const res = await fetch(`${baseUrl3}/submissions`, {
9987
9987
  method: "POST",
9988
9988
  headers: {
9989
9989
  "X-Auth-Token": apiKey,
@@ -10030,7 +10030,7 @@ async function createSubmission(inv, apiKey, baseUrl2, timeoutMs) {
10030
10030
  idempotentReplay: false
10031
10031
  };
10032
10032
  }
10033
- async function voidSubmission(inv, apiKey, baseUrl2, timeoutMs) {
10033
+ async function voidSubmission(inv, apiKey, baseUrl3, timeoutMs) {
10034
10034
  const { submissionId, reason } = inv.args;
10035
10035
  const headers = {
10036
10036
  "X-Auth-Token": apiKey,
@@ -10038,7 +10038,7 @@ async function voidSubmission(inv, apiKey, baseUrl2, timeoutMs) {
10038
10038
  };
10039
10039
  if (inv.expectedEtag) headers["if-match"] = inv.expectedEtag;
10040
10040
  if (reason) headers["x-docuseal-void-reason"] = reason;
10041
- const res = await fetch(`${baseUrl2}/submissions/${encodeURIComponent(submissionId)}`, {
10041
+ const res = await fetch(`${baseUrl3}/submissions/${encodeURIComponent(submissionId)}`, {
10042
10042
  method: "DELETE",
10043
10043
  headers,
10044
10044
  signal: AbortSignal.timeout(timeoutMs)
@@ -13890,16 +13890,16 @@ function gmail(opts) {
13890
13890
  ]
13891
13891
  },
13892
13892
  async executeRead(inv) {
13893
- const accessToken2 = await ensureFreshAccessToken(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
13894
- if (inv.capabilityName === "list_messages") return listMessages(inv, accessToken2, timeoutMs);
13895
- if (inv.capabilityName === "read_message") return readMessage(inv, accessToken2, timeoutMs);
13893
+ const accessToken3 = await ensureFreshAccessToken(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
13894
+ if (inv.capabilityName === "list_messages") return listMessages(inv, accessToken3, timeoutMs);
13895
+ if (inv.capabilityName === "read_message") return readMessage(inv, accessToken3, timeoutMs);
13896
13896
  throw new Error(`gmail: unknown read capability ${inv.capabilityName}`);
13897
13897
  },
13898
13898
  async executeMutation(inv) {
13899
- const accessToken2 = await ensureFreshAccessToken(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
13900
- if (inv.capabilityName === "send") return send(inv, accessToken2, timeoutMs);
13901
- if (inv.capabilityName === "send_reply") return sendReply(inv, accessToken2, timeoutMs);
13902
- if (inv.capabilityName === "watch_label") return watchLabel(inv, accessToken2, timeoutMs);
13899
+ const accessToken3 = await ensureFreshAccessToken(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
13900
+ if (inv.capabilityName === "send") return send(inv, accessToken3, timeoutMs);
13901
+ if (inv.capabilityName === "send_reply") return sendReply(inv, accessToken3, timeoutMs);
13902
+ if (inv.capabilityName === "watch_label") return watchLabel(inv, accessToken3, timeoutMs);
13903
13903
  throw new Error(`gmail: unknown mutation capability ${inv.capabilityName}`);
13904
13904
  },
13905
13905
  async exchangeOAuth(input) {
@@ -13941,9 +13941,9 @@ function gmail(opts) {
13941
13941
  },
13942
13942
  async test(source) {
13943
13943
  try {
13944
- const accessToken2 = await ensureFreshAccessToken(source.credentials, clientId, clientSecret);
13944
+ const accessToken3 = await ensureFreshAccessToken(source.credentials, clientId, clientSecret);
13945
13945
  const res = await fetch(`${API}/profile`, {
13946
- headers: { authorization: `Bearer ${accessToken2}` },
13946
+ headers: { authorization: `Bearer ${accessToken3}` },
13947
13947
  signal: AbortSignal.timeout(8e3)
13948
13948
  });
13949
13949
  if (!res.ok) {
@@ -13958,7 +13958,7 @@ function gmail(opts) {
13958
13958
  };
13959
13959
  return adapter;
13960
13960
  }
13961
- async function listMessages(inv, accessToken2, timeoutMs) {
13961
+ async function listMessages(inv, accessToken3, timeoutMs) {
13962
13962
  const args = inv.args ?? {};
13963
13963
  const params = new URLSearchParams({
13964
13964
  maxResults: String(args.maxResults ?? 25)
@@ -13967,7 +13967,7 @@ async function listMessages(inv, accessToken2, timeoutMs) {
13967
13967
  if (args.query) params.set("q", args.query);
13968
13968
  if (args.pageToken) params.set("pageToken", args.pageToken);
13969
13969
  const listRes = await fetch(`${API}/messages?${params.toString()}`, {
13970
- headers: { authorization: `Bearer ${accessToken2}` },
13970
+ headers: { authorization: `Bearer ${accessToken3}` },
13971
13971
  signal: AbortSignal.timeout(timeoutMs)
13972
13972
  });
13973
13973
  if (!listRes.ok) {
@@ -13978,7 +13978,7 @@ async function listMessages(inv, accessToken2, timeoutMs) {
13978
13978
  const metas = await Promise.all(
13979
13979
  ids.map(async ({ id }) => {
13980
13980
  const res = await fetch(`${API}/messages/${encodeURIComponent(id)}?format=metadata&metadataHeaders=From&metadataHeaders=To&metadataHeaders=Subject&metadataHeaders=Date`, {
13981
- headers: { authorization: `Bearer ${accessToken2}` },
13981
+ headers: { authorization: `Bearer ${accessToken3}` },
13982
13982
  signal: AbortSignal.timeout(timeoutMs)
13983
13983
  });
13984
13984
  if (!res.ok) return null;
@@ -14005,10 +14005,10 @@ function toMessageSummary(meta) {
14005
14005
  date: headers.get("date")
14006
14006
  };
14007
14007
  }
14008
- async function readMessage(inv, accessToken2, timeoutMs) {
14008
+ async function readMessage(inv, accessToken3, timeoutMs) {
14009
14009
  const { id } = inv.args;
14010
14010
  const res = await fetch(`${API}/messages/${encodeURIComponent(id)}?format=full`, {
14011
- headers: { authorization: `Bearer ${accessToken2}` },
14011
+ headers: { authorization: `Bearer ${accessToken3}` },
14012
14012
  signal: AbortSignal.timeout(timeoutMs)
14013
14013
  });
14014
14014
  if (res.status === 404) {
@@ -14062,7 +14062,7 @@ function decodeBase64Url(s) {
14062
14062
  function encodeBase64Url(s) {
14063
14063
  return Buffer.from(s, "utf-8").toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
14064
14064
  }
14065
- async function send(inv, accessToken2, timeoutMs) {
14065
+ async function send(inv, accessToken3, timeoutMs) {
14066
14066
  const args = inv.args;
14067
14067
  if (!args.to || Array.isArray(args.to) && args.to.length === 0) {
14068
14068
  throw new Error("gmail send: `to` is required");
@@ -14085,7 +14085,7 @@ ${args.body}`;
14085
14085
  const sendRes = await fetch(`${API}/messages/send`, {
14086
14086
  method: "POST",
14087
14087
  headers: {
14088
- authorization: `Bearer ${accessToken2}`,
14088
+ authorization: `Bearer ${accessToken3}`,
14089
14089
  "content-type": "application/json"
14090
14090
  },
14091
14091
  body: JSON.stringify({ raw: encodeBase64Url(raw) }),
@@ -14102,10 +14102,10 @@ ${args.body}`;
14102
14102
  idempotentReplay: false
14103
14103
  };
14104
14104
  }
14105
- async function sendReply(inv, accessToken2, timeoutMs) {
14105
+ async function sendReply(inv, accessToken3, timeoutMs) {
14106
14106
  const { threadId, body, replyAll, cc } = inv.args;
14107
14107
  const threadRes = await fetch(`${API}/threads/${encodeURIComponent(threadId)}?format=metadata&metadataHeaders=From&metadataHeaders=To&metadataHeaders=Cc&metadataHeaders=Subject&metadataHeaders=Message-ID&metadataHeaders=References`, {
14108
- headers: { authorization: `Bearer ${accessToken2}` },
14108
+ headers: { authorization: `Bearer ${accessToken3}` },
14109
14109
  signal: AbortSignal.timeout(timeoutMs)
14110
14110
  });
14111
14111
  if (!threadRes.ok) {
@@ -14146,7 +14146,7 @@ ${body}`;
14146
14146
  const sendRes = await fetch(`${API}/messages/send`, {
14147
14147
  method: "POST",
14148
14148
  headers: {
14149
- authorization: `Bearer ${accessToken2}`,
14149
+ authorization: `Bearer ${accessToken3}`,
14150
14150
  "content-type": "application/json"
14151
14151
  },
14152
14152
  body: JSON.stringify(sendBody),
@@ -14163,7 +14163,7 @@ ${body}`;
14163
14163
  idempotentReplay: false
14164
14164
  };
14165
14165
  }
14166
- async function watchLabel(inv, accessToken2, timeoutMs) {
14166
+ async function watchLabel(inv, accessToken3, timeoutMs) {
14167
14167
  const { labelIds, topicName, labelFilterAction } = inv.args;
14168
14168
  const body = {
14169
14169
  topicName,
@@ -14173,7 +14173,7 @@ async function watchLabel(inv, accessToken2, timeoutMs) {
14173
14173
  const res = await fetch(`${API}/watch`, {
14174
14174
  method: "POST",
14175
14175
  headers: {
14176
- authorization: `Bearer ${accessToken2}`,
14176
+ authorization: `Bearer ${accessToken3}`,
14177
14177
  "content-type": "application/json"
14178
14178
  },
14179
14179
  body: JSON.stringify(body),
@@ -14777,37 +14777,37 @@ function googleCalendar(opts) {
14777
14777
  ]
14778
14778
  },
14779
14779
  async executeRead(inv) {
14780
- const accessToken2 = await ensureFreshAccessToken2(inv.source.credentials, clientId, clientSecret);
14780
+ const accessToken3 = await ensureFreshAccessToken2(inv.source.credentials, clientId, clientSecret);
14781
14781
  if (inv.capabilityName === "list_availability") {
14782
14782
  const calendarId = readMetaString(inv.source.metadata, "calendarId");
14783
14783
  const { timeMin, timeMax } = inv.args;
14784
- const fb = await freebusyQuery({ accessToken: accessToken2, calendarId, timeMin, timeMax, sourceId: inv.source.id });
14784
+ const fb = await freebusyQuery({ accessToken: accessToken3, calendarId, timeMin, timeMax, sourceId: inv.source.id });
14785
14785
  return {
14786
14786
  data: { busy: fb.busy },
14787
14787
  fetchedAt: Date.now()
14788
14788
  };
14789
14789
  }
14790
- if (inv.capabilityName === "get_event") return getEvent(inv, accessToken2, 15e3);
14791
- if (inv.capabilityName === "list_events") return listEvents(inv, accessToken2, 15e3);
14790
+ if (inv.capabilityName === "get_event") return getEvent(inv, accessToken3, 15e3);
14791
+ if (inv.capabilityName === "list_events") return listEvents(inv, accessToken3, 15e3);
14792
14792
  throw new Error(`google-calendar: unknown read capability ${inv.capabilityName}`);
14793
14793
  },
14794
14794
  async executeMutation(inv) {
14795
- const accessToken2 = await ensureFreshAccessToken2(inv.source.credentials, clientId, clientSecret);
14796
- if (inv.capabilityName === "create_event") return createEvent(inv, accessToken2, 15e3);
14797
- if (inv.capabilityName === "update_event") return updateEvent(inv, accessToken2, 15e3);
14798
- if (inv.capabilityName === "delete_event") return deleteEvent(inv, accessToken2, 15e3);
14795
+ const accessToken3 = await ensureFreshAccessToken2(inv.source.credentials, clientId, clientSecret);
14796
+ if (inv.capabilityName === "create_event") return createEvent(inv, accessToken3, 15e3);
14797
+ if (inv.capabilityName === "update_event") return updateEvent(inv, accessToken3, 15e3);
14798
+ if (inv.capabilityName === "delete_event") return deleteEvent(inv, accessToken3, 15e3);
14799
14799
  if (inv.capabilityName !== "book_slot") {
14800
14800
  throw new Error(`google-calendar: unknown mutation capability ${inv.capabilityName}`);
14801
14801
  }
14802
14802
  const calendarId = readMetaString(inv.source.metadata, "calendarId");
14803
14803
  const { start, end, summary, description, attendees } = inv.args;
14804
- const fb = await freebusyQuery({ accessToken: accessToken2, calendarId, timeMin: start, timeMax: end, sourceId: inv.source.id });
14804
+ const fb = await freebusyQuery({ accessToken: accessToken3, calendarId, timeMin: start, timeMax: end, sourceId: inv.source.id });
14805
14805
  if (fb.busy.length > 0) {
14806
14806
  const startMs = Date.parse(start);
14807
14807
  const endMs = Date.parse(end);
14808
14808
  const durMs = endMs - startMs;
14809
14809
  const alternatives = await findNextFreeSlots({
14810
- accessToken: accessToken2,
14810
+ accessToken: accessToken3,
14811
14811
  calendarId,
14812
14812
  searchFromMs: endMs,
14813
14813
  durationMs: durMs,
@@ -14833,7 +14833,7 @@ function googleCalendar(opts) {
14833
14833
  {
14834
14834
  method: "POST",
14835
14835
  headers: {
14836
- authorization: `Bearer ${accessToken2}`,
14836
+ authorization: `Bearer ${accessToken3}`,
14837
14837
  "content-type": "application/json"
14838
14838
  },
14839
14839
  body: JSON.stringify(event),
@@ -14901,11 +14901,11 @@ function googleCalendar(opts) {
14901
14901
  },
14902
14902
  async test(source) {
14903
14903
  try {
14904
- const accessToken2 = await ensureFreshAccessToken2(source.credentials, clientId, clientSecret);
14904
+ const accessToken3 = await ensureFreshAccessToken2(source.credentials, clientId, clientSecret);
14905
14905
  const calendarId = readMetaString(source.metadata, "calendarId");
14906
14906
  const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}`;
14907
14907
  const res = await fetch(url, {
14908
- headers: { authorization: `Bearer ${accessToken2}` },
14908
+ headers: { authorization: `Bearer ${accessToken3}` },
14909
14909
  signal: AbortSignal.timeout(8e3)
14910
14910
  });
14911
14911
  if (!res.ok) {
@@ -14927,7 +14927,7 @@ function resolveCalendarId(inv) {
14927
14927
  if (typeof fromMeta === "string" && fromMeta.length > 0) return fromMeta;
14928
14928
  return "primary";
14929
14929
  }
14930
- async function createEvent(inv, accessToken2, timeoutMs) {
14930
+ async function createEvent(inv, accessToken3, timeoutMs) {
14931
14931
  const args = inv.args;
14932
14932
  if (!args.start) throw new Error("google-calendar create_event: `start` is required");
14933
14933
  if (!args.end) throw new Error("google-calendar create_event: `end` is required");
@@ -14949,7 +14949,7 @@ async function createEvent(inv, accessToken2, timeoutMs) {
14949
14949
  const res = await fetch(url, {
14950
14950
  method: "POST",
14951
14951
  headers: {
14952
- authorization: `Bearer ${accessToken2}`,
14952
+ authorization: `Bearer ${accessToken3}`,
14953
14953
  "content-type": "application/json"
14954
14954
  },
14955
14955
  body: JSON.stringify(event),
@@ -14972,7 +14972,7 @@ async function createEvent(inv, accessToken2, timeoutMs) {
14972
14972
  idempotentReplay: false
14973
14973
  };
14974
14974
  }
14975
- async function updateEvent(inv, accessToken2, timeoutMs) {
14975
+ async function updateEvent(inv, accessToken3, timeoutMs) {
14976
14976
  const args = inv.args;
14977
14977
  if (!args.eventId) throw new Error("google-calendar update_event: `eventId` is required");
14978
14978
  const calendarId = resolveCalendarId(inv);
@@ -14990,7 +14990,7 @@ async function updateEvent(inv, accessToken2, timeoutMs) {
14990
14990
  const res = await fetch(url, {
14991
14991
  method: "PATCH",
14992
14992
  headers: {
14993
- authorization: `Bearer ${accessToken2}`,
14993
+ authorization: `Bearer ${accessToken3}`,
14994
14994
  "content-type": "application/json"
14995
14995
  },
14996
14996
  body: JSON.stringify(patch),
@@ -15012,7 +15012,7 @@ async function updateEvent(inv, accessToken2, timeoutMs) {
15012
15012
  idempotentReplay: false
15013
15013
  };
15014
15014
  }
15015
- async function deleteEvent(inv, accessToken2, timeoutMs) {
15015
+ async function deleteEvent(inv, accessToken3, timeoutMs) {
15016
15016
  const args = inv.args;
15017
15017
  if (!args.eventId) throw new Error("google-calendar delete_event: `eventId` is required");
15018
15018
  const calendarId = resolveCalendarId(inv);
@@ -15020,7 +15020,7 @@ async function deleteEvent(inv, accessToken2, timeoutMs) {
15020
15020
  const url = `${CAL_API}/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(args.eventId)}?sendUpdates=${encodeURIComponent(sendUpdates)}`;
15021
15021
  const res = await fetch(url, {
15022
15022
  method: "DELETE",
15023
- headers: { authorization: `Bearer ${accessToken2}` },
15023
+ headers: { authorization: `Bearer ${accessToken3}` },
15024
15024
  signal: AbortSignal.timeout(timeoutMs)
15025
15025
  });
15026
15026
  const idempotent = res.status === 404 || res.status === 410;
@@ -15034,13 +15034,13 @@ async function deleteEvent(inv, accessToken2, timeoutMs) {
15034
15034
  idempotentReplay: idempotent
15035
15035
  };
15036
15036
  }
15037
- async function getEvent(inv, accessToken2, timeoutMs) {
15037
+ async function getEvent(inv, accessToken3, timeoutMs) {
15038
15038
  const args = inv.args;
15039
15039
  if (!args.eventId) throw new Error("google-calendar get_event: `eventId` is required");
15040
15040
  const calendarId = resolveCalendarId(inv);
15041
15041
  const url = `${CAL_API}/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(args.eventId)}`;
15042
15042
  const res = await fetch(url, {
15043
- headers: { authorization: `Bearer ${accessToken2}` },
15043
+ headers: { authorization: `Bearer ${accessToken3}` },
15044
15044
  signal: AbortSignal.timeout(timeoutMs)
15045
15045
  });
15046
15046
  if (!res.ok) {
@@ -15052,7 +15052,7 @@ async function getEvent(inv, accessToken2, timeoutMs) {
15052
15052
  fetchedAt: Date.now()
15053
15053
  };
15054
15054
  }
15055
- async function listEvents(inv, accessToken2, timeoutMs) {
15055
+ async function listEvents(inv, accessToken3, timeoutMs) {
15056
15056
  const args = inv.args ?? {};
15057
15057
  const calendarId = resolveCalendarId(inv);
15058
15058
  const params = new URLSearchParams();
@@ -15066,7 +15066,7 @@ async function listEvents(inv, accessToken2, timeoutMs) {
15066
15066
  if (args.pageToken) params.set("pageToken", args.pageToken);
15067
15067
  const url = `${CAL_API}/calendars/${encodeURIComponent(calendarId)}/events?${params.toString()}`;
15068
15068
  const res = await fetch(url, {
15069
- headers: { authorization: `Bearer ${accessToken2}` },
15069
+ headers: { authorization: `Bearer ${accessToken3}` },
15070
15070
  signal: AbortSignal.timeout(timeoutMs)
15071
15071
  });
15072
15072
  if (!res.ok) {
@@ -15998,16 +15998,16 @@ function googleDocs(opts) {
15998
15998
  ]
15999
15999
  },
16000
16000
  async executeRead(inv) {
16001
- const accessToken2 = await ensureFreshAccessToken3(inv.source.credentials, clientId, clientSecret);
16002
- if (inv.capabilityName === "get_document") return getDocument(inv, accessToken2, timeoutMs);
16003
- if (inv.capabilityName === "export_document") return exportDocument(inv, accessToken2, timeoutMs);
16001
+ const accessToken3 = await ensureFreshAccessToken3(inv.source.credentials, clientId, clientSecret);
16002
+ if (inv.capabilityName === "get_document") return getDocument(inv, accessToken3, timeoutMs);
16003
+ if (inv.capabilityName === "export_document") return exportDocument(inv, accessToken3, timeoutMs);
16004
16004
  throw new Error(`google-docs: unknown read capability ${inv.capabilityName}`);
16005
16005
  },
16006
16006
  async executeMutation(inv) {
16007
- const accessToken2 = await ensureFreshAccessToken3(inv.source.credentials, clientId, clientSecret);
16008
- if (inv.capabilityName === "create_document") return createDocument(inv, accessToken2, timeoutMs);
16009
- if (inv.capabilityName === "append_text") return appendText(inv, accessToken2, timeoutMs);
16010
- if (inv.capabilityName === "delete_document") return deleteDocument(inv, accessToken2, timeoutMs);
16007
+ const accessToken3 = await ensureFreshAccessToken3(inv.source.credentials, clientId, clientSecret);
16008
+ if (inv.capabilityName === "create_document") return createDocument(inv, accessToken3, timeoutMs);
16009
+ if (inv.capabilityName === "append_text") return appendText(inv, accessToken3, timeoutMs);
16010
+ if (inv.capabilityName === "delete_document") return deleteDocument(inv, accessToken3, timeoutMs);
16011
16011
  throw new Error(`google-docs: unknown mutation capability ${inv.capabilityName}`);
16012
16012
  },
16013
16013
  async exchangeOAuth(input) {
@@ -16052,9 +16052,9 @@ function googleDocs(opts) {
16052
16052
  },
16053
16053
  async test(source) {
16054
16054
  try {
16055
- const accessToken2 = await ensureFreshAccessToken3(source.credentials, clientId, clientSecret);
16055
+ const accessToken3 = await ensureFreshAccessToken3(source.credentials, clientId, clientSecret);
16056
16056
  const res = await fetch("https://openidconnect.googleapis.com/v1/userinfo", {
16057
- headers: { authorization: `Bearer ${accessToken2}` },
16057
+ headers: { authorization: `Bearer ${accessToken3}` },
16058
16058
  signal: AbortSignal.timeout(8e3)
16059
16059
  });
16060
16060
  if (!res.ok) {
@@ -16090,10 +16090,10 @@ function findAppendIndex(doc) {
16090
16090
  }
16091
16091
  return Math.max(1, maxEnd - 1);
16092
16092
  }
16093
- async function getDocument(inv, accessToken2, timeoutMs) {
16093
+ async function getDocument(inv, accessToken3, timeoutMs) {
16094
16094
  const { documentId } = inv.args ?? {};
16095
16095
  const res = await fetch(`${API2}/documents/${encodeURIComponent(documentId)}`, {
16096
- headers: { authorization: `Bearer ${accessToken2}` },
16096
+ headers: { authorization: `Bearer ${accessToken3}` },
16097
16097
  signal: AbortSignal.timeout(timeoutMs)
16098
16098
  });
16099
16099
  if (res.status === 404) {
@@ -16117,7 +16117,7 @@ async function getDocument(inv, accessToken2, timeoutMs) {
16117
16117
  fetchedAt: Date.now()
16118
16118
  };
16119
16119
  }
16120
- async function createDocument(inv, accessToken2, timeoutMs) {
16120
+ async function createDocument(inv, accessToken3, timeoutMs) {
16121
16121
  const { title, body } = inv.args ?? {};
16122
16122
  if (!title || typeof title !== "string") {
16123
16123
  throw new Error("google-docs create_document: title is required");
@@ -16125,7 +16125,7 @@ async function createDocument(inv, accessToken2, timeoutMs) {
16125
16125
  const createRes = await fetch(`${API2}/documents`, {
16126
16126
  method: "POST",
16127
16127
  headers: {
16128
- authorization: `Bearer ${accessToken2}`,
16128
+ authorization: `Bearer ${accessToken3}`,
16129
16129
  "content-type": "application/json"
16130
16130
  },
16131
16131
  body: JSON.stringify({ title }),
@@ -16142,7 +16142,7 @@ async function createDocument(inv, accessToken2, timeoutMs) {
16142
16142
  {
16143
16143
  method: "POST",
16144
16144
  headers: {
16145
- authorization: `Bearer ${accessToken2}`,
16145
+ authorization: `Bearer ${accessToken3}`,
16146
16146
  "content-type": "application/json"
16147
16147
  },
16148
16148
  body: JSON.stringify({
@@ -16172,13 +16172,13 @@ async function createDocument(inv, accessToken2, timeoutMs) {
16172
16172
  idempotentReplay: false
16173
16173
  };
16174
16174
  }
16175
- async function appendText(inv, accessToken2, timeoutMs) {
16175
+ async function appendText(inv, accessToken3, timeoutMs) {
16176
16176
  const { documentId, text, requiredRevisionId } = inv.args ?? {};
16177
16177
  if (!text) {
16178
16178
  throw new Error("google-docs append_text: text is required");
16179
16179
  }
16180
16180
  const docRes = await fetch(`${API2}/documents/${encodeURIComponent(documentId)}?fields=documentId,revisionId,body(content(endIndex))`, {
16181
- headers: { authorization: `Bearer ${accessToken2}` },
16181
+ headers: { authorization: `Bearer ${accessToken3}` },
16182
16182
  signal: AbortSignal.timeout(timeoutMs)
16183
16183
  });
16184
16184
  if (docRes.status === 404) {
@@ -16207,7 +16207,7 @@ async function appendText(inv, accessToken2, timeoutMs) {
16207
16207
  {
16208
16208
  method: "POST",
16209
16209
  headers: {
16210
- authorization: `Bearer ${accessToken2}`,
16210
+ authorization: `Bearer ${accessToken3}`,
16211
16211
  "content-type": "application/json"
16212
16212
  },
16213
16213
  body: JSON.stringify(body),
@@ -16237,7 +16237,7 @@ async function appendText(inv, accessToken2, timeoutMs) {
16237
16237
  idempotentReplay: false
16238
16238
  };
16239
16239
  }
16240
- async function deleteDocument(inv, accessToken2, timeoutMs) {
16240
+ async function deleteDocument(inv, accessToken3, timeoutMs) {
16241
16241
  const { documentId } = inv.args ?? {};
16242
16242
  if (!documentId) {
16243
16243
  throw new Error("google-docs delete_document: documentId is required");
@@ -16245,7 +16245,7 @@ async function deleteDocument(inv, accessToken2, timeoutMs) {
16245
16245
  const res = await fetch(`${DRIVE_API}/files/${encodeURIComponent(documentId)}`, {
16246
16246
  method: "PATCH",
16247
16247
  headers: {
16248
- authorization: `Bearer ${accessToken2}`,
16248
+ authorization: `Bearer ${accessToken3}`,
16249
16249
  "content-type": "application/json"
16250
16250
  },
16251
16251
  body: JSON.stringify({ trashed: true }),
@@ -16265,7 +16265,7 @@ async function deleteDocument(inv, accessToken2, timeoutMs) {
16265
16265
  idempotentReplay: false
16266
16266
  };
16267
16267
  }
16268
- async function exportDocument(inv, accessToken2, timeoutMs) {
16268
+ async function exportDocument(inv, accessToken3, timeoutMs) {
16269
16269
  const { documentId, format, mimeType } = inv.args ?? {};
16270
16270
  if (!documentId) {
16271
16271
  throw new Error("google-docs export_document: documentId is required");
@@ -16278,7 +16278,7 @@ async function exportDocument(inv, accessToken2, timeoutMs) {
16278
16278
  }
16279
16279
  const url = `${DRIVE_API}/files/${encodeURIComponent(documentId)}/export?mimeType=${encodeURIComponent(resolvedMime)}`;
16280
16280
  const res = await fetch(url, {
16281
- headers: { authorization: `Bearer ${accessToken2}` },
16281
+ headers: { authorization: `Bearer ${accessToken3}` },
16282
16282
  signal: AbortSignal.timeout(timeoutMs)
16283
16283
  });
16284
16284
  if (res.status === 404) {
@@ -16472,18 +16472,18 @@ function googleDrive(opts) {
16472
16472
  ]
16473
16473
  },
16474
16474
  async executeRead(inv) {
16475
- const accessToken2 = await ensureFreshAccessToken4(inv.source.credentials, clientId, clientSecret);
16476
- if (inv.capabilityName === "list_files") return listFiles(inv, accessToken2, timeoutMs);
16477
- if (inv.capabilityName === "read_file") return readFile(inv, accessToken2, timeoutMs);
16475
+ const accessToken3 = await ensureFreshAccessToken4(inv.source.credentials, clientId, clientSecret);
16476
+ if (inv.capabilityName === "list_files") return listFiles(inv, accessToken3, timeoutMs);
16477
+ if (inv.capabilityName === "read_file") return readFile(inv, accessToken3, timeoutMs);
16478
16478
  throw new Error(`google-drive: unknown read capability ${inv.capabilityName}`);
16479
16479
  },
16480
16480
  async executeMutation(inv) {
16481
- const accessToken2 = await ensureFreshAccessToken4(inv.source.credentials, clientId, clientSecret);
16482
- if (inv.capabilityName === "watch_folder") return watchFolder(inv, accessToken2, timeoutMs);
16483
- if (inv.capabilityName === "upload_file") return uploadFile(inv, accessToken2, timeoutMs);
16484
- if (inv.capabilityName === "create_folder") return createFolder(inv, accessToken2, timeoutMs);
16485
- if (inv.capabilityName === "delete_file") return deleteFile(inv, accessToken2, timeoutMs);
16486
- if (inv.capabilityName === "move_file") return moveFile(inv, accessToken2, timeoutMs);
16481
+ const accessToken3 = await ensureFreshAccessToken4(inv.source.credentials, clientId, clientSecret);
16482
+ if (inv.capabilityName === "watch_folder") return watchFolder(inv, accessToken3, timeoutMs);
16483
+ if (inv.capabilityName === "upload_file") return uploadFile(inv, accessToken3, timeoutMs);
16484
+ if (inv.capabilityName === "create_folder") return createFolder(inv, accessToken3, timeoutMs);
16485
+ if (inv.capabilityName === "delete_file") return deleteFile(inv, accessToken3, timeoutMs);
16486
+ if (inv.capabilityName === "move_file") return moveFile(inv, accessToken3, timeoutMs);
16487
16487
  throw new Error(`google-drive: unknown mutation capability ${inv.capabilityName}`);
16488
16488
  },
16489
16489
  async exchangeOAuth(input) {
@@ -16525,9 +16525,9 @@ function googleDrive(opts) {
16525
16525
  },
16526
16526
  async test(source) {
16527
16527
  try {
16528
- const accessToken2 = await ensureFreshAccessToken4(source.credentials, clientId, clientSecret);
16528
+ const accessToken3 = await ensureFreshAccessToken4(source.credentials, clientId, clientSecret);
16529
16529
  const res = await fetch(`${API3}/about?fields=user`, {
16530
- headers: { authorization: `Bearer ${accessToken2}` },
16530
+ headers: { authorization: `Bearer ${accessToken3}` },
16531
16531
  signal: AbortSignal.timeout(8e3)
16532
16532
  });
16533
16533
  if (!res.ok) {
@@ -16542,7 +16542,7 @@ function googleDrive(opts) {
16542
16542
  };
16543
16543
  return adapter;
16544
16544
  }
16545
- async function listFiles(inv, accessToken2, timeoutMs) {
16545
+ async function listFiles(inv, accessToken3, timeoutMs) {
16546
16546
  const args = inv.args ?? {};
16547
16547
  const q = [];
16548
16548
  if (args.folderId) q.push(`'${args.folderId.replace(/'/g, "\\'")}' in parents`);
@@ -16555,7 +16555,7 @@ async function listFiles(inv, accessToken2, timeoutMs) {
16555
16555
  });
16556
16556
  if (args.pageToken) params.set("pageToken", args.pageToken);
16557
16557
  const res = await fetch(`${API3}/files?${params.toString()}`, {
16558
- headers: { authorization: `Bearer ${accessToken2}` },
16558
+ headers: { authorization: `Bearer ${accessToken3}` },
16559
16559
  signal: AbortSignal.timeout(timeoutMs)
16560
16560
  });
16561
16561
  if (!res.ok) {
@@ -16572,10 +16572,10 @@ var GOOGLE_NATIVE_DEFAULTS = {
16572
16572
  "application/vnd.google-apps.spreadsheet": "text/csv",
16573
16573
  "application/vnd.google-apps.presentation": "application/pdf"
16574
16574
  };
16575
- async function readFile(inv, accessToken2, timeoutMs) {
16575
+ async function readFile(inv, accessToken3, timeoutMs) {
16576
16576
  const { fileId, exportMime } = inv.args ?? {};
16577
16577
  const metaRes = await fetch(`${API3}/files/${encodeURIComponent(fileId)}?fields=id,name,mimeType,modifiedTime`, {
16578
- headers: { authorization: `Bearer ${accessToken2}` },
16578
+ headers: { authorization: `Bearer ${accessToken3}` },
16579
16579
  signal: AbortSignal.timeout(timeoutMs)
16580
16580
  });
16581
16581
  if (metaRes.status === 404) {
@@ -16590,7 +16590,7 @@ async function readFile(inv, accessToken2, timeoutMs) {
16590
16590
  if (isNative) {
16591
16591
  const targetMime = exportMime ?? GOOGLE_NATIVE_DEFAULTS[meta.mimeType] ?? "text/plain";
16592
16592
  const res2 = await fetch(`${API3}/files/${encodeURIComponent(fileId)}/export?mimeType=${encodeURIComponent(targetMime)}`, {
16593
- headers: { authorization: `Bearer ${accessToken2}` },
16593
+ headers: { authorization: `Bearer ${accessToken3}` },
16594
16594
  signal: AbortSignal.timeout(timeoutMs)
16595
16595
  });
16596
16596
  if (!res2.ok) {
@@ -16611,7 +16611,7 @@ async function readFile(inv, accessToken2, timeoutMs) {
16611
16611
  };
16612
16612
  }
16613
16613
  const res = await fetch(`${API3}/files/${encodeURIComponent(fileId)}?alt=media`, {
16614
- headers: { authorization: `Bearer ${accessToken2}` },
16614
+ headers: { authorization: `Bearer ${accessToken3}` },
16615
16615
  signal: AbortSignal.timeout(timeoutMs)
16616
16616
  });
16617
16617
  if (!res.ok) {
@@ -16631,7 +16631,7 @@ async function readFile(inv, accessToken2, timeoutMs) {
16631
16631
  fetchedAt
16632
16632
  };
16633
16633
  }
16634
- async function watchFolder(inv, accessToken2, timeoutMs) {
16634
+ async function watchFolder(inv, accessToken3, timeoutMs) {
16635
16635
  const { folderId, channelId, address, ttlMs } = inv.args;
16636
16636
  const body = {
16637
16637
  id: channelId,
@@ -16642,7 +16642,7 @@ async function watchFolder(inv, accessToken2, timeoutMs) {
16642
16642
  const res = await fetch(`${API3}/files/${encodeURIComponent(folderId)}/watch`, {
16643
16643
  method: "POST",
16644
16644
  headers: {
16645
- authorization: `Bearer ${accessToken2}`,
16645
+ authorization: `Bearer ${accessToken3}`,
16646
16646
  "content-type": "application/json"
16647
16647
  },
16648
16648
  body: JSON.stringify(body),
@@ -16668,7 +16668,7 @@ async function watchFolder(inv, accessToken2, timeoutMs) {
16668
16668
  idempotentReplay: false
16669
16669
  };
16670
16670
  }
16671
- async function uploadFile(inv, accessToken2, timeoutMs) {
16671
+ async function uploadFile(inv, accessToken3, timeoutMs) {
16672
16672
  const args = inv.args ?? {};
16673
16673
  if (!args.name) throw new Error("google-drive upload_file: `name` is required");
16674
16674
  if (args.content === void 0 || args.content === null) {
@@ -16697,7 +16697,7 @@ Content-Type: ${mimeType}\r
16697
16697
  const res = await fetch(`${UPLOAD_API}/files?uploadType=multipart&fields=id,name,mimeType,parents,modifiedTime,size,md5Checksum`, {
16698
16698
  method: "POST",
16699
16699
  headers: {
16700
- authorization: `Bearer ${accessToken2}`,
16700
+ authorization: `Bearer ${accessToken3}`,
16701
16701
  "content-type": `multipart/related; boundary=${boundary}`
16702
16702
  },
16703
16703
  body,
@@ -16722,7 +16722,7 @@ Content-Type: ${mimeType}\r
16722
16722
  idempotentReplay: false
16723
16723
  };
16724
16724
  }
16725
- async function createFolder(inv, accessToken2, timeoutMs) {
16725
+ async function createFolder(inv, accessToken3, timeoutMs) {
16726
16726
  const args = inv.args ?? {};
16727
16727
  if (!args.name) throw new Error("google-drive create_folder: `name` is required");
16728
16728
  const body = {
@@ -16733,7 +16733,7 @@ async function createFolder(inv, accessToken2, timeoutMs) {
16733
16733
  const res = await fetch(`${API3}/files?fields=id,name,mimeType,parents,modifiedTime`, {
16734
16734
  method: "POST",
16735
16735
  headers: {
16736
- authorization: `Bearer ${accessToken2}`,
16736
+ authorization: `Bearer ${accessToken3}`,
16737
16737
  "content-type": "application/json"
16738
16738
  },
16739
16739
  body: JSON.stringify(body),
@@ -16756,12 +16756,12 @@ async function createFolder(inv, accessToken2, timeoutMs) {
16756
16756
  idempotentReplay: false
16757
16757
  };
16758
16758
  }
16759
- async function deleteFile(inv, accessToken2, timeoutMs) {
16759
+ async function deleteFile(inv, accessToken3, timeoutMs) {
16760
16760
  const args = inv.args ?? {};
16761
16761
  if (!args.fileId) throw new Error("google-drive delete_file: `fileId` is required");
16762
16762
  const res = await fetch(`${API3}/files/${encodeURIComponent(args.fileId)}`, {
16763
16763
  method: "DELETE",
16764
- headers: { authorization: `Bearer ${accessToken2}` },
16764
+ headers: { authorization: `Bearer ${accessToken3}` },
16765
16765
  signal: AbortSignal.timeout(timeoutMs)
16766
16766
  });
16767
16767
  if (!res.ok && res.status !== 204) {
@@ -16774,7 +16774,7 @@ async function deleteFile(inv, accessToken2, timeoutMs) {
16774
16774
  idempotentReplay: false
16775
16775
  };
16776
16776
  }
16777
- async function moveFile(inv, accessToken2, timeoutMs) {
16777
+ async function moveFile(inv, accessToken3, timeoutMs) {
16778
16778
  const args = inv.args ?? {};
16779
16779
  if (!args.fileId) throw new Error("google-drive move_file: `fileId` is required");
16780
16780
  if (!args.addParents?.length && !args.removeParents?.length) {
@@ -16786,7 +16786,7 @@ async function moveFile(inv, accessToken2, timeoutMs) {
16786
16786
  const res = await fetch(`${API3}/files/${encodeURIComponent(args.fileId)}?${params.toString()}`, {
16787
16787
  method: "PATCH",
16788
16788
  headers: {
16789
- authorization: `Bearer ${accessToken2}`,
16789
+ authorization: `Bearer ${accessToken3}`,
16790
16790
  "content-type": "application/json"
16791
16791
  },
16792
16792
  // Empty body — the parent changes ride on the query string per the
@@ -16981,16 +16981,16 @@ function googleForms(opts) {
16981
16981
  ]
16982
16982
  },
16983
16983
  async executeRead(inv) {
16984
- const accessToken2 = await ensureFreshAccessToken5(inv.source.credentials, clientId, clientSecret);
16985
- if (inv.capabilityName === "get_form") return getForm(inv, accessToken2, timeoutMs);
16986
- if (inv.capabilityName === "list_responses") return listResponses(inv, accessToken2, timeoutMs);
16987
- if (inv.capabilityName === "get_response") return getResponse(inv, accessToken2, timeoutMs);
16984
+ const accessToken3 = await ensureFreshAccessToken5(inv.source.credentials, clientId, clientSecret);
16985
+ if (inv.capabilityName === "get_form") return getForm(inv, accessToken3, timeoutMs);
16986
+ if (inv.capabilityName === "list_responses") return listResponses(inv, accessToken3, timeoutMs);
16987
+ if (inv.capabilityName === "get_response") return getResponse(inv, accessToken3, timeoutMs);
16988
16988
  throw new Error(`google-forms: unknown read capability ${inv.capabilityName}`);
16989
16989
  },
16990
16990
  async executeMutation(inv) {
16991
- const accessToken2 = await ensureFreshAccessToken5(inv.source.credentials, clientId, clientSecret);
16992
- if (inv.capabilityName === "create_form") return createForm(inv, accessToken2, timeoutMs);
16993
- if (inv.capabilityName === "batch_update") return batchUpdate(inv, accessToken2, timeoutMs);
16991
+ const accessToken3 = await ensureFreshAccessToken5(inv.source.credentials, clientId, clientSecret);
16992
+ if (inv.capabilityName === "create_form") return createForm(inv, accessToken3, timeoutMs);
16993
+ if (inv.capabilityName === "batch_update") return batchUpdate(inv, accessToken3, timeoutMs);
16994
16994
  throw new Error(`google-forms: unknown mutation capability ${inv.capabilityName}`);
16995
16995
  },
16996
16996
  async exchangeOAuth(input) {
@@ -17035,9 +17035,9 @@ function googleForms(opts) {
17035
17035
  },
17036
17036
  async test(source) {
17037
17037
  try {
17038
- const accessToken2 = await ensureFreshAccessToken5(source.credentials, clientId, clientSecret);
17038
+ const accessToken3 = await ensureFreshAccessToken5(source.credentials, clientId, clientSecret);
17039
17039
  const res = await fetch("https://openidconnect.googleapis.com/v1/userinfo", {
17040
- headers: { authorization: `Bearer ${accessToken2}` },
17040
+ headers: { authorization: `Bearer ${accessToken3}` },
17041
17041
  signal: AbortSignal.timeout(8e3)
17042
17042
  });
17043
17043
  if (!res.ok) {
@@ -17064,11 +17064,11 @@ function flattenAnswers(answers) {
17064
17064
  }
17065
17065
  return out;
17066
17066
  }
17067
- async function getForm(inv, accessToken2, timeoutMs) {
17067
+ async function getForm(inv, accessToken3, timeoutMs) {
17068
17068
  const { formId } = inv.args ?? {};
17069
17069
  if (!formId) throw new Error("google-forms get_form: formId is required");
17070
17070
  const res = await fetch(`${API4}/forms/${encodeURIComponent(formId)}`, {
17071
- headers: { authorization: `Bearer ${accessToken2}` },
17071
+ headers: { authorization: `Bearer ${accessToken3}` },
17072
17072
  signal: AbortSignal.timeout(timeoutMs)
17073
17073
  });
17074
17074
  if (res.status === 404) {
@@ -17077,20 +17077,20 @@ async function getForm(inv, accessToken2, timeoutMs) {
17077
17077
  if (!res.ok) {
17078
17078
  throw await googleApiError(res, "google-forms get_form", inv.source.id);
17079
17079
  }
17080
- const form = await res.json();
17080
+ const form2 = await res.json();
17081
17081
  return {
17082
17082
  data: {
17083
- formId: form.formId,
17084
- info: form.info ?? {},
17085
- items: form.items ?? [],
17086
- revisionId: form.revisionId,
17087
- responderUri: form.responderUri
17083
+ formId: form2.formId,
17084
+ info: form2.info ?? {},
17085
+ items: form2.items ?? [],
17086
+ revisionId: form2.revisionId,
17087
+ responderUri: form2.responderUri
17088
17088
  },
17089
- etag: form.revisionId,
17089
+ etag: form2.revisionId,
17090
17090
  fetchedAt: Date.now()
17091
17091
  };
17092
17092
  }
17093
- async function listResponses(inv, accessToken2, timeoutMs) {
17093
+ async function listResponses(inv, accessToken3, timeoutMs) {
17094
17094
  const { formId, pageSize, pageToken, filter } = inv.args ?? {};
17095
17095
  if (!formId) throw new Error("google-forms list_responses: formId is required");
17096
17096
  const params = new URLSearchParams();
@@ -17100,7 +17100,7 @@ async function listResponses(inv, accessToken2, timeoutMs) {
17100
17100
  const qs = params.toString();
17101
17101
  const url = `${API4}/forms/${encodeURIComponent(formId)}/responses${qs ? `?${qs}` : ""}`;
17102
17102
  const res = await fetch(url, {
17103
- headers: { authorization: `Bearer ${accessToken2}` },
17103
+ headers: { authorization: `Bearer ${accessToken3}` },
17104
17104
  signal: AbortSignal.timeout(timeoutMs)
17105
17105
  });
17106
17106
  if (res.status === 404) {
@@ -17126,14 +17126,14 @@ async function listResponses(inv, accessToken2, timeoutMs) {
17126
17126
  fetchedAt: Date.now()
17127
17127
  };
17128
17128
  }
17129
- async function getResponse(inv, accessToken2, timeoutMs) {
17129
+ async function getResponse(inv, accessToken3, timeoutMs) {
17130
17130
  const { formId, responseId } = inv.args ?? {};
17131
17131
  if (!formId) throw new Error("google-forms get_response: formId is required");
17132
17132
  if (!responseId) throw new Error("google-forms get_response: responseId is required");
17133
17133
  const res = await fetch(
17134
17134
  `${API4}/forms/${encodeURIComponent(formId)}/responses/${encodeURIComponent(responseId)}`,
17135
17135
  {
17136
- headers: { authorization: `Bearer ${accessToken2}` },
17136
+ headers: { authorization: `Bearer ${accessToken3}` },
17137
17137
  signal: AbortSignal.timeout(timeoutMs)
17138
17138
  }
17139
17139
  );
@@ -17156,7 +17156,7 @@ async function getResponse(inv, accessToken2, timeoutMs) {
17156
17156
  fetchedAt: Date.now()
17157
17157
  };
17158
17158
  }
17159
- async function createForm(inv, accessToken2, timeoutMs) {
17159
+ async function createForm(inv, accessToken3, timeoutMs) {
17160
17160
  const { title, documentTitle } = inv.args ?? {};
17161
17161
  if (!title) throw new Error("google-forms create_form: title is required");
17162
17162
  const info = { title };
@@ -17164,7 +17164,7 @@ async function createForm(inv, accessToken2, timeoutMs) {
17164
17164
  const res = await fetch(`${API4}/forms`, {
17165
17165
  method: "POST",
17166
17166
  headers: {
17167
- authorization: `Bearer ${accessToken2}`,
17167
+ authorization: `Bearer ${accessToken3}`,
17168
17168
  "content-type": "application/json"
17169
17169
  },
17170
17170
  body: JSON.stringify({ info }),
@@ -17173,21 +17173,21 @@ async function createForm(inv, accessToken2, timeoutMs) {
17173
17173
  if (!res.ok) {
17174
17174
  throw await googleApiError(res, "google-forms create_form", inv.source.id);
17175
17175
  }
17176
- const form = await res.json();
17176
+ const form2 = await res.json();
17177
17177
  return {
17178
17178
  status: "committed",
17179
17179
  data: {
17180
- formId: form.formId,
17181
- info: form.info ?? {},
17182
- items: form.items ?? [],
17183
- revisionId: form.revisionId,
17184
- responderUri: form.responderUri
17180
+ formId: form2.formId,
17181
+ info: form2.info ?? {},
17182
+ items: form2.items ?? [],
17183
+ revisionId: form2.revisionId,
17184
+ responderUri: form2.responderUri
17185
17185
  },
17186
17186
  committedAt: Date.now(),
17187
17187
  idempotentReplay: false
17188
17188
  };
17189
17189
  }
17190
- async function batchUpdate(inv, accessToken2, timeoutMs) {
17190
+ async function batchUpdate(inv, accessToken3, timeoutMs) {
17191
17191
  const { formId, requests, includeFormInResponse, writeControl } = inv.args ?? {};
17192
17192
  if (!formId) throw new Error("google-forms batch_update: formId is required");
17193
17193
  if (!Array.isArray(requests) || requests.length === 0) {
@@ -17199,7 +17199,7 @@ async function batchUpdate(inv, accessToken2, timeoutMs) {
17199
17199
  const res = await fetch(`${API4}/forms/${encodeURIComponent(formId)}:batchUpdate`, {
17200
17200
  method: "POST",
17201
17201
  headers: {
17202
- authorization: `Bearer ${accessToken2}`,
17202
+ authorization: `Bearer ${accessToken3}`,
17203
17203
  "content-type": "application/json"
17204
17204
  },
17205
17205
  body: JSON.stringify(body),
@@ -17379,8 +17379,8 @@ function googleSheets(opts) {
17379
17379
  },
17380
17380
  async executeRead(inv) {
17381
17381
  const meta = readSheetMeta(inv.source.metadata);
17382
- const accessToken2 = await ensureFreshAccessToken6(inv.source.credentials, clientId, clientSecret);
17383
- const rows = await fetchAllRows(accessToken2, meta);
17382
+ const accessToken3 = await ensureFreshAccessToken6(inv.source.credentials, clientId, clientSecret);
17383
+ const rows = await fetchAllRows(accessToken3, meta);
17384
17384
  const limit = clampLimit(inv.args.limit, 100);
17385
17385
  let filtered = rows;
17386
17386
  if (inv.capabilityName === "query_rows") {
@@ -17402,11 +17402,11 @@ function googleSheets(opts) {
17402
17402
  };
17403
17403
  },
17404
17404
  async executeMutation(inv) {
17405
- const accessToken2 = await ensureFreshAccessToken6(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
17406
- if (inv.capabilityName === "update_row") return updateRow(inv, accessToken2, 15e3);
17407
- if (inv.capabilityName === "append_row") return appendRow(inv, accessToken2, 15e3);
17408
- if (inv.capabilityName === "clear_range") return clearRange(inv, accessToken2, 15e3);
17409
- if (inv.capabilityName === "create_sheet") return createSheet(inv, accessToken2, 15e3);
17405
+ const accessToken3 = await ensureFreshAccessToken6(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
17406
+ if (inv.capabilityName === "update_row") return updateRow(inv, accessToken3, 15e3);
17407
+ if (inv.capabilityName === "append_row") return appendRow(inv, accessToken3, 15e3);
17408
+ if (inv.capabilityName === "clear_range") return clearRange(inv, accessToken3, 15e3);
17409
+ if (inv.capabilityName === "create_sheet") return createSheet(inv, accessToken3, 15e3);
17410
17410
  throw new Error(`google-sheets: unknown mutation ${inv.capabilityName}`);
17411
17411
  },
17412
17412
  async exchangeOAuth(input) {
@@ -17450,14 +17450,14 @@ function googleSheets(opts) {
17450
17450
  },
17451
17451
  async test(source) {
17452
17452
  try {
17453
- const accessToken2 = await ensureFreshAccessToken6(source.credentials, clientId, clientSecret);
17453
+ const accessToken3 = await ensureFreshAccessToken6(source.credentials, clientId, clientSecret);
17454
17454
  const meta = readSheetMeta(source.metadata);
17455
17455
  if (!meta.spreadsheetId) {
17456
17456
  return { ok: false, reason: "spreadsheetId not configured \u2014 pick a sheet in the connection settings" };
17457
17457
  }
17458
17458
  const url = `https://sheets.googleapis.com/v4/spreadsheets/${encodeURIComponent(meta.spreadsheetId)}?fields=spreadsheetId,properties.title`;
17459
17459
  const res = await fetch(url, {
17460
- headers: { authorization: `Bearer ${accessToken2}` },
17460
+ headers: { authorization: `Bearer ${accessToken3}` },
17461
17461
  signal: AbortSignal.timeout(8e3)
17462
17462
  });
17463
17463
  if (!res.ok) {
@@ -17483,11 +17483,11 @@ function readSheetMeta(meta) {
17483
17483
  }
17484
17484
  return { spreadsheetId, sheetName, headerRow, keyColumn, headers };
17485
17485
  }
17486
- async function fetchAllRows(accessToken2, meta) {
17486
+ async function fetchAllRows(accessToken3, meta) {
17487
17487
  const range = `${meta.sheetName}`;
17488
17488
  const url = `https://sheets.googleapis.com/v4/spreadsheets/${encodeURIComponent(meta.spreadsheetId)}/values/${encodeURIComponent(range)}`;
17489
17489
  const res = await fetch(url, {
17490
- headers: { authorization: `Bearer ${accessToken2}` },
17490
+ headers: { authorization: `Bearer ${accessToken3}` },
17491
17491
  signal: AbortSignal.timeout(15e3)
17492
17492
  });
17493
17493
  if (!res.ok) {
@@ -17571,10 +17571,10 @@ async function ensureFreshAccessToken6(creds, clientId, clientSecret, onCredenti
17571
17571
  });
17572
17572
  return creds.accessToken;
17573
17573
  }
17574
- async function updateRow(inv, accessToken2, timeoutMs) {
17574
+ async function updateRow(inv, accessToken3, timeoutMs) {
17575
17575
  const meta = readSheetMeta(inv.source.metadata);
17576
17576
  const { rowKey, patch, expectedFingerprint } = inv.args;
17577
- const rows = await fetchAllRows(accessToken2, meta);
17577
+ const rows = await fetchAllRows(accessToken3, meta);
17578
17578
  const target = rows.find((r) => normalizeKey(r.values[meta.keyColumn]) === normalizeKey(rowKey));
17579
17579
  if (!target) {
17580
17580
  throw new ResourceContention(
@@ -17598,7 +17598,7 @@ async function updateRow(inv, accessToken2, timeoutMs) {
17598
17598
  const res = await fetch(url, {
17599
17599
  method: "PUT",
17600
17600
  headers: {
17601
- authorization: `Bearer ${accessToken2}`,
17601
+ authorization: `Bearer ${accessToken3}`,
17602
17602
  "content-type": "application/json"
17603
17603
  },
17604
17604
  body: JSON.stringify({ values: [updatedValues] }),
@@ -17622,7 +17622,7 @@ async function updateRow(inv, accessToken2, timeoutMs) {
17622
17622
  idempotentReplay: false
17623
17623
  };
17624
17624
  }
17625
- async function appendRow(inv, accessToken2, timeoutMs) {
17625
+ async function appendRow(inv, accessToken3, timeoutMs) {
17626
17626
  const args = inv.args;
17627
17627
  if (!args.spreadsheetId) throw new Error("google-sheets append_row: `spreadsheetId` is required");
17628
17628
  if (!args.range) throw new Error("google-sheets append_row: `range` is required");
@@ -17634,7 +17634,7 @@ async function appendRow(inv, accessToken2, timeoutMs) {
17634
17634
  const res = await fetch(url, {
17635
17635
  method: "POST",
17636
17636
  headers: {
17637
- authorization: `Bearer ${accessToken2}`,
17637
+ authorization: `Bearer ${accessToken3}`,
17638
17638
  "content-type": "application/json"
17639
17639
  },
17640
17640
  body: JSON.stringify({ values: args.values }),
@@ -17658,7 +17658,7 @@ async function appendRow(inv, accessToken2, timeoutMs) {
17658
17658
  idempotentReplay: false
17659
17659
  };
17660
17660
  }
17661
- async function clearRange(inv, accessToken2, timeoutMs) {
17661
+ async function clearRange(inv, accessToken3, timeoutMs) {
17662
17662
  const args = inv.args;
17663
17663
  if (!args.spreadsheetId) throw new Error("google-sheets clear_range: `spreadsheetId` is required");
17664
17664
  if (!args.range) throw new Error("google-sheets clear_range: `range` is required");
@@ -17666,7 +17666,7 @@ async function clearRange(inv, accessToken2, timeoutMs) {
17666
17666
  const res = await fetch(url, {
17667
17667
  method: "POST",
17668
17668
  headers: {
17669
- authorization: `Bearer ${accessToken2}`,
17669
+ authorization: `Bearer ${accessToken3}`,
17670
17670
  "content-type": "application/json"
17671
17671
  },
17672
17672
  body: "{}",
@@ -17686,14 +17686,14 @@ async function clearRange(inv, accessToken2, timeoutMs) {
17686
17686
  idempotentReplay: false
17687
17687
  };
17688
17688
  }
17689
- async function createSheet(inv, accessToken2, timeoutMs) {
17689
+ async function createSheet(inv, accessToken3, timeoutMs) {
17690
17690
  const args = inv.args;
17691
17691
  if (!args.title) throw new Error("google-sheets create_sheet: `title` is required");
17692
17692
  const url = "https://sheets.googleapis.com/v4/spreadsheets";
17693
17693
  const res = await fetch(url, {
17694
17694
  method: "POST",
17695
17695
  headers: {
17696
- authorization: `Bearer ${accessToken2}`,
17696
+ authorization: `Bearer ${accessToken3}`,
17697
17697
  "content-type": "application/json"
17698
17698
  },
17699
17699
  body: JSON.stringify({ properties: { title: args.title } }),
@@ -18382,7 +18382,7 @@ var TOKEN_URL7 = "https://app.hellosign.com/oauth/token";
18382
18382
  var DEFAULT_API_BASE = "https://api.hellosign.com/v3";
18383
18383
  function hellosign(opts) {
18384
18384
  const { clientId, clientSecret } = opts;
18385
- const baseUrl2 = (opts.baseUrl ?? DEFAULT_API_BASE).replace(/\/$/, "");
18385
+ const baseUrl3 = (opts.baseUrl ?? DEFAULT_API_BASE).replace(/\/$/, "");
18386
18386
  const timeoutMs = opts.timeoutMs ?? 3e4;
18387
18387
  const adapter = {
18388
18388
  manifest: {
@@ -18502,11 +18502,11 @@ function hellosign(opts) {
18502
18502
  if (inv.capabilityName !== "get_signature_request") {
18503
18503
  throw new Error(`hellosign: unknown read capability ${inv.capabilityName}`);
18504
18504
  }
18505
- const accessToken2 = await ensureFreshAccessToken7(inv.source.credentials, clientId, clientSecret, inv);
18505
+ const accessToken3 = await ensureFreshAccessToken7(inv.source.credentials, clientId, clientSecret, inv);
18506
18506
  const { signatureRequestId } = inv.args;
18507
- const res = await fetch(`${baseUrl2}/signature_request/${encodeURIComponent(signatureRequestId)}`, {
18507
+ const res = await fetch(`${baseUrl3}/signature_request/${encodeURIComponent(signatureRequestId)}`, {
18508
18508
  headers: {
18509
- authorization: `Bearer ${accessToken2}`,
18509
+ authorization: `Bearer ${accessToken3}`,
18510
18510
  accept: "application/json"
18511
18511
  },
18512
18512
  signal: AbortSignal.timeout(timeoutMs)
@@ -18532,15 +18532,15 @@ function hellosign(opts) {
18532
18532
  };
18533
18533
  },
18534
18534
  async executeMutation(inv) {
18535
- const accessToken2 = await ensureFreshAccessToken7(inv.source.credentials, clientId, clientSecret, inv);
18535
+ const accessToken3 = await ensureFreshAccessToken7(inv.source.credentials, clientId, clientSecret, inv);
18536
18536
  if (inv.capabilityName === "send_signature_request") {
18537
- return sendSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs);
18537
+ return sendSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs);
18538
18538
  }
18539
18539
  if (inv.capabilityName === "cancel_signature_request") {
18540
- return cancelSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs);
18540
+ return cancelSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs);
18541
18541
  }
18542
18542
  if (inv.capabilityName === "remind_signature_request") {
18543
- return remindSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs);
18543
+ return remindSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs);
18544
18544
  }
18545
18545
  throw new Error(`hellosign: unknown mutation capability ${inv.capabilityName}`);
18546
18546
  },
@@ -18626,9 +18626,9 @@ function hellosign(opts) {
18626
18626
  },
18627
18627
  async test(source) {
18628
18628
  try {
18629
- const accessToken2 = await ensureFreshAccessToken7(source.credentials, clientId, clientSecret);
18630
- const res = await fetch(`${baseUrl2}/account`, {
18631
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
18629
+ const accessToken3 = await ensureFreshAccessToken7(source.credentials, clientId, clientSecret);
18630
+ const res = await fetch(`${baseUrl3}/account`, {
18631
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
18632
18632
  signal: AbortSignal.timeout(8e3)
18633
18633
  });
18634
18634
  if (res.status === 401 || res.status === 403) {
@@ -18675,7 +18675,7 @@ function normalizeSignatureRequest(sr) {
18675
18675
  }))
18676
18676
  };
18677
18677
  }
18678
- async function sendSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18678
+ async function sendSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs) {
18679
18679
  const { templateIds, signers, subject, message, testMode, customFields } = inv.args;
18680
18680
  if (!Array.isArray(templateIds) || templateIds.length === 0) {
18681
18681
  throw new Error("hellosign send_signature_request: templateIds must be a non-empty array");
@@ -18694,10 +18694,10 @@ async function sendSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18694
18694
  if (customFields && customFields.length > 0) {
18695
18695
  body.custom_fields = customFields.map((cf) => ({ name: cf.name, value: cf.value }));
18696
18696
  }
18697
- const res = await fetch(`${baseUrl2}/signature_request/send_with_template`, {
18697
+ const res = await fetch(`${baseUrl3}/signature_request/send_with_template`, {
18698
18698
  method: "POST",
18699
18699
  headers: {
18700
- authorization: `Bearer ${accessToken2}`,
18700
+ authorization: `Bearer ${accessToken3}`,
18701
18701
  "content-type": "application/json",
18702
18702
  accept: "application/json"
18703
18703
  },
@@ -18735,12 +18735,12 @@ async function sendSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18735
18735
  idempotentReplay: false
18736
18736
  };
18737
18737
  }
18738
- async function cancelSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18738
+ async function cancelSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs) {
18739
18739
  const { signatureRequestId } = inv.args;
18740
- const res = await fetch(`${baseUrl2}/signature_request/cancel/${encodeURIComponent(signatureRequestId)}`, {
18740
+ const res = await fetch(`${baseUrl3}/signature_request/cancel/${encodeURIComponent(signatureRequestId)}`, {
18741
18741
  method: "POST",
18742
18742
  headers: {
18743
- authorization: `Bearer ${accessToken2}`,
18743
+ authorization: `Bearer ${accessToken3}`,
18744
18744
  accept: "application/json"
18745
18745
  },
18746
18746
  signal: AbortSignal.timeout(timeoutMs)
@@ -18777,7 +18777,7 @@ async function cancelSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18777
18777
  idempotentReplay: false
18778
18778
  };
18779
18779
  }
18780
- async function remindSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18780
+ async function remindSignatureRequest(inv, accessToken3, baseUrl3, timeoutMs) {
18781
18781
  const { signatureRequestId, emailAddress: emailAddress5, name } = inv.args;
18782
18782
  if (typeof signatureRequestId !== "string" || signatureRequestId.length === 0) {
18783
18783
  throw new Error("hellosign remind_signature_request: signatureRequestId is required");
@@ -18787,10 +18787,10 @@ async function remindSignatureRequest(inv, accessToken2, baseUrl2, timeoutMs) {
18787
18787
  }
18788
18788
  const body = { email_address: emailAddress5 };
18789
18789
  if (name) body.name = name;
18790
- const res = await fetch(`${baseUrl2}/signature_request/remind/${encodeURIComponent(signatureRequestId)}`, {
18790
+ const res = await fetch(`${baseUrl3}/signature_request/remind/${encodeURIComponent(signatureRequestId)}`, {
18791
18791
  method: "POST",
18792
18792
  headers: {
18793
- authorization: `Bearer ${accessToken2}`,
18793
+ authorization: `Bearer ${accessToken3}`,
18794
18794
  "content-type": "application/json",
18795
18795
  accept: "application/json"
18796
18796
  },
@@ -19204,11 +19204,11 @@ function hubspot(opts) {
19204
19204
  throw new Error(`hubspot: unknown read capability ${inv.capabilityName}`);
19205
19205
  }
19206
19206
  const { email } = inv.args;
19207
- const accessToken2 = await ensureFreshAccessToken8(inv.source.credentials, clientId, clientSecret);
19207
+ const accessToken3 = await ensureFreshAccessToken8(inv.source.credentials, clientId, clientSecret);
19208
19208
  const res = await fetch(`${API5}/crm/v3/objects/contacts/search`, {
19209
19209
  method: "POST",
19210
19210
  headers: {
19211
- authorization: `Bearer ${accessToken2}`,
19211
+ authorization: `Bearer ${accessToken3}`,
19212
19212
  "content-type": "application/json"
19213
19213
  },
19214
19214
  body: JSON.stringify({
@@ -19237,21 +19237,21 @@ function hubspot(opts) {
19237
19237
  };
19238
19238
  },
19239
19239
  async executeMutation(inv) {
19240
- const accessToken2 = await ensureFreshAccessToken8(inv.source.credentials, clientId, clientSecret);
19240
+ const accessToken3 = await ensureFreshAccessToken8(inv.source.credentials, clientId, clientSecret);
19241
19241
  if (inv.capabilityName === "upsert_contact") {
19242
- return upsertContact(inv, accessToken2);
19242
+ return upsertContact(inv, accessToken3);
19243
19243
  }
19244
19244
  if (inv.capabilityName === "create_note") {
19245
- return createNote(inv, accessToken2);
19245
+ return createNote(inv, accessToken3);
19246
19246
  }
19247
19247
  if (inv.capabilityName === "create_deal") {
19248
- return createDeal(inv, accessToken2, 15e3);
19248
+ return createDeal(inv, accessToken3, 15e3);
19249
19249
  }
19250
19250
  if (inv.capabilityName === "update_deal_stage") {
19251
- return updateDealStage(inv, accessToken2, 15e3);
19251
+ return updateDealStage(inv, accessToken3, 15e3);
19252
19252
  }
19253
19253
  if (inv.capabilityName === "create_ticket") {
19254
- return createTicket(inv, accessToken2, 15e3);
19254
+ return createTicket(inv, accessToken3, 15e3);
19255
19255
  }
19256
19256
  throw new Error(`hubspot: unknown mutation capability ${inv.capabilityName}`);
19257
19257
  },
@@ -19297,8 +19297,8 @@ function hubspot(opts) {
19297
19297
  },
19298
19298
  async test(source) {
19299
19299
  try {
19300
- const accessToken2 = await ensureFreshAccessToken8(source.credentials, clientId, clientSecret);
19301
- const res = await fetch(`${API5}/oauth/v1/access-tokens/${encodeURIComponent(accessToken2)}`, {
19300
+ const accessToken3 = await ensureFreshAccessToken8(source.credentials, clientId, clientSecret);
19301
+ const res = await fetch(`${API5}/oauth/v1/access-tokens/${encodeURIComponent(accessToken3)}`, {
19302
19302
  signal: AbortSignal.timeout(8e3)
19303
19303
  });
19304
19304
  if (res.status === 401 || res.status === 403 || res.status === 404) {
@@ -19313,7 +19313,7 @@ function hubspot(opts) {
19313
19313
  };
19314
19314
  return adapter;
19315
19315
  }
19316
- async function upsertContact(inv, accessToken2) {
19316
+ async function upsertContact(inv, accessToken3) {
19317
19317
  const { email, properties } = inv.args;
19318
19318
  const idemKey = sanitizeIdempotencyKey(inv.idempotencyKey);
19319
19319
  const url = `${API5}/crm/v3/objects/contacts/batch/upsert?idempotencyKey=${encodeURIComponent(idemKey)}`;
@@ -19329,7 +19329,7 @@ async function upsertContact(inv, accessToken2) {
19329
19329
  const res = await fetch(url, {
19330
19330
  method: "POST",
19331
19331
  headers: {
19332
- authorization: `Bearer ${accessToken2}`,
19332
+ authorization: `Bearer ${accessToken3}`,
19333
19333
  "content-type": "application/json"
19334
19334
  },
19335
19335
  body: JSON.stringify(body),
@@ -19359,7 +19359,7 @@ async function upsertContact(inv, accessToken2) {
19359
19359
  idempotentReplay: false
19360
19360
  };
19361
19361
  }
19362
- async function createNote(inv, accessToken2) {
19362
+ async function createNote(inv, accessToken3) {
19363
19363
  const { contactId, body } = inv.args;
19364
19364
  const idemKey = sanitizeIdempotencyKey(inv.idempotencyKey);
19365
19365
  const url = `${API5}/crm/v3/objects/notes/batch/create?idempotencyKey=${encodeURIComponent(idemKey)}`;
@@ -19383,7 +19383,7 @@ async function createNote(inv, accessToken2) {
19383
19383
  const res = await fetch(url, {
19384
19384
  method: "POST",
19385
19385
  headers: {
19386
- authorization: `Bearer ${accessToken2}`,
19386
+ authorization: `Bearer ${accessToken3}`,
19387
19387
  "content-type": "application/json"
19388
19388
  },
19389
19389
  body: JSON.stringify(payload),
@@ -19412,7 +19412,7 @@ async function createNote(inv, accessToken2) {
19412
19412
  idempotentReplay: false
19413
19413
  };
19414
19414
  }
19415
- async function createDeal(inv, accessToken2, timeoutMs) {
19415
+ async function createDeal(inv, accessToken3, timeoutMs) {
19416
19416
  const args = inv.args ?? {};
19417
19417
  if (!args.properties || typeof args.properties !== "object") {
19418
19418
  throw new Error("hubspot create_deal: `properties` is required");
@@ -19437,7 +19437,7 @@ async function createDeal(inv, accessToken2, timeoutMs) {
19437
19437
  const res = await fetch(`${API5}/crm/v3/objects/deals`, {
19438
19438
  method: "POST",
19439
19439
  headers: {
19440
- authorization: `Bearer ${accessToken2}`,
19440
+ authorization: `Bearer ${accessToken3}`,
19441
19441
  "content-type": "application/json",
19442
19442
  "X-Tangle-Idempotency-Key": inv.idempotencyKey
19443
19443
  },
@@ -19467,7 +19467,7 @@ async function createDeal(inv, accessToken2, timeoutMs) {
19467
19467
  idempotentReplay: false
19468
19468
  };
19469
19469
  }
19470
- async function updateDealStage(inv, accessToken2, timeoutMs) {
19470
+ async function updateDealStage(inv, accessToken3, timeoutMs) {
19471
19471
  const args = inv.args ?? {};
19472
19472
  if (!args.dealId) {
19473
19473
  throw new Error("hubspot update_deal_stage: `dealId` is required");
@@ -19480,7 +19480,7 @@ async function updateDealStage(inv, accessToken2, timeoutMs) {
19480
19480
  {
19481
19481
  method: "PATCH",
19482
19482
  headers: {
19483
- authorization: `Bearer ${accessToken2}`,
19483
+ authorization: `Bearer ${accessToken3}`,
19484
19484
  "content-type": "application/json",
19485
19485
  "X-Tangle-Idempotency-Key": inv.idempotencyKey
19486
19486
  },
@@ -19511,7 +19511,7 @@ async function updateDealStage(inv, accessToken2, timeoutMs) {
19511
19511
  idempotentReplay: false
19512
19512
  };
19513
19513
  }
19514
- async function createTicket(inv, accessToken2, timeoutMs) {
19514
+ async function createTicket(inv, accessToken3, timeoutMs) {
19515
19515
  const args = inv.args ?? {};
19516
19516
  if (!args.properties || typeof args.properties !== "object") {
19517
19517
  throw new Error("hubspot create_ticket: `properties` is required");
@@ -19530,7 +19530,7 @@ async function createTicket(inv, accessToken2, timeoutMs) {
19530
19530
  const res = await fetch(`${API5}/crm/v3/objects/tickets`, {
19531
19531
  method: "POST",
19532
19532
  headers: {
19533
- authorization: `Bearer ${accessToken2}`,
19533
+ authorization: `Bearer ${accessToken3}`,
19534
19534
  "content-type": "application/json",
19535
19535
  "X-Tangle-Idempotency-Key": inv.idempotencyKey
19536
19536
  },
@@ -19705,12 +19705,12 @@ var httpConnector = {
19705
19705
  headers,
19706
19706
  signal: AbortSignal.timeout(readTimeout(args.timeoutMs))
19707
19707
  });
19708
- const data3 = await parseResponse(res, method);
19708
+ const data4 = await parseResponse(res, method);
19709
19709
  if (!res.ok) {
19710
- throw new Error(`http ${method} ${url.toString()} failed: ${res.status} ${truncate(stringify(data3), 200)}`);
19710
+ throw new Error(`http ${method} ${url.toString()} failed: ${res.status} ${truncate(stringify(data4), 200)}`);
19711
19711
  }
19712
19712
  return {
19713
- data: data3,
19713
+ data: data4,
19714
19714
  etag: res.headers.get("etag") ?? void 0,
19715
19715
  fetchedAt: Date.now()
19716
19716
  };
@@ -19727,11 +19727,11 @@ var httpConnector = {
19727
19727
  body,
19728
19728
  signal: AbortSignal.timeout(readTimeout(args.timeoutMs))
19729
19729
  });
19730
- const data3 = await parseResponse(res, method);
19730
+ const data4 = await parseResponse(res, method);
19731
19731
  if (res.status === 409) {
19732
- const message = typeof data3 === "object" && data3 !== null && "message" in data3 && typeof data3.message === "string" ? data3.message : `http ${method} ${url.toString()} returned 409`;
19733
- const alternatives = typeof data3 === "object" && data3 !== null && Array.isArray(data3.alternatives) ? data3.alternatives : [];
19734
- return { status: "conflict", alternatives, message, currentState: data3 };
19732
+ const message = typeof data4 === "object" && data4 !== null && "message" in data4 && typeof data4.message === "string" ? data4.message : `http ${method} ${url.toString()} returned 409`;
19733
+ const alternatives = typeof data4 === "object" && data4 !== null && Array.isArray(data4.alternatives) ? data4.alternatives : [];
19734
+ return { status: "conflict", alternatives, message, currentState: data4 };
19735
19735
  }
19736
19736
  if (res.status === 429) {
19737
19737
  const retryAfter = parseRetryAfterMs(res.headers.get("retry-after"));
@@ -19742,11 +19742,11 @@ var httpConnector = {
19742
19742
  };
19743
19743
  }
19744
19744
  if (!res.ok) {
19745
- throw new Error(`http ${method} ${url.toString()} failed: ${res.status} ${truncate(stringify(data3), 200)}`);
19745
+ throw new Error(`http ${method} ${url.toString()} failed: ${res.status} ${truncate(stringify(data4), 200)}`);
19746
19746
  }
19747
19747
  return {
19748
19748
  status: "committed",
19749
- data: data3,
19749
+ data: data4,
19750
19750
  etagAfter: res.headers.get("etag") ?? void 0,
19751
19751
  committedAt: Date.now(),
19752
19752
  idempotentReplay: false
@@ -19792,13 +19792,13 @@ function readTimeout(value) {
19792
19792
  }
19793
19793
  return Math.min(Math.floor(value), MAX_TIMEOUT_MS);
19794
19794
  }
19795
- function buildUrl(base, query) {
19796
- if (query === void 0 || query === null) return base;
19797
- if (typeof query !== "object") {
19795
+ function buildUrl(base, query2) {
19796
+ if (query2 === void 0 || query2 === null) return base;
19797
+ if (typeof query2 !== "object") {
19798
19798
  throw new Error("http.query must be an object of string/number/boolean values (or arrays of those)");
19799
19799
  }
19800
19800
  const url = new URL(base.toString());
19801
- for (const [key, raw] of Object.entries(query)) {
19801
+ for (const [key, raw] of Object.entries(query2)) {
19802
19802
  if (raw === void 0 || raw === null) continue;
19803
19803
  if (Array.isArray(raw)) {
19804
19804
  for (const entry of raw) url.searchParams.append(key, scalarToString(entry, key));
@@ -23919,11 +23919,11 @@ function microsoftCalendar(opts) {
23919
23919
  ]
23920
23920
  },
23921
23921
  async executeRead(inv) {
23922
- const accessToken2 = await ensureFreshAccessToken9(inv.source.credentials, clientId, clientSecret);
23922
+ const accessToken3 = await ensureFreshAccessToken9(inv.source.credentials, clientId, clientSecret);
23923
23923
  if (inv.capabilityName === "list_availability") {
23924
23924
  const userPrincipal = readMetaString2(inv.source.metadata, "userPrincipal");
23925
23925
  const { timeMin, timeMax } = inv.args;
23926
- const busy = await getScheduleBusy({ accessToken: accessToken2, userPrincipal, timeMin, timeMax });
23926
+ const busy = await getScheduleBusy({ accessToken: accessToken3, userPrincipal, timeMin, timeMax });
23927
23927
  return {
23928
23928
  data: { busy },
23929
23929
  fetchedAt: Date.now()
@@ -23947,10 +23947,10 @@ function microsoftCalendar(opts) {
23947
23947
  if ($select) qs.set("$select", $select);
23948
23948
  if ($orderby) qs.set("$orderby", $orderby);
23949
23949
  if ($search) qs.set("$search", $search);
23950
- const query = qs.toString();
23951
- const url = query ? `${base}?${query}` : base;
23950
+ const query2 = qs.toString();
23951
+ const url = query2 ? `${base}?${query2}` : base;
23952
23952
  const res = await fetch(url, {
23953
- headers: { authorization: `Bearer ${accessToken2}` },
23953
+ headers: { authorization: `Bearer ${accessToken3}` },
23954
23954
  signal: AbortSignal.timeout(15e3)
23955
23955
  });
23956
23956
  if (res.status === 401 || res.status === 403) {
@@ -23969,7 +23969,7 @@ function microsoftCalendar(opts) {
23969
23969
  throw new Error(`microsoft-calendar: unknown read capability ${inv.capabilityName}`);
23970
23970
  },
23971
23971
  async executeMutation(inv) {
23972
- const accessToken2 = await ensureFreshAccessToken9(inv.source.credentials, clientId, clientSecret);
23972
+ const accessToken3 = await ensureFreshAccessToken9(inv.source.credentials, clientId, clientSecret);
23973
23973
  if (inv.capabilityName === "book_slot") {
23974
23974
  const userPrincipal = readMetaString2(inv.source.metadata, "userPrincipal");
23975
23975
  const {
@@ -23988,13 +23988,13 @@ function microsoftCalendar(opts) {
23988
23988
  categories,
23989
23989
  importance
23990
23990
  } = inv.args;
23991
- const busy = await getScheduleBusy({ accessToken: accessToken2, userPrincipal, timeMin: start, timeMax: end });
23991
+ const busy = await getScheduleBusy({ accessToken: accessToken3, userPrincipal, timeMin: start, timeMax: end });
23992
23992
  if (busy.length > 0) {
23993
23993
  const startMs = Date.parse(start);
23994
23994
  const endMs = Date.parse(end);
23995
23995
  const durMs = endMs - startMs;
23996
23996
  const alternatives = await findNextFreeSlots2({
23997
- accessToken: accessToken2,
23997
+ accessToken: accessToken3,
23998
23998
  userPrincipal,
23999
23999
  searchFromMs: endMs,
24000
24000
  durationMs: durMs,
@@ -24028,7 +24028,7 @@ function microsoftCalendar(opts) {
24028
24028
  const res = await fetch(url, {
24029
24029
  method: "POST",
24030
24030
  headers: {
24031
- authorization: `Bearer ${accessToken2}`,
24031
+ authorization: `Bearer ${accessToken3}`,
24032
24032
  "content-type": "application/json"
24033
24033
  },
24034
24034
  body: JSON.stringify(event),
@@ -24058,7 +24058,7 @@ function microsoftCalendar(opts) {
24058
24058
  }
24059
24059
  if (inv.capabilityName === "delete_event") {
24060
24060
  const { eventId } = inv.args;
24061
- const headers = { authorization: `Bearer ${accessToken2}` };
24061
+ const headers = { authorization: `Bearer ${accessToken3}` };
24062
24062
  if (inv.expectedEtag) headers["if-match"] = inv.expectedEtag;
24063
24063
  const res = await fetch(
24064
24064
  `https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(eventId)}`,
@@ -24142,9 +24142,9 @@ function microsoftCalendar(opts) {
24142
24142
  },
24143
24143
  async test(source) {
24144
24144
  try {
24145
- const accessToken2 = await ensureFreshAccessToken9(source.credentials, clientId, clientSecret);
24145
+ const accessToken3 = await ensureFreshAccessToken9(source.credentials, clientId, clientSecret);
24146
24146
  const res = await fetch("https://graph.microsoft.com/v1.0/me?$select=id", {
24147
- headers: { authorization: `Bearer ${accessToken2}` },
24147
+ headers: { authorization: `Bearer ${accessToken3}` },
24148
24148
  signal: AbortSignal.timeout(8e3)
24149
24149
  });
24150
24150
  if (res.status === 401 || res.status === 403) {
@@ -25263,9 +25263,9 @@ function microsoftGraph(opts) {
25263
25263
  ]
25264
25264
  },
25265
25265
  async executeRead(inv) {
25266
- const accessToken2 = await ensureFreshAccessToken10(inv.source.credentials, clientId, clientSecret);
25266
+ const accessToken3 = await ensureFreshAccessToken10(inv.source.credentials, clientId, clientSecret);
25267
25267
  if (inv.capabilityName === "get_me") {
25268
- const json = await graphGet(`${GRAPH}/me?$select=id,displayName,mail,userPrincipalName,jobTitle`, accessToken2, inv.source.id);
25268
+ const json = await graphGet(`${GRAPH}/me?$select=id,displayName,mail,userPrincipalName,jobTitle`, accessToken3, inv.source.id);
25269
25269
  return {
25270
25270
  data: {
25271
25271
  user: {
@@ -25283,7 +25283,7 @@ function microsoftGraph(opts) {
25283
25283
  const { email } = inv.args;
25284
25284
  const filter = `mail eq '${escapeOData(email)}' or userPrincipalName eq '${escapeOData(email)}'`;
25285
25285
  const url = `${GRAPH}/users?$select=id,displayName,mail,userPrincipalName,jobTitle&$filter=${encodeURIComponent(filter)}`;
25286
- const json = await graphGet(url, accessToken2, inv.source.id);
25286
+ const json = await graphGet(url, accessToken3, inv.source.id);
25287
25287
  const user = (json.value ?? [])[0];
25288
25288
  if (!user) return { data: { found: false }, fetchedAt: Date.now() };
25289
25289
  return {
@@ -25308,7 +25308,7 @@ function microsoftGraph(opts) {
25308
25308
  params.push(`$search=${encodeURIComponent(`"displayName:${search}" OR "mail:${search}"`)}`);
25309
25309
  }
25310
25310
  const url = `${GRAPH}/users?${params.join("&")}`;
25311
- const json = await graphGet(url, accessToken2, inv.source.id, { "ConsistencyLevel": "eventual" });
25311
+ const json = await graphGet(url, accessToken3, inv.source.id, { "ConsistencyLevel": "eventual" });
25312
25312
  const users = (json.value ?? []).map((u) => ({
25313
25313
  id: u.id,
25314
25314
  displayName: u.displayName,
@@ -25326,7 +25326,7 @@ function microsoftGraph(opts) {
25326
25326
  params.push(`$search=${encodeURIComponent(`"displayName:${search}"`)}`);
25327
25327
  }
25328
25328
  const url = `${GRAPH}/groups?${params.join("&")}`;
25329
- const json = await graphGet(url, accessToken2, inv.source.id, { "ConsistencyLevel": "eventual" });
25329
+ const json = await graphGet(url, accessToken3, inv.source.id, { "ConsistencyLevel": "eventual" });
25330
25330
  const groups = (json.value ?? []).map((g) => ({
25331
25331
  id: g.id,
25332
25332
  displayName: g.displayName,
@@ -25340,7 +25340,7 @@ function microsoftGraph(opts) {
25340
25340
  const { groupId, top } = inv.args;
25341
25341
  const t = Math.min(Math.max(1, top ?? 50), 100);
25342
25342
  const url = `${GRAPH}/groups/${encodeURIComponent(groupId)}/members?$select=id,displayName,mail,userPrincipalName&$top=${t}`;
25343
- const json = await graphGet(url, accessToken2, inv.source.id);
25343
+ const json = await graphGet(url, accessToken3, inv.source.id);
25344
25344
  const members = (json.value ?? []).map((m) => ({
25345
25345
  // odata.type is '#microsoft.graph.user' | '#microsoft.graph.group'
25346
25346
  // | '#microsoft.graph.device' — surface as the bare suffix.
@@ -25353,7 +25353,7 @@ function microsoftGraph(opts) {
25353
25353
  return { data: { members }, fetchedAt: Date.now() };
25354
25354
  }
25355
25355
  if (inv.capabilityName === "get_organization") {
25356
- const json = await graphGet(`${GRAPH}/organization?$select=id,displayName,verifiedDomains,tenantType`, accessToken2, inv.source.id);
25356
+ const json = await graphGet(`${GRAPH}/organization?$select=id,displayName,verifiedDomains,tenantType`, accessToken3, inv.source.id);
25357
25357
  const org = (json.value ?? [])[0];
25358
25358
  if (!org) return { data: { organization: null }, fetchedAt: Date.now() };
25359
25359
  return {
@@ -25415,9 +25415,9 @@ function microsoftGraph(opts) {
25415
25415
  },
25416
25416
  async test(source) {
25417
25417
  try {
25418
- const accessToken2 = await ensureFreshAccessToken10(source.credentials, clientId, clientSecret);
25418
+ const accessToken3 = await ensureFreshAccessToken10(source.credentials, clientId, clientSecret);
25419
25419
  const res = await fetch(`${GRAPH}/me?$select=id`, {
25420
- headers: { authorization: `Bearer ${accessToken2}` },
25420
+ headers: { authorization: `Bearer ${accessToken3}` },
25421
25421
  signal: AbortSignal.timeout(8e3)
25422
25422
  });
25423
25423
  if (res.status === 401 || res.status === 403) {
@@ -25453,10 +25453,10 @@ async function ensureFreshAccessToken10(creds, clientId, clientSecret) {
25453
25453
  if (refreshed.refreshToken) creds.refreshToken = refreshed.refreshToken;
25454
25454
  return creds.accessToken;
25455
25455
  }
25456
- async function graphGet(url, accessToken2, dataSourceId, extraHeaders = {}) {
25456
+ async function graphGet(url, accessToken3, dataSourceId, extraHeaders = {}) {
25457
25457
  const res = await fetch(url, {
25458
25458
  headers: {
25459
- authorization: `Bearer ${accessToken2}`,
25459
+ authorization: `Bearer ${accessToken3}`,
25460
25460
  accept: "application/json",
25461
25461
  ...extraHeaders
25462
25462
  },
@@ -25600,11 +25600,11 @@ function microsoftTeams(opts) {
25600
25600
  ]
25601
25601
  },
25602
25602
  async executeRead(inv) {
25603
- const accessToken2 = await ensureFreshAccessToken11(inv.source.credentials, clientId, clientSecret);
25603
+ const accessToken3 = await ensureFreshAccessToken11(inv.source.credentials, clientId, clientSecret);
25604
25604
  if (inv.capabilityName === "list_joined_teams") {
25605
25605
  const json = await graphGet2(
25606
25606
  `${GRAPH2}/me/joinedTeams`,
25607
- accessToken2,
25607
+ accessToken3,
25608
25608
  inv.source.id
25609
25609
  );
25610
25610
  const teams = (json.value ?? []).map((t) => ({
@@ -25616,7 +25616,7 @@ function microsoftTeams(opts) {
25616
25616
  }
25617
25617
  if (inv.capabilityName === "list_team_channels") {
25618
25618
  const { teamId } = inv.args;
25619
- const json = await graphGet2(`${GRAPH2}/teams/${encodeURIComponent(teamId)}/channels`, accessToken2, inv.source.id);
25619
+ const json = await graphGet2(`${GRAPH2}/teams/${encodeURIComponent(teamId)}/channels`, accessToken3, inv.source.id);
25620
25620
  const channels = (json.value ?? []).map((c) => ({
25621
25621
  id: c.id,
25622
25622
  displayName: c.displayName,
@@ -25628,7 +25628,7 @@ function microsoftTeams(opts) {
25628
25628
  const { teamId, channelId, top } = inv.args;
25629
25629
  const t = Math.min(Math.max(1, top ?? 20), 50);
25630
25630
  const url = `${GRAPH2}/teams/${encodeURIComponent(teamId)}/channels/${encodeURIComponent(channelId)}/messages?$top=${t}`;
25631
- const json = await graphGet2(url, accessToken2, inv.source.id);
25631
+ const json = await graphGet2(url, accessToken3, inv.source.id);
25632
25632
  const messages = (json.value ?? []).map((m) => ({
25633
25633
  id: m.id,
25634
25634
  createdAt: m.createdDateTime,
@@ -25641,7 +25641,7 @@ function microsoftTeams(opts) {
25641
25641
  const { email } = inv.args;
25642
25642
  const filter = `mail eq '${escapeOData2(email)}' or userPrincipalName eq '${escapeOData2(email)}'`;
25643
25643
  const url = `${GRAPH2}/users?$select=id,displayName,mail,userPrincipalName&$filter=${encodeURIComponent(filter)}`;
25644
- const json = await graphGet2(url, accessToken2, inv.source.id);
25644
+ const json = await graphGet2(url, accessToken3, inv.source.id);
25645
25645
  const user = (json.value ?? [])[0];
25646
25646
  if (!user) return { data: { found: false }, fetchedAt: Date.now() };
25647
25647
  return {
@@ -25660,12 +25660,12 @@ function microsoftTeams(opts) {
25660
25660
  throw new Error(`microsoft-teams: unknown read capability ${inv.capabilityName}`);
25661
25661
  },
25662
25662
  async executeMutation(inv) {
25663
- const accessToken2 = await ensureFreshAccessToken11(inv.source.credentials, clientId, clientSecret);
25663
+ const accessToken3 = await ensureFreshAccessToken11(inv.source.credentials, clientId, clientSecret);
25664
25664
  if (inv.capabilityName === "post_channel_message") {
25665
25665
  const { teamId, channelId, content, contentType } = inv.args;
25666
25666
  const url = `${GRAPH2}/teams/${encodeURIComponent(teamId)}/channels/${encodeURIComponent(channelId)}/messages`;
25667
25667
  const body = { body: { contentType: contentType ?? "text", content } };
25668
- const json = await graphPost(url, accessToken2, body, inv.source.id, "post_channel_message");
25668
+ const json = await graphPost(url, accessToken3, body, inv.source.id, "post_channel_message");
25669
25669
  return {
25670
25670
  status: "committed",
25671
25671
  data: { id: json.id, webUrl: json.webUrl, createdAt: json.createdDateTime },
@@ -25677,7 +25677,7 @@ function microsoftTeams(opts) {
25677
25677
  const { chatId, content, contentType } = inv.args;
25678
25678
  const url = `${GRAPH2}/chats/${encodeURIComponent(chatId)}/messages`;
25679
25679
  const body = { body: { contentType: contentType ?? "text", content } };
25680
- const json = await graphPost(url, accessToken2, body, inv.source.id, "post_chat_message");
25680
+ const json = await graphPost(url, accessToken3, body, inv.source.id, "post_chat_message");
25681
25681
  return {
25682
25682
  status: "committed",
25683
25683
  data: { id: json.id, webUrl: json.webUrl, createdAt: json.createdDateTime },
@@ -25738,9 +25738,9 @@ function microsoftTeams(opts) {
25738
25738
  },
25739
25739
  async test(source) {
25740
25740
  try {
25741
- const accessToken2 = await ensureFreshAccessToken11(source.credentials, clientId, clientSecret);
25741
+ const accessToken3 = await ensureFreshAccessToken11(source.credentials, clientId, clientSecret);
25742
25742
  const res = await fetch(`${GRAPH2}/me?$select=id`, {
25743
- headers: { authorization: `Bearer ${accessToken2}` },
25743
+ headers: { authorization: `Bearer ${accessToken3}` },
25744
25744
  signal: AbortSignal.timeout(8e3)
25745
25745
  });
25746
25746
  if (res.status === 401 || res.status === 403) {
@@ -25800,9 +25800,9 @@ async function ensureFreshAccessToken11(creds, clientId, clientSecret) {
25800
25800
  if (refreshed.refreshToken) creds.refreshToken = refreshed.refreshToken;
25801
25801
  return creds.accessToken;
25802
25802
  }
25803
- async function graphGet2(url, accessToken2, dataSourceId) {
25803
+ async function graphGet2(url, accessToken3, dataSourceId) {
25804
25804
  const res = await fetch(url, {
25805
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
25805
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
25806
25806
  signal: AbortSignal.timeout(1e4)
25807
25807
  });
25808
25808
  if (res.status === 401 || res.status === 403) {
@@ -25814,11 +25814,11 @@ async function graphGet2(url, accessToken2, dataSourceId) {
25814
25814
  }
25815
25815
  return await res.json();
25816
25816
  }
25817
- async function graphPost(url, accessToken2, body, dataSourceId, op) {
25817
+ async function graphPost(url, accessToken3, body, dataSourceId, op) {
25818
25818
  const res = await fetch(url, {
25819
25819
  method: "POST",
25820
25820
  headers: {
25821
- authorization: `Bearer ${accessToken2}`,
25821
+ authorization: `Bearer ${accessToken3}`,
25822
25822
  "content-type": "application/json",
25823
25823
  accept: "application/json"
25824
25824
  },
@@ -29156,26 +29156,26 @@ function oneDrive(opts) {
29156
29156
  ]
29157
29157
  },
29158
29158
  async executeRead(inv) {
29159
- const accessToken2 = await ensureFreshAccessToken12(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
29160
- if (inv.capabilityName === "list_files") return listFiles2(inv, accessToken2, timeoutMs);
29161
- if (inv.capabilityName === "read_file") return readFile2(inv, accessToken2, timeoutMs);
29159
+ const accessToken3 = await ensureFreshAccessToken12(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
29160
+ if (inv.capabilityName === "list_files") return listFiles2(inv, accessToken3, timeoutMs);
29161
+ if (inv.capabilityName === "read_file") return readFile2(inv, accessToken3, timeoutMs);
29162
29162
  throw new Error(`onedrive: unknown read capability ${inv.capabilityName}`);
29163
29163
  },
29164
29164
  async executeMutation(inv) {
29165
- const accessToken2 = await ensureFreshAccessToken12(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
29165
+ const accessToken3 = await ensureFreshAccessToken12(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
29166
29166
  switch (inv.capabilityName) {
29167
29167
  case "watch_folder":
29168
- return watchFolder2(inv, accessToken2, timeoutMs);
29168
+ return watchFolder2(inv, accessToken3, timeoutMs);
29169
29169
  case "files.upload":
29170
- return uploadFile2(inv, accessToken2, timeoutMs);
29170
+ return uploadFile2(inv, accessToken3, timeoutMs);
29171
29171
  case "files.delete":
29172
- return deleteItem(inv, accessToken2, timeoutMs);
29172
+ return deleteItem(inv, accessToken3, timeoutMs);
29173
29173
  case "files.move":
29174
- return moveItem(inv, accessToken2, timeoutMs);
29174
+ return moveItem(inv, accessToken3, timeoutMs);
29175
29175
  case "files.share":
29176
- return shareItem(inv, accessToken2, timeoutMs);
29176
+ return shareItem(inv, accessToken3, timeoutMs);
29177
29177
  case "folders.create":
29178
- return createFolder2(inv, accessToken2, timeoutMs);
29178
+ return createFolder2(inv, accessToken3, timeoutMs);
29179
29179
  default:
29180
29180
  throw new Error(`onedrive: unknown mutation capability ${inv.capabilityName}`);
29181
29181
  }
@@ -29222,9 +29222,9 @@ function oneDrive(opts) {
29222
29222
  },
29223
29223
  async test(source) {
29224
29224
  try {
29225
- const accessToken2 = await ensureFreshAccessToken12(source.credentials, clientId, clientSecret);
29225
+ const accessToken3 = await ensureFreshAccessToken12(source.credentials, clientId, clientSecret);
29226
29226
  const res = await fetch(`${API6}/me/drive?$select=id`, {
29227
- headers: { authorization: `Bearer ${accessToken2}` },
29227
+ headers: { authorization: `Bearer ${accessToken3}` },
29228
29228
  signal: AbortSignal.timeout(8e3)
29229
29229
  });
29230
29230
  if (res.status === 401 || res.status === 403) {
@@ -29239,7 +29239,7 @@ function oneDrive(opts) {
29239
29239
  };
29240
29240
  return adapter;
29241
29241
  }
29242
- async function listFiles2(inv, accessToken2, timeoutMs) {
29242
+ async function listFiles2(inv, accessToken3, timeoutMs) {
29243
29243
  const args = inv.args ?? {};
29244
29244
  const params = new URLSearchParams({
29245
29245
  $top: String(args.top ?? 100),
@@ -29248,7 +29248,7 @@ async function listFiles2(inv, accessToken2, timeoutMs) {
29248
29248
  if (args.query) params.set("$search", `"${args.query}"`);
29249
29249
  else params.set("$orderby", "lastModifiedDateTime desc");
29250
29250
  if (args.skipToken) params.set("$skiptoken", args.skipToken);
29251
- const headers = { authorization: `Bearer ${accessToken2}` };
29251
+ const headers = { authorization: `Bearer ${accessToken3}` };
29252
29252
  if (args.query) headers["ConsistencyLevel"] = "eventual";
29253
29253
  const path = args.folderId ? `/me/drive/items/${encodeURIComponent(args.folderId)}/children` : "/me/drive/root/children";
29254
29254
  const useSearchEndpoint = !!args.query && !args.folderId;
@@ -29279,12 +29279,12 @@ function stripSearch(params) {
29279
29279
  copy.delete("$orderby");
29280
29280
  return copy;
29281
29281
  }
29282
- async function readFile2(inv, accessToken2, timeoutMs) {
29282
+ async function readFile2(inv, accessToken3, timeoutMs) {
29283
29283
  const { fileId } = inv.args ?? {};
29284
29284
  if (!fileId) throw new Error("onedrive read_file: fileId is required");
29285
29285
  const metaUrl = `${API6}/me/drive/items/${encodeURIComponent(fileId)}?$select=id,name,eTag,lastModifiedDateTime,size,file,folder`;
29286
29286
  const metaRes = await fetch(metaUrl, {
29287
- headers: { authorization: `Bearer ${accessToken2}` },
29287
+ headers: { authorization: `Bearer ${accessToken3}` },
29288
29288
  signal: AbortSignal.timeout(timeoutMs)
29289
29289
  });
29290
29290
  if (metaRes.status === 401 || metaRes.status === 403) {
@@ -29304,7 +29304,7 @@ async function readFile2(inv, accessToken2, timeoutMs) {
29304
29304
  const mimeType = meta.file?.mimeType ?? "application/octet-stream";
29305
29305
  const fetchedAt = Date.now();
29306
29306
  const contentRes = await fetch(`${API6}/me/drive/items/${encodeURIComponent(fileId)}/content`, {
29307
- headers: { authorization: `Bearer ${accessToken2}` },
29307
+ headers: { authorization: `Bearer ${accessToken3}` },
29308
29308
  signal: AbortSignal.timeout(timeoutMs)
29309
29309
  });
29310
29310
  if (contentRes.status === 401 || contentRes.status === 403) {
@@ -29344,7 +29344,7 @@ async function readFile2(inv, accessToken2, timeoutMs) {
29344
29344
  fetchedAt
29345
29345
  };
29346
29346
  }
29347
- async function watchFolder2(inv, accessToken2, timeoutMs) {
29347
+ async function watchFolder2(inv, accessToken3, timeoutMs) {
29348
29348
  const { folderId, notificationUrl, ttlMinutes, clientState } = inv.args;
29349
29349
  const ttl = Math.max(1, Math.min(ttlMinutes ?? 4230, 43200));
29350
29350
  const expirationDateTime = new Date(Date.now() + ttl * 6e4).toISOString();
@@ -29359,7 +29359,7 @@ async function watchFolder2(inv, accessToken2, timeoutMs) {
29359
29359
  const res = await fetch(`${API6}/subscriptions`, {
29360
29360
  method: "POST",
29361
29361
  headers: {
29362
- authorization: `Bearer ${accessToken2}`,
29362
+ authorization: `Bearer ${accessToken3}`,
29363
29363
  "content-type": "application/json"
29364
29364
  },
29365
29365
  body: JSON.stringify(body),
@@ -29387,7 +29387,7 @@ async function watchFolder2(inv, accessToken2, timeoutMs) {
29387
29387
  function itemPath(itemId) {
29388
29388
  return itemId === "root" ? "/me/drive/root" : `/me/drive/items/${encodeURIComponent(itemId)}`;
29389
29389
  }
29390
- async function uploadFile2(inv, accessToken2, timeoutMs) {
29390
+ async function uploadFile2(inv, accessToken3, timeoutMs) {
29391
29391
  const { folderId, fileName, fileContent, encoding, contentType } = inv.args ?? {};
29392
29392
  if (!folderId) throw new Error("onedrive files.upload: folderId is required");
29393
29393
  if (!fileName) throw new Error("onedrive files.upload: fileName is required");
@@ -29400,7 +29400,7 @@ async function uploadFile2(inv, accessToken2, timeoutMs) {
29400
29400
  const res = await fetch(url, {
29401
29401
  method: "PUT",
29402
29402
  headers: {
29403
- authorization: `Bearer ${accessToken2}`,
29403
+ authorization: `Bearer ${accessToken3}`,
29404
29404
  "content-type": contentType ?? "application/octet-stream"
29405
29405
  },
29406
29406
  body,
@@ -29429,12 +29429,12 @@ async function uploadFile2(inv, accessToken2, timeoutMs) {
29429
29429
  idempotentReplay: false
29430
29430
  };
29431
29431
  }
29432
- async function deleteItem(inv, accessToken2, timeoutMs) {
29432
+ async function deleteItem(inv, accessToken3, timeoutMs) {
29433
29433
  const { itemId } = inv.args ?? {};
29434
29434
  if (!itemId) throw new Error("onedrive files.delete: itemId is required");
29435
29435
  const res = await fetch(`${API6}${itemPath(itemId)}`, {
29436
29436
  method: "DELETE",
29437
- headers: { authorization: `Bearer ${accessToken2}` },
29437
+ headers: { authorization: `Bearer ${accessToken3}` },
29438
29438
  signal: AbortSignal.timeout(timeoutMs)
29439
29439
  });
29440
29440
  if (res.status === 401 || res.status === 403) {
@@ -29459,7 +29459,7 @@ async function deleteItem(inv, accessToken2, timeoutMs) {
29459
29459
  idempotentReplay: false
29460
29460
  };
29461
29461
  }
29462
- async function moveItem(inv, accessToken2, timeoutMs) {
29462
+ async function moveItem(inv, accessToken3, timeoutMs) {
29463
29463
  const { itemId, newParentId, newName } = inv.args ?? {};
29464
29464
  if (!itemId) throw new Error("onedrive files.move: itemId is required");
29465
29465
  if (!newParentId && !newName) {
@@ -29473,7 +29473,7 @@ async function moveItem(inv, accessToken2, timeoutMs) {
29473
29473
  const res = await fetch(`${API6}${itemPath(itemId)}`, {
29474
29474
  method: "PATCH",
29475
29475
  headers: {
29476
- authorization: `Bearer ${accessToken2}`,
29476
+ authorization: `Bearer ${accessToken3}`,
29477
29477
  "content-type": "application/json"
29478
29478
  },
29479
29479
  body: JSON.stringify(body),
@@ -29501,7 +29501,7 @@ async function moveItem(inv, accessToken2, timeoutMs) {
29501
29501
  idempotentReplay: false
29502
29502
  };
29503
29503
  }
29504
- async function shareItem(inv, accessToken2, timeoutMs) {
29504
+ async function shareItem(inv, accessToken3, timeoutMs) {
29505
29505
  const { itemId, type, scope, password, expirationDateTime } = inv.args ?? {};
29506
29506
  if (!itemId) throw new Error("onedrive files.share: itemId is required");
29507
29507
  const body = {
@@ -29513,7 +29513,7 @@ async function shareItem(inv, accessToken2, timeoutMs) {
29513
29513
  const res = await fetch(`${API6}${itemPath(itemId)}/createLink`, {
29514
29514
  method: "POST",
29515
29515
  headers: {
29516
- authorization: `Bearer ${accessToken2}`,
29516
+ authorization: `Bearer ${accessToken3}`,
29517
29517
  "content-type": "application/json"
29518
29518
  },
29519
29519
  body: JSON.stringify(body),
@@ -29539,7 +29539,7 @@ async function shareItem(inv, accessToken2, timeoutMs) {
29539
29539
  idempotentReplay: false
29540
29540
  };
29541
29541
  }
29542
- async function createFolder2(inv, accessToken2, timeoutMs) {
29542
+ async function createFolder2(inv, accessToken3, timeoutMs) {
29543
29543
  const { parentId, name, conflictBehavior } = inv.args ?? {};
29544
29544
  if (!parentId) throw new Error("onedrive folders.create: parentId is required");
29545
29545
  if (!name) throw new Error("onedrive folders.create: name is required");
@@ -29552,7 +29552,7 @@ async function createFolder2(inv, accessToken2, timeoutMs) {
29552
29552
  const res = await fetch(`${API6}${parentSegment}`, {
29553
29553
  method: "POST",
29554
29554
  headers: {
29555
- authorization: `Bearer ${accessToken2}`,
29555
+ authorization: `Bearer ${accessToken3}`,
29556
29556
  "content-type": "application/json"
29557
29557
  },
29558
29558
  body: JSON.stringify(body),
@@ -30027,22 +30027,22 @@ function outlookMail(opts) {
30027
30027
  ]
30028
30028
  },
30029
30029
  async executeRead(inv) {
30030
- const accessToken2 = await ensureFreshAccessToken13(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
30031
- if (inv.capabilityName === "list_messages") return listMessages2(inv, accessToken2, timeoutMs);
30032
- if (inv.capabilityName === "read_message") return readMessage2(inv, accessToken2, timeoutMs);
30033
- if (inv.capabilityName === "download_attachment") return downloadAttachment(inv, accessToken2, timeoutMs);
30030
+ const accessToken3 = await ensureFreshAccessToken13(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
30031
+ if (inv.capabilityName === "list_messages") return listMessages2(inv, accessToken3, timeoutMs);
30032
+ if (inv.capabilityName === "read_message") return readMessage2(inv, accessToken3, timeoutMs);
30033
+ if (inv.capabilityName === "download_attachment") return downloadAttachment(inv, accessToken3, timeoutMs);
30034
30034
  throw new Error(`outlook-mail: unknown read capability ${inv.capabilityName}`);
30035
30035
  },
30036
30036
  async executeMutation(inv) {
30037
- const accessToken2 = await ensureFreshAccessToken13(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
30038
- if (inv.capabilityName === "send_reply") return sendReply2(inv, accessToken2, timeoutMs);
30039
- if (inv.capabilityName === "send_message") return sendMessage(inv, accessToken2, timeoutMs);
30040
- if (inv.capabilityName === "create_draft") return createDraft(inv, accessToken2, timeoutMs);
30041
- if (inv.capabilityName === "subscribe_folder") return subscribeFolder(inv, accessToken2, timeoutMs);
30042
- if (inv.capabilityName === "forward_message") return forwardMessage(inv, accessToken2, timeoutMs);
30043
- if (inv.capabilityName === "move_message") return moveMessage(inv, accessToken2, timeoutMs);
30044
- if (inv.capabilityName === "set_labels") return setLabels(inv, accessToken2, timeoutMs);
30045
- if (inv.capabilityName === "send_draft") return sendDraft(inv, accessToken2, timeoutMs);
30037
+ const accessToken3 = await ensureFreshAccessToken13(inv.source.credentials, clientId, clientSecret, inv.onCredentialsRotated);
30038
+ if (inv.capabilityName === "send_reply") return sendReply2(inv, accessToken3, timeoutMs);
30039
+ if (inv.capabilityName === "send_message") return sendMessage(inv, accessToken3, timeoutMs);
30040
+ if (inv.capabilityName === "create_draft") return createDraft(inv, accessToken3, timeoutMs);
30041
+ if (inv.capabilityName === "subscribe_folder") return subscribeFolder(inv, accessToken3, timeoutMs);
30042
+ if (inv.capabilityName === "forward_message") return forwardMessage(inv, accessToken3, timeoutMs);
30043
+ if (inv.capabilityName === "move_message") return moveMessage(inv, accessToken3, timeoutMs);
30044
+ if (inv.capabilityName === "set_labels") return setLabels(inv, accessToken3, timeoutMs);
30045
+ if (inv.capabilityName === "send_draft") return sendDraft(inv, accessToken3, timeoutMs);
30046
30046
  throw new Error(`outlook-mail: unknown mutation capability ${inv.capabilityName}`);
30047
30047
  },
30048
30048
  async exchangeOAuth(input) {
@@ -30087,9 +30087,9 @@ function outlookMail(opts) {
30087
30087
  },
30088
30088
  async test(source) {
30089
30089
  try {
30090
- const accessToken2 = await ensureFreshAccessToken13(source.credentials, clientId, clientSecret);
30090
+ const accessToken3 = await ensureFreshAccessToken13(source.credentials, clientId, clientSecret);
30091
30091
  const res = await fetch(`${API7}/me?$select=id,userPrincipalName`, {
30092
- headers: { authorization: `Bearer ${accessToken2}` },
30092
+ headers: { authorization: `Bearer ${accessToken3}` },
30093
30093
  signal: AbortSignal.timeout(8e3)
30094
30094
  });
30095
30095
  if (res.status === 401 || res.status === 403) {
@@ -30104,7 +30104,7 @@ function outlookMail(opts) {
30104
30104
  };
30105
30105
  return adapter;
30106
30106
  }
30107
- async function listMessages2(inv, accessToken2, timeoutMs) {
30107
+ async function listMessages2(inv, accessToken3, timeoutMs) {
30108
30108
  const args = inv.args ?? {};
30109
30109
  const folder = encodeURIComponent(args.folder ?? "inbox");
30110
30110
  const params = new URLSearchParams({
@@ -30114,7 +30114,7 @@ async function listMessages2(inv, accessToken2, timeoutMs) {
30114
30114
  if (args.query) params.set("$search", `"${args.query}"`);
30115
30115
  else params.set("$orderby", "receivedDateTime desc");
30116
30116
  if (args.skipToken) params.set("$skiptoken", args.skipToken);
30117
- const headers = { authorization: `Bearer ${accessToken2}` };
30117
+ const headers = { authorization: `Bearer ${accessToken3}` };
30118
30118
  if (args.query) headers["ConsistencyLevel"] = "eventual";
30119
30119
  const res = await fetch(`${API7}/me/mailFolders/${folder}/messages?${params.toString()}`, {
30120
30120
  headers,
@@ -30148,11 +30148,11 @@ function toMessageSummary2(m) {
30148
30148
  to: (m.toRecipients ?? []).map((r) => r.emailAddress?.address).filter(Boolean)
30149
30149
  };
30150
30150
  }
30151
- async function readMessage2(inv, accessToken2, timeoutMs) {
30151
+ async function readMessage2(inv, accessToken3, timeoutMs) {
30152
30152
  const { id } = inv.args;
30153
30153
  const url = `${API7}/me/messages/${encodeURIComponent(id)}?$expand=attachments($select=id,name,contentType,size,isInline)`;
30154
30154
  const res = await fetch(url, {
30155
- headers: { authorization: `Bearer ${accessToken2}` },
30155
+ headers: { authorization: `Bearer ${accessToken3}` },
30156
30156
  signal: AbortSignal.timeout(timeoutMs)
30157
30157
  });
30158
30158
  if (res.status === 401 || res.status === 403) {
@@ -30190,13 +30190,13 @@ async function readMessage2(inv, accessToken2, timeoutMs) {
30190
30190
  fetchedAt: Date.now()
30191
30191
  };
30192
30192
  }
30193
- async function sendReply2(inv, accessToken2, timeoutMs) {
30193
+ async function sendReply2(inv, accessToken3, timeoutMs) {
30194
30194
  const { messageId: messageId2, body, bodyType, replyAll, comment } = inv.args;
30195
30195
  const action = replyAll ? "createReplyAll" : "createReply";
30196
30196
  const draftRes = await fetch(`${API7}/me/messages/${encodeURIComponent(messageId2)}/${action}`, {
30197
30197
  method: "POST",
30198
30198
  headers: {
30199
- authorization: `Bearer ${accessToken2}`,
30199
+ authorization: `Bearer ${accessToken3}`,
30200
30200
  "content-type": "application/json"
30201
30201
  },
30202
30202
  body: JSON.stringify(comment ? { comment } : {}),
@@ -30219,7 +30219,7 @@ async function sendReply2(inv, accessToken2, timeoutMs) {
30219
30219
  const patchRes = await fetch(`${API7}/me/messages/${encodeURIComponent(draft.id)}`, {
30220
30220
  method: "PATCH",
30221
30221
  headers: {
30222
- authorization: `Bearer ${accessToken2}`,
30222
+ authorization: `Bearer ${accessToken3}`,
30223
30223
  "content-type": "application/json"
30224
30224
  },
30225
30225
  body: JSON.stringify(patchBody),
@@ -30234,7 +30234,7 @@ async function sendReply2(inv, accessToken2, timeoutMs) {
30234
30234
  }
30235
30235
  const sendRes = await fetch(`${API7}/me/messages/${encodeURIComponent(draft.id)}/send`, {
30236
30236
  method: "POST",
30237
- headers: { authorization: `Bearer ${accessToken2}` },
30237
+ headers: { authorization: `Bearer ${accessToken3}` },
30238
30238
  signal: AbortSignal.timeout(timeoutMs)
30239
30239
  });
30240
30240
  if (sendRes.status === 401 || sendRes.status === 403) {
@@ -30294,13 +30294,13 @@ function buildMessagePayload(args, idempotencyKey, cap) {
30294
30294
  }
30295
30295
  return payload;
30296
30296
  }
30297
- async function sendMessage(inv, accessToken2, timeoutMs) {
30297
+ async function sendMessage(inv, accessToken3, timeoutMs) {
30298
30298
  const args = inv.args ?? {};
30299
30299
  const message = buildMessagePayload(args, inv.idempotencyKey, "send_message");
30300
30300
  const res = await fetch(`${API7}/me/sendMail`, {
30301
30301
  method: "POST",
30302
30302
  headers: {
30303
- authorization: `Bearer ${accessToken2}`,
30303
+ authorization: `Bearer ${accessToken3}`,
30304
30304
  "content-type": "application/json"
30305
30305
  },
30306
30306
  body: JSON.stringify({ message, saveToSentItems: true }),
@@ -30324,13 +30324,13 @@ async function sendMessage(inv, accessToken2, timeoutMs) {
30324
30324
  idempotentReplay: false
30325
30325
  };
30326
30326
  }
30327
- async function createDraft(inv, accessToken2, timeoutMs) {
30327
+ async function createDraft(inv, accessToken3, timeoutMs) {
30328
30328
  const args = inv.args ?? {};
30329
30329
  const message = buildMessagePayload(args, inv.idempotencyKey, "create_draft");
30330
30330
  const res = await fetch(`${API7}/me/messages`, {
30331
30331
  method: "POST",
30332
30332
  headers: {
30333
- authorization: `Bearer ${accessToken2}`,
30333
+ authorization: `Bearer ${accessToken3}`,
30334
30334
  "content-type": "application/json"
30335
30335
  },
30336
30336
  body: JSON.stringify(message),
@@ -30356,7 +30356,7 @@ async function createDraft(inv, accessToken2, timeoutMs) {
30356
30356
  idempotentReplay: false
30357
30357
  };
30358
30358
  }
30359
- async function subscribeFolder(inv, accessToken2, timeoutMs) {
30359
+ async function subscribeFolder(inv, accessToken3, timeoutMs) {
30360
30360
  const { folder, notificationUrl, ttlMinutes, clientState } = inv.args;
30361
30361
  const minutes = Math.min(Math.max(ttlMinutes ?? 4230, 1), 4230);
30362
30362
  const expirationDateTime = new Date(Date.now() + minutes * 60 * 1e3).toISOString();
@@ -30371,7 +30371,7 @@ async function subscribeFolder(inv, accessToken2, timeoutMs) {
30371
30371
  const res = await fetch(`${API7}/subscriptions`, {
30372
30372
  method: "POST",
30373
30373
  headers: {
30374
- authorization: `Bearer ${accessToken2}`,
30374
+ authorization: `Bearer ${accessToken3}`,
30375
30375
  "content-type": "application/json"
30376
30376
  },
30377
30377
  body: JSON.stringify(subBody),
@@ -30397,7 +30397,7 @@ async function subscribeFolder(inv, accessToken2, timeoutMs) {
30397
30397
  idempotentReplay: false
30398
30398
  };
30399
30399
  }
30400
- async function forwardMessage(inv, accessToken2, timeoutMs) {
30400
+ async function forwardMessage(inv, accessToken3, timeoutMs) {
30401
30401
  const { messageId: messageId2, to, comment } = inv.args;
30402
30402
  if (!messageId2) throw new Error("outlook-mail forward_message: `messageId` is required");
30403
30403
  if (!to || Array.isArray(to) && to.length === 0) {
@@ -30412,7 +30412,7 @@ async function forwardMessage(inv, accessToken2, timeoutMs) {
30412
30412
  const res = await fetch(`${API7}/me/messages/${encodeURIComponent(messageId2)}/forward`, {
30413
30413
  method: "POST",
30414
30414
  headers: {
30415
- authorization: `Bearer ${accessToken2}`,
30415
+ authorization: `Bearer ${accessToken3}`,
30416
30416
  "content-type": "application/json"
30417
30417
  },
30418
30418
  body: JSON.stringify(fwdBody),
@@ -30432,14 +30432,14 @@ async function forwardMessage(inv, accessToken2, timeoutMs) {
30432
30432
  idempotentReplay: false
30433
30433
  };
30434
30434
  }
30435
- async function moveMessage(inv, accessToken2, timeoutMs) {
30435
+ async function moveMessage(inv, accessToken3, timeoutMs) {
30436
30436
  const { messageId: messageId2, destinationId } = inv.args;
30437
30437
  if (!messageId2) throw new Error("outlook-mail move_message: `messageId` is required");
30438
30438
  if (!destinationId) throw new Error("outlook-mail move_message: `destinationId` is required");
30439
30439
  const res = await fetch(`${API7}/me/messages/${encodeURIComponent(messageId2)}/move`, {
30440
30440
  method: "POST",
30441
30441
  headers: {
30442
- authorization: `Bearer ${accessToken2}`,
30442
+ authorization: `Bearer ${accessToken3}`,
30443
30443
  "content-type": "application/json"
30444
30444
  },
30445
30445
  body: JSON.stringify({ destinationId }),
@@ -30465,7 +30465,7 @@ async function moveMessage(inv, accessToken2, timeoutMs) {
30465
30465
  idempotentReplay: false
30466
30466
  };
30467
30467
  }
30468
- async function setLabels(inv, accessToken2, timeoutMs) {
30468
+ async function setLabels(inv, accessToken3, timeoutMs) {
30469
30469
  const { messageId: messageId2, categories } = inv.args;
30470
30470
  if (!messageId2) throw new Error("outlook-mail set_labels: `messageId` is required");
30471
30471
  if (!Array.isArray(categories)) {
@@ -30474,7 +30474,7 @@ async function setLabels(inv, accessToken2, timeoutMs) {
30474
30474
  const res = await fetch(`${API7}/me/messages/${encodeURIComponent(messageId2)}`, {
30475
30475
  method: "PATCH",
30476
30476
  headers: {
30477
- authorization: `Bearer ${accessToken2}`,
30477
+ authorization: `Bearer ${accessToken3}`,
30478
30478
  "content-type": "application/json"
30479
30479
  },
30480
30480
  body: JSON.stringify({ categories }),
@@ -30498,12 +30498,12 @@ async function setLabels(inv, accessToken2, timeoutMs) {
30498
30498
  idempotentReplay: false
30499
30499
  };
30500
30500
  }
30501
- async function sendDraft(inv, accessToken2, timeoutMs) {
30501
+ async function sendDraft(inv, accessToken3, timeoutMs) {
30502
30502
  const { messageId: messageId2 } = inv.args;
30503
30503
  if (!messageId2) throw new Error("outlook-mail send_draft: `messageId` is required");
30504
30504
  const res = await fetch(`${API7}/me/messages/${encodeURIComponent(messageId2)}/send`, {
30505
30505
  method: "POST",
30506
- headers: { authorization: `Bearer ${accessToken2}` },
30506
+ headers: { authorization: `Bearer ${accessToken3}` },
30507
30507
  signal: AbortSignal.timeout(timeoutMs)
30508
30508
  });
30509
30509
  if (res.status === 401 || res.status === 403) {
@@ -30520,11 +30520,11 @@ async function sendDraft(inv, accessToken2, timeoutMs) {
30520
30520
  idempotentReplay: false
30521
30521
  };
30522
30522
  }
30523
- async function downloadAttachment(inv, accessToken2, timeoutMs) {
30523
+ async function downloadAttachment(inv, accessToken3, timeoutMs) {
30524
30524
  const { messageId: messageId2, attachmentId } = inv.args;
30525
30525
  const url = `${API7}/me/messages/${encodeURIComponent(messageId2)}/attachments/${encodeURIComponent(attachmentId)}`;
30526
30526
  const res = await fetch(url, {
30527
- headers: { authorization: `Bearer ${accessToken2}` },
30527
+ headers: { authorization: `Bearer ${accessToken3}` },
30528
30528
  signal: AbortSignal.timeout(timeoutMs)
30529
30529
  });
30530
30530
  if (res.status === 401 || res.status === 403) {
@@ -30588,7 +30588,7 @@ var TOKEN_URL15 = "https://api.pandadoc.com/oauth2/access_token";
30588
30588
  var API8 = "https://api.pandadoc.com/public/v1";
30589
30589
  function pandadoc(opts) {
30590
30590
  const { clientId, clientSecret } = opts;
30591
- const baseUrl2 = (opts.baseUrl ?? API8).replace(/\/$/, "");
30591
+ const baseUrl3 = (opts.baseUrl ?? API8).replace(/\/$/, "");
30592
30592
  const timeoutMs = opts.timeoutMs ?? 3e4;
30593
30593
  const adapter = {
30594
30594
  manifest: {
@@ -30729,16 +30729,16 @@ function pandadoc(opts) {
30729
30729
  ]
30730
30730
  },
30731
30731
  async executeRead(inv) {
30732
- const accessToken2 = await ensureFreshAccessToken14(inv, clientId, clientSecret);
30733
- if (inv.capabilityName === "search_documents") return searchDocuments(inv, accessToken2, baseUrl2, timeoutMs);
30734
- if (inv.capabilityName === "get_document") return getDocument2(inv, accessToken2, baseUrl2, timeoutMs);
30732
+ const accessToken3 = await ensureFreshAccessToken14(inv, clientId, clientSecret);
30733
+ if (inv.capabilityName === "search_documents") return searchDocuments(inv, accessToken3, baseUrl3, timeoutMs);
30734
+ if (inv.capabilityName === "get_document") return getDocument2(inv, accessToken3, baseUrl3, timeoutMs);
30735
30735
  throw new Error(`pandadoc: unknown read capability ${inv.capabilityName}`);
30736
30736
  },
30737
30737
  async executeMutation(inv) {
30738
- const accessToken2 = await ensureFreshAccessToken14(inv, clientId, clientSecret);
30739
- if (inv.capabilityName === "create_document") return createDocument2(inv, accessToken2, baseUrl2, timeoutMs);
30740
- if (inv.capabilityName === "send_document") return sendDocument(inv, accessToken2, baseUrl2, timeoutMs);
30741
- if (inv.capabilityName === "cancel_document") return cancelDocument(inv, accessToken2, baseUrl2, timeoutMs);
30738
+ const accessToken3 = await ensureFreshAccessToken14(inv, clientId, clientSecret);
30739
+ if (inv.capabilityName === "create_document") return createDocument2(inv, accessToken3, baseUrl3, timeoutMs);
30740
+ if (inv.capabilityName === "send_document") return sendDocument(inv, accessToken3, baseUrl3, timeoutMs);
30741
+ if (inv.capabilityName === "cancel_document") return cancelDocument(inv, accessToken3, baseUrl3, timeoutMs);
30742
30742
  throw new Error(`pandadoc: unknown mutation capability ${inv.capabilityName}`);
30743
30743
  },
30744
30744
  async exchangeOAuth(input) {
@@ -30783,9 +30783,9 @@ function pandadoc(opts) {
30783
30783
  },
30784
30784
  async test(source) {
30785
30785
  try {
30786
- const accessToken2 = await ensureFreshAccessTokenFromCreds(source.credentials, clientId, clientSecret);
30787
- const res = await fetch(`${baseUrl2}/documents?count=1`, {
30788
- headers: { authorization: `Bearer ${accessToken2}` },
30786
+ const accessToken3 = await ensureFreshAccessTokenFromCreds(source.credentials, clientId, clientSecret);
30787
+ const res = await fetch(`${baseUrl3}/documents?count=1`, {
30788
+ headers: { authorization: `Bearer ${accessToken3}` },
30789
30789
  signal: AbortSignal.timeout(8e3)
30790
30790
  });
30791
30791
  if (res.status === 401 || res.status === 403) {
@@ -30829,15 +30829,15 @@ function normalizeDetail(d) {
30829
30829
  pricing: d.pricing
30830
30830
  };
30831
30831
  }
30832
- async function searchDocuments(inv, accessToken2, baseUrl2, timeoutMs) {
30833
- const { query, status, templateId, limit } = inv.args;
30832
+ async function searchDocuments(inv, accessToken3, baseUrl3, timeoutMs) {
30833
+ const { query: query2, status, templateId, limit } = inv.args;
30834
30834
  const params = new URLSearchParams();
30835
- if (query) params.set("q", query);
30835
+ if (query2) params.set("q", query2);
30836
30836
  if (status) params.set("status", status);
30837
30837
  if (templateId) params.set("template_id", templateId);
30838
30838
  params.set("count", String(Math.min(Math.max(limit ?? 25, 1), 100)));
30839
- const res = await fetch(`${baseUrl2}/documents?${params.toString()}`, {
30840
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
30839
+ const res = await fetch(`${baseUrl3}/documents?${params.toString()}`, {
30840
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
30841
30841
  signal: AbortSignal.timeout(timeoutMs)
30842
30842
  });
30843
30843
  if (res.status === 401) throw new CredentialsExpired("PandaDoc rejected token (401)", inv.source.id);
@@ -30854,10 +30854,10 @@ async function searchDocuments(inv, accessToken2, baseUrl2, timeoutMs) {
30854
30854
  fetchedAt: Date.now()
30855
30855
  };
30856
30856
  }
30857
- async function getDocument2(inv, accessToken2, baseUrl2, timeoutMs) {
30857
+ async function getDocument2(inv, accessToken3, baseUrl3, timeoutMs) {
30858
30858
  const { documentId } = inv.args;
30859
- const res = await fetch(`${baseUrl2}/documents/${encodeURIComponent(documentId)}/details`, {
30860
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
30859
+ const res = await fetch(`${baseUrl3}/documents/${encodeURIComponent(documentId)}/details`, {
30860
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
30861
30861
  signal: AbortSignal.timeout(timeoutMs)
30862
30862
  });
30863
30863
  if (res.status === 401) throw new CredentialsExpired("PandaDoc rejected token (401)", inv.source.id);
@@ -30875,11 +30875,11 @@ async function getDocument2(inv, accessToken2, baseUrl2, timeoutMs) {
30875
30875
  fetchedAt: Date.now()
30876
30876
  };
30877
30877
  }
30878
- async function createDocument2(inv, accessToken2, baseUrl2, timeoutMs) {
30878
+ async function createDocument2(inv, accessToken3, baseUrl3, timeoutMs) {
30879
30879
  const { name, templateId, recipients, tokens, fields, pricingTables, metadata, tags } = inv.args;
30880
30880
  const fingerprintKey = "tangleIdempotencyKey";
30881
30881
  const fingerprint = inv.idempotencyKey;
30882
- const replay = await findByFingerprint(accessToken2, baseUrl2, timeoutMs, fingerprintKey, fingerprint);
30882
+ const replay = await findByFingerprint(accessToken3, baseUrl3, timeoutMs, fingerprintKey, fingerprint);
30883
30883
  if (replay) {
30884
30884
  return {
30885
30885
  status: "committed",
@@ -30905,10 +30905,10 @@ async function createDocument2(inv, accessToken2, baseUrl2, timeoutMs) {
30905
30905
  metadata: { ...metadata ?? {}, [fingerprintKey]: fingerprint },
30906
30906
  tags: tags ?? []
30907
30907
  };
30908
- const res = await fetch(`${baseUrl2}/documents`, {
30908
+ const res = await fetch(`${baseUrl3}/documents`, {
30909
30909
  method: "POST",
30910
30910
  headers: {
30911
- authorization: `Bearer ${accessToken2}`,
30911
+ authorization: `Bearer ${accessToken3}`,
30912
30912
  "content-type": "application/json",
30913
30913
  accept: "application/json"
30914
30914
  },
@@ -30937,19 +30937,19 @@ async function createDocument2(inv, accessToken2, baseUrl2, timeoutMs) {
30937
30937
  idempotentReplay: false
30938
30938
  };
30939
30939
  }
30940
- async function findByFingerprint(accessToken2, baseUrl2, timeoutMs, key, fingerprint) {
30940
+ async function findByFingerprint(accessToken3, baseUrl3, timeoutMs, key, fingerprint) {
30941
30941
  const params = new URLSearchParams();
30942
30942
  params.set(`metadata_${key}`, fingerprint);
30943
30943
  params.set("count", "1");
30944
- const res = await fetch(`${baseUrl2}/documents?${params.toString()}`, {
30945
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
30944
+ const res = await fetch(`${baseUrl3}/documents?${params.toString()}`, {
30945
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
30946
30946
  signal: AbortSignal.timeout(timeoutMs)
30947
30947
  });
30948
30948
  if (!res.ok) return null;
30949
30949
  const json = await res.json().catch(() => ({}));
30950
30950
  return json.results?.[0] ?? null;
30951
30951
  }
30952
- async function sendDocument(inv, accessToken2, baseUrl2, timeoutMs) {
30952
+ async function sendDocument(inv, accessToken3, baseUrl3, timeoutMs) {
30953
30953
  const { documentId, subject, message, sender, silent } = inv.args;
30954
30954
  const body = {
30955
30955
  silent: silent ?? false
@@ -30963,10 +30963,10 @@ async function sendDocument(inv, accessToken2, baseUrl2, timeoutMs) {
30963
30963
  last_name: sender.lastName
30964
30964
  };
30965
30965
  }
30966
- const res = await fetch(`${baseUrl2}/documents/${encodeURIComponent(documentId)}/send`, {
30966
+ const res = await fetch(`${baseUrl3}/documents/${encodeURIComponent(documentId)}/send`, {
30967
30967
  method: "POST",
30968
30968
  headers: {
30969
- authorization: `Bearer ${accessToken2}`,
30969
+ authorization: `Bearer ${accessToken3}`,
30970
30970
  "content-type": "application/json",
30971
30971
  accept: "application/json"
30972
30972
  },
@@ -31009,12 +31009,12 @@ async function sendDocument(inv, accessToken2, baseUrl2, timeoutMs) {
31009
31009
  idempotentReplay: false
31010
31010
  };
31011
31011
  }
31012
- async function cancelDocument(inv, accessToken2, baseUrl2, timeoutMs) {
31012
+ async function cancelDocument(inv, accessToken3, baseUrl3, timeoutMs) {
31013
31013
  const { documentId, reason } = inv.args;
31014
- const res = await fetch(`${baseUrl2}/documents/${encodeURIComponent(documentId)}/cancel`, {
31014
+ const res = await fetch(`${baseUrl3}/documents/${encodeURIComponent(documentId)}/cancel`, {
31015
31015
  method: "POST",
31016
31016
  headers: {
31017
- authorization: `Bearer ${accessToken2}`,
31017
+ authorization: `Bearer ${accessToken3}`,
31018
31018
  "content-type": "application/json",
31019
31019
  accept: "application/json"
31020
31020
  },
@@ -32579,7 +32579,7 @@ var rssConnector = {
32579
32579
  const body = await readBoundedText(res, MAX_BODY_BYTES);
32580
32580
  const parsed = parseFeed(body, url.toString());
32581
32581
  const filtered = filterAndLimit(parsed.entries, since, limit);
32582
- const data3 = {
32582
+ const data4 = {
32583
32583
  feedTitle: parsed.feedTitle,
32584
32584
  feedUrl: url.toString(),
32585
32585
  feedUpdated: parsed.feedUpdated,
@@ -32587,7 +32587,7 @@ var rssConnector = {
32587
32587
  format: parsed.format
32588
32588
  };
32589
32589
  return {
32590
- data: data3,
32590
+ data: data4,
32591
32591
  etag: res.headers.get("etag") ?? res.headers.get("last-modified") ?? void 0,
32592
32592
  fetchedAt: Date.now()
32593
32593
  };
@@ -33724,16 +33724,16 @@ function sharepoint(opts) {
33724
33724
  ]
33725
33725
  },
33726
33726
  async executeRead(inv) {
33727
- const accessToken2 = await ensureFreshAccessToken15(
33727
+ const accessToken3 = await ensureFreshAccessToken15(
33728
33728
  inv.source.credentials,
33729
33729
  clientId,
33730
33730
  clientSecret
33731
33731
  );
33732
33732
  if (inv.capabilityName === "search_sites") {
33733
- const { query, top } = inv.args;
33733
+ const { query: query2, top } = inv.args;
33734
33734
  const t = clamp(top ?? 20, 1, 50);
33735
- const url = `${GRAPH3}/sites?search=${encodeURIComponent(query)}&$top=${t}&$select=id,name,displayName,webUrl,description`;
33736
- const json = await graphGet3(url, accessToken2, inv.source.id);
33735
+ const url = `${GRAPH3}/sites?search=${encodeURIComponent(query2)}&$top=${t}&$select=id,name,displayName,webUrl,description`;
33736
+ const json = await graphGet3(url, accessToken3, inv.source.id);
33737
33737
  const sites = (json.value ?? []).map((s) => ({
33738
33738
  id: s.id,
33739
33739
  name: s.displayName ?? s.name,
@@ -33747,7 +33747,7 @@ function sharepoint(opts) {
33747
33747
  const t = clamp(top ?? 50, 1, 200);
33748
33748
  const path = folderId ? `/sites/${encodeURIComponent(siteId)}/drive/items/${encodeURIComponent(folderId)}/children` : `/sites/${encodeURIComponent(siteId)}/drive/root/children`;
33749
33749
  const url = `${GRAPH3}${path}?$top=${t}&$select=id,name,size,webUrl,file,folder,lastModifiedDateTime,eTag`;
33750
- const json = await graphGet3(url, accessToken2, inv.source.id);
33750
+ const json = await graphGet3(url, accessToken3, inv.source.id);
33751
33751
  const items = (json.value ?? []).map((it) => ({
33752
33752
  id: it.id,
33753
33753
  name: it.name,
@@ -33765,11 +33765,11 @@ function sharepoint(opts) {
33765
33765
  };
33766
33766
  }
33767
33767
  if (inv.capabilityName === "search_drive") {
33768
- const { siteId, query, top } = inv.args;
33768
+ const { siteId, query: query2, top } = inv.args;
33769
33769
  const t = clamp(top ?? 20, 1, 50);
33770
- const q = query.replace(/'/g, "''");
33770
+ const q = query2.replace(/'/g, "''");
33771
33771
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/drive/root/search(q='${encodeURIComponent(q)}')?$top=${t}&$select=id,name,size,webUrl,file,folder,lastModifiedDateTime,eTag`;
33772
- const json = await graphGet3(url, accessToken2, inv.source.id);
33772
+ const json = await graphGet3(url, accessToken3, inv.source.id);
33773
33773
  const items = (json.value ?? []).map((it) => ({
33774
33774
  id: it.id,
33775
33775
  name: it.name,
@@ -33785,7 +33785,7 @@ function sharepoint(opts) {
33785
33785
  if (inv.capabilityName === "get_item_content") {
33786
33786
  const { siteId, itemId } = inv.args;
33787
33787
  const metaUrl = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/drive/items/${encodeURIComponent(itemId)}?$select=id,name,size,file,webUrl,@microsoft.graph.downloadUrl,eTag`;
33788
- const meta = await graphGet3(metaUrl, accessToken2, inv.source.id);
33788
+ const meta = await graphGet3(metaUrl, accessToken3, inv.source.id);
33789
33789
  const downloadUrl = meta["@microsoft.graph.downloadUrl"];
33790
33790
  if (typeof meta.size === "number" && meta.size > MAX_INLINE_BYTES) {
33791
33791
  return {
@@ -33804,7 +33804,7 @@ function sharepoint(opts) {
33804
33804
  }
33805
33805
  const contentUrl = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/drive/items/${encodeURIComponent(itemId)}/content`;
33806
33806
  const res = await fetch(contentUrl, {
33807
- headers: { authorization: `Bearer ${accessToken2}` },
33807
+ headers: { authorization: `Bearer ${accessToken3}` },
33808
33808
  signal: AbortSignal.timeout(2e4)
33809
33809
  });
33810
33810
  if (res.status === 401 || res.status === 403) {
@@ -33872,7 +33872,7 @@ function sharepoint(opts) {
33872
33872
  if (inv.capabilityName === "get_site_info") {
33873
33873
  const { siteId } = inv.args;
33874
33874
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}?$select=id,name,displayName,webUrl,description`;
33875
- const site = await graphGet3(url, accessToken2, inv.source.id);
33875
+ const site = await graphGet3(url, accessToken3, inv.source.id);
33876
33876
  return {
33877
33877
  data: {
33878
33878
  id: site.id,
@@ -33891,7 +33891,7 @@ function sharepoint(opts) {
33891
33891
  if (typeof filter === "string" && filter.length > 0) params.set("$filter", filter);
33892
33892
  if (typeof expand === "string" && expand.length > 0) params.set("$expand", expand);
33893
33893
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/lists/${encodeURIComponent(listId)}/items?${params.toString()}`;
33894
- const json = await graphGet3(url, accessToken2, inv.source.id);
33894
+ const json = await graphGet3(url, accessToken3, inv.source.id);
33895
33895
  const items = (json.value ?? []).map((it) => ({
33896
33896
  id: it.id,
33897
33897
  webUrl: it.webUrl,
@@ -33907,7 +33907,7 @@ function sharepoint(opts) {
33907
33907
  throw new Error(`sharepoint: unknown read capability ${inv.capabilityName}`);
33908
33908
  },
33909
33909
  async executeMutation(inv) {
33910
- const accessToken2 = await ensureFreshAccessToken15(
33910
+ const accessToken3 = await ensureFreshAccessToken15(
33911
33911
  inv.source.credentials,
33912
33912
  clientId,
33913
33913
  clientSecret
@@ -33925,7 +33925,7 @@ function sharepoint(opts) {
33925
33925
  const res = await fetch(url, {
33926
33926
  method: "PUT",
33927
33927
  headers: {
33928
- authorization: `Bearer ${accessToken2}`,
33928
+ authorization: `Bearer ${accessToken3}`,
33929
33929
  "content-type": contentType || "text/plain"
33930
33930
  },
33931
33931
  body: bytes,
@@ -33973,7 +33973,7 @@ function sharepoint(opts) {
33973
33973
  const res = await fetch(url, {
33974
33974
  method: "POST",
33975
33975
  headers: {
33976
- authorization: `Bearer ${accessToken2}`,
33976
+ authorization: `Bearer ${accessToken3}`,
33977
33977
  "content-type": "application/json",
33978
33978
  accept: "application/json"
33979
33979
  },
@@ -34010,7 +34010,7 @@ function sharepoint(opts) {
34010
34010
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/drive/items/${encodeURIComponent(itemId)}`;
34011
34011
  const res = await fetch(url, {
34012
34012
  method: "DELETE",
34013
- headers: { authorization: `Bearer ${accessToken2}` },
34013
+ headers: { authorization: `Bearer ${accessToken3}` },
34014
34014
  signal: AbortSignal.timeout(15e3)
34015
34015
  });
34016
34016
  if (res.status === 401 || res.status === 403) {
@@ -34054,7 +34054,7 @@ function sharepoint(opts) {
34054
34054
  const res = await fetch(url, {
34055
34055
  method: "PATCH",
34056
34056
  headers: {
34057
- authorization: `Bearer ${accessToken2}`,
34057
+ authorization: `Bearer ${accessToken3}`,
34058
34058
  "content-type": "application/json",
34059
34059
  accept: "application/json"
34060
34060
  },
@@ -34104,7 +34104,7 @@ function sharepoint(opts) {
34104
34104
  const res = await fetch(url, {
34105
34105
  method: "POST",
34106
34106
  headers: {
34107
- authorization: `Bearer ${accessToken2}`,
34107
+ authorization: `Bearer ${accessToken3}`,
34108
34108
  "content-type": "application/json",
34109
34109
  accept: "application/json"
34110
34110
  },
@@ -34141,7 +34141,7 @@ function sharepoint(opts) {
34141
34141
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/drive/items/${encodeURIComponent(itemId)}/permissions/${encodeURIComponent(permissionId)}`;
34142
34142
  const res = await fetch(url, {
34143
34143
  method: "DELETE",
34144
- headers: { authorization: `Bearer ${accessToken2}` },
34144
+ headers: { authorization: `Bearer ${accessToken3}` },
34145
34145
  signal: AbortSignal.timeout(15e3)
34146
34146
  });
34147
34147
  if (res.status === 401 || res.status === 403) {
@@ -34181,7 +34181,7 @@ function sharepoint(opts) {
34181
34181
  const res = await fetch(url, {
34182
34182
  method: "POST",
34183
34183
  headers: {
34184
- authorization: `Bearer ${accessToken2}`,
34184
+ authorization: `Bearer ${accessToken3}`,
34185
34185
  "content-type": "application/json",
34186
34186
  accept: "application/json"
34187
34187
  },
@@ -34227,7 +34227,7 @@ function sharepoint(opts) {
34227
34227
  const res = await fetch(url, {
34228
34228
  method: "POST",
34229
34229
  headers: {
34230
- authorization: `Bearer ${accessToken2}`,
34230
+ authorization: `Bearer ${accessToken3}`,
34231
34231
  "content-type": "application/json",
34232
34232
  accept: "application/json"
34233
34233
  },
@@ -34267,7 +34267,7 @@ function sharepoint(opts) {
34267
34267
  const res = await fetch(url, {
34268
34268
  method: "POST",
34269
34269
  headers: {
34270
- authorization: `Bearer ${accessToken2}`,
34270
+ authorization: `Bearer ${accessToken3}`,
34271
34271
  "content-type": "application/json",
34272
34272
  accept: "application/json"
34273
34273
  },
@@ -34307,7 +34307,7 @@ function sharepoint(opts) {
34307
34307
  const { siteId, listId, itemId, fields } = inv.args;
34308
34308
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/lists/${encodeURIComponent(listId)}/items/${encodeURIComponent(itemId)}/fields`;
34309
34309
  const headers = {
34310
- authorization: `Bearer ${accessToken2}`,
34310
+ authorization: `Bearer ${accessToken3}`,
34311
34311
  "content-type": "application/json",
34312
34312
  accept: "application/json"
34313
34313
  };
@@ -34350,7 +34350,7 @@ function sharepoint(opts) {
34350
34350
  const url = `${GRAPH3}/sites/${encodeURIComponent(siteId)}/lists/${encodeURIComponent(listId)}/items/${encodeURIComponent(itemId)}`;
34351
34351
  const res = await fetch(url, {
34352
34352
  method: "DELETE",
34353
- headers: { authorization: `Bearer ${accessToken2}` },
34353
+ headers: { authorization: `Bearer ${accessToken3}` },
34354
34354
  signal: AbortSignal.timeout(15e3)
34355
34355
  });
34356
34356
  if (res.status === 401 || res.status === 403) {
@@ -34390,7 +34390,7 @@ function sharepoint(opts) {
34390
34390
  const res = await fetch(url, {
34391
34391
  method: "POST",
34392
34392
  headers: {
34393
- authorization: `Bearer ${accessToken2}`,
34393
+ authorization: `Bearer ${accessToken3}`,
34394
34394
  accept: "application/json"
34395
34395
  },
34396
34396
  signal: AbortSignal.timeout(15e3)
@@ -34462,13 +34462,13 @@ function sharepoint(opts) {
34462
34462
  },
34463
34463
  async test(source) {
34464
34464
  try {
34465
- const accessToken2 = await ensureFreshAccessToken15(
34465
+ const accessToken3 = await ensureFreshAccessToken15(
34466
34466
  source.credentials,
34467
34467
  clientId,
34468
34468
  clientSecret
34469
34469
  );
34470
34470
  const res = await fetch(`${GRAPH3}/sites/root?$select=id`, {
34471
- headers: { authorization: `Bearer ${accessToken2}` },
34471
+ headers: { authorization: `Bearer ${accessToken3}` },
34472
34472
  signal: AbortSignal.timeout(8e3)
34473
34473
  });
34474
34474
  if (res.status === 401 || res.status === 403) {
@@ -34507,9 +34507,9 @@ async function ensureFreshAccessToken15(creds, clientId, clientSecret) {
34507
34507
  if (refreshed.refreshToken) creds.refreshToken = refreshed.refreshToken;
34508
34508
  return creds.accessToken;
34509
34509
  }
34510
- async function graphGet3(url, accessToken2, dataSourceId) {
34510
+ async function graphGet3(url, accessToken3, dataSourceId) {
34511
34511
  const res = await fetch(url, {
34512
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
34512
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
34513
34513
  signal: AbortSignal.timeout(1e4)
34514
34514
  });
34515
34515
  if (res.status === 401 || res.status === 403) {
@@ -34900,11 +34900,11 @@ function slack(opts) {
34900
34900
  ]
34901
34901
  },
34902
34902
  async executeRead(inv) {
34903
- const accessToken2 = readBotToken(inv.source.credentials);
34903
+ const accessToken3 = readBotToken(inv.source.credentials);
34904
34904
  if (inv.capabilityName === "lookup_user") {
34905
34905
  const { email } = inv.args;
34906
34906
  const url = `${API9}/users.lookupByEmail?email=${encodeURIComponent(email)}`;
34907
- const json = await slackGet(url, accessToken2, inv.source.id);
34907
+ const json = await slackGet(url, accessToken3, inv.source.id);
34908
34908
  if (!json.ok) {
34909
34909
  if (json.error === "users_not_found") {
34910
34910
  return { data: { found: false }, fetchedAt: Date.now() };
@@ -34923,7 +34923,7 @@ function slack(opts) {
34923
34923
  limit: String(Math.min(Math.max(1, limit ?? 200), 1e3)),
34924
34924
  types: types ?? "public_channel,private_channel"
34925
34925
  });
34926
- const json = await slackGet(`${API9}/conversations.list?${params.toString()}`, accessToken2, inv.source.id);
34926
+ const json = await slackGet(`${API9}/conversations.list?${params.toString()}`, accessToken3, inv.source.id);
34927
34927
  if (!json.ok) {
34928
34928
  throw new Error(`slack list_channels: ${json.error ?? "unknown"}`);
34929
34929
  }
@@ -34934,29 +34934,29 @@ function slack(opts) {
34934
34934
  };
34935
34935
  }
34936
34936
  if (inv.capabilityName === "download_file") {
34937
- return downloadFile(inv, accessToken2);
34937
+ return downloadFile(inv, accessToken3);
34938
34938
  }
34939
34939
  throw new Error(`slack: unknown read capability ${inv.capabilityName}`);
34940
34940
  },
34941
34941
  async executeMutation(inv) {
34942
- const accessToken2 = readBotToken(inv.source.credentials);
34942
+ const accessToken3 = readBotToken(inv.source.credentials);
34943
34943
  if (inv.capabilityName === "post_message") {
34944
- return postMessage(inv, accessToken2, 15e3);
34944
+ return postMessage(inv, accessToken3, 15e3);
34945
34945
  }
34946
34946
  if (inv.capabilityName === "post_in_thread") {
34947
- return postInThread(inv, accessToken2, 15e3);
34947
+ return postInThread(inv, accessToken3, 15e3);
34948
34948
  }
34949
34949
  if (inv.capabilityName === "update_message") {
34950
- return updateMessage(inv, accessToken2, 15e3);
34950
+ return updateMessage(inv, accessToken3, 15e3);
34951
34951
  }
34952
34952
  if (inv.capabilityName === "delete_message") {
34953
- return deleteMessage(inv, accessToken2, 15e3);
34953
+ return deleteMessage(inv, accessToken3, 15e3);
34954
34954
  }
34955
34955
  if (inv.capabilityName === "add_reaction") {
34956
- return addReaction(inv, accessToken2, 15e3);
34956
+ return addReaction(inv, accessToken3, 15e3);
34957
34957
  }
34958
34958
  if (inv.capabilityName === "upload_file") {
34959
- return uploadFile3(inv, accessToken2, 3e4);
34959
+ return uploadFile3(inv, accessToken3, 3e4);
34960
34960
  }
34961
34961
  throw new Error(`slack: unknown mutation capability ${inv.capabilityName}`);
34962
34962
  },
@@ -35002,10 +35002,10 @@ function slack(opts) {
35002
35002
  },
35003
35003
  async test(source) {
35004
35004
  try {
35005
- const accessToken2 = readBotToken(source.credentials);
35005
+ const accessToken3 = readBotToken(source.credentials);
35006
35006
  const res = await fetch(`${API9}/auth.test`, {
35007
35007
  method: "POST",
35008
- headers: { authorization: `Bearer ${accessToken2}` },
35008
+ headers: { authorization: `Bearer ${accessToken3}` },
35009
35009
  signal: AbortSignal.timeout(8e3)
35010
35010
  });
35011
35011
  if (!res.ok) return { ok: false, reason: `Slack returned ${res.status}` };
@@ -35027,9 +35027,9 @@ function readBotToken(creds) {
35027
35027
  }
35028
35028
  return creds.accessToken;
35029
35029
  }
35030
- async function slackGet(url, accessToken2, dataSourceId) {
35030
+ async function slackGet(url, accessToken3, dataSourceId) {
35031
35031
  const res = await fetch(url, {
35032
- headers: { authorization: `Bearer ${accessToken2}` },
35032
+ headers: { authorization: `Bearer ${accessToken3}` },
35033
35033
  signal: AbortSignal.timeout(1e4)
35034
35034
  });
35035
35035
  if (res.status === 401) {
@@ -35041,7 +35041,7 @@ async function slackGet(url, accessToken2, dataSourceId) {
35041
35041
  }
35042
35042
  return await res.json();
35043
35043
  }
35044
- async function downloadFile(inv, accessToken2) {
35044
+ async function downloadFile(inv, accessToken3) {
35045
35045
  const { file_id: rawFileId } = inv.args;
35046
35046
  const fileId = typeof rawFileId === "string" ? rawFileId.trim() : "";
35047
35047
  if (!fileId || fileId.length > 300) {
@@ -35051,7 +35051,7 @@ async function downloadFile(inv, accessToken2) {
35051
35051
  }
35052
35052
  const info = await slackGet(
35053
35053
  `${API9}/files.info?file=${encodeURIComponent(fileId)}`,
35054
- accessToken2,
35054
+ accessToken3,
35055
35055
  inv.source.id
35056
35056
  );
35057
35057
  if (!info.ok) {
@@ -35075,7 +35075,7 @@ async function downloadFile(inv, accessToken2) {
35075
35075
  );
35076
35076
  }
35077
35077
  const response = await fetch(url, {
35078
- headers: { authorization: `Bearer ${accessToken2}` },
35078
+ headers: { authorization: `Bearer ${accessToken3}` },
35079
35079
  redirect: "error",
35080
35080
  signal: AbortSignal.timeout(3e4)
35081
35081
  });
@@ -35147,11 +35147,11 @@ async function readBoundedBody(response, limitBytes) {
35147
35147
  function isAuthError(error) {
35148
35148
  return error === "invalid_auth" || error === "token_expired" || error === "not_authed" || error === "token_revoked";
35149
35149
  }
35150
- async function slackPostJson(url, accessToken2, body, timeoutMs, dataSourceId, cap) {
35150
+ async function slackPostJson(url, accessToken3, body, timeoutMs, dataSourceId, cap) {
35151
35151
  const res = await fetch(url, {
35152
35152
  method: "POST",
35153
35153
  headers: {
35154
- authorization: `Bearer ${accessToken2}`,
35154
+ authorization: `Bearer ${accessToken3}`,
35155
35155
  "content-type": "application/json; charset=utf-8"
35156
35156
  },
35157
35157
  body: JSON.stringify(body),
@@ -35173,12 +35173,12 @@ async function slackPostJson(url, accessToken2, body, timeoutMs, dataSourceId, c
35173
35173
  }
35174
35174
  return json;
35175
35175
  }
35176
- async function postMessage(inv, accessToken2, timeoutMs) {
35176
+ async function postMessage(inv, accessToken3, timeoutMs) {
35177
35177
  const { channel, text, blocks } = inv.args;
35178
35178
  if (!channel) throw new Error("slack post_message: `channel` is required");
35179
35179
  const json = await slackPostJson(
35180
35180
  `${API9}/chat.postMessage`,
35181
- accessToken2,
35181
+ accessToken3,
35182
35182
  { channel, text, blocks },
35183
35183
  timeoutMs,
35184
35184
  inv.source.id,
@@ -35191,13 +35191,13 @@ async function postMessage(inv, accessToken2, timeoutMs) {
35191
35191
  idempotentReplay: false
35192
35192
  };
35193
35193
  }
35194
- async function postInThread(inv, accessToken2, timeoutMs) {
35194
+ async function postInThread(inv, accessToken3, timeoutMs) {
35195
35195
  const { channel, thread_ts, text, blocks } = inv.args;
35196
35196
  if (!channel) throw new Error("slack post_in_thread: `channel` is required");
35197
35197
  if (!thread_ts) throw new Error("slack post_in_thread: `thread_ts` is required");
35198
35198
  const json = await slackPostJson(
35199
35199
  `${API9}/chat.postMessage`,
35200
- accessToken2,
35200
+ accessToken3,
35201
35201
  { channel, thread_ts, text, blocks },
35202
35202
  timeoutMs,
35203
35203
  inv.source.id,
@@ -35210,7 +35210,7 @@ async function postInThread(inv, accessToken2, timeoutMs) {
35210
35210
  idempotentReplay: false
35211
35211
  };
35212
35212
  }
35213
- async function updateMessage(inv, accessToken2, timeoutMs) {
35213
+ async function updateMessage(inv, accessToken3, timeoutMs) {
35214
35214
  const { channel, ts, text, blocks } = inv.args;
35215
35215
  if (!channel) throw new Error("slack update_message: `channel` is required");
35216
35216
  if (!ts) throw new Error("slack update_message: `ts` is required");
@@ -35219,7 +35219,7 @@ async function updateMessage(inv, accessToken2, timeoutMs) {
35219
35219
  }
35220
35220
  const json = await slackPostJson(
35221
35221
  `${API9}/chat.update`,
35222
- accessToken2,
35222
+ accessToken3,
35223
35223
  { channel, ts, text, blocks },
35224
35224
  timeoutMs,
35225
35225
  inv.source.id,
@@ -35232,13 +35232,13 @@ async function updateMessage(inv, accessToken2, timeoutMs) {
35232
35232
  idempotentReplay: false
35233
35233
  };
35234
35234
  }
35235
- async function deleteMessage(inv, accessToken2, timeoutMs) {
35235
+ async function deleteMessage(inv, accessToken3, timeoutMs) {
35236
35236
  const { channel, ts } = inv.args;
35237
35237
  if (!channel) throw new Error("slack delete_message: `channel` is required");
35238
35238
  if (!ts) throw new Error("slack delete_message: `ts` is required");
35239
35239
  const json = await slackPostJson(
35240
35240
  `${API9}/chat.delete`,
35241
- accessToken2,
35241
+ accessToken3,
35242
35242
  { channel, ts },
35243
35243
  timeoutMs,
35244
35244
  inv.source.id,
@@ -35251,7 +35251,7 @@ async function deleteMessage(inv, accessToken2, timeoutMs) {
35251
35251
  idempotentReplay: false
35252
35252
  };
35253
35253
  }
35254
- async function addReaction(inv, accessToken2, timeoutMs) {
35254
+ async function addReaction(inv, accessToken3, timeoutMs) {
35255
35255
  const { channel, timestamp, name } = inv.args;
35256
35256
  if (!channel) throw new Error("slack add_reaction: `channel` is required");
35257
35257
  if (!timestamp) throw new Error("slack add_reaction: `timestamp` is required");
@@ -35259,7 +35259,7 @@ async function addReaction(inv, accessToken2, timeoutMs) {
35259
35259
  const res = await fetch(`${API9}/reactions.add`, {
35260
35260
  method: "POST",
35261
35261
  headers: {
35262
- authorization: `Bearer ${accessToken2}`,
35262
+ authorization: `Bearer ${accessToken3}`,
35263
35263
  "content-type": "application/json; charset=utf-8"
35264
35264
  },
35265
35265
  body: JSON.stringify({ channel, timestamp, name }),
@@ -35294,7 +35294,7 @@ async function addReaction(inv, accessToken2, timeoutMs) {
35294
35294
  idempotentReplay: false
35295
35295
  };
35296
35296
  }
35297
- async function uploadFile3(inv, accessToken2, timeoutMs) {
35297
+ async function uploadFile3(inv, accessToken3, timeoutMs) {
35298
35298
  const args = inv.args;
35299
35299
  if (!Array.isArray(args.channels) || args.channels.length === 0) {
35300
35300
  throw new Error("slack upload_file: `channels` is required (non-empty array)");
@@ -35305,7 +35305,7 @@ async function uploadFile3(inv, accessToken2, timeoutMs) {
35305
35305
  const stepOne = await fetch(`${API9}/files.getUploadURLExternal`, {
35306
35306
  method: "POST",
35307
35307
  headers: {
35308
- authorization: `Bearer ${accessToken2}`,
35308
+ authorization: `Bearer ${accessToken3}`,
35309
35309
  "content-type": "application/json; charset=utf-8"
35310
35310
  },
35311
35311
  body: JSON.stringify({ filename: args.filename, length: bytes.byteLength }),
@@ -35344,7 +35344,7 @@ async function uploadFile3(inv, accessToken2, timeoutMs) {
35344
35344
  if (args.initial_comment) completePayload.initial_comment = args.initial_comment;
35345
35345
  const completeRes = await slackPostJson(
35346
35346
  `${API9}/files.completeUploadExternal`,
35347
- accessToken2,
35347
+ accessToken3,
35348
35348
  completePayload,
35349
35349
  timeoutMs,
35350
35350
  inv.source.id,
@@ -37153,13 +37153,13 @@ var todoistConnector = declarativeRestConnector({
37153
37153
  kind: "oauth2",
37154
37154
  authorizationUrl: "https://todoist.com/oauth/authorize",
37155
37155
  tokenUrl: "https://todoist.com/oauth/access_token",
37156
- scopes: ["task:add", "task:read", "task:update", "data:read"],
37156
+ scopes: ["data:read_write"],
37157
37157
  clientIdEnv: "TODOIST_OAUTH_CLIENT_ID",
37158
37158
  clientSecretEnv: "TODOIST_OAUTH_CLIENT_SECRET"
37159
37159
  },
37160
37160
  category: "doc",
37161
37161
  defaultConsistencyModel: "authoritative",
37162
- baseUrl: "https://api.todoist.com/rest/v2",
37162
+ baseUrl: "https://api.todoist.com/api/v1",
37163
37163
  test: { method: "GET", path: "/projects" },
37164
37164
  capabilities: [
37165
37165
  {
@@ -37193,7 +37193,7 @@ var todoistConnector = declarativeRestConnector({
37193
37193
  }
37194
37194
  },
37195
37195
  cas: "native-idempotency",
37196
- requiredScopes: ["task:add"]
37196
+ requiredScopes: ["data:read_write"]
37197
37197
  },
37198
37198
  {
37199
37199
  name: "tasks.update",
@@ -37225,7 +37225,7 @@ var todoistConnector = declarativeRestConnector({
37225
37225
  }
37226
37226
  },
37227
37227
  cas: "optimistic-read-verify",
37228
- requiredScopes: ["task:update"]
37228
+ requiredScopes: ["data:read_write"]
37229
37229
  },
37230
37230
  {
37231
37231
  name: "tasks.get",
@@ -37237,7 +37237,7 @@ var todoistConnector = declarativeRestConnector({
37237
37237
  required: ["task_id"]
37238
37238
  },
37239
37239
  request: { method: "GET", path: "/tasks/{task_id}" },
37240
- requiredScopes: ["task:read"]
37240
+ requiredScopes: ["data:read_write"]
37241
37241
  },
37242
37242
  {
37243
37243
  name: "tasks.list",
@@ -37261,7 +37261,7 @@ var todoistConnector = declarativeRestConnector({
37261
37261
  limit: "{limit}"
37262
37262
  }
37263
37263
  },
37264
- requiredScopes: ["task:read"]
37264
+ requiredScopes: ["data:read_write"]
37265
37265
  },
37266
37266
  {
37267
37267
  name: "tasks.complete",
@@ -37274,7 +37274,7 @@ var todoistConnector = declarativeRestConnector({
37274
37274
  },
37275
37275
  request: { method: "POST", path: "/tasks/{task_id}/close" },
37276
37276
  cas: "optimistic-read-verify",
37277
- requiredScopes: ["task:update"]
37277
+ requiredScopes: ["data:read_write"]
37278
37278
  },
37279
37279
  {
37280
37280
  name: "tasks.delete",
@@ -37287,7 +37287,7 @@ var todoistConnector = declarativeRestConnector({
37287
37287
  },
37288
37288
  request: { method: "DELETE", path: "/tasks/{task_id}" },
37289
37289
  cas: "optimistic-read-verify",
37290
- requiredScopes: ["task:update"]
37290
+ requiredScopes: ["data:read_write"]
37291
37291
  },
37292
37292
  {
37293
37293
  name: "projects.list",
@@ -37299,7 +37299,7 @@ var todoistConnector = declarativeRestConnector({
37299
37299
  required: []
37300
37300
  },
37301
37301
  request: { method: "GET", path: "/projects" },
37302
- requiredScopes: ["data:read"]
37302
+ requiredScopes: ["data:read_write"]
37303
37303
  },
37304
37304
  {
37305
37305
  name: "projects.create",
@@ -37323,7 +37323,7 @@ var todoistConnector = declarativeRestConnector({
37323
37323
  },
37324
37324
  cas: "native-idempotency",
37325
37325
  externalEffect: true,
37326
- requiredScopes: ["data:read"]
37326
+ requiredScopes: ["data:read_write"]
37327
37327
  },
37328
37328
  {
37329
37329
  name: "projects.delete",
@@ -37337,7 +37337,7 @@ var todoistConnector = declarativeRestConnector({
37337
37337
  request: { method: "DELETE", path: "/projects/{project_id}" },
37338
37338
  cas: "native-idempotency",
37339
37339
  externalEffect: true,
37340
- requiredScopes: ["data:read"]
37340
+ requiredScopes: ["data:read_write"]
37341
37341
  },
37342
37342
  {
37343
37343
  name: "comments.create",
@@ -37359,7 +37359,7 @@ var todoistConnector = declarativeRestConnector({
37359
37359
  },
37360
37360
  cas: "native-idempotency",
37361
37361
  externalEffect: true,
37362
- requiredScopes: ["task:add"]
37362
+ requiredScopes: ["data:read_write"]
37363
37363
  },
37364
37364
  {
37365
37365
  name: "labels.create",
@@ -37382,7 +37382,7 @@ var todoistConnector = declarativeRestConnector({
37382
37382
  },
37383
37383
  cas: "native-idempotency",
37384
37384
  externalEffect: true,
37385
- requiredScopes: ["data:read"]
37385
+ requiredScopes: ["data:read_write"]
37386
37386
  }
37387
37387
  ]
37388
37388
  });
@@ -39446,7 +39446,7 @@ function whatsappBusiness(opts) {
39446
39446
  ]
39447
39447
  },
39448
39448
  async executeRead(inv) {
39449
- const accessToken2 = readAccessToken(inv.source.credentials);
39449
+ const accessToken3 = readAccessToken(inv.source.credentials);
39450
39450
  if (inv.capabilityName === "list_message_templates") {
39451
39451
  const wabaId = readMetaString4(inv.source.metadata, "wabaId");
39452
39452
  const { limit, status } = inv.args;
@@ -39454,11 +39454,11 @@ function whatsappBusiness(opts) {
39454
39454
  params.set("limit", String(Math.min(Math.max(1, limit ?? 50), 200)));
39455
39455
  if (status) params.set("status", status);
39456
39456
  const url = `${API12}/${encodeURIComponent(wabaId)}/message_templates?${params.toString()}`;
39457
- const json = await graphGet4(url, accessToken2, inv.source.id);
39458
- const data3 = json.data ?? [];
39457
+ const json = await graphGet4(url, accessToken3, inv.source.id);
39458
+ const data4 = json.data ?? [];
39459
39459
  return {
39460
39460
  data: {
39461
- templates: data3.map((t) => ({
39461
+ templates: data4.map((t) => ({
39462
39462
  id: t.id,
39463
39463
  name: t.name,
39464
39464
  status: t.status,
@@ -39475,7 +39475,7 @@ function whatsappBusiness(opts) {
39475
39475
  fields: "display_phone_number,verified_name,quality_rating,code_verification_status,platform_type"
39476
39476
  });
39477
39477
  const url = `${API12}/${encodeURIComponent(phoneNumberId)}?${params.toString()}`;
39478
- const json = await graphGet4(url, accessToken2, inv.source.id);
39478
+ const json = await graphGet4(url, accessToken3, inv.source.id);
39479
39479
  return {
39480
39480
  data: {
39481
39481
  phoneNumber: json.display_phone_number,
@@ -39490,15 +39490,15 @@ function whatsappBusiness(opts) {
39490
39490
  throw new Error(`whatsapp-business: unknown read capability ${inv.capabilityName}`);
39491
39491
  },
39492
39492
  async executeMutation(inv) {
39493
- const accessToken2 = readAccessToken(inv.source.credentials);
39493
+ const accessToken3 = readAccessToken(inv.source.credentials);
39494
39494
  if (inv.capabilityName === "media.upload") {
39495
- return uploadMedia(inv, accessToken2);
39495
+ return uploadMedia(inv, accessToken3);
39496
39496
  }
39497
39497
  if (inv.capabilityName === "templates.create") {
39498
- return createTemplate(inv, accessToken2);
39498
+ return createTemplate(inv, accessToken3);
39499
39499
  }
39500
39500
  if (inv.capabilityName === "templates.delete") {
39501
- return deleteTemplate(inv, accessToken2);
39501
+ return deleteTemplate(inv, accessToken3);
39502
39502
  }
39503
39503
  const phoneNumberId = readMetaString4(inv.source.metadata, "phoneNumberId");
39504
39504
  const url = `${API12}/${encodeURIComponent(phoneNumberId)}/messages`;
@@ -39541,7 +39541,7 @@ function whatsappBusiness(opts) {
39541
39541
  const res = await fetch(url, {
39542
39542
  method: "POST",
39543
39543
  headers: {
39544
- authorization: `Bearer ${accessToken2}`,
39544
+ authorization: `Bearer ${accessToken3}`,
39545
39545
  "content-type": "application/json"
39546
39546
  },
39547
39547
  body: JSON.stringify(body),
@@ -39604,11 +39604,11 @@ function whatsappBusiness(opts) {
39604
39604
  },
39605
39605
  async test(source) {
39606
39606
  try {
39607
- const accessToken2 = readAccessToken(source.credentials);
39607
+ const accessToken3 = readAccessToken(source.credentials);
39608
39608
  const phoneNumberId = typeof source.metadata.phoneNumberId === "string" ? source.metadata.phoneNumberId : void 0;
39609
39609
  const probeUrl = phoneNumberId ? `${API12}/${encodeURIComponent(phoneNumberId)}?fields=display_phone_number` : `${API12}/me?fields=id`;
39610
39610
  const res = await fetch(probeUrl, {
39611
- headers: { authorization: `Bearer ${accessToken2}` },
39611
+ headers: { authorization: `Bearer ${accessToken3}` },
39612
39612
  signal: AbortSignal.timeout(8e3)
39613
39613
  });
39614
39614
  if (res.status === 401) return { ok: false, reason: "WhatsApp Business rejected credentials (401) \u2014 reconnect required" };
@@ -39637,9 +39637,9 @@ function readMetaString4(meta, key) {
39637
39637
  }
39638
39638
  return v;
39639
39639
  }
39640
- async function graphGet4(url, accessToken2, dataSourceId) {
39640
+ async function graphGet4(url, accessToken3, dataSourceId) {
39641
39641
  const res = await fetch(url, {
39642
- headers: { authorization: `Bearer ${accessToken2}`, accept: "application/json" },
39642
+ headers: { authorization: `Bearer ${accessToken3}`, accept: "application/json" },
39643
39643
  signal: AbortSignal.timeout(1e4)
39644
39644
  });
39645
39645
  if (res.status === 401) {
@@ -39658,7 +39658,7 @@ function decodeBase64(value) {
39658
39658
  for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
39659
39659
  return bytes;
39660
39660
  }
39661
- async function uploadMedia(inv, accessToken2) {
39661
+ async function uploadMedia(inv, accessToken3) {
39662
39662
  const phoneNumberId = readMetaString4(inv.source.metadata, "phoneNumberId");
39663
39663
  const { dataBase64, mimeType, filename } = inv.args;
39664
39664
  if (typeof dataBase64 !== "string" || dataBase64.length === 0) {
@@ -39668,15 +39668,15 @@ async function uploadMedia(inv, accessToken2) {
39668
39668
  throw new Error("whatsapp-business media.upload: mimeType is required");
39669
39669
  }
39670
39670
  const bytes = decodeBase64(dataBase64);
39671
- const form = new FormData();
39672
- form.set("messaging_product", "whatsapp");
39673
- form.set("type", mimeType);
39674
- form.set("file", new Blob([bytes], { type: mimeType }), filename ?? "upload");
39671
+ const form2 = new FormData();
39672
+ form2.set("messaging_product", "whatsapp");
39673
+ form2.set("type", mimeType);
39674
+ form2.set("file", new Blob([bytes], { type: mimeType }), filename ?? "upload");
39675
39675
  const url = `${API12}/${encodeURIComponent(phoneNumberId)}/media`;
39676
39676
  const res = await fetch(url, {
39677
39677
  method: "POST",
39678
- headers: { authorization: `Bearer ${accessToken2}` },
39679
- body: form,
39678
+ headers: { authorization: `Bearer ${accessToken3}` },
39679
+ body: form2,
39680
39680
  signal: AbortSignal.timeout(3e4)
39681
39681
  });
39682
39682
  if (res.status === 401) {
@@ -39694,7 +39694,7 @@ async function uploadMedia(inv, accessToken2) {
39694
39694
  idempotentReplay: false
39695
39695
  };
39696
39696
  }
39697
- async function createTemplate(inv, accessToken2) {
39697
+ async function createTemplate(inv, accessToken3) {
39698
39698
  const wabaId = readMetaString4(inv.source.metadata, "wabaId");
39699
39699
  const { name, language, category, components } = inv.args;
39700
39700
  if (typeof name !== "string" || name.length === 0) {
@@ -39713,7 +39713,7 @@ async function createTemplate(inv, accessToken2) {
39713
39713
  const res = await fetch(url, {
39714
39714
  method: "POST",
39715
39715
  headers: {
39716
- authorization: `Bearer ${accessToken2}`,
39716
+ authorization: `Bearer ${accessToken3}`,
39717
39717
  "content-type": "application/json"
39718
39718
  },
39719
39719
  body: JSON.stringify({ name, language, category, components }),
@@ -39734,7 +39734,7 @@ async function createTemplate(inv, accessToken2) {
39734
39734
  idempotentReplay: false
39735
39735
  };
39736
39736
  }
39737
- async function deleteTemplate(inv, accessToken2) {
39737
+ async function deleteTemplate(inv, accessToken3) {
39738
39738
  const wabaId = readMetaString4(inv.source.metadata, "wabaId");
39739
39739
  const { name, hsmId } = inv.args;
39740
39740
  if (typeof name !== "string" || name.length === 0) {
@@ -39746,7 +39746,7 @@ async function deleteTemplate(inv, accessToken2) {
39746
39746
  const url = `${API12}/${encodeURIComponent(wabaId)}/message_templates?${params.toString()}`;
39747
39747
  const res = await fetch(url, {
39748
39748
  method: "DELETE",
39749
- headers: { authorization: `Bearer ${accessToken2}` },
39749
+ headers: { authorization: `Bearer ${accessToken3}` },
39750
39750
  signal: AbortSignal.timeout(15e3)
39751
39751
  });
39752
39752
  if (res.status === 401) {
@@ -42158,6 +42158,541 @@ var zoomConnector = declarativeRestConnector({
42158
42158
  ]
42159
42159
  });
42160
42160
 
42161
+ // src/connectors/adapters/zoho-bookings.ts
42162
+ var zohoBookingsConnector = {
42163
+ manifest: {
42164
+ kind: "zoho-bookings",
42165
+ displayName: "Zoho Bookings",
42166
+ description: "Discover services and staff, check availability, and manage Zoho Bookings appointments.",
42167
+ auth: {
42168
+ kind: "oauth2",
42169
+ authorizationUrl: "https://accounts.zoho.com/oauth/v2/auth",
42170
+ tokenUrl: "https://accounts.zoho.com/oauth/v2/token",
42171
+ scopes: ["zohobookings.data.CREATE", "zohobookings.data.READ"],
42172
+ scopeSeparator: ",",
42173
+ clientIdEnv: "ZOHO_OAUTH_CLIENT_ID",
42174
+ clientSecretEnv: "ZOHO_OAUTH_CLIENT_SECRET",
42175
+ extraAuthParams: { access_type: "offline", prompt: "consent" }
42176
+ },
42177
+ category: "calendar",
42178
+ defaultConsistencyModel: "authoritative",
42179
+ capabilities: [
42180
+ readCapability("workspaces.list", "List Zoho Bookings workspaces.", {}),
42181
+ readCapability("services.list", "List services, optionally within one workspace.", {
42182
+ workspace_id: { type: "string" }
42183
+ }),
42184
+ readCapability("resources.list", "List bookable resources, optionally for one service.", {
42185
+ service_id: { type: "string" }
42186
+ }),
42187
+ readCapability("staff.list", "List staff, optionally for one service.", {
42188
+ service_id: { type: "string" }
42189
+ }),
42190
+ readCapability("appointments.list", "List appointments from a required start time.", {
42191
+ from_time: {
42192
+ type: "string",
42193
+ description: "Zoho timestamp in dd-MMM-yyyy HH:mm:ss format."
42194
+ },
42195
+ to_time: { type: "string" },
42196
+ service_id: { type: "string" },
42197
+ staff_id: { type: "string" },
42198
+ status: { type: "string" }
42199
+ }, ["from_time"]),
42200
+ readCapability("appointments.get", "Read one appointment by booking id.", {
42201
+ booking_id: { type: "string" }
42202
+ }, ["booking_id"]),
42203
+ readCapability("availability.fetch", "Fetch open time slots for a service and date.", {
42204
+ service_id: { type: "string" },
42205
+ selected_date: { type: "string", description: "Date in YYYY-MM-DD format." },
42206
+ staff_id: { type: "string" },
42207
+ group_id: { type: "string" },
42208
+ resource_id: { type: "string" }
42209
+ }, ["service_id", "selected_date"]),
42210
+ mutationCapability("appointments.book", "Book an appointment for a customer.", {
42211
+ service_id: { type: "string" },
42212
+ from_time: { type: "string", description: "Zoho timestamp in dd-MMM-yyyy HH:mm:ss format." },
42213
+ customer_details: {
42214
+ type: "object",
42215
+ description: "Customer name, email, and phone_number."
42216
+ },
42217
+ staff_id: { type: "string" },
42218
+ resource_id: { type: "string" },
42219
+ group_id: { type: "string" },
42220
+ to_time: { type: "string" },
42221
+ timezone: { type: "string" },
42222
+ notes: { type: "string" },
42223
+ additional_fields: { type: "object" },
42224
+ payment_info: { type: "object" }
42225
+ }, ["service_id", "from_time", "customer_details"]),
42226
+ mutationCapability("appointments.reschedule", "Move an appointment to a new time, staff member, or group.", {
42227
+ booking_id: { type: "string" },
42228
+ start_time: { type: "string", description: "Zoho timestamp in dd-MMM-yyyy HH:mm:ss format." },
42229
+ staff_id: { type: "string" },
42230
+ group_id: { type: "string" }
42231
+ }, ["booking_id"]),
42232
+ mutationCapability("appointments.cancel", "Cancel an appointment by booking id.", {
42233
+ booking_id: { type: "string" }
42234
+ }, ["booking_id"])
42235
+ ]
42236
+ },
42237
+ async executeRead(inv) {
42238
+ let data4;
42239
+ switch (inv.capabilityName) {
42240
+ case "workspaces.list":
42241
+ data4 = await request(inv.source, "/workspaces", { method: "GET" });
42242
+ break;
42243
+ case "services.list":
42244
+ data4 = await request(inv.source, "/services", {
42245
+ method: "GET",
42246
+ query: query(inv.args, ["workspace_id"])
42247
+ });
42248
+ break;
42249
+ case "resources.list":
42250
+ data4 = await request(inv.source, "/resources", {
42251
+ method: "GET",
42252
+ query: query(inv.args, ["service_id"])
42253
+ });
42254
+ break;
42255
+ case "staff.list":
42256
+ data4 = await request(inv.source, "/staffs", {
42257
+ method: "GET",
42258
+ query: query(inv.args, ["service_id"])
42259
+ });
42260
+ break;
42261
+ case "appointments.list": {
42262
+ requireString(inv.args, "from_time");
42263
+ const filters = pick(inv.args, ["from_time", "to_time", "service_id", "staff_id", "status"]);
42264
+ data4 = await request(inv.source, "/fetchappointment", {
42265
+ method: "POST",
42266
+ body: form({ data: JSON.stringify(filters) })
42267
+ });
42268
+ break;
42269
+ }
42270
+ case "appointments.get":
42271
+ data4 = await request(inv.source, "/getappointment", {
42272
+ method: "GET",
42273
+ query: query(inv.args, ["booking_id"], ["booking_id"])
42274
+ });
42275
+ break;
42276
+ case "availability.fetch": {
42277
+ requireString(inv.args, "service_id");
42278
+ requireString(inv.args, "selected_date");
42279
+ exactlyOne(inv.args, ["staff_id", "group_id", "resource_id"], "availability target");
42280
+ data4 = await request(inv.source, "/availableslots", {
42281
+ method: "GET",
42282
+ query: query(inv.args, ["service_id", "selected_date", "staff_id", "group_id", "resource_id"])
42283
+ });
42284
+ break;
42285
+ }
42286
+ default:
42287
+ throw new Error(`zoho-bookings: unknown read capability ${inv.capabilityName}`);
42288
+ }
42289
+ return { data: data4, fetchedAt: Date.now() };
42290
+ },
42291
+ async executeMutation(inv) {
42292
+ let data4;
42293
+ switch (inv.capabilityName) {
42294
+ case "appointments.book": {
42295
+ for (const key of ["service_id", "from_time"]) requireString(inv.args, key);
42296
+ const customer = requireObject(inv.args, "customer_details");
42297
+ exactlyOne(inv.args, ["staff_id", "resource_id", "group_id"], "booking assignment");
42298
+ const fields = pick(inv.args, [
42299
+ "service_id",
42300
+ "from_time",
42301
+ "staff_id",
42302
+ "resource_id",
42303
+ "group_id",
42304
+ "to_time",
42305
+ "timezone",
42306
+ "notes"
42307
+ ]);
42308
+ fields.customer_details = JSON.stringify(customer);
42309
+ for (const key of ["additional_fields", "payment_info"]) {
42310
+ if (inv.args[key] !== void 0) fields[key] = JSON.stringify(requireObject(inv.args, key));
42311
+ }
42312
+ data4 = await request(inv.source, "/appointment", { method: "POST", body: form(fields) });
42313
+ break;
42314
+ }
42315
+ case "appointments.reschedule": {
42316
+ requireString(inv.args, "booking_id");
42317
+ exactlyOne(inv.args, ["start_time", "staff_id", "group_id"], "reschedule target");
42318
+ data4 = await request(inv.source, "/rescheduleappointment", {
42319
+ method: "POST",
42320
+ body: form(pick(inv.args, ["booking_id", "start_time", "staff_id", "group_id"]))
42321
+ });
42322
+ break;
42323
+ }
42324
+ case "appointments.cancel":
42325
+ data4 = await request(inv.source, "/updateappointment", {
42326
+ method: "POST",
42327
+ body: form({ booking_id: requireString(inv.args, "booking_id"), action: "cancel" })
42328
+ });
42329
+ break;
42330
+ default:
42331
+ throw new Error(`zoho-bookings: unknown mutation capability ${inv.capabilityName}`);
42332
+ }
42333
+ return {
42334
+ status: "committed",
42335
+ data: data4,
42336
+ committedAt: Date.now(),
42337
+ idempotentReplay: false
42338
+ };
42339
+ },
42340
+ async test(source) {
42341
+ try {
42342
+ await request(source, "/workspaces", { method: "GET" });
42343
+ return { ok: true };
42344
+ } catch (error) {
42345
+ return { ok: false, reason: error instanceof Error ? error.message : "unknown error" };
42346
+ }
42347
+ }
42348
+ };
42349
+ function readCapability(name, description, properties, required = []) {
42350
+ return {
42351
+ name,
42352
+ class: "read",
42353
+ description,
42354
+ parameters: { type: "object", properties, ...required.length ? { required } : {} },
42355
+ requiredScopes: ["zohobookings.data.READ"]
42356
+ };
42357
+ }
42358
+ function mutationCapability(name, description, properties, required) {
42359
+ return {
42360
+ name,
42361
+ class: "mutation",
42362
+ description,
42363
+ parameters: { type: "object", properties, required },
42364
+ cas: "native-idempotency",
42365
+ externalEffect: true,
42366
+ requiredScopes: ["zohobookings.data.CREATE"]
42367
+ };
42368
+ }
42369
+ var locations = /* @__PURE__ */ new Map([
42370
+ ["zoho.com", "com"],
42371
+ ["zoho.eu", "eu"],
42372
+ ["zoho.in", "in"],
42373
+ ["zoho.com.au", "com.au"],
42374
+ ["zoho.jp", "jp"],
42375
+ ["zoho.com.cn", "com.cn"],
42376
+ ["zohocloud.ca", "ca"]
42377
+ ]);
42378
+ function baseUrl(source) {
42379
+ const location = typeof source.metadata.zohoLocation === "string" ? source.metadata.zohoLocation : "zoho.com";
42380
+ const tld = locations.get(location);
42381
+ if (!tld) throw new Error("zoho-bookings: zohoLocation is not an allowed Zoho data center");
42382
+ return `https://www.zohoapis.${tld}/bookings/v1/json`;
42383
+ }
42384
+ function accessToken(source) {
42385
+ if (source.credentials.kind !== "oauth2" || !source.credentials.accessToken) {
42386
+ throw new Error("zoho-bookings: OAuth2 credentials required");
42387
+ }
42388
+ return source.credentials.accessToken;
42389
+ }
42390
+ async function request(source, path, options) {
42391
+ const url = new URL(`${baseUrl(source)}${path}`);
42392
+ if ("query" in options && options.query) url.search = options.query.toString();
42393
+ const response = await fetch(url, {
42394
+ method: options.method,
42395
+ headers: {
42396
+ Authorization: `Zoho-oauthtoken ${accessToken(source)}`,
42397
+ ..."body" in options ? { "content-type": "application/x-www-form-urlencoded" } : {}
42398
+ },
42399
+ body: "body" in options ? options.body : void 0,
42400
+ signal: AbortSignal.timeout(15e3)
42401
+ });
42402
+ const responseBody = await readBody(response);
42403
+ if (response.status === 401) {
42404
+ throw new CredentialsExpired("Zoho Bookings rejected OAuth credentials (401)", source.id, {
42405
+ status: 401,
42406
+ body: responseBody
42407
+ });
42408
+ }
42409
+ if (response.status === 429) {
42410
+ throw new ProviderRateLimited("Zoho Bookings rate limit (429)", source.id, {
42411
+ status: 429,
42412
+ body: responseBody,
42413
+ retryAfterMs: retryAfterMs(response.headers.get("retry-after"))
42414
+ });
42415
+ }
42416
+ if (!response.ok) throw new Error(`zoho-bookings ${options.method} ${path} HTTP ${response.status}`);
42417
+ return responseBody;
42418
+ }
42419
+ async function readBody(response) {
42420
+ const text = await response.text();
42421
+ if (!text) return null;
42422
+ try {
42423
+ return JSON.parse(text);
42424
+ } catch {
42425
+ return text;
42426
+ }
42427
+ }
42428
+ function query(args, keys, required = []) {
42429
+ for (const key of required) requireString(args, key);
42430
+ return form(pick(args, keys));
42431
+ }
42432
+ function form(values) {
42433
+ const result = new URLSearchParams();
42434
+ for (const [key, value] of Object.entries(values)) {
42435
+ if (value !== void 0 && value !== null && value !== "") result.set(key, String(value));
42436
+ }
42437
+ return result;
42438
+ }
42439
+ function pick(args, keys) {
42440
+ return Object.fromEntries(keys.filter((key) => args[key] !== void 0).map((key) => [key, args[key]]));
42441
+ }
42442
+ function requireString(args, key) {
42443
+ const value = args[key];
42444
+ if (typeof value !== "string" || !value) throw new Error(`zoho-bookings: ${key} is required`);
42445
+ return value;
42446
+ }
42447
+ function requireObject(args, key) {
42448
+ const value = args[key];
42449
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
42450
+ throw new Error(`zoho-bookings: ${key} must be an object`);
42451
+ }
42452
+ return value;
42453
+ }
42454
+ function exactlyOne(args, keys, label) {
42455
+ const present = keys.filter((key) => args[key] !== void 0 && args[key] !== null && args[key] !== "");
42456
+ if (present.length !== 1) throw new Error(`zoho-bookings: exactly one ${label} is required`);
42457
+ }
42458
+ function retryAfterMs(value) {
42459
+ if (!value) return 6e4;
42460
+ const seconds = Number(value);
42461
+ return Number.isFinite(seconds) && seconds >= 0 ? Math.max(1e3, seconds * 1e3) : 6e4;
42462
+ }
42463
+
42464
+ // src/connectors/adapters/zoho-desk.ts
42465
+ var orgId = {
42466
+ type: "string",
42467
+ description: "Zoho Desk organization id. Discover it with organizations.list."
42468
+ };
42469
+ var data = {
42470
+ type: "object",
42471
+ description: "Provider-native Zoho Desk request body."
42472
+ };
42473
+ var orgHeader = { orgId: "{orgId}" };
42474
+ var zohoDeskConnector = declarativeRestConnector({
42475
+ kind: "zoho-desk",
42476
+ displayName: "Zoho Desk",
42477
+ description: "Discover organizations, manage support tickets, and find contacts in Zoho Desk.",
42478
+ auth: {
42479
+ kind: "oauth2",
42480
+ authorizationUrl: "https://accounts.zoho.com/oauth/v2/auth",
42481
+ tokenUrl: "https://accounts.zoho.com/oauth/v2/token",
42482
+ scopes: [
42483
+ "Desk.tickets.ALL",
42484
+ "Desk.contacts.READ",
42485
+ "Desk.search.READ",
42486
+ "Desk.basic.READ"
42487
+ ],
42488
+ scopeSeparator: ",",
42489
+ clientIdEnv: "ZOHO_OAUTH_CLIENT_ID",
42490
+ clientSecretEnv: "ZOHO_OAUTH_CLIENT_SECRET",
42491
+ extraAuthParams: { access_type: "offline", prompt: "consent" }
42492
+ },
42493
+ category: "crm",
42494
+ defaultConsistencyModel: "authoritative",
42495
+ baseUrl: { metadataKey: "deskApiDomain", fallback: "https://desk.zoho.com" },
42496
+ allowedBaseUrls: [
42497
+ "https://desk.zoho.com",
42498
+ "https://desk.zoho.eu",
42499
+ "https://desk.zoho.in",
42500
+ "https://desk.zoho.com.au",
42501
+ "https://desk.zoho.jp",
42502
+ "https://desk.zohocloud.ca",
42503
+ "https://desk.zoho.com.cn"
42504
+ ],
42505
+ credentialPlacement: { kind: "header", header: "Authorization", prefix: "Zoho-oauthtoken " },
42506
+ test: { method: "GET", path: "/api/v1/organizations" },
42507
+ capabilities: [
42508
+ {
42509
+ name: "organizations.list",
42510
+ class: "read",
42511
+ description: "List Zoho Desk organizations available to the connected user.",
42512
+ parameters: { type: "object", properties: {} },
42513
+ request: { method: "GET", path: "/api/v1/organizations" },
42514
+ requiredScopes: ["Desk.basic.READ"]
42515
+ },
42516
+ {
42517
+ name: "tickets.list",
42518
+ class: "read",
42519
+ description: "List tickets within one Zoho Desk organization.",
42520
+ parameters: {
42521
+ type: "object",
42522
+ properties: {
42523
+ orgId,
42524
+ include: { type: "string", description: "Comma-separated related objects to include." },
42525
+ from: { type: "integer", minimum: 0 },
42526
+ limit: { type: "integer", minimum: 1, maximum: 100 },
42527
+ status: { type: "string" },
42528
+ departmentId: { type: "string" }
42529
+ },
42530
+ required: ["orgId"]
42531
+ },
42532
+ request: {
42533
+ method: "GET",
42534
+ path: "/api/v1/tickets",
42535
+ headers: orgHeader,
42536
+ query: {
42537
+ include: "{include}",
42538
+ from: "{from}",
42539
+ limit: "{limit}",
42540
+ status: "{status}",
42541
+ departmentId: "{departmentId}"
42542
+ }
42543
+ },
42544
+ requiredScopes: ["Desk.tickets.ALL"]
42545
+ },
42546
+ {
42547
+ name: "tickets.get",
42548
+ class: "read",
42549
+ description: "Read one ticket by id.",
42550
+ parameters: {
42551
+ type: "object",
42552
+ properties: { orgId, ticketId: { type: "string" } },
42553
+ required: ["orgId", "ticketId"]
42554
+ },
42555
+ request: { method: "GET", path: "/api/v1/tickets/{ticketId}", headers: orgHeader },
42556
+ requiredScopes: ["Desk.tickets.ALL"]
42557
+ },
42558
+ {
42559
+ name: "tickets.create",
42560
+ class: "mutation",
42561
+ description: "Create a ticket in one Zoho Desk organization.",
42562
+ parameters: {
42563
+ type: "object",
42564
+ properties: { orgId, data },
42565
+ required: ["orgId", "data"]
42566
+ },
42567
+ request: { method: "POST", path: "/api/v1/tickets", headers: orgHeader, body: "{data}" },
42568
+ cas: "native-idempotency",
42569
+ externalEffect: true,
42570
+ requiredScopes: ["Desk.tickets.ALL"]
42571
+ },
42572
+ {
42573
+ name: "tickets.update",
42574
+ class: "mutation",
42575
+ description: "Update an existing ticket.",
42576
+ parameters: {
42577
+ type: "object",
42578
+ properties: { orgId, ticketId: { type: "string" }, data },
42579
+ required: ["orgId", "ticketId", "data"]
42580
+ },
42581
+ request: { method: "PATCH", path: "/api/v1/tickets/{ticketId}", headers: orgHeader, body: "{data}" },
42582
+ cas: "optimistic-read-verify",
42583
+ externalEffect: true,
42584
+ requiredScopes: ["Desk.tickets.ALL"]
42585
+ },
42586
+ {
42587
+ name: "tickets.close",
42588
+ class: "mutation",
42589
+ description: "Close a ticket.",
42590
+ parameters: {
42591
+ type: "object",
42592
+ properties: { orgId, ticketId: { type: "string" } },
42593
+ required: ["orgId", "ticketId"]
42594
+ },
42595
+ request: {
42596
+ method: "PATCH",
42597
+ path: "/api/v1/tickets/{ticketId}",
42598
+ headers: orgHeader,
42599
+ body: { status: "Closed" }
42600
+ },
42601
+ cas: "native-idempotency",
42602
+ externalEffect: true,
42603
+ requiredScopes: ["Desk.tickets.ALL"]
42604
+ },
42605
+ {
42606
+ name: "tickets.assign",
42607
+ class: "mutation",
42608
+ description: "Assign a ticket to an agent.",
42609
+ parameters: {
42610
+ type: "object",
42611
+ properties: { orgId, ticketId: { type: "string" }, assigneeId: { type: "string" } },
42612
+ required: ["orgId", "ticketId", "assigneeId"]
42613
+ },
42614
+ request: {
42615
+ method: "PATCH",
42616
+ path: "/api/v1/tickets/{ticketId}",
42617
+ headers: orgHeader,
42618
+ body: { assigneeId: "{assigneeId}" }
42619
+ },
42620
+ cas: "native-idempotency",
42621
+ externalEffect: true,
42622
+ requiredScopes: ["Desk.tickets.ALL"]
42623
+ },
42624
+ {
42625
+ name: "tickets.add-comment",
42626
+ class: "mutation",
42627
+ description: "Add a public or internal comment to a ticket.",
42628
+ parameters: {
42629
+ type: "object",
42630
+ properties: {
42631
+ orgId,
42632
+ ticketId: { type: "string" },
42633
+ content: { type: "string" },
42634
+ isPublic: { type: "boolean" },
42635
+ contentType: { type: "string", enum: ["html", "plainText"] }
42636
+ },
42637
+ required: ["orgId", "ticketId", "content", "isPublic"]
42638
+ },
42639
+ request: {
42640
+ method: "POST",
42641
+ path: "/api/v1/tickets/{ticketId}/comments",
42642
+ headers: orgHeader,
42643
+ body: {
42644
+ content: "{content}",
42645
+ isPublic: "{isPublic}",
42646
+ contentType: "{contentType}"
42647
+ }
42648
+ },
42649
+ cas: "native-idempotency",
42650
+ externalEffect: true,
42651
+ requiredScopes: ["Desk.tickets.ALL"]
42652
+ },
42653
+ {
42654
+ name: "tickets.merge",
42655
+ class: "mutation",
42656
+ description: "Merge duplicate tickets into a primary ticket.",
42657
+ parameters: {
42658
+ type: "object",
42659
+ properties: {
42660
+ orgId,
42661
+ ticketId: { type: "string", description: "Primary ticket id." },
42662
+ ids: { type: "array", items: { type: "string" }, minItems: 1 }
42663
+ },
42664
+ required: ["orgId", "ticketId", "ids"]
42665
+ },
42666
+ request: {
42667
+ method: "POST",
42668
+ path: "/api/v1/tickets/{ticketId}/mergeTickets",
42669
+ headers: orgHeader,
42670
+ body: { ids: "{ids}" }
42671
+ },
42672
+ cas: "native-idempotency",
42673
+ externalEffect: true,
42674
+ requiredScopes: ["Desk.tickets.ALL"]
42675
+ },
42676
+ {
42677
+ name: "contacts.find",
42678
+ class: "read",
42679
+ description: "Find contacts by exact email address.",
42680
+ parameters: {
42681
+ type: "object",
42682
+ properties: { orgId, email: { type: "string" } },
42683
+ required: ["orgId", "email"]
42684
+ },
42685
+ request: {
42686
+ method: "GET",
42687
+ path: "/api/v1/contacts/search",
42688
+ headers: orgHeader,
42689
+ query: { email: "{email}" }
42690
+ },
42691
+ requiredScopes: ["Desk.contacts.READ", "Desk.search.READ"]
42692
+ }
42693
+ ]
42694
+ });
42695
+
42161
42696
  // src/connectors/adapters/zoho-crm.ts
42162
42697
  var moduleParam2 = {
42163
42698
  type: "string",
@@ -42522,7 +43057,7 @@ var organizationId = {
42522
43057
  type: "string",
42523
43058
  description: "Zoho Books organization id. Discover it with organizations.list."
42524
43059
  };
42525
- var data = {
43060
+ var data2 = {
42526
43061
  type: "object",
42527
43062
  description: "Provider-native Zoho Books request body."
42528
43063
  };
@@ -42618,7 +43153,7 @@ var zohoBooksConnector = declarativeRestConnector({
42618
43153
  description: "Create a customer or vendor in Zoho Books.",
42619
43154
  parameters: {
42620
43155
  type: "object",
42621
- properties: { organization_id: organizationId, data },
43156
+ properties: { organization_id: organizationId, data: data2 },
42622
43157
  required: ["organization_id", "data"]
42623
43158
  },
42624
43159
  request: {
@@ -42636,7 +43171,7 @@ var zohoBooksConnector = declarativeRestConnector({
42636
43171
  description: "Update an existing Zoho Books contact.",
42637
43172
  parameters: {
42638
43173
  type: "object",
42639
- properties: { organization_id: organizationId, contactId: { type: "string" }, data },
43174
+ properties: { organization_id: organizationId, contactId: { type: "string" }, data: data2 },
42640
43175
  required: ["organization_id", "contactId", "data"]
42641
43176
  },
42642
43177
  request: {
@@ -42698,7 +43233,7 @@ var zohoBooksConnector = declarativeRestConnector({
42698
43233
  description: "Create an invoice in Zoho Books.",
42699
43234
  parameters: {
42700
43235
  type: "object",
42701
- properties: { organization_id: organizationId, data },
43236
+ properties: { organization_id: organizationId, data: data2 },
42702
43237
  required: ["organization_id", "data"]
42703
43238
  },
42704
43239
  request: {
@@ -42716,7 +43251,7 @@ var zohoBooksConnector = declarativeRestConnector({
42716
43251
  description: "Update a Zoho Books invoice.",
42717
43252
  parameters: {
42718
43253
  type: "object",
42719
- properties: { organization_id: organizationId, invoiceId: { type: "string" }, data },
43254
+ properties: { organization_id: organizationId, invoiceId: { type: "string" }, data: data2 },
42720
43255
  required: ["organization_id", "invoiceId", "data"]
42721
43256
  },
42722
43257
  request: {
@@ -42734,7 +43269,7 @@ var zohoBooksConnector = declarativeRestConnector({
42734
43269
  description: "Email an existing invoice to its configured recipients.",
42735
43270
  parameters: {
42736
43271
  type: "object",
42737
- properties: { organization_id: organizationId, invoiceId: { type: "string" }, data },
43272
+ properties: { organization_id: organizationId, invoiceId: { type: "string" }, data: data2 },
42738
43273
  required: ["organization_id", "invoiceId", "data"]
42739
43274
  },
42740
43275
  request: {
@@ -42940,66 +43475,66 @@ var zohoCampaignsConnector = {
42940
43475
  ]
42941
43476
  },
42942
43477
  async executeRead(inv) {
42943
- const query = new URLSearchParams({ resfmt: "JSON" });
43478
+ const query2 = new URLSearchParams({ resfmt: "JSON" });
42944
43479
  let path;
42945
43480
  switch (inv.capabilityName) {
42946
43481
  case "campaigns.list":
42947
43482
  path = "/recentcampaigns";
42948
- append(query, inv.args, ["status", "fromindex", "range"]);
43483
+ append(query2, inv.args, ["status", "fromindex", "range"]);
42949
43484
  break;
42950
43485
  case "mailing-lists.list":
42951
43486
  path = "/getmailinglists";
42952
- append(query, inv.args, ["fromindex", "range"]);
43487
+ append(query2, inv.args, ["fromindex", "range"]);
42953
43488
  break;
42954
43489
  case "contacts.list":
42955
43490
  path = "/getlistsubscribers";
42956
- requireString(inv.args, "listkey");
42957
- append(query, inv.args, ["listkey", "status", "fromindex", "range"]);
43491
+ requireString2(inv.args, "listkey");
43492
+ append(query2, inv.args, ["listkey", "status", "fromindex", "range"]);
42958
43493
  break;
42959
43494
  default:
42960
43495
  throw new Error(`zoho-campaigns: unknown read capability ${inv.capabilityName}`);
42961
43496
  }
42962
43497
  return {
42963
- data: await request(inv.source, path, { method: "GET", query }),
43498
+ data: await request2(inv.source, path, { method: "GET", query: query2 }),
42964
43499
  fetchedAt: Date.now()
42965
43500
  };
42966
43501
  },
42967
43502
  async executeMutation(inv) {
42968
- const form = new URLSearchParams({ resfmt: "JSON" });
43503
+ const form2 = new URLSearchParams({ resfmt: "JSON" });
42969
43504
  let path;
42970
43505
  switch (inv.capabilityName) {
42971
43506
  case "contacts.upsert":
42972
43507
  path = "/json/listsubscribe";
42973
- form.set("listkey", requireString(inv.args, "listkey"));
42974
- form.set("contactinfo", JSON.stringify(requireObject(inv.args, "contactinfo")));
42975
- append(form, inv.args, ["source", "topic_id"]);
43508
+ form2.set("listkey", requireString2(inv.args, "listkey"));
43509
+ form2.set("contactinfo", JSON.stringify(requireObject2(inv.args, "contactinfo")));
43510
+ append(form2, inv.args, ["source", "topic_id"]);
42976
43511
  break;
42977
43512
  case "contacts.unsubscribe":
42978
43513
  path = "/json/listunsubscribe";
42979
- form.set("listkey", requireString(inv.args, "listkey"));
42980
- form.set("contactinfo", JSON.stringify(requireObject(inv.args, "contactinfo")));
42981
- append(form, inv.args, ["topic_id"]);
43514
+ form2.set("listkey", requireString2(inv.args, "listkey"));
43515
+ form2.set("contactinfo", JSON.stringify(requireObject2(inv.args, "contactinfo")));
43516
+ append(form2, inv.args, ["topic_id"]);
42982
43517
  break;
42983
43518
  case "campaigns.create":
42984
43519
  path = "/createCampaign";
42985
43520
  for (const key of ["campaignname", "subject", "from_name", "from_email"]) {
42986
- form.set(key, requireString(inv.args, key));
43521
+ form2.set(key, requireString2(inv.args, key));
42987
43522
  }
42988
- form.set("list_details", JSON.stringify(requireObject(inv.args, "list_details")));
42989
- append(form, inv.args, ["reply_to", "topicId", "content_url", "email_content"]);
43523
+ form2.set("list_details", JSON.stringify(requireObject2(inv.args, "list_details")));
43524
+ append(form2, inv.args, ["reply_to", "topicId", "content_url", "email_content"]);
42990
43525
  break;
42991
43526
  case "campaigns.clone":
42992
43527
  path = "/json/clonecampaign";
42993
- form.set("campaigninfo", JSON.stringify(requireObject(inv.args, "campaigninfo")));
43528
+ form2.set("campaigninfo", JSON.stringify(requireObject2(inv.args, "campaigninfo")));
42994
43529
  break;
42995
43530
  case "campaigns.send":
42996
43531
  path = "/sendcampaign";
42997
- form.set("campaignkey", requireString(inv.args, "campaignkey"));
43532
+ form2.set("campaignkey", requireString2(inv.args, "campaignkey"));
42998
43533
  break;
42999
43534
  default:
43000
43535
  throw new Error(`zoho-campaigns: unknown mutation capability ${inv.capabilityName}`);
43001
43536
  }
43002
- const response = await request(inv.source, path, { method: "POST", body: form });
43537
+ const response = await request2(inv.source, path, { method: "POST", body: form2 });
43003
43538
  return {
43004
43539
  status: "committed",
43005
43540
  data: response,
@@ -43009,15 +43544,15 @@ var zohoCampaignsConnector = {
43009
43544
  },
43010
43545
  async test(source) {
43011
43546
  try {
43012
- const query = new URLSearchParams({ resfmt: "JSON", range: "1" });
43013
- await request(source, "/recentcampaigns", { method: "GET", query });
43547
+ const query2 = new URLSearchParams({ resfmt: "JSON", range: "1" });
43548
+ await request2(source, "/recentcampaigns", { method: "GET", query: query2 });
43014
43549
  return { ok: true };
43015
43550
  } catch (error) {
43016
43551
  return { ok: false, reason: error instanceof Error ? error.message : "unknown error" };
43017
43552
  }
43018
43553
  }
43019
43554
  };
43020
- var locations = /* @__PURE__ */ new Set([
43555
+ var locations2 = /* @__PURE__ */ new Set([
43021
43556
  "zoho.com",
43022
43557
  "zoho.eu",
43023
43558
  "zoho.in",
@@ -43026,32 +43561,32 @@ var locations = /* @__PURE__ */ new Set([
43026
43561
  "zoho.com.cn",
43027
43562
  "zohocloud.ca"
43028
43563
  ]);
43029
- function baseUrl(source) {
43564
+ function baseUrl2(source) {
43030
43565
  const requested = typeof source.metadata.zohoLocation === "string" ? source.metadata.zohoLocation : "zoho.com";
43031
- if (!locations.has(requested)) {
43566
+ if (!locations2.has(requested)) {
43032
43567
  throw new Error("zoho-campaigns: zohoLocation is not an allowed Zoho data center");
43033
43568
  }
43034
43569
  return `https://campaigns.${requested}/api/v1.1`;
43035
43570
  }
43036
- function accessToken(source) {
43571
+ function accessToken2(source) {
43037
43572
  if (source.credentials.kind !== "oauth2" || !source.credentials.accessToken) {
43038
43573
  throw new Error("zoho-campaigns: OAuth2 credentials required");
43039
43574
  }
43040
43575
  return source.credentials.accessToken;
43041
43576
  }
43042
- async function request(source, path, options) {
43043
- const url = new URL(`${baseUrl(source)}${path}`);
43577
+ async function request2(source, path, options) {
43578
+ const url = new URL(`${baseUrl2(source)}${path}`);
43044
43579
  if ("query" in options) url.search = options.query.toString();
43045
43580
  const response = await fetch(url, {
43046
43581
  method: options.method,
43047
43582
  headers: {
43048
- Authorization: `Zoho-oauthtoken ${accessToken(source)}`,
43583
+ Authorization: `Zoho-oauthtoken ${accessToken2(source)}`,
43049
43584
  ..."body" in options ? { "content-type": "application/x-www-form-urlencoded" } : {}
43050
43585
  },
43051
43586
  body: "body" in options ? options.body : void 0,
43052
43587
  signal: AbortSignal.timeout(15e3)
43053
43588
  });
43054
- const responseBody = await readBody(response);
43589
+ const responseBody = await readBody2(response);
43055
43590
  if (response.status === 401) {
43056
43591
  throw new CredentialsExpired("Zoho Campaigns rejected OAuth credentials (401)", source.id, {
43057
43592
  status: 401,
@@ -43059,11 +43594,11 @@ async function request(source, path, options) {
43059
43594
  });
43060
43595
  }
43061
43596
  if (response.status === 429) {
43062
- const retryAfterMs = parseRetryAfter(response.headers.get("retry-after"));
43597
+ const retryAfterMs2 = parseRetryAfter(response.headers.get("retry-after"));
43063
43598
  throw new ProviderRateLimited("Zoho Campaigns rate limit (429)", source.id, {
43064
43599
  status: 429,
43065
43600
  body: responseBody,
43066
- retryAfterMs
43601
+ retryAfterMs: retryAfterMs2
43067
43602
  });
43068
43603
  }
43069
43604
  if (!response.ok) {
@@ -43071,7 +43606,7 @@ async function request(source, path, options) {
43071
43606
  }
43072
43607
  return responseBody;
43073
43608
  }
43074
- async function readBody(response) {
43609
+ async function readBody2(response) {
43075
43610
  const text = await response.text();
43076
43611
  if (!text) return null;
43077
43612
  try {
@@ -43080,18 +43615,18 @@ async function readBody(response) {
43080
43615
  return text;
43081
43616
  }
43082
43617
  }
43083
- function append(query, args, keys) {
43618
+ function append(query2, args, keys) {
43084
43619
  for (const key of keys) {
43085
43620
  const value = args[key];
43086
- if (value !== void 0 && value !== null && value !== "") query.set(key, String(value));
43621
+ if (value !== void 0 && value !== null && value !== "") query2.set(key, String(value));
43087
43622
  }
43088
43623
  }
43089
- function requireString(args, key) {
43624
+ function requireString2(args, key) {
43090
43625
  const value = args[key];
43091
43626
  if (typeof value !== "string" || !value) throw new Error(`zoho-campaigns: ${key} is required`);
43092
43627
  return value;
43093
43628
  }
43094
- function requireObject(args, key) {
43629
+ function requireObject2(args, key) {
43095
43630
  const value = args[key];
43096
43631
  if (!value || typeof value !== "object" || Array.isArray(value)) {
43097
43632
  throw new Error(`zoho-campaigns: ${key} must be an object`);
@@ -43111,7 +43646,7 @@ var organizationId2 = {
43111
43646
  type: "string",
43112
43647
  description: "Zoho Invoice organization id. Discover it with organizations.list."
43113
43648
  };
43114
- var data2 = {
43649
+ var data3 = {
43115
43650
  type: "object",
43116
43651
  description: "Provider-native Zoho Invoice request body."
43117
43652
  };
@@ -43209,7 +43744,7 @@ var zohoInvoiceConnector = declarativeRestConnector({
43209
43744
  description: "Create a Zoho Invoice invoice.",
43210
43745
  parameters: {
43211
43746
  type: "object",
43212
- properties: { organization_id: organizationId2, data: data2 },
43747
+ properties: { organization_id: organizationId2, data: data3 },
43213
43748
  required: ["organization_id", "data"]
43214
43749
  },
43215
43750
  request: {
@@ -43227,7 +43762,7 @@ var zohoInvoiceConnector = declarativeRestConnector({
43227
43762
  description: "Update a Zoho Invoice invoice.",
43228
43763
  parameters: {
43229
43764
  type: "object",
43230
- properties: { organization_id: organizationId2, invoiceId: { type: "string" }, data: data2 },
43765
+ properties: { organization_id: organizationId2, invoiceId: { type: "string" }, data: data3 },
43231
43766
  required: ["organization_id", "invoiceId", "data"]
43232
43767
  },
43233
43768
  request: {
@@ -43245,7 +43780,7 @@ var zohoInvoiceConnector = declarativeRestConnector({
43245
43780
  description: "Email an existing Zoho Invoice invoice to its configured recipients.",
43246
43781
  parameters: {
43247
43782
  type: "object",
43248
- properties: { organization_id: organizationId2, invoiceId: { type: "string" }, data: data2 },
43783
+ properties: { organization_id: organizationId2, invoiceId: { type: "string" }, data: data3 },
43249
43784
  required: ["organization_id", "invoiceId", "data"]
43250
43785
  },
43251
43786
  request: {
@@ -46752,14 +47287,14 @@ var telegramConnector = {
46752
47287
  ]
46753
47288
  },
46754
47289
  async executeRead(inv) {
46755
- const data3 = await callMethod(inv, inv.capabilityName);
46756
- return { data: data3, fetchedAt: Date.now() };
47290
+ const data4 = await callMethod(inv, inv.capabilityName);
47291
+ return { data: data4, fetchedAt: Date.now() };
46757
47292
  },
46758
47293
  async executeMutation(inv) {
46759
- const data3 = await callMethod(inv, inv.capabilityName);
47294
+ const data4 = await callMethod(inv, inv.capabilityName);
46760
47295
  return {
46761
47296
  status: "committed",
46762
- data: data3,
47297
+ data: data4,
46763
47298
  committedAt: Date.now(),
46764
47299
  idempotentReplay: false
46765
47300
  };
@@ -49803,6 +50338,8 @@ var CONNECTOR_ADAPTER_FACTORIES = [
49803
50338
  clientSecret: "CLOSE_OAUTH_CLIENT_SECRET"
49804
50339
  }),
49805
50340
  defineFactoryAdapter(() => zohoCrmConnector, zohoOAuthEnvMap),
50341
+ defineFactoryAdapter(() => zohoDeskConnector, zohoOAuthEnvMap),
50342
+ defineFactoryAdapter(() => zohoBookingsConnector, zohoOAuthEnvMap),
49806
50343
  defineFactoryAdapter(() => zohoBooksConnector, zohoOAuthEnvMap),
49807
50344
  defineFactoryAdapter(() => zohoInvoiceConnector, zohoOAuthEnvMap),
49808
50345
  defineFactoryAdapter(() => zohoMailConnector, zohoOAuthEnvMap),
@@ -50252,8 +50789,8 @@ var phonyConnector = {
50252
50789
  return { data: { calls: json.calls ?? [] }, fetchedAt: Date.now() };
50253
50790
  }
50254
50791
  if (inv.capabilityName === "kb_search") {
50255
- const { collectionId, query, limit, threshold, includeMetadata } = inv.args;
50256
- const payload = { query };
50792
+ const { collectionId, query: query2, limit, threshold, includeMetadata } = inv.args;
50793
+ const payload = { query: query2 };
50257
50794
  if (limit !== void 0) payload.limit = limit;
50258
50795
  if (threshold !== void 0) payload.threshold = threshold;
50259
50796
  if (includeMetadata !== void 0) payload.includeMetadata = includeMetadata;
@@ -50327,7 +50864,7 @@ var phonyConnector = {
50327
50864
  };
50328
50865
  }
50329
50866
  if (inv.capabilityName === "create_agent") {
50330
- const payload = pick(inv.args, AGENT_FIELDS);
50867
+ const payload = pick2(inv.args, AGENT_FIELDS);
50331
50868
  const json = await postJson(inv, token, `${API13}/v1/agents`, payload, "create_agent");
50332
50869
  return {
50333
50870
  status: "committed",
@@ -50338,7 +50875,7 @@ var phonyConnector = {
50338
50875
  }
50339
50876
  if (inv.capabilityName === "provision_agent") {
50340
50877
  const args = inv.args;
50341
- const payload = pick(args, AGENT_FIELDS);
50878
+ const payload = pick2(args, AGENT_FIELDS);
50342
50879
  if (args.collection !== void 0) payload.collection = args.collection;
50343
50880
  if (args.initialContent !== void 0) payload.initialContent = args.initialContent;
50344
50881
  const json = await postJson(
@@ -50374,7 +50911,7 @@ var phonyConnector = {
50374
50911
  }
50375
50912
  if (inv.capabilityName === "kb_ingest") {
50376
50913
  const { collectionId, ...rest } = inv.args;
50377
- const payload = pick(rest, INGEST_FIELDS);
50914
+ const payload = pick2(rest, INGEST_FIELDS);
50378
50915
  const json = await postJson(
50379
50916
  inv,
50380
50917
  token,
@@ -50502,7 +51039,7 @@ async function postJson(inv, token, url, payload, label) {
50502
51039
  }
50503
51040
  return await res.json();
50504
51041
  }
50505
- function pick(args, fields) {
51042
+ function pick2(args, fields) {
50506
51043
  const out = {};
50507
51044
  for (const key of fields) {
50508
51045
  if (args[key] !== void 0) out[key] = args[key];
@@ -50590,9 +51127,9 @@ var webhookConnector = {
50590
51127
  if (!res.ok) {
50591
51128
  throw new Error(`webhook fetch_state ${res.status}: ${(await res.text()).slice(0, 200)}`);
50592
51129
  }
50593
- const data3 = await res.json();
51130
+ const data4 = await res.json();
50594
51131
  return {
50595
- data: data3,
51132
+ data: data4,
50596
51133
  etag: res.headers.get("etag") ?? void 0,
50597
51134
  fetchedAt: Date.now()
50598
51135
  };
@@ -50617,10 +51154,10 @@ var webhookConnector = {
50617
51154
  if (!res.ok) {
50618
51155
  throw new Error(`webhook post_event ${res.status}: ${(await res.text()).slice(0, 200)}`);
50619
51156
  }
50620
- const data3 = await res.json().catch(() => ({}));
51157
+ const data4 = await res.json().catch(() => ({}));
50621
51158
  return {
50622
51159
  status: "committed",
50623
- data: data3,
51160
+ data: data4,
50624
51161
  etagAfter: res.headers.get("etag") ?? void 0,
50625
51162
  committedAt: Date.now(),
50626
51163
  idempotentReplay: false
@@ -52110,294 +52647,6 @@ var facebookPagesConnector = declarativeRestConnector({
52110
52647
  ]
52111
52648
  });
52112
52649
 
52113
- // src/connectors/adapters/zoho-desk.ts
52114
- var departmentParam = {
52115
- type: "string",
52116
- description: "Department id or name to list tickets from. Omit to list all departments."
52117
- };
52118
- var statusFilterParam = {
52119
- type: "string",
52120
- description: "Ticket status: Open, OnHold, Closed, Spam."
52121
- };
52122
- var ticketDataParam = {
52123
- type: "object",
52124
- description: "Ticket field object (subject, departmentId, contactId, description, etc.)."
52125
- };
52126
- var zohoDeskConnector = declarativeRestConnector({
52127
- kind: "zoho-desk",
52128
- displayName: "Zoho Desk",
52129
- description: "List and search tickets, find contacts, and create or update Zoho Desk tickets.",
52130
- auth: {
52131
- kind: "oauth2",
52132
- authorizationUrl: "https://accounts.zoho.com/oauth/v2/auth",
52133
- tokenUrl: "https://accounts.zoho.com/oauth/v2/token",
52134
- scopes: ["Desk.tickets.ALL", "Desk.contacts.ALL", "offline_access"],
52135
- clientIdEnv: "ZOHO_DESK_OAUTH_CLIENT_ID",
52136
- clientSecretEnv: "ZOHO_DESK_OAUTH_CLIENT_SECRET"
52137
- },
52138
- category: "crm",
52139
- defaultConsistencyModel: "authoritative",
52140
- baseUrl: { metadataKey: "apiDomain", fallback: "https://www.zohoapis.com" },
52141
- credentialPlacement: { kind: "header", header: "Authorization", prefix: "Zoho-oauthtoken " },
52142
- test: { method: "GET", path: "/desk/v1/tickets", query: { limit: "1" } },
52143
- capabilities: [
52144
- {
52145
- name: "tickets.list",
52146
- class: "read",
52147
- description: "List all tickets in a department with optional status filter and pagination.",
52148
- parameters: {
52149
- type: "object",
52150
- properties: {
52151
- departmentId: departmentParam,
52152
- status: statusFilterParam,
52153
- limit: { type: "integer", minimum: 1, maximum: 100 },
52154
- offset: { type: "integer", minimum: 0 }
52155
- },
52156
- required: []
52157
- },
52158
- request: {
52159
- method: "GET",
52160
- path: "/desk/v1/tickets",
52161
- query: {
52162
- departmentId: "{departmentId}",
52163
- status: "{status}",
52164
- limit: "{limit}",
52165
- offset: "{offset}"
52166
- }
52167
- },
52168
- requiredScopes: ["Desk.tickets.ALL"]
52169
- },
52170
- {
52171
- name: "tickets.search",
52172
- class: "read",
52173
- description: "Search tickets by subject or description text.",
52174
- parameters: {
52175
- type: "object",
52176
- properties: {
52177
- query: { type: "string", description: "Search query string." },
52178
- departmentId: departmentParam,
52179
- limit: { type: "integer", minimum: 1, maximum: 100 },
52180
- offset: { type: "integer", minimum: 0 }
52181
- },
52182
- required: ["query"]
52183
- },
52184
- request: {
52185
- method: "GET",
52186
- path: "/desk/v1/search/tickets",
52187
- query: {
52188
- query: "{query}",
52189
- departmentId: "{departmentId}",
52190
- limit: "{limit}",
52191
- offset: "{offset}"
52192
- }
52193
- },
52194
- requiredScopes: ["Desk.tickets.ALL"]
52195
- },
52196
- {
52197
- name: "tickets.get",
52198
- class: "read",
52199
- description: "Get a ticket by id.",
52200
- parameters: {
52201
- type: "object",
52202
- properties: {
52203
- ticketId: { type: "string", description: "Ticket id." }
52204
- },
52205
- required: ["ticketId"]
52206
- },
52207
- request: {
52208
- method: "GET",
52209
- path: "/desk/v1/tickets/{ticketId}"
52210
- },
52211
- requiredScopes: ["Desk.tickets.ALL"]
52212
- },
52213
- {
52214
- name: "tickets.create",
52215
- class: "mutation",
52216
- description: "Create a new ticket.",
52217
- parameters: {
52218
- type: "object",
52219
- properties: {
52220
- subject: { type: "string", description: "Ticket subject." },
52221
- departmentId: { type: "string", description: "Department id where the ticket will be created." },
52222
- contactId: { type: "string", description: "Contact id of the customer." },
52223
- description: { type: "string", description: "Ticket description." },
52224
- data: ticketDataParam
52225
- },
52226
- required: ["subject", "departmentId"]
52227
- },
52228
- request: {
52229
- method: "POST",
52230
- path: "/desk/v1/tickets",
52231
- body: "{data}"
52232
- },
52233
- cas: "native-idempotency",
52234
- requiredScopes: ["Desk.tickets.ALL"]
52235
- },
52236
- {
52237
- name: "tickets.update",
52238
- class: "mutation",
52239
- description: "Update an existing ticket by id.",
52240
- parameters: {
52241
- type: "object",
52242
- properties: {
52243
- ticketId: { type: "string", description: "Ticket id to update." },
52244
- data: { type: "object", description: "Fields to update (subject, status, description, etc.)." }
52245
- },
52246
- required: ["ticketId", "data"]
52247
- },
52248
- request: {
52249
- method: "PATCH",
52250
- path: "/desk/v1/tickets/{ticketId}",
52251
- body: "{data}"
52252
- },
52253
- cas: "optimistic-read-verify",
52254
- requiredScopes: ["Desk.tickets.ALL"]
52255
- },
52256
- {
52257
- // Zoho Desk's PATCH /tickets/{id} with `status: "Closed"` is the canonical
52258
- // close path; there is no dedicated /close endpoint. We surface it as a
52259
- // distinct capability rather than nudging callers through tickets.update
52260
- // because closure is a workflow-trigger boundary (SLA timers, satisfaction
52261
- // surveys, escalations) and deserves its own audit trail.
52262
- name: "tickets.close",
52263
- class: "mutation",
52264
- description: "Close a ticket by setting its status to Closed. Triggers downstream SLA/notification automations.",
52265
- parameters: {
52266
- type: "object",
52267
- properties: {
52268
- ticketId: { type: "string", description: "Ticket id to close." }
52269
- },
52270
- required: ["ticketId"]
52271
- },
52272
- request: {
52273
- method: "PATCH",
52274
- path: "/desk/v1/tickets/{ticketId}",
52275
- body: { status: "Closed" }
52276
- },
52277
- cas: "native-idempotency",
52278
- externalEffect: true,
52279
- requiredScopes: ["Desk.tickets.ALL"]
52280
- },
52281
- {
52282
- // Assignment to an agent is also a PATCH against the ticket, with a
52283
- // single `assigneeId` field. Zoho documents `assigneeId` on the ticket
52284
- // PATCH body — assignment is not a separate route. We require the
52285
- // assignee id because reassigning to "unassigned" is a different write
52286
- // (set assigneeId: null) and we don't want to silently null on a missing
52287
- // arg.
52288
- name: "tickets.assign",
52289
- class: "mutation",
52290
- description: "Assign a ticket to an agent by user id (uses the ticket PATCH route with assigneeId).",
52291
- parameters: {
52292
- type: "object",
52293
- properties: {
52294
- ticketId: { type: "string", description: "Ticket id to assign." },
52295
- assigneeId: { type: "string", description: "Agent user id to assign the ticket to." }
52296
- },
52297
- required: ["ticketId", "assigneeId"]
52298
- },
52299
- request: {
52300
- method: "PATCH",
52301
- path: "/desk/v1/tickets/{ticketId}",
52302
- body: { assigneeId: "{assigneeId}" }
52303
- },
52304
- cas: "native-idempotency",
52305
- externalEffect: true,
52306
- requiredScopes: ["Desk.tickets.ALL"]
52307
- },
52308
- {
52309
- // Comments are first-class resources under /tickets/{id}/comments.
52310
- // `isPublic` controls whether the comment is visible to the requester or
52311
- // internal-only; `contentType` lets the caller pick html/plainText. We
52312
- // leave it on the caller rather than defaulting because Zoho's editor
52313
- // produces both shapes and a silent default would change rendering.
52314
- name: "tickets.add-comment",
52315
- class: "mutation",
52316
- description: "Add a comment to a ticket. `isPublic` controls visibility (false = internal).",
52317
- parameters: {
52318
- type: "object",
52319
- properties: {
52320
- ticketId: { type: "string", description: "Ticket id to comment on." },
52321
- content: { type: "string", description: "Comment body." },
52322
- isPublic: { type: "boolean", description: "True for customer-visible, false for internal note." },
52323
- contentType: { type: "string", enum: ["html", "plainText"], description: "Body format (defaults to plainText if omitted)." }
52324
- },
52325
- required: ["ticketId", "content", "isPublic"]
52326
- },
52327
- request: {
52328
- // contentType is optional but the bare-placeholder body template
52329
- // requires every key to resolve. body: 'args' lets us pass the
52330
- // resolved arg bag (content + isPublic + optional contentType) without
52331
- // tripping readRequiredPath on the optional field. Zoho silently
52332
- // ignores extra `ticketId` in the body since it's already on the path.
52333
- method: "POST",
52334
- path: "/desk/v1/tickets/{ticketId}/comments",
52335
- body: "args"
52336
- },
52337
- cas: "native-idempotency",
52338
- externalEffect: true,
52339
- requiredScopes: ["Desk.tickets.ALL"]
52340
- },
52341
- {
52342
- // Merge consumes a primary ticket and a list of secondary ids. Zoho's
52343
- // mergeTickets endpoint expects { ids: [...secondaries] } — the surviving
52344
- // ticket id goes in the path. We keep the body shape verbatim instead of
52345
- // aliasing to e.g. {tickets: [...]} so callers can match the Zoho docs
52346
- // 1:1 when debugging merge failures.
52347
- name: "tickets.merge",
52348
- class: "mutation",
52349
- description: "Merge duplicate tickets into a single primary ticket. The primary id goes on the path; secondary ids in the body.",
52350
- parameters: {
52351
- type: "object",
52352
- properties: {
52353
- ticketId: { type: "string", description: "Surviving (primary) ticket id." },
52354
- ids: {
52355
- type: "array",
52356
- items: { type: "string" },
52357
- description: "Duplicate ticket ids to merge into the primary.",
52358
- minItems: 1
52359
- }
52360
- },
52361
- required: ["ticketId", "ids"]
52362
- },
52363
- request: {
52364
- method: "POST",
52365
- path: "/desk/v1/tickets/{ticketId}/mergeTickets",
52366
- body: { ids: "{ids}" }
52367
- },
52368
- cas: "native-idempotency",
52369
- externalEffect: true,
52370
- requiredScopes: ["Desk.tickets.ALL"]
52371
- },
52372
- {
52373
- name: "contacts.find",
52374
- class: "read",
52375
- description: "Find a contact by email or search query.",
52376
- parameters: {
52377
- type: "object",
52378
- properties: {
52379
- email: { type: "string", description: "Contact email to search by." },
52380
- query: { type: "string", description: "Search query string." },
52381
- limit: { type: "integer", minimum: 1, maximum: 100 },
52382
- offset: { type: "integer", minimum: 0 }
52383
- },
52384
- required: []
52385
- },
52386
- request: {
52387
- method: "GET",
52388
- path: "/desk/v1/contacts",
52389
- query: {
52390
- email: "{email}",
52391
- query: "{query}",
52392
- limit: "{limit}",
52393
- offset: "{offset}"
52394
- }
52395
- },
52396
- requiredScopes: ["Desk.contacts.ALL"]
52397
- }
52398
- ]
52399
- });
52400
-
52401
52650
  // src/connectors/adapters/gusto.ts
52402
52651
  var gustoConnector = declarativeRestConnector({
52403
52652
  kind: "gusto",
@@ -55621,321 +55870,6 @@ var postmarkConnector = declarativeRestConnector({
55621
55870
  ]
55622
55871
  });
55623
55872
 
55624
- // src/connectors/adapters/zoho-bookings.ts
55625
- var zohoBookingsConnector = declarativeRestConnector({
55626
- kind: "zoho-bookings",
55627
- displayName: "Zoho Bookings",
55628
- description: "Manage appointments and services in Zoho Bookings: book, reschedule, and cancel appointments; fetch availability; and retrieve appointment details.",
55629
- auth: {
55630
- kind: "oauth2",
55631
- authorizationUrl: "https://accounts.zoho.com/oauth/v2/auth",
55632
- tokenUrl: "https://accounts.zoho.com/oauth/v2/token",
55633
- scopes: ["ZohoBokings.appointments.ALL", "offline_access"],
55634
- clientIdEnv: "ZOHO_BOOKINGS_OAUTH_CLIENT_ID",
55635
- clientSecretEnv: "ZOHO_BOOKINGS_OAUTH_CLIENT_SECRET"
55636
- },
55637
- category: "calendar",
55638
- defaultConsistencyModel: "authoritative",
55639
- baseUrl: { metadataKey: "apiDomain", fallback: "https://www.zohoapis.com" },
55640
- credentialPlacement: { kind: "header", header: "Authorization", prefix: "Zoho-oauthtoken " },
55641
- test: { method: "GET", path: "/bookings/v1/appointments" },
55642
- capabilities: [
55643
- {
55644
- name: "appointment.list",
55645
- class: "read",
55646
- description: "List all appointments with optional filtering by status, date range, or customer.",
55647
- parameters: {
55648
- type: "object",
55649
- properties: {
55650
- status: {
55651
- type: "string",
55652
- description: "Filter by appointment status (e.g. confirmed, cancelled, completed)."
55653
- },
55654
- startDate: {
55655
- type: "string",
55656
- description: "ISO 8601 date to filter appointments from (inclusive)."
55657
- },
55658
- endDate: {
55659
- type: "string",
55660
- description: "ISO 8601 date to filter appointments until (inclusive)."
55661
- },
55662
- customerId: {
55663
- type: "string",
55664
- description: "Filter appointments by customer ID."
55665
- },
55666
- limit: {
55667
- type: "integer",
55668
- minimum: 1,
55669
- maximum: 200,
55670
- description: "Number of records to return."
55671
- }
55672
- }
55673
- },
55674
- request: {
55675
- method: "GET",
55676
- path: "/bookings/v1/appointments",
55677
- query: {
55678
- status: "{status}",
55679
- startDate: "{startDate}",
55680
- endDate: "{endDate}",
55681
- customerId: "{customerId}",
55682
- limit: "{limit}"
55683
- }
55684
- },
55685
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55686
- },
55687
- {
55688
- name: "appointment.get",
55689
- class: "read",
55690
- description: "Fetch details for a specific appointment by ID.",
55691
- parameters: {
55692
- type: "object",
55693
- properties: {
55694
- appointmentId: {
55695
- type: "string",
55696
- description: "The unique appointment ID."
55697
- }
55698
- },
55699
- required: ["appointmentId"]
55700
- },
55701
- request: {
55702
- method: "GET",
55703
- path: "/bookings/v1/appointments/{appointmentId}"
55704
- },
55705
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55706
- },
55707
- {
55708
- name: "availability.fetch",
55709
- class: "read",
55710
- description: "Fetch available time slots for a service and date range.",
55711
- parameters: {
55712
- type: "object",
55713
- properties: {
55714
- serviceId: {
55715
- type: "string",
55716
- description: "The service ID to check availability for."
55717
- },
55718
- startDate: {
55719
- type: "string",
55720
- description: "ISO 8601 date to start checking availability."
55721
- },
55722
- endDate: {
55723
- type: "string",
55724
- description: "ISO 8601 date to end checking availability."
55725
- }
55726
- },
55727
- required: ["serviceId", "startDate", "endDate"]
55728
- },
55729
- request: {
55730
- method: "GET",
55731
- path: "/bookings/v1/availability",
55732
- query: {
55733
- serviceId: "{serviceId}",
55734
- startDate: "{startDate}",
55735
- endDate: "{endDate}"
55736
- }
55737
- },
55738
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55739
- },
55740
- {
55741
- name: "appointment.book",
55742
- class: "mutation",
55743
- description: "Book a new appointment for a customer at an available time slot.",
55744
- parameters: {
55745
- type: "object",
55746
- properties: {
55747
- customerId: {
55748
- type: "string",
55749
- description: "The customer ID to book the appointment for."
55750
- },
55751
- serviceId: {
55752
- type: "string",
55753
- description: "The service ID for the appointment."
55754
- },
55755
- startTime: {
55756
- type: "string",
55757
- description: "ISO 8601 datetime for the appointment start."
55758
- },
55759
- details: {
55760
- type: "object",
55761
- description: "Additional appointment details (notes, custom fields, etc.)."
55762
- }
55763
- },
55764
- required: ["customerId", "serviceId", "startTime"]
55765
- },
55766
- request: {
55767
- method: "POST",
55768
- path: "/bookings/v1/appointments",
55769
- body: {
55770
- customerId: "{customerId}",
55771
- serviceId: "{serviceId}",
55772
- startTime: "{startTime}",
55773
- details: "{details}"
55774
- }
55775
- },
55776
- cas: "native-idempotency",
55777
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55778
- },
55779
- {
55780
- name: "appointment.reschedule",
55781
- class: "mutation",
55782
- description: "Reschedule an existing appointment to a new date and time.",
55783
- parameters: {
55784
- type: "object",
55785
- properties: {
55786
- appointmentId: {
55787
- type: "string",
55788
- description: "The appointment ID to reschedule."
55789
- },
55790
- startTime: {
55791
- type: "string",
55792
- description: "ISO 8601 datetime for the new appointment start."
55793
- },
55794
- reason: {
55795
- type: "string",
55796
- description: "Optional reason for rescheduling."
55797
- }
55798
- },
55799
- required: ["appointmentId", "startTime"]
55800
- },
55801
- request: {
55802
- method: "PUT",
55803
- path: "/bookings/v1/appointments/{appointmentId}/reschedule",
55804
- body: {
55805
- startTime: "{startTime}",
55806
- reason: "{reason}"
55807
- }
55808
- },
55809
- cas: "optimistic-read-verify",
55810
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55811
- },
55812
- {
55813
- name: "appointment.cancel",
55814
- class: "mutation",
55815
- description: "Cancel an existing appointment.",
55816
- parameters: {
55817
- type: "object",
55818
- properties: {
55819
- appointmentId: {
55820
- type: "string",
55821
- description: "The appointment ID to cancel."
55822
- },
55823
- reason: {
55824
- type: "string",
55825
- description: "Optional cancellation reason."
55826
- }
55827
- },
55828
- required: ["appointmentId"]
55829
- },
55830
- request: {
55831
- method: "DELETE",
55832
- path: "/bookings/v1/appointments/{appointmentId}",
55833
- query: {
55834
- reason: "{reason}"
55835
- }
55836
- },
55837
- cas: "optimistic-read-verify",
55838
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55839
- },
55840
- {
55841
- name: "services.list",
55842
- class: "read",
55843
- description: "List all bookable services configured in Zoho Bookings.",
55844
- parameters: {
55845
- type: "object",
55846
- properties: {
55847
- workspaceId: {
55848
- type: "string",
55849
- description: "Optional workspace ID to scope the listing."
55850
- },
55851
- limit: {
55852
- type: "integer",
55853
- minimum: 1,
55854
- maximum: 200,
55855
- description: "Number of records to return."
55856
- }
55857
- }
55858
- },
55859
- request: {
55860
- method: "GET",
55861
- path: "/bookings/v1/services",
55862
- query: { workspaceId: "{workspaceId}", limit: "{limit}" }
55863
- },
55864
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55865
- },
55866
- {
55867
- name: "staff.list",
55868
- class: "read",
55869
- description: "List staff members eligible to host appointments.",
55870
- parameters: {
55871
- type: "object",
55872
- properties: {
55873
- serviceId: {
55874
- type: "string",
55875
- description: "Optional service ID to scope the staff listing."
55876
- },
55877
- limit: {
55878
- type: "integer",
55879
- minimum: 1,
55880
- maximum: 200,
55881
- description: "Number of records to return."
55882
- }
55883
- }
55884
- },
55885
- request: {
55886
- method: "GET",
55887
- path: "/bookings/v1/staff",
55888
- query: { serviceId: "{serviceId}", limit: "{limit}" }
55889
- },
55890
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55891
- },
55892
- {
55893
- name: "appointment.complete",
55894
- class: "mutation",
55895
- description: "Mark an existing appointment as completed.",
55896
- parameters: {
55897
- type: "object",
55898
- properties: {
55899
- appointmentId: {
55900
- type: "string",
55901
- description: "The appointment ID to mark completed."
55902
- }
55903
- },
55904
- required: ["appointmentId"]
55905
- },
55906
- request: {
55907
- method: "PUT",
55908
- path: "/bookings/v1/appointments/{appointmentId}/complete"
55909
- },
55910
- cas: "native-idempotency",
55911
- externalEffect: true,
55912
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55913
- },
55914
- {
55915
- name: "appointment.no-show",
55916
- class: "mutation",
55917
- description: "Mark an existing appointment as a no-show.",
55918
- parameters: {
55919
- type: "object",
55920
- properties: {
55921
- appointmentId: {
55922
- type: "string",
55923
- description: "The appointment ID to mark as a no-show."
55924
- }
55925
- },
55926
- required: ["appointmentId"]
55927
- },
55928
- request: {
55929
- method: "PUT",
55930
- path: "/bookings/v1/appointments/{appointmentId}/no-show"
55931
- },
55932
- cas: "native-idempotency",
55933
- externalEffect: true,
55934
- requiredScopes: ["ZohoBokings.appointments.ALL"]
55935
- }
55936
- ]
55937
- });
55938
-
55939
55873
  // src/connectors/adapters/sanity.ts
55940
55874
  var DEFAULT_API_VERSION = "v2025-02-19";
55941
55875
  var datasetLocator = {
@@ -72492,10 +72426,10 @@ var clayConnector = {
72492
72426
  if (!res.ok) {
72493
72427
  throw new Error(`clay push_row ${res.status}: ${(await res.text().catch(() => res.statusText)).slice(0, 200)}`);
72494
72428
  }
72495
- const data3 = await res.json().catch(() => ({}));
72429
+ const data4 = await res.json().catch(() => ({}));
72496
72430
  return {
72497
72431
  status: "committed",
72498
- data: data3,
72432
+ data: data4,
72499
72433
  committedAt: Date.now(),
72500
72434
  idempotentReplay: false
72501
72435
  };
@@ -131432,6 +131366,8 @@ export {
131432
131366
  zapierConnector,
131433
131367
  zendeskConnector,
131434
131368
  zoomConnector,
131369
+ zohoBookingsConnector,
131370
+ zohoDeskConnector,
131435
131371
  zohoCrmConnector,
131436
131372
  zohoBooksConnector,
131437
131373
  zohoCampaignsConnector,
@@ -131476,7 +131412,6 @@ export {
131476
131412
  gitlabConnector,
131477
131413
  discordConnector,
131478
131414
  facebookPagesConnector,
131479
- zohoDeskConnector,
131480
131415
  gustoConnector,
131481
131416
  bigcommerceConnector,
131482
131417
  ebayConnector,
@@ -131486,7 +131421,6 @@ export {
131486
131421
  sendgridConnector,
131487
131422
  sendpulseConnector,
131488
131423
  postmarkConnector,
131489
- zohoBookingsConnector,
131490
131424
  sanityConnector,
131491
131425
  figmaConnector,
131492
131426
  figjamConnector,
@@ -131857,4 +131791,4 @@ export {
131857
131791
  demandbaseConnector,
131858
131792
  adapters_exports
131859
131793
  };
131860
- //# sourceMappingURL=chunk-3K5N3SQI.js.map
131794
+ //# sourceMappingURL=chunk-35JYHZYE.js.map