@executor-js/sdk 1.5.15 → 1.5.16

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.
@@ -4041,6 +4041,13 @@ var looseDb = (db) => db;
4041
4041
  var accessItemId = (owner, integration, name) => `oauth:${owner}:${integration}:${name}`;
4042
4042
  var refreshItemIdFor = (accessId) => `${accessId}:refresh`;
4043
4043
  var dedupeScopes = (scopes) => [...new Set(scopes)];
4044
+ var recordedOAuthScope = (token, requestedScopes) => {
4045
+ if (token.scope == null) return requestedScopes.join(" ") || null;
4046
+ const granted = token.scope.split(/\s+/).filter(Boolean);
4047
+ const coveredByRefreshToken = token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : [];
4048
+ const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]);
4049
+ return recorded.join(" ") || null;
4050
+ };
4044
4051
  var decodeJsonPayload = Schema4.decodeUnknownOption(Schema4.UnknownFromJsonString);
4045
4052
  var requestedScopesFromPayload = (payload) => {
4046
4053
  const decoded = typeof payload === "string" ? decodeJsonPayload(payload).pipe(Option2.getOrElse(() => payload)) : payload;
@@ -4516,12 +4523,11 @@ var makeOAuthService = (deps) => {
4516
4523
  oauthClientOwner: clientOwner,
4517
4524
  refreshItemId,
4518
4525
  expiresAt: expiresAtFrom(token),
4519
- // Benign fallback (kept by design): record the granted scope the AS
4520
- // echoed back; when it omits `scope` (some servers do), fall back to the
4521
- // scopes we requested (declared client). This only affects the recorded
4522
- // scope label, not what the token can do, so a guess here masks no
4523
- // misconfiguration.
4524
- oauthScope: token.scope ?? (requestedScopes.join(" ") || null)
4526
+ // Record the granted scope the AS echoed back. Some providers, including
4527
+ // Microsoft, issue a refresh token for `offline_access` but omit that
4528
+ // non-resource scope from the token `scope` string, so preserve it when
4529
+ // the refresh token proves it was granted.
4530
+ oauthScope: recordedOAuthScope(token, requestedScopes)
4525
4531
  });
4526
4532
  });
4527
4533
  const deleteSession = (state) => deps.fuma.use(
@@ -4573,6 +4579,7 @@ var makeOAuthService = (deps) => {
4573
4579
 
4574
4580
  // src/executor.ts
4575
4581
  var PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE = 90;
4582
+ var PLUGIN_STORAGE_CREATE_ROW_BATCH_SIZE = 90;
4576
4583
  var MAX_APPROVAL_ARGUMENT_PREVIEW_CHARS = 4e3;
4577
4584
  var acceptAllHandler = () => Effect8.succeed(ElicitationResponse.make({ action: "accept" }));
4578
4585
  var resolveElicitationHandler = (onElicitation) => onElicitation === "accept-all" ? acceptAllHandler : onElicitation;
@@ -4970,20 +4977,26 @@ var makePluginStorageFacade = (input) => {
4970
4977
  if (uniqueEntries.length === 0) return;
4971
4978
  yield* deleteManyImpl(owner, os.subject, uniqueEntries);
4972
4979
  const now = /* @__PURE__ */ new Date();
4973
- yield* input.core.createMany(
4974
- "plugin_storage",
4975
- uniqueEntries.map((entry) => ({
4976
- tenant,
4977
- owner: os.owner,
4978
- subject: os.subject,
4979
- plugin_id: input.pluginId,
4980
- collection: entry.collection,
4981
- key: entry.key,
4982
- data: entry.data,
4983
- created_at: now,
4984
- updated_at: now
4985
- }))
4986
- );
4980
+ for (let offset = 0; offset < uniqueEntries.length; offset += PLUGIN_STORAGE_CREATE_ROW_BATCH_SIZE) {
4981
+ const batchEntries = uniqueEntries.slice(
4982
+ offset,
4983
+ offset + PLUGIN_STORAGE_CREATE_ROW_BATCH_SIZE
4984
+ );
4985
+ yield* input.core.createMany(
4986
+ "plugin_storage",
4987
+ batchEntries.map((entry) => ({
4988
+ tenant,
4989
+ owner: os.owner,
4990
+ subject: os.subject,
4991
+ plugin_id: input.pluginId,
4992
+ collection: entry.collection,
4993
+ key: entry.key,
4994
+ data: entry.data,
4995
+ created_at: now,
4996
+ updated_at: now
4997
+ }))
4998
+ );
4999
+ }
4987
5000
  });
4988
5001
  const removeManyImpl = (owner, entries) => Effect8.gen(function* () {
4989
5002
  const os = ownerSubject(owner);
@@ -6672,4 +6685,4 @@ export {
6672
6685
  collectTables,
6673
6686
  createExecutor
6674
6687
  };
6675
- //# sourceMappingURL=chunk-QEKKFEJL.js.map
6688
+ //# sourceMappingURL=chunk-VICUTMT6.js.map