@executor-js/sdk 1.5.14 → 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.
- package/dist/{chunk-WKKKHDH2.js → chunk-VICUTMT6.js} +52 -21
- package/dist/chunk-VICUTMT6.js.map +1 -0
- package/dist/core.js +7 -1
- package/dist/core.js.map +1 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/oauth-service.d.ts.map +1 -1
- package/dist/testing/oauth-test-server.d.ts +1 -0
- package/dist/testing/oauth-test-server.d.ts.map +1 -1
- package/dist/testing.js +11 -3
- package/dist/testing.js.map +1 -1
- package/dist/tool-result.d.ts +10 -0
- package/dist/tool-result.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-WKKKHDH2.js.map +0 -1
|
@@ -3018,6 +3018,21 @@ var ToolHttpMetaSchema = Schema.Struct({
|
|
|
3018
3018
|
status: Schema.Number,
|
|
3019
3019
|
headers: Schema.Record(Schema.String, Schema.String)
|
|
3020
3020
|
});
|
|
3021
|
+
var ToolFileSchema = Schema.TaggedStruct("ToolFile", {
|
|
3022
|
+
name: Schema.optional(Schema.String),
|
|
3023
|
+
mimeType: Schema.String,
|
|
3024
|
+
encoding: Schema.Literal("base64"),
|
|
3025
|
+
data: Schema.String.annotate({
|
|
3026
|
+
description: "Base64-encoded file bytes.",
|
|
3027
|
+
contentEncoding: "base64"
|
|
3028
|
+
}),
|
|
3029
|
+
byteLength: Schema.Int.annotate({
|
|
3030
|
+
description: "Raw file size in bytes before base64 encoding."
|
|
3031
|
+
})
|
|
3032
|
+
});
|
|
3033
|
+
var ToolFileJsonSchema = Schema.toJsonSchemaDocument(ToolFileSchema).schema;
|
|
3034
|
+
var matchesToolFileSchema = Schema.is(ToolFileSchema);
|
|
3035
|
+
var isToolFile = (value) => matchesToolFileSchema(value);
|
|
3021
3036
|
var ToolResult = {
|
|
3022
3037
|
ok: (data, meta) => ({
|
|
3023
3038
|
ok: true,
|
|
@@ -4026,6 +4041,13 @@ var looseDb = (db) => db;
|
|
|
4026
4041
|
var accessItemId = (owner, integration, name) => `oauth:${owner}:${integration}:${name}`;
|
|
4027
4042
|
var refreshItemIdFor = (accessId) => `${accessId}:refresh`;
|
|
4028
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
|
+
};
|
|
4029
4051
|
var decodeJsonPayload = Schema4.decodeUnknownOption(Schema4.UnknownFromJsonString);
|
|
4030
4052
|
var requestedScopesFromPayload = (payload) => {
|
|
4031
4053
|
const decoded = typeof payload === "string" ? decodeJsonPayload(payload).pipe(Option2.getOrElse(() => payload)) : payload;
|
|
@@ -4501,12 +4523,11 @@ var makeOAuthService = (deps) => {
|
|
|
4501
4523
|
oauthClientOwner: clientOwner,
|
|
4502
4524
|
refreshItemId,
|
|
4503
4525
|
expiresAt: expiresAtFrom(token),
|
|
4504
|
-
//
|
|
4505
|
-
//
|
|
4506
|
-
//
|
|
4507
|
-
//
|
|
4508
|
-
|
|
4509
|
-
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)
|
|
4510
4531
|
});
|
|
4511
4532
|
});
|
|
4512
4533
|
const deleteSession = (state) => deps.fuma.use(
|
|
@@ -4558,6 +4579,7 @@ var makeOAuthService = (deps) => {
|
|
|
4558
4579
|
|
|
4559
4580
|
// src/executor.ts
|
|
4560
4581
|
var PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE = 90;
|
|
4582
|
+
var PLUGIN_STORAGE_CREATE_ROW_BATCH_SIZE = 90;
|
|
4561
4583
|
var MAX_APPROVAL_ARGUMENT_PREVIEW_CHARS = 4e3;
|
|
4562
4584
|
var acceptAllHandler = () => Effect8.succeed(ElicitationResponse.make({ action: "accept" }));
|
|
4563
4585
|
var resolveElicitationHandler = (onElicitation) => onElicitation === "accept-all" ? acceptAllHandler : onElicitation;
|
|
@@ -4955,20 +4977,26 @@ var makePluginStorageFacade = (input) => {
|
|
|
4955
4977
|
if (uniqueEntries.length === 0) return;
|
|
4956
4978
|
yield* deleteManyImpl(owner, os.subject, uniqueEntries);
|
|
4957
4979
|
const now = /* @__PURE__ */ new Date();
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
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
|
+
}
|
|
4972
5000
|
});
|
|
4973
5001
|
const removeManyImpl = (owner, entries) => Effect8.gen(function* () {
|
|
4974
5002
|
const os = ownerSubject(owner);
|
|
@@ -6645,6 +6673,9 @@ export {
|
|
|
6645
6673
|
definePluginStorageCollection,
|
|
6646
6674
|
pluginStorageId,
|
|
6647
6675
|
buildToolTypeScriptPreview,
|
|
6676
|
+
ToolFileSchema,
|
|
6677
|
+
ToolFileJsonSchema,
|
|
6678
|
+
isToolFile,
|
|
6648
6679
|
ToolResult,
|
|
6649
6680
|
isToolResult,
|
|
6650
6681
|
annotateToolResultOutcome,
|
|
@@ -6654,4 +6685,4 @@ export {
|
|
|
6654
6685
|
collectTables,
|
|
6655
6686
|
createExecutor
|
|
6656
6687
|
};
|
|
6657
|
-
//# sourceMappingURL=chunk-
|
|
6688
|
+
//# sourceMappingURL=chunk-VICUTMT6.js.map
|