@executor-js/sdk 1.4.29 → 1.4.30
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/blob.d.ts +2 -1
- package/dist/blob.d.ts.map +1 -1
- package/dist/chunk-2LU3SC64.js +7 -0
- package/dist/chunk-2LU3SC64.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +38 -0
- package/dist/chunk-7D4SUZUM.js.map +1 -0
- package/dist/chunk-B4YGTZF6.js +22 -0
- package/dist/chunk-B4YGTZF6.js.map +1 -0
- package/dist/chunk-BZNIRSMG.js +7873 -0
- package/dist/chunk-BZNIRSMG.js.map +1 -0
- package/dist/chunk-ECMCGZYE.js +5814 -0
- package/dist/chunk-ECMCGZYE.js.map +1 -0
- package/dist/{chunk-6SQWMOM4.js → chunk-MLNVNVRI.js} +2 -6
- package/dist/chunk-MLNVNVRI.js.map +1 -0
- package/dist/chunk-P2WKYAC5.js +1 -0
- package/dist/chunk-P2WKYAC5.js.map +1 -0
- package/dist/chunk-ZANQD7E2.js +1035 -0
- package/dist/chunk-ZANQD7E2.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +3 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/core-schema.d.ts +283 -408
- package/dist/core-schema.d.ts.map +1 -1
- package/dist/core-tools.d.ts +6 -0
- package/dist/core-tools.d.ts.map +1 -0
- package/dist/core.js +120 -168
- package/dist/core.js.map +1 -1
- package/dist/credential-bindings.d.ts +86 -24
- package/dist/credential-bindings.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/executor.d.ts +46 -12
- package/dist/executor.d.ts.map +1 -1
- package/dist/fuma-runtime.d.ts +50 -0
- package/dist/fuma-runtime.d.ts.map +1 -0
- package/dist/http-source.d.ts +109 -0
- package/dist/http-source.d.ts.map +1 -0
- package/dist/http-source.js +155 -0
- package/dist/http-source.js.map +1 -0
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -21
- package/dist/index.js.map +1 -1
- package/dist/oauth-service.d.ts +2 -10
- package/dist/oauth-service.d.ts.map +1 -1
- package/dist/oauth.d.ts +9 -1
- package/dist/oauth.d.ts.map +1 -1
- package/dist/plugin-storage.d.ts +40 -0
- package/dist/plugin-storage.d.ts.map +1 -0
- package/dist/plugin.d.ts +110 -34
- package/dist/plugin.d.ts.map +1 -1
- package/dist/promise-executor.d.ts +33 -8
- package/dist/promise-executor.d.ts.map +1 -1
- package/dist/promise.d.ts +3 -3
- package/dist/promise.d.ts.map +1 -1
- package/dist/schema-refs.d.ts +1 -0
- package/dist/schema-refs.d.ts.map +1 -1
- package/dist/schema-refs.test.d.ts +2 -0
- package/dist/schema-refs.test.d.ts.map +1 -0
- package/dist/schema-types.d.ts +22 -8
- package/dist/schema-types.d.ts.map +1 -1
- package/dist/scope-policy.d.ts +23 -0
- package/dist/scope-policy.d.ts.map +1 -0
- package/dist/scope-policy.test.d.ts +2 -0
- package/dist/scope-policy.test.d.ts.map +1 -0
- package/dist/scope.d.ts +10 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/secrets.d.ts +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/shared.d.ts +13 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +103 -0
- package/dist/shared.js.map +1 -0
- package/dist/sqlite-test-db-OK2WQNR5.js +8 -0
- package/dist/sqlite-test-db-OK2WQNR5.js.map +1 -0
- package/dist/sqlite-test-db.d.ts +22 -0
- package/dist/sqlite-test-db.d.ts.map +1 -0
- package/dist/test-config.d.ts +45 -4
- package/dist/test-config.d.ts.map +1 -1
- package/dist/testing/oauth-test-server.d.ts +80 -0
- package/dist/testing/oauth-test-server.d.ts.map +1 -0
- package/dist/testing.d.ts +4 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +706 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.test.d.ts +2 -0
- package/dist/testing.test.d.ts.map +1 -0
- package/dist/tool-result.d.ts +22 -0
- package/dist/tool-result.d.ts.map +1 -0
- package/dist/tool-result.test.d.ts +2 -0
- package/dist/tool-result.test.d.ts.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vendor/json-schema-to-typescript/applySchemaTyping.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/applySchemaTyping.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/compat.d.ts +10 -0
- package/dist/vendor/json-schema-to-typescript/compat.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/formatter.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/formatter.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/generator.d.ts +7 -0
- package/dist/vendor/json-schema-to-typescript/generator.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/index.d.ts +93 -0
- package/dist/vendor/json-schema-to-typescript/index.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/linker.d.ts +8 -0
- package/dist/vendor/json-schema-to-typescript/linker.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/normalizer.d.ts +5 -0
- package/dist/vendor/json-schema-to-typescript/normalizer.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/optimizer.d.ts +4 -0
- package/dist/vendor/json-schema-to-typescript/optimizer.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/optionValidator.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/optionValidator.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/parser.d.ts +8 -0
- package/dist/vendor/json-schema-to-typescript/parser.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/resolver.d.ts +7 -0
- package/dist/vendor/json-schema-to-typescript/resolver.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/AST.d.ts +108 -0
- package/dist/vendor/json-schema-to-typescript/types/AST.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/JSONSchema.d.ts +103 -0
- package/dist/vendor/json-schema-to-typescript/types/JSONSchema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/json-schema.d.ts +34 -0
- package/dist/vendor/json-schema-to-typescript/types/json-schema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/typesOfSchema.d.ts +11 -0
- package/dist/vendor/json-schema-to-typescript/typesOfSchema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/utils.d.ts +30 -0
- package/dist/vendor/json-schema-to-typescript/utils.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/validator.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/validator.d.ts.map +1 -0
- package/package.json +17 -2
- package/dist/chunk-6SQWMOM4.js.map +0 -1
- package/dist/chunk-I2OEQ2GJ.js +0 -103
- package/dist/chunk-I2OEQ2GJ.js.map +0 -1
- package/dist/chunk-OIJL6F6M.js +0 -5507
- package/dist/chunk-OIJL6F6M.js.map +0 -1
- package/dist/error-handling.test.d.ts +0 -2
- package/dist/error-handling.test.d.ts.map +0 -1
- package/dist/scoped-adapter.d.ts +0 -28
- package/dist/scoped-adapter.d.ts.map +0 -1
- package/dist/scoped-adapter.test.d.ts +0 -2
- package/dist/scoped-adapter.test.d.ts.map +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import "./chunk-P2WKYAC5.js";
|
|
2
|
+
import "./chunk-B4YGTZF6.js";
|
|
3
|
+
import "./chunk-MLNVNVRI.js";
|
|
4
|
+
import {
|
|
5
|
+
ConfiguredCredentialBinding,
|
|
6
|
+
ConnectionId,
|
|
7
|
+
ScopeId,
|
|
8
|
+
SecretId,
|
|
9
|
+
credentialSlotPart
|
|
10
|
+
} from "./chunk-ZANQD7E2.js";
|
|
11
|
+
import "./chunk-7D4SUZUM.js";
|
|
12
|
+
|
|
13
|
+
// src/http-source.ts
|
|
14
|
+
import { Effect, Schema } from "effect";
|
|
15
|
+
var HttpCredentialInput = Schema.Union([
|
|
16
|
+
Schema.String,
|
|
17
|
+
Schema.Struct({
|
|
18
|
+
kind: Schema.Literal("text"),
|
|
19
|
+
text: Schema.String,
|
|
20
|
+
prefix: Schema.optional(Schema.String)
|
|
21
|
+
}),
|
|
22
|
+
Schema.Struct({
|
|
23
|
+
kind: Schema.Literal("secret"),
|
|
24
|
+
secretId: Schema.String,
|
|
25
|
+
secretScope: Schema.optional(Schema.String),
|
|
26
|
+
prefix: Schema.optional(Schema.String)
|
|
27
|
+
}),
|
|
28
|
+
Schema.Struct({
|
|
29
|
+
kind: Schema.Literal("connection"),
|
|
30
|
+
connectionId: Schema.String
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
var HttpConfiguredValueInput = Schema.Union([
|
|
34
|
+
Schema.String,
|
|
35
|
+
Schema.Struct({
|
|
36
|
+
kind: Schema.Literal("secret"),
|
|
37
|
+
prefix: Schema.optional(Schema.String)
|
|
38
|
+
})
|
|
39
|
+
]);
|
|
40
|
+
var OAuth2Flow = Schema.Literals(["authorizationCode", "clientCredentials"]);
|
|
41
|
+
var OAuth2SourceConfig = Schema.Struct({
|
|
42
|
+
kind: Schema.Literal("oauth2"),
|
|
43
|
+
securitySchemeName: Schema.String,
|
|
44
|
+
flow: OAuth2Flow,
|
|
45
|
+
tokenUrl: Schema.String,
|
|
46
|
+
authorizationUrl: Schema.NullOr(Schema.String).pipe(
|
|
47
|
+
Schema.optional,
|
|
48
|
+
Schema.withDecodingDefault(Effect.succeed(null))
|
|
49
|
+
),
|
|
50
|
+
issuerUrl: Schema.optional(Schema.NullOr(Schema.String)),
|
|
51
|
+
clientIdSlot: Schema.String,
|
|
52
|
+
clientSecretSlot: Schema.NullOr(Schema.String),
|
|
53
|
+
connectionSlot: Schema.String,
|
|
54
|
+
scopes: Schema.Array(Schema.String)
|
|
55
|
+
}).annotate({ identifier: "OAuth2SourceConfig" });
|
|
56
|
+
var HttpOAuthConfigureInput = Schema.Struct({
|
|
57
|
+
clientId: Schema.optional(HttpCredentialInput),
|
|
58
|
+
clientSecret: Schema.optional(Schema.NullOr(HttpCredentialInput)),
|
|
59
|
+
connection: Schema.optional(HttpCredentialInput)
|
|
60
|
+
}).annotate({ identifier: "HttpOAuthConfigureInput" });
|
|
61
|
+
var httpCredentialSlotKey = (section, placement, name) => `${section}.${placement}.${credentialSlotPart(name)}`;
|
|
62
|
+
var httpHeaderSlotKey = (section, name) => httpCredentialSlotKey(section, "headers", name);
|
|
63
|
+
var httpQuerySlotKey = (section, name) => httpCredentialSlotKey(section, "query", name);
|
|
64
|
+
var httpOAuthConnectionSlotKey = (section) => `${section}.oauth.connection`;
|
|
65
|
+
var httpOAuthClientIdSlotKey = (section) => `${section}.oauth.clientId`;
|
|
66
|
+
var httpOAuthClientSecretSlotKey = (section) => `${section}.oauth.clientSecret`;
|
|
67
|
+
var httpSectionSlotPrefix = (section) => `${section}.`;
|
|
68
|
+
var compileHttpNamedCredentialMap = (values, slotForName) => {
|
|
69
|
+
const nextValues = {};
|
|
70
|
+
const bindings = [];
|
|
71
|
+
for (const [name, value] of Object.entries(values ?? {})) {
|
|
72
|
+
if (typeof value === "string") {
|
|
73
|
+
nextValues[name] = value;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if ("kind" in value) {
|
|
77
|
+
if (value.kind === "binding") {
|
|
78
|
+
nextValues[name] = value;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const slot2 = slotForName(name);
|
|
82
|
+
nextValues[name] = ConfiguredCredentialBinding.make({
|
|
83
|
+
kind: "binding",
|
|
84
|
+
slot: slot2,
|
|
85
|
+
prefix: "prefix" in value ? value.prefix : void 0
|
|
86
|
+
});
|
|
87
|
+
bindings.push({
|
|
88
|
+
slot: slot2,
|
|
89
|
+
value: httpCredentialInputToBindingValue(value)
|
|
90
|
+
});
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const slot = slotForName(name);
|
|
94
|
+
nextValues[name] = ConfiguredCredentialBinding.make({
|
|
95
|
+
kind: "binding",
|
|
96
|
+
slot,
|
|
97
|
+
prefix: value.prefix
|
|
98
|
+
});
|
|
99
|
+
bindings.push({
|
|
100
|
+
slot,
|
|
101
|
+
targetScope: "targetScope" in value ? value.targetScope : void 0,
|
|
102
|
+
value: {
|
|
103
|
+
kind: "secret",
|
|
104
|
+
secretId: SecretId.make(value.secretId),
|
|
105
|
+
..."secretScopeId" in value && value.secretScopeId ? { secretScopeId: ScopeId.make(value.secretScopeId) } : {}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return { values: nextValues, bindings };
|
|
110
|
+
};
|
|
111
|
+
var httpCredentialInputToBindingValue = (input) => {
|
|
112
|
+
if (typeof input === "string") {
|
|
113
|
+
return {
|
|
114
|
+
kind: "text",
|
|
115
|
+
text: input
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (input.kind === "text") {
|
|
119
|
+
return {
|
|
120
|
+
kind: "text",
|
|
121
|
+
text: input.text
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (input.kind === "secret") {
|
|
125
|
+
return {
|
|
126
|
+
kind: "secret",
|
|
127
|
+
secretId: SecretId.make(input.secretId),
|
|
128
|
+
...input.secretScope ? { secretScopeId: ScopeId.make(input.secretScope) } : {}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (input.kind === "connection") {
|
|
132
|
+
return {
|
|
133
|
+
kind: "connection",
|
|
134
|
+
connectionId: ConnectionId.make(input.connectionId)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return input;
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
HttpConfiguredValueInput,
|
|
141
|
+
HttpCredentialInput,
|
|
142
|
+
HttpOAuthConfigureInput,
|
|
143
|
+
OAuth2Flow,
|
|
144
|
+
OAuth2SourceConfig,
|
|
145
|
+
compileHttpNamedCredentialMap,
|
|
146
|
+
httpCredentialInputToBindingValue,
|
|
147
|
+
httpCredentialSlotKey,
|
|
148
|
+
httpHeaderSlotKey,
|
|
149
|
+
httpOAuthClientIdSlotKey,
|
|
150
|
+
httpOAuthClientSecretSlotKey,
|
|
151
|
+
httpOAuthConnectionSlotKey,
|
|
152
|
+
httpQuerySlotKey,
|
|
153
|
+
httpSectionSlotPrefix
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=http-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/http-source.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\n\nimport {\n ConnectionId,\n ConfiguredCredentialBinding,\n credentialSlotPart,\n type ConfiguredCredentialValue,\n type CredentialBindingValue,\n type ScopedSecretCredentialInput,\n SecretId,\n ScopeId,\n} from \"./shared\";\n\nexport const HttpCredentialInput = Schema.Union([\n Schema.String,\n Schema.Struct({\n kind: Schema.Literal(\"text\"),\n text: Schema.String,\n prefix: Schema.optional(Schema.String),\n }),\n Schema.Struct({\n kind: Schema.Literal(\"secret\"),\n secretId: Schema.String,\n secretScope: Schema.optional(Schema.String),\n prefix: Schema.optional(Schema.String),\n }),\n Schema.Struct({\n kind: Schema.Literal(\"connection\"),\n connectionId: Schema.String,\n }),\n]);\nexport type HttpCredentialInput = typeof HttpCredentialInput.Type;\nexport type HttpCredentialInputType = HttpCredentialInput;\n\nexport const HttpConfiguredValueInput = Schema.Union([\n Schema.String,\n Schema.Struct({\n kind: Schema.Literal(\"secret\"),\n prefix: Schema.optional(Schema.String),\n }),\n]);\nexport type HttpConfiguredValueInput = typeof HttpConfiguredValueInput.Type;\nexport type HttpConfiguredValueInputType = HttpConfiguredValueInput;\n\nexport const OAuth2Flow = Schema.Literals([\"authorizationCode\", \"clientCredentials\"]);\nexport type OAuth2Flow = typeof OAuth2Flow.Type;\nexport type OAuth2FlowType = OAuth2Flow;\n\nexport const OAuth2SourceConfig = Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n securitySchemeName: Schema.String,\n flow: OAuth2Flow,\n tokenUrl: Schema.String,\n authorizationUrl: Schema.NullOr(Schema.String).pipe(\n Schema.optional,\n Schema.withDecodingDefault(Effect.succeed(null)),\n ),\n issuerUrl: Schema.optional(Schema.NullOr(Schema.String)),\n clientIdSlot: Schema.String,\n clientSecretSlot: Schema.NullOr(Schema.String),\n connectionSlot: Schema.String,\n scopes: Schema.Array(Schema.String),\n}).annotate({ identifier: \"OAuth2SourceConfig\" });\nexport type OAuth2SourceConfig = typeof OAuth2SourceConfig.Type;\nexport type OAuth2SourceConfigType = OAuth2SourceConfig;\n\nexport const HttpOAuthConfigureInput = Schema.Struct({\n clientId: Schema.optional(HttpCredentialInput),\n clientSecret: Schema.optional(Schema.NullOr(HttpCredentialInput)),\n connection: Schema.optional(HttpCredentialInput),\n}).annotate({ identifier: \"HttpOAuthConfigureInput\" });\nexport type HttpOAuthConfigureInput = typeof HttpOAuthConfigureInput.Type;\nexport type HttpOAuthConfigureInputType = HttpOAuthConfigureInput;\n\nexport type HttpCredentialSection = \"request\" | \"specFetch\" | \"introspection\";\nexport type HttpCredentialPlacement = \"headers\" | \"query\";\n\nexport const httpCredentialSlotKey = (\n section: HttpCredentialSection,\n placement: HttpCredentialPlacement,\n name: string,\n): string => `${section}.${placement}.${credentialSlotPart(name)}`;\n\nexport const httpHeaderSlotKey = (section: HttpCredentialSection, name: string): string =>\n httpCredentialSlotKey(section, \"headers\", name);\n\nexport const httpQuerySlotKey = (section: HttpCredentialSection, name: string): string =>\n httpCredentialSlotKey(section, \"query\", name);\n\nexport const httpOAuthConnectionSlotKey = (section: HttpCredentialSection): string =>\n `${section}.oauth.connection`;\n\nexport const httpOAuthClientIdSlotKey = (section: HttpCredentialSection): string =>\n `${section}.oauth.clientId`;\n\nexport const httpOAuthClientSecretSlotKey = (section: HttpCredentialSection): string =>\n `${section}.oauth.clientSecret`;\n\nexport const httpSectionSlotPrefix = (section: HttpCredentialSection): string => `${section}.`;\n\nexport type HttpNamedCredentialInput =\n | ConfiguredCredentialValue\n | ScopedSecretCredentialInput\n | {\n readonly secretId: string;\n readonly prefix?: string;\n readonly targetScope?: string;\n readonly secretScopeId?: string;\n };\n\nexport interface CompiledHttpNamedCredentialBinding {\n readonly slot: string;\n readonly value: CredentialBindingValue;\n readonly targetScope?: string;\n}\n\nexport const compileHttpNamedCredentialMap = (\n values: Record<string, HttpNamedCredentialInput | HttpCredentialInput> | undefined,\n slotForName: (name: string) => string,\n): {\n readonly values: Record<string, ConfiguredCredentialValue>;\n readonly bindings: readonly CompiledHttpNamedCredentialBinding[];\n} => {\n const nextValues: Record<string, ConfiguredCredentialValue> = {};\n const bindings: CompiledHttpNamedCredentialBinding[] = [];\n for (const [name, value] of Object.entries(values ?? {})) {\n if (typeof value === \"string\") {\n nextValues[name] = value;\n continue;\n }\n if (\"kind\" in value) {\n if (value.kind === \"binding\") {\n nextValues[name] = value;\n continue;\n }\n const slot = slotForName(name);\n nextValues[name] = ConfiguredCredentialBinding.make({\n kind: \"binding\",\n slot,\n prefix: \"prefix\" in value ? value.prefix : undefined,\n });\n bindings.push({\n slot,\n value: httpCredentialInputToBindingValue(value),\n });\n continue;\n }\n const slot = slotForName(name);\n nextValues[name] = ConfiguredCredentialBinding.make({\n kind: \"binding\",\n slot,\n prefix: value.prefix,\n });\n bindings.push({\n slot,\n targetScope: \"targetScope\" in value ? value.targetScope : undefined,\n value: {\n kind: \"secret\",\n secretId: SecretId.make(value.secretId),\n ...(\"secretScopeId\" in value && value.secretScopeId\n ? { secretScopeId: ScopeId.make(value.secretScopeId) }\n : {}),\n },\n });\n }\n return { values: nextValues, bindings };\n};\n\nexport const httpCredentialInputToBindingValue = (\n input: HttpCredentialInput,\n): CredentialBindingValue => {\n if (typeof input === \"string\") {\n return {\n kind: \"text\",\n text: input,\n };\n }\n if (input.kind === \"text\") {\n return {\n kind: \"text\",\n text: input.text,\n };\n }\n if (input.kind === \"secret\") {\n return {\n kind: \"secret\",\n secretId: SecretId.make(input.secretId),\n ...(input.secretScope ? { secretScopeId: ScopeId.make(input.secretScope) } : {}),\n };\n }\n if (input.kind === \"connection\") {\n return {\n kind: \"connection\",\n connectionId: ConnectionId.make(input.connectionId),\n };\n }\n return input;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,QAAQ,cAAc;AAaxB,IAAM,sBAAsB,OAAO,MAAM;AAAA,EAC9C,OAAO;AAAA,EACP,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,MAAM;AAAA,IAC3B,MAAM,OAAO;AAAA,IACb,QAAQ,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,CAAC;AAAA,EACD,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,QAAQ;AAAA,IAC7B,UAAU,OAAO;AAAA,IACjB,aAAa,OAAO,SAAS,OAAO,MAAM;AAAA,IAC1C,QAAQ,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,CAAC;AAAA,EACD,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,YAAY;AAAA,IACjC,cAAc,OAAO;AAAA,EACvB,CAAC;AACH,CAAC;AAIM,IAAM,2BAA2B,OAAO,MAAM;AAAA,EACnD,OAAO;AAAA,EACP,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,QAAQ;AAAA,IAC7B,QAAQ,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,CAAC;AACH,CAAC;AAIM,IAAM,aAAa,OAAO,SAAS,CAAC,qBAAqB,mBAAmB,CAAC;AAI7E,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,MAAM,OAAO,QAAQ,QAAQ;AAAA,EAC7B,oBAAoB,OAAO;AAAA,EAC3B,MAAM;AAAA,EACN,UAAU,OAAO;AAAA,EACjB,kBAAkB,OAAO,OAAO,OAAO,MAAM,EAAE;AAAA,IAC7C,OAAO;AAAA,IACP,OAAO,oBAAoB,OAAO,QA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AC/B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,cAAc,aAAa,KAAK,MAAM,YAAY;AAAA,IACpD;AAAA,EACF;AACA,SAAO;AACT;","names":["slot"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
export { Context, Effect, Layer, Schema, Data, Option } from "effect";
|
|
2
2
|
export { HttpApi, HttpApiBuilder, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, } from "effect/unstable/httpapi";
|
|
3
|
-
export
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
3
|
+
export { fumadb } from "fumadb";
|
|
4
|
+
export type { FumaDB } from "fumadb";
|
|
5
|
+
export type { AbstractQuery, Condition, ConditionBuilder } from "fumadb/query";
|
|
6
|
+
export { column, idColumn, schema as fumaSchema, table } from "fumadb/schema";
|
|
7
|
+
export type { AnyColumn, AnySchema, AnyTable, Column, Schema as FumaSchema } from "fumadb/schema";
|
|
8
|
+
export type { FumaDb, FumaQuery, FumaRow, FumaTables, IFumaClient, StorageFailure, } from "./fuma-runtime";
|
|
9
|
+
export { StorageError, UniqueViolationError, isStorageFailure } from "./fuma-runtime";
|
|
6
10
|
export { ScopeId, ToolId, SecretId, PolicyId, ConnectionId, CredentialBindingId } from "./ids";
|
|
7
|
-
export { Scope } from "./scope";
|
|
11
|
+
export { Scope, defaultSourceInstallScopeId } from "./scope";
|
|
8
12
|
export { ToolNotFoundError, ToolInvocationError, ToolBlockedError, NoHandlerError, SourceNotFoundError, SourceRemovalNotAllowedError, PluginNotLoadedError, SecretNotFoundError, SecretResolutionError, SecretOwnedByConnectionError, SecretInUseError, ConnectionNotFoundError, ConnectionProviderNotRegisteredError, ConnectionRefreshNotSupportedError, ConnectionReauthRequiredError, ConnectionInUseError, type ExecutorError, } from "./errors";
|
|
9
13
|
export { ToolSchema, SourceDetectionResult, type RefreshSourceInput, type RemoveSourceInput, type Source, type Tool, type ToolListFilter, } from "./types";
|
|
10
|
-
export { coreSchema, isToolPolicyAction, TOOL_POLICY_ACTIONS, type CoreSchema, type SourceInput, type SourceInputTool, type SourceRow, type ToolRow, type DefinitionRow, type SecretRow, type ConnectionRow, type CredentialBindingRow, type ToolPolicyRow, type ToolPolicyAction, type DefinitionsInput, type ToolAnnotations, } from "./core-schema";
|
|
14
|
+
export { bigintColumn, boolColumn, coreSchema, dateColumn, isToolPolicyAction, jsonColumn, nullableBigintColumn, nullableJsonColumn, nullableTextColumn, scopedExecutorTable, textColumn, TOOL_POLICY_ACTIONS, type CoreSchema, type SourceInput, type SourceInputTool, type SourceRow, type ToolRow, type DefinitionRow, type SecretRow, type ConnectionRow, type PluginStorageRow, type CredentialBindingRow, type ToolPolicyRow, type ToolPolicyAction, type DefinitionsInput, type ToolAnnotations, } from "./core-schema";
|
|
11
15
|
export { matchPattern, isValidPattern, resolveToolPolicy, resolveEffectivePolicy, effectivePolicyFromSorted, rowToToolPolicy, ToolPolicyActionSchema, type ToolPolicy, type CreateToolPolicyInput, type UpdateToolPolicyInput, type RemoveToolPolicyInput, type PolicyMatch, type EffectivePolicy, type PolicySource, } from "./policies";
|
|
12
16
|
export { SecretRef, SetSecretInput, RemoveSecretInput, type SecretProvider } from "./secrets";
|
|
13
17
|
export { SecretBackedMap, SecretBackedValue, isSecretBackedRef, resolveSecretBackedMap, type ResolveSecretBackedMapOptions, } from "./secret-backed-value";
|
|
14
|
-
export { CredentialBindingKind, CredentialBindingValue, ConfiguredCredentialBinding, ConfiguredCredentialValue, ScopedSecretCredentialInput, CredentialBindingRef,
|
|
18
|
+
export { CredentialBindingKind, CredentialBindingValue, ConfiguredCredentialBinding, ConfiguredCredentialValue, ScopedSecretCredentialInput, CredentialBindingRef, CredentialBindingSlotInput, RemoveCredentialBindingInput, RemoveSourceCredentialBindingInput, ReplaceCredentialBindingValue, ReplaceCredentialBindingsInput, ReplaceSourceCredentialBindingsInput, CredentialBindingResolutionStatus, ResolvedCredentialSlot, SetSourceCredentialBindingInput, SourceCredentialBindingSource, SourceCredentialBindingSourceInput, SourceCredentialBindingSlotInput, credentialBindingId, credentialSlotKey, credentialSlotPart, credentialBindingRowToRef, credentialBindingValueFromRow, type CredentialBindingsFacade, } from "./credential-bindings";
|
|
15
19
|
export { Usage, type UsagesForSecretInput, type UsagesForConnectionInput } from "./usages";
|
|
16
20
|
export { ConnectionRef, ConnectionProviderState, CreateConnectionInput, RemoveConnectionInput, UpdateConnectionTokensInput, TokenMaterial, ConnectionRefreshError, type ConnectionProvider, type ConnectionRefreshInput, type ConnectionRefreshResult, } from "./connections";
|
|
17
21
|
export { FormElicitation, UrlElicitation, ElicitationAction, ElicitationResponse, ElicitationDeclinedError, type ElicitationRequest, type ElicitationHandler, type ElicitationContext, } from "./elicitation";
|
|
18
|
-
export { type BlobStore, type PluginBlobStore, pluginBlobStore, makeInMemoryBlobStore, } from "./blob";
|
|
22
|
+
export { type BlobStore, type PluginBlobStore, pluginBlobStore, makeFumaBlobStore, makeInMemoryBlobStore, } from "./blob";
|
|
19
23
|
export { type OAuthService, type OAuthStrategy, type OAuthDynamicDcrStrategy, type OAuthAuthorizationCodeStrategy, type OAuthClientCredentialsStrategy, type OAuthProviderState, type OAuthProbeInput, type OAuthProbeResult, type OAuthStartInput, type OAuthStartResult, type OAuthCompleteInput, type OAuthCompleteResult, OAuthProbeError, OAuthStartError, OAuthCompleteError, OAuthSessionNotFoundError, OAUTH2_PROVIDER_KEY, OAUTH2_SESSION_TTL_MS, OAuthStrategy as OAuthStrategySchema, OAuthProviderState as OAuthProviderStateSchema, OAuthDynamicDcrStrategy as OAuthDynamicDcrStrategySchema, OAuthAuthorizationCodeStrategy as OAuthAuthorizationCodeStrategySchema, OAuthClientCredentialsStrategy as OAuthClientCredentialsStrategySchema, } from "./oauth";
|
|
20
24
|
export { OAuth2Error, OAUTH2_DEFAULT_TIMEOUT_MS, OAUTH2_REFRESH_SKEW_MS, assertSupportedOAuthEndpointUrl, buildAuthorizationUrl, createPkceCodeChallenge, createPkceCodeVerifier, exchangeAuthorizationCode, exchangeClientCredentials, isSupportedOAuthEndpointUrl, refreshAccessToken, shouldRefreshToken, type OAuth2TokenResponse, type BuildAuthorizationUrlInput, type ClientAuthMethod, type ExchangeAuthorizationCodeInput, type ExchangeClientCredentialsInput, type RefreshAccessTokenInput, } from "./oauth-helpers";
|
|
21
25
|
export { makeOAuth2Service, type OAuthServiceDeps } from "./oauth-service";
|
|
22
|
-
export type { ScopedDBAdapter, ScopedTypedAdapter } from "./scoped-adapter";
|
|
23
26
|
export { HostedOutboundRequestBlocked, makeHostedHttpClientLayer, validateHostedOutboundUrl, type HostedHttpClientOptions, } from "./hosted-http-client";
|
|
24
27
|
export { OAuthDiscoveryError, OAuthAuthorizationServerMetadataSchema, OAuthClientInformationSchema, OAuthProtectedResourceMetadataSchema, beginDynamicAuthorization, discoverAuthorizationServerMetadata, discoverProtectedResourceMetadata, registerDynamicClient, type BeginDynamicAuthorizationInput, type DiscoveryRequestOptions, type DynamicAuthorizationState, type DynamicAuthorizationStartResult, type DynamicClientMetadata, type OAuthAuthorizationServerMetadata, type OAuthClientInformation, type OAuthProtectedResourceMetadata, type RegisterDynamicClientInput, } from "./oauth-discovery";
|
|
25
28
|
export { OAUTH_POPUP_MESSAGE_TYPE, type OAuthPopupResult, isOAuthPopupResult, } from "./oauth-popup-types";
|
|
26
|
-
export { type Plugin, type PluginSpec, type PluginCtx, type PluginExtensions, type ConfiguredPlugin, type AnyPlugin, type StorageDeps, type StaticSourceDecl, type StaticToolDecl, type StaticToolExecuteContext, type StaticToolHandlerInput, type StaticToolInput, type InvokeToolInput, type SourceLifecycleInput, type SecretListEntry, type Elicit, definePlugin,
|
|
27
|
-
export { type
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
29
|
+
export { type Plugin, type PluginSpec, type PluginCtx, type PluginExtensions, type ConfiguredPlugin, type AnyPlugin, type StorageDeps, type StaticSourceDecl, type StaticToolDecl, type StaticToolSchema, type StaticToolExecuteContext, type StaticToolHandlerInput, type StaticToolInput, type ConfigureSourceHandlerInput, type InvokeToolInput, type SourceLifecycleInput, type SourceConfigureDecl, type SecretListEntry, type Elicit, definePlugin, tool, } from "./plugin";
|
|
30
|
+
export { pluginStorageId, type PluginStorageEntry, type PluginStorageFacade, type PluginStorageKeyInput, type PluginStorageListInput, type PluginStoragePutInput, type PluginStorageScopedKeyInput, } from "./plugin-storage";
|
|
31
|
+
export { type Executor, type ExecutorConfig, type ExecutorDb, type ExecutorDbFactory, type ExecutorDbInput, type OnElicitation, type InvokeOptions, createExecutor, collectTables, } from "./executor";
|
|
32
|
+
export { coreToolsPlugin, type CoreToolsPluginOptions } from "./core-tools";
|
|
33
|
+
export { defineExecutorConfig, type ExecutorCliConfig, type ExecutorPluginsFactory, } from "./config";
|
|
30
34
|
export { hoistDefinitions, collectRefs, reattachDefs, normalizeRefs } from "./schema-refs";
|
|
31
35
|
export { schemaToTypeScriptPreview, schemaToTypeScriptPreviewWithDefs, buildToolTypeScriptPreview, type TypeScriptRenderOptions, type TypeScriptSchemaPreview, } from "./schema-types";
|
|
32
36
|
export { InternalError } from "./api-errors";
|
|
37
|
+
export { ToolResult, isToolResult, type ToolError } from "./tool-result";
|
|
33
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,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
|
|
4
|
-
defineExecutorConfig,
|
|
5
7
|
isSecretBackedRef,
|
|
6
8
|
resolveSecretBackedMap
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MLNVNVRI.js";
|
|
8
10
|
import {
|
|
9
11
|
ElicitationAction,
|
|
10
12
|
ElicitationResponse,
|
|
11
13
|
FormElicitation,
|
|
12
|
-
NoHandlerError,
|
|
13
|
-
PluginNotLoadedError,
|
|
14
|
-
PolicyId,
|
|
15
14
|
RemoveConnectionInput,
|
|
16
15
|
RemoveSecretInput,
|
|
17
16
|
Scope,
|
|
17
|
+
SecretRef,
|
|
18
|
+
SetSecretInput,
|
|
19
|
+
UrlElicitation,
|
|
20
|
+
collectTables,
|
|
21
|
+
createExecutor
|
|
22
|
+
} from "./chunk-BZNIRSMG.js";
|
|
23
|
+
import {
|
|
24
|
+
NoHandlerError,
|
|
25
|
+
PluginNotLoadedError,
|
|
26
|
+
PolicyId,
|
|
18
27
|
ScopeId,
|
|
19
28
|
SecretId,
|
|
20
29
|
SecretNotFoundError,
|
|
21
|
-
SecretRef,
|
|
22
30
|
SecretResolutionError,
|
|
23
|
-
SetSecretInput,
|
|
24
31
|
SourceDetectionResult,
|
|
25
32
|
SourceNotFoundError,
|
|
26
33
|
SourceRemovalNotAllowedError,
|
|
27
34
|
ToolId,
|
|
28
35
|
ToolInvocationError,
|
|
29
36
|
ToolNotFoundError,
|
|
30
|
-
ToolSchema
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
createExecutor,
|
|
34
|
-
makeInMemoryBlobStore
|
|
35
|
-
} from "./chunk-OIJL6F6M.js";
|
|
37
|
+
ToolSchema
|
|
38
|
+
} from "./chunk-ZANQD7E2.js";
|
|
39
|
+
import "./chunk-7D4SUZUM.js";
|
|
36
40
|
|
|
37
41
|
// src/promise-executor.ts
|
|
38
42
|
import { Effect } from "effect";
|
|
39
|
-
import { makeMemoryAdapter } from "@executor-js/storage-core/testing/memory";
|
|
40
43
|
var isPlainObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v) && !(v instanceof Date) && !(v instanceof Promise);
|
|
44
|
+
var isPromiseOnElicitation = (value) => value === "accept-all" || typeof value === "function";
|
|
45
|
+
var toEffectOnElicitation = (handler) => handler === "accept-all" ? "accept-all" : (ctx) => Effect.promise(() => Promise.resolve(handler(ctx)));
|
|
46
|
+
var adaptPromiseInvokeOptions = (value) => {
|
|
47
|
+
if (!isPlainObject(value) || !Object.hasOwn(value, "onElicitation")) return value;
|
|
48
|
+
const onElicitation = value.onElicitation;
|
|
49
|
+
if (onElicitation === void 0 || !isPromiseOnElicitation(onElicitation)) return value;
|
|
50
|
+
return {
|
|
51
|
+
...value,
|
|
52
|
+
onElicitation: toEffectOnElicitation(onElicitation)
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var adaptPromiseArgs = (args) => args.map((arg) => adaptPromiseInvokeOptions(arg));
|
|
41
56
|
var promisifyDeep = (value) => {
|
|
42
57
|
if (typeof value === "function") {
|
|
43
58
|
return ((...args) => {
|
|
44
|
-
const result = value.apply(
|
|
59
|
+
const result = value.apply(
|
|
60
|
+
void 0,
|
|
61
|
+
adaptPromiseArgs(args)
|
|
62
|
+
);
|
|
45
63
|
if (Effect.isEffect(result)) {
|
|
46
64
|
return Effect.runPromise(result);
|
|
47
65
|
}
|
|
@@ -54,7 +72,7 @@ var promisifyDeep = (value) => {
|
|
|
54
72
|
const v = Reflect.get(target, prop, receiver);
|
|
55
73
|
if (typeof v === "function") {
|
|
56
74
|
return (...args) => {
|
|
57
|
-
const result = v.apply(target, args);
|
|
75
|
+
const result = v.apply(target, adaptPromiseArgs(args));
|
|
58
76
|
if (Effect.isEffect(result)) {
|
|
59
77
|
return Effect.runPromise(result);
|
|
60
78
|
}
|
|
@@ -68,7 +86,7 @@ var promisifyDeep = (value) => {
|
|
|
68
86
|
};
|
|
69
87
|
var createExecutor2 = async (config) => {
|
|
70
88
|
const plugins = config?.plugins ?? [];
|
|
71
|
-
const
|
|
89
|
+
const db = typeof config.db === "function" ? await config.db({ tables: collectTables(plugins) }) : config.db;
|
|
72
90
|
const scopes = config.scopes && config.scopes.length > 0 ? config.scopes.map(
|
|
73
91
|
(s, i) => Scope.make({
|
|
74
92
|
id: ScopeId.make(s.id ?? (i === 0 ? "default-scope" : `scope-${i}`)),
|
|
@@ -84,13 +102,18 @@ var createExecutor2 = async (config) => {
|
|
|
84
102
|
];
|
|
85
103
|
const effectConfig = {
|
|
86
104
|
scopes,
|
|
87
|
-
adapter: makeMemoryAdapter({ schema }),
|
|
88
|
-
blobs: makeInMemoryBlobStore(),
|
|
89
105
|
plugins,
|
|
90
|
-
onElicitation: config.onElicitation
|
|
106
|
+
onElicitation: toEffectOnElicitation(config.onElicitation),
|
|
107
|
+
...db ? { db } : {}
|
|
91
108
|
};
|
|
92
109
|
const effectExecutor = await Effect.runPromise(createExecutor(effectConfig));
|
|
93
|
-
|
|
110
|
+
const executor = promisifyDeep(effectExecutor);
|
|
111
|
+
return {
|
|
112
|
+
...executor,
|
|
113
|
+
close: async () => {
|
|
114
|
+
await Effect.runPromise(effectExecutor.close());
|
|
115
|
+
}
|
|
116
|
+
};
|
|
94
117
|
};
|
|
95
118
|
export {
|
|
96
119
|
ElicitationAction,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/promise-executor.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/sdk/promise — thin Promise façade over the Effect SDK.\n//\n// Consumer goal: use executors + plugins without touching Effect. The\n// façade wraps `createExecutor` so it returns a Promise, and proxies\n// every method on the returned executor to unwrap its Effect into a\n// Promise. Plugin factories are Effect-native but consumers never see\n// that — the proxy flattens plugin extension methods too.\n//\n// Not a goal: authoring plugins in Promise style. The plugin model\n// (storage, schema, staticSources, Effect ctx) is Effect-only. Bring\n// your own `@executor-js/plugin-*` from the Effect side.\n// ---------------------------------------------------------------------------\n\nimport { Brand, Effect } from \"effect\";\n\nimport { makeMemoryAdapter } from \"@executor-js/storage-core/testing/memory\";\n\nimport { makeInMemoryBlobStore } from \"./blob\";\nimport {\n createExecutor as createEffectExecutor,\n collectSchemas,\n type Executor as EffectExecutor,\n type OnElicitation,\n} from \"./executor\";\nimport { ScopeId } from \"./ids\";\nimport type { AnyPlugin } from \"./plugin\";\nimport { Scope } from \"./scope\";\n\n// ---------------------------------------------------------------------------\n// Types\n//\n// Promise consumers shouldn't need to construct Effect `Brand`s to call into\n// the executor — branded ids (`SecretId`, `ScopeId`, `ToolId`, `PolicyId`,\n// `ConnectionId`) are typed as `string & Brand<...>` on the Effect side, but\n// at runtime they're plain strings. `Unbrand` strips brand tags from\n// parameter types (recursively, so it walks into object fields like\n// `secrets.set({ id, scope })`) so consumers can pass plain strings. Return\n// types are passed through unchanged — caller code that reads `.id` etc.\n// off a returned ref still gets the branded type for use as an opaque token.\n// ---------------------------------------------------------------------------\n\ntype Unbrand<T> =\n T extends Brand.Brand<string>\n ? string\n : T extends readonly (infer U)[]\n ? readonly Unbrand<U>[]\n : T extends ReadonlyMap<infer K, infer V>\n ? ReadonlyMap<Unbrand<K>, Unbrand<V>>\n : T extends ReadonlySet<infer U>\n ? ReadonlySet<Unbrand<U>>\n : T extends Date\n ? T\n : T extends (...args: infer A) => infer R\n ? (...args: { [I in keyof A]: Unbrand<A[I]> }) => Unbrand<R>\n : T extends object\n ? { readonly [K in keyof T]: Unbrand<T[K]> }\n : T;\n\nexport type Promisified<T> = T extends (...args: infer A) => Effect.Effect<infer R, infer _E>\n ? (...args: { [I in keyof A]: Unbrand<A[I]> }) => Promise<R>\n : T extends readonly unknown[]\n ? T\n : T extends object\n ? { readonly [K in keyof T]: Promisified<T[K]> }\n : T;\n\nexport type Executor<TPlugins extends readonly AnyPlugin[] = []> = Promisified<\n EffectExecutor<TPlugins>\n>;\n\nexport interface ExecutorConfig<TPlugins extends readonly AnyPlugin[] = []> {\n /**\n * Precedence-ordered scope stack (innermost first). Optional — defaults\n * to a single-element stack with id \"default-scope\". Pass an array of\n * `{ id, name }` partials to build a multi-scope executor.\n */\n readonly scopes?: readonly { readonly id?: string; readonly name?: string }[];\n readonly plugins?: TPlugins;\n /**\n * How to respond when a tool requests user input mid-invocation. Pass\n * `\"accept-all\"` for tests / non-interactive hosts, or a handler\n * `(ctx) => Promise<ElicitationResponse>` for interactive ones.\n * Required at construction so per-invoke calls don't have to thread\n * an options arg.\n */\n readonly onElicitation: OnElicitation;\n}\n\n// ---------------------------------------------------------------------------\n// Promisify proxy — walks nested objects, converts Effect-returning methods\n// into Promise-returning methods. Non-Effect return values pass through.\n// ---------------------------------------------------------------------------\n\nconst isPlainObject = (v: unknown): v is Record<string | symbol, unknown> =>\n v !== null &&\n typeof v === \"object\" &&\n !Array.isArray(v) &&\n !(v instanceof Date) &&\n !(v instanceof Promise);\n\nconst promisifyDeep = <T>(value: T): Promisified<T> => {\n if (typeof value === \"function\") {\n return ((...args: unknown[]) => {\n const result = (value as (...a: unknown[]) => unknown).apply(undefined, args);\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as Effect.Effect<unknown, unknown>);\n }\n return result;\n }) as Promisified<T>;\n }\n\n if (!isPlainObject(value)) return value as Promisified<T>;\n\n return new Proxy(value, {\n get(target, prop, receiver) {\n const v = Reflect.get(target, prop, receiver);\n if (typeof v === \"function\") {\n return (...args: unknown[]) => {\n const result = (v as (...a: unknown[]) => unknown).apply(target, args);\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as Effect.Effect<unknown, unknown>);\n }\n return result;\n };\n }\n if (isPlainObject(v)) return promisifyDeep(v);\n return v;\n },\n }) as Promisified<T>;\n};\n\n// ---------------------------------------------------------------------------\n// createExecutor — Promise wrapper over the Effect createExecutor.\n// Defaults to an in-memory adapter + blob store, so a consumer can\n// construct an executor with just `{ plugins: [...] }`.\n// ---------------------------------------------------------------------------\n\nexport const createExecutor = async <const TPlugins extends readonly AnyPlugin[] = []>(\n config: ExecutorConfig<TPlugins>,\n): Promise<Executor<TPlugins>> => {\n const plugins = (config?.plugins ?? []) as TPlugins;\n const schema = collectSchemas(plugins);\n\n const scopes =\n config.scopes && config.scopes.length > 0\n ? config.scopes.map((s, i) =>\n Scope.make({\n id: ScopeId.make(s.id ?? (i === 0 ? \"default-scope\" : `scope-${i}`)),\n name: s.name ?? (i === 0 ? \"default\" : `scope-${i}`),\n createdAt: new Date(),\n }),\n )\n : [\n Scope.make({\n id: ScopeId.make(\"default-scope\"),\n name: \"default\",\n createdAt: new Date(),\n }),\n ];\n\n const effectConfig = {\n scopes,\n adapter: makeMemoryAdapter({ schema }),\n blobs: makeInMemoryBlobStore(),\n plugins,\n onElicitation: config.onElicitation,\n };\n\n // The SDK has no observability requirement; storage failures surface\n // as raw `StorageError` / `UniqueViolationError` in the typed channel.\n // `Effect.runPromise` turns them into Promise rejections — consumers\n // get the tagged error as the rejected value. See\n // notes/promise-sdk-typed-errors.md for the planned `runPromiseExit`\n // rewrite that exposes the full error union to consumers.\n const effectExecutor = await Effect.runPromise(createEffectExecutor(effectConfig));\n\n return promisifyDeep(effectExecutor) as Executor<TPlugins>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAgB,cAAc;AAE9B,SAAS,yBAAyB;AA8ElC,IAAM,gBAAgB,CAAC,MACrB,MAAM,QACN,OAAO,MAAM,YACb,CAAC,MAAM,QAAQ,CAAC,KAChB,EAAE,aAAa,SACf,EAAE,aAAa;AAEjB,IAAM,gBAAgB,CAAI,UAA6B;AACrD,MAAI,OAAO,UAAU,YAAY;AAC/B,YAAQ,IAAI,SAAoB;AAC9B,YAAM,SAAU,MAAuC,MAAM,QAAW,IAAI;AAC5E,UAAI,OAAO,SAAS,MAAM,GAAG;AAC3B,eAAO,OAAO,WAAW,MAAyC;AAAA,MACpE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,KAAK,EAAG,QAAO;AAElC,SAAO,IAAI,MAAM,OAAO;AAAA,IACtB,IAAI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"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/sdk/promise — thin Promise façade over the Effect SDK.\n//\n// Consumer goal: use executors + plugins without touching Effect. The\n// façade wraps `createExecutor` so it returns a Promise, and proxies\n// every method on the returned executor to unwrap its Effect into a\n// Promise. Plugin factories are Effect-native but consumers never see\n// that — the proxy flattens plugin extension methods too.\n//\n// Not a goal: authoring plugins in Promise style. The plugin model\n// (storage, schema, staticSources, Effect ctx) is Effect-only. Bring\n// your own `@executor-js/plugin-*` from the Effect side.\n// ---------------------------------------------------------------------------\n\nimport { Brand, Effect } from \"effect\";\n\nimport {\n collectTables,\n createExecutor as createEffectExecutor,\n type Executor as EffectExecutor,\n type InvokeOptions as EffectInvokeOptions,\n type OnElicitation,\n} from \"./executor\";\nimport type { ElicitationContext, ElicitationResponse } from \"./elicitation\";\nimport type { FumaDb, FumaTables } from \"./fuma-runtime\";\nimport { ScopeId } from \"./ids\";\nimport type { AnyPlugin } from \"./plugin\";\nimport { Scope } from \"./scope\";\n\n// ---------------------------------------------------------------------------\n// Types\n//\n// Promise consumers shouldn't need to construct Effect `Brand`s to call into\n// the executor — branded ids (`SecretId`, `ScopeId`, `ToolId`, `PolicyId`,\n// `ConnectionId`) are typed as `string & Brand<...>` on the Effect side, but\n// at runtime they're plain strings. `Unbrand` strips brand tags from\n// parameter types (recursively, so it walks into object fields like\n// `secrets.set({ id, scope })`) so consumers can pass plain strings. Return\n// types are passed through unchanged — caller code that reads `.id` etc.\n// off a returned ref still gets the branded type for use as an opaque token.\n// ---------------------------------------------------------------------------\n\ntype Unbrand<T> =\n T extends Brand.Brand<string>\n ? string\n : T extends readonly (infer U)[]\n ? readonly Unbrand<U>[]\n : T extends ReadonlyMap<infer K, infer V>\n ? ReadonlyMap<Unbrand<K>, Unbrand<V>>\n : T extends ReadonlySet<infer U>\n ? ReadonlySet<Unbrand<U>>\n : T extends Date\n ? T\n : T extends (...args: infer A) => infer R\n ? (...args: { [I in keyof A]: Unbrand<A[I]> }) => Unbrand<R>\n : T extends object\n ? { readonly [K in keyof T]: Unbrand<T[K]> }\n : T;\n\nexport type PromiseOnElicitation =\n | \"accept-all\"\n | ((ctx: Unbrand<ElicitationContext>) => ElicitationResponse | Promise<ElicitationResponse>);\n\nexport interface PromiseInvokeOptions {\n readonly onElicitation?: PromiseOnElicitation;\n}\n\ntype PromisifiedArg<T> = T extends EffectInvokeOptions | undefined\n ? PromiseInvokeOptions | undefined\n : Unbrand<T>;\n\ntype PromisifiedArgs<TArgs extends readonly unknown[]> = {\n [I in keyof TArgs]: PromisifiedArg<TArgs[I]>;\n};\n\nexport type Promisified<T> = T extends (...args: infer A) => Effect.Effect<infer R, infer _E>\n ? (...args: PromisifiedArgs<A>) => Promise<R>\n : T extends readonly unknown[]\n ? T\n : T extends object\n ? { readonly [K in keyof T]: Promisified<T[K]> }\n : T;\n\nexport type Executor<TPlugins extends readonly AnyPlugin[] = readonly []> = Promisified<\n EffectExecutor<TPlugins>\n>;\n\nexport interface ExecutorConfig<TPlugins extends readonly AnyPlugin[] = readonly []> {\n /**\n * Precedence-ordered scope stack (innermost first). Optional — defaults\n * to a single-element stack with id \"default-scope\". Pass an array of\n * `{ id, name }` partials to build a multi-scope executor.\n */\n readonly scopes?: readonly { readonly id?: string; readonly name?: string }[];\n readonly plugins?: TPlugins;\n /**\n * FumaDB ORM handle, or a factory that receives the full Executor table\n * map after plugins have been applied. Public consumers usually want the\n * factory form so `collectTables(plugins)` stays inside `createExecutor`.\n */\n readonly db?:\n | FumaDb\n | { readonly db: FumaDb; readonly close?: () => Promise<void> | void }\n | ((config: {\n readonly tables: FumaTables;\n }) =>\n | FumaDb\n | { readonly db: FumaDb; readonly close?: () => Promise<void> | void }\n | Promise<FumaDb | { readonly db: FumaDb; readonly close?: () => Promise<void> | void }>);\n /**\n * How to respond when a tool requests user input mid-invocation. Pass\n * `\"accept-all\"` for tests / non-interactive hosts, or a handler\n * `(ctx) => Promise<ElicitationResponse>` for interactive ones.\n * Required at construction so per-invoke calls don't have to thread\n * an options arg.\n */\n readonly onElicitation: PromiseOnElicitation;\n}\n\n// ---------------------------------------------------------------------------\n// Promisify proxy — walks nested objects, converts Effect-returning methods\n// into Promise-returning methods. Non-Effect return values pass through.\n// ---------------------------------------------------------------------------\n\nconst isPlainObject = (v: unknown): v is Record<string | symbol, unknown> =>\n v !== null &&\n typeof v === \"object\" &&\n !Array.isArray(v) &&\n !(v instanceof Date) &&\n !(v instanceof Promise);\n\nconst isPromiseOnElicitation = (value: unknown): value is PromiseOnElicitation =>\n value === \"accept-all\" || typeof value === \"function\";\n\nconst toEffectOnElicitation = (handler: PromiseOnElicitation): OnElicitation =>\n handler === \"accept-all\"\n ? \"accept-all\"\n : (ctx) => Effect.promise(() => Promise.resolve(handler(ctx)));\n\nconst adaptPromiseInvokeOptions = (value: unknown): unknown => {\n if (!isPlainObject(value) || !Object.hasOwn(value, \"onElicitation\")) return value;\n const onElicitation = value.onElicitation;\n if (onElicitation === undefined || !isPromiseOnElicitation(onElicitation)) return value;\n return {\n ...value,\n onElicitation: toEffectOnElicitation(onElicitation),\n };\n};\n\nconst adaptPromiseArgs = (args: readonly unknown[]): unknown[] =>\n args.map((arg) => adaptPromiseInvokeOptions(arg));\n\nconst promisifyDeep = <T>(value: T): Promisified<T> => {\n if (typeof value === \"function\") {\n return ((...args: unknown[]) => {\n const result = (value as (...a: unknown[]) => unknown).apply(\n undefined,\n adaptPromiseArgs(args),\n );\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as Effect.Effect<unknown, unknown>);\n }\n return result;\n }) as Promisified<T>;\n }\n\n if (!isPlainObject(value)) return value as Promisified<T>;\n\n return new Proxy(value, {\n get(target, prop, receiver) {\n const v = Reflect.get(target, prop, receiver);\n if (typeof v === \"function\") {\n return (...args: unknown[]) => {\n const result = (v as (...a: unknown[]) => unknown).apply(target, adaptPromiseArgs(args));\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as Effect.Effect<unknown, unknown>);\n }\n return result;\n };\n }\n if (isPlainObject(v)) return promisifyDeep(v);\n return v;\n },\n }) as Promisified<T>;\n};\n\n// ---------------------------------------------------------------------------\n// createExecutor — Promise wrapper over the Effect createExecutor.\n// ---------------------------------------------------------------------------\n\nexport const createExecutor = async <const TPlugins extends readonly AnyPlugin[] = readonly []>(\n config: ExecutorConfig<TPlugins>,\n): Promise<Executor<TPlugins>> => {\n const plugins = (config?.plugins ?? []) as TPlugins;\n const db =\n typeof config.db === \"function\"\n ? await config.db({ tables: collectTables(plugins) })\n : config.db;\n\n const scopes =\n config.scopes && config.scopes.length > 0\n ? config.scopes.map((s, i) =>\n Scope.make({\n id: ScopeId.make(s.id ?? (i === 0 ? \"default-scope\" : `scope-${i}`)),\n name: s.name ?? (i === 0 ? \"default\" : `scope-${i}`),\n createdAt: new Date(),\n }),\n )\n : [\n Scope.make({\n id: ScopeId.make(\"default-scope\"),\n name: \"default\",\n createdAt: new Date(),\n }),\n ];\n\n const effectConfig = {\n scopes,\n plugins,\n onElicitation: toEffectOnElicitation(config.onElicitation),\n ...(db ? { db } : {}),\n };\n\n // The SDK has no observability requirement; storage failures surface\n // as raw `StorageError` / `UniqueViolationError` in the typed channel.\n // `Effect.runPromise` turns them into Promise rejections — consumers\n // get the tagged error as the rejected value. See\n // notes/promise-sdk-typed-errors.md for the planned `runPromiseExit`\n // rewrite that exposes the full error union to consumers.\n const effectExecutor = await Effect.runPromise(createEffectExecutor(effectConfig));\n\n const executor = promisifyDeep(effectExecutor) as Executor<TPlugins>;\n return {\n ...executor,\n close: async () => {\n await Effect.runPromise(effectExecutor.close());\n },\n } as Executor<TPlugins>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAgB,cAAc;AA8G9B,IAAM,gBAAgB,CAAC,MACrB,MAAM,QACN,OAAO,MAAM,YACb,CAAC,MAAM,QAAQ,CAAC,KAChB,EAAE,aAAa,SACf,EAAE,aAAa;AAEjB,IAAM,yBAAyB,CAAC,UAC9B,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C5C,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAMO,IAAMA,kBAAiB,OAC5B,WACgC;AAChC,QAAM,UAAW,QAAQ,WAAW,CAAC;AACrC,QAAM,KACJ,OAAO,OAAO,OAAO,aACjB,MAAM,OAAO,GAAG,EAAE,QAAQ,cAAc,OAAO,EAAE,CAAC,IAClD,OAAO;AAEb,QAAM,SACJ,OAAO,UAAU,OAAO,OAAO,SAAS,IACpC,OAAO,OAAO;AAAA,IAAI,CAAC,GAAG,MACpB,MAAM,KAAK;AAAA,MACT,IAAI,QAAQ,KAAK,EAAE,OAAO,MAAM,IAAI,kBAAkB,SAAS,CAAC,GAAG;AAAA,MACnE,MAAM,EAAE,SAAS,MAAM,IAAI,YAAY,SAAS,CAAC;AAAA,MACjD,WAAW,oBAAI,KAAK;AAAA,IACtB,CAAC;AAAA,EACH,IACA;AAAA,IACE,MAAM,KAAK;AAAA,MACT,IAAI,QAAQ,KAAK,eAAe;AAAA,MAChC,MAAM;AAAA,MACN,WAAW,oBAAI,KAAK;AAAA,IACtB,CAAC;AAAA,EACH;AAEN,QAAM,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA,eAAe,sBAAsB,OAAO,aAAa;AAAA,IACzD,GAAI,KAAK,EAAE,GAAG,IAAI,CAAC;AAAA,EACrB;AAQA,QAAM,iBAAiB,MAAM,OAAO,WAAW,eAAqB,YAAY,CAAC;AAEjF,QAAM,WAAW,cAAc,cAAc;AAC7C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,YAAY;AACjB,YAAM,OAAO,WAAW,eAAe,MAAM,CAAC;AAAA,IAChD;AAAA,EACF;AACF;","names":["createExecutor"]}
|
package/dist/oauth-service.d.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { Effect, Layer } from "effect";
|
|
2
2
|
import { HttpClient } from "effect/unstable/http";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFumaClient, StorageFailure } from "./fuma-runtime";
|
|
4
4
|
import { CreateConnectionInput, type ConnectionProvider, type ConnectionRef } from "./connections";
|
|
5
5
|
import type { ConnectionProviderNotRegisteredError } from "./errors";
|
|
6
|
-
import type { CoreSchema } from "./core-schema";
|
|
7
6
|
import { SetSecretInput, type SecretRef } from "./secrets";
|
|
8
7
|
import { type OAuthService } from "./oauth";
|
|
9
8
|
import { type OAuthEndpointUrlPolicy } from "./oauth-helpers";
|
|
10
|
-
import type { ScopedDBAdapter } from "./scoped-adapter";
|
|
11
9
|
export interface OAuthServiceDeps {
|
|
12
|
-
|
|
13
|
-
* fall through the scope stack; writes stamp the scope the caller
|
|
14
|
-
* named (`tokenScope` on start input). */
|
|
15
|
-
readonly adapter: TypedAdapter<CoreSchema>;
|
|
16
|
-
/** Scoped adapter for opening transactions — the typed one doesn't
|
|
17
|
-
* expose `.transaction` directly. */
|
|
18
|
-
readonly rawAdapter: ScopedDBAdapter;
|
|
10
|
+
readonly fuma: IFumaClient;
|
|
19
11
|
/** Resolves client-id / client-secret refs at start + refresh time.
|
|
20
12
|
* A `null` return means "secret row is gone" and aborts the flow. */
|
|
21
13
|
readonly secretsGet: (id: string) => Effect.Effect<string | null, StorageFailure>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-service.d.ts","sourceRoot":"","sources":["../src/oauth-service.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAY,MAAM,EAAE,KAAK,EAAyB,MAAM,QAAQ,CAAC;AACxE,OAAO,EAAmB,UAAU,EAAqB,MAAM,sBAAsB,CAAC;AAEtF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"oauth-service.d.ts","sourceRoot":"","sources":["../src/oauth-service.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAY,MAAM,EAAE,KAAK,EAAyB,MAAM,QAAQ,CAAC;AACxE,OAAO,EAAmB,UAAU,EAAqB,MAAM,sBAAsB,CAAC;AAEtF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gB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ACrB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;IACrC,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CACrD;AAqCD,eAAO,MAAM,iBAAiB,GAC5B,MAAM,gBAAgB,KACrB;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAA;CAk+BnF,CAAC"}
|
package/dist/oauth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import type { StorageFailure } from "
|
|
2
|
+
import type { StorageFailure } from "./fuma-runtime";
|
|
3
3
|
import { ConnectionId } from "./ids";
|
|
4
4
|
/** RFC 9728 + RFC 8414 + RFC 7591 + PKCE: discover protected-resource
|
|
5
5
|
* metadata, discover the authorization server, dynamically register a
|
|
@@ -28,9 +28,11 @@ export declare const OAuthAuthorizationCodeStrategy: Schema.Struct<{
|
|
|
28
28
|
* an inline string so the value lives at the scope where the caller
|
|
29
29
|
* configured it and shadowing behaves consistently. */
|
|
30
30
|
readonly clientIdSecretId: Schema.String;
|
|
31
|
+
readonly clientIdSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
31
32
|
/** Secret id for `client_secret`. Null for public clients using
|
|
32
33
|
* PKCE without a confidential secret. */
|
|
33
34
|
readonly clientSecretSecretId: Schema.NullOr<Schema.String>;
|
|
35
|
+
readonly clientSecretSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
34
36
|
readonly scopes: Schema.$Array<Schema.String>;
|
|
35
37
|
/** Separator between scopes. RFC 6749 says space; some providers
|
|
36
38
|
* (GitHub classic) use comma. */
|
|
@@ -51,7 +53,9 @@ export declare const OAuthClientCredentialsStrategy: Schema.Struct<{
|
|
|
51
53
|
readonly kind: Schema.Literal<"client-credentials">;
|
|
52
54
|
readonly tokenEndpoint: Schema.String;
|
|
53
55
|
readonly clientIdSecretId: Schema.String;
|
|
56
|
+
readonly clientIdSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
54
57
|
readonly clientSecretSecretId: Schema.String;
|
|
58
|
+
readonly clientSecretSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
55
59
|
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
56
60
|
readonly scopeSeparator: Schema.optional<Schema.String>;
|
|
57
61
|
readonly clientAuth: Schema.optional<Schema.Literals<readonly ["body", "basic"]>>;
|
|
@@ -77,9 +81,11 @@ export declare const OAuthStrategy: Schema.Union<readonly [Schema.Struct<{
|
|
|
77
81
|
* an inline string so the value lives at the scope where the caller
|
|
78
82
|
* configured it and shadowing behaves consistently. */
|
|
79
83
|
readonly clientIdSecretId: Schema.String;
|
|
84
|
+
readonly clientIdSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
80
85
|
/** Secret id for `client_secret`. Null for public clients using
|
|
81
86
|
* PKCE without a confidential secret. */
|
|
82
87
|
readonly clientSecretSecretId: Schema.NullOr<Schema.String>;
|
|
88
|
+
readonly clientSecretSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
83
89
|
readonly scopes: Schema.$Array<Schema.String>;
|
|
84
90
|
/** Separator between scopes. RFC 6749 says space; some providers
|
|
85
91
|
* (GitHub classic) use comma. */
|
|
@@ -94,7 +100,9 @@ export declare const OAuthStrategy: Schema.Union<readonly [Schema.Struct<{
|
|
|
94
100
|
readonly kind: Schema.Literal<"client-credentials">;
|
|
95
101
|
readonly tokenEndpoint: Schema.String;
|
|
96
102
|
readonly clientIdSecretId: Schema.String;
|
|
103
|
+
readonly clientIdSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
97
104
|
readonly clientSecretSecretId: Schema.String;
|
|
105
|
+
readonly clientSecretSecretScopeId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
98
106
|
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
99
107
|
readonly scopeSeparator: Schema.optional<Schema.String>;
|
|
100
108
|
readonly clientAuth: Schema.optional<Schema.Literals<readonly ["body", "basic"]>>;
|
package/dist/oauth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAWrC;;;yDAGyD;AACzD,eAAO,MAAM,uBAAuB;;IAElC;mDAC+C;;EAE/C,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAC;AAE1E;;;2EAG2E;AAC3E,eAAO,MAAM,8BAA8B;;;;IAIzC;;wEAEoE;;IAEpE;;4DAEwD;;;IAGxD;8CAC0C;;;;IAI1C;sCACkC;;IAElC;mEAC+D;;IAE/D;oEACgE;;EAEhE,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,8BAA8B,CAAC,IAAI,CAAC;AAExF;;;sCAGsC;AACtC,eAAO,MAAM,8BAA8B;;;;;;;;;;EAUzC,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,8BAA8B,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AAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;;;;AAWD,qBAAa,eAAgB,SAAQ,oBAMpC;CAAG;;;IAMA;;sEAEkE;;;;AANtE,qBAAa,eAAgB,SAAQ,oBAWpC;CAAG;;;IAMA;;iDAE6C;;;AANjD,qBAAa,kBAAmB,SAAQ,uBAUvC;CAAG;;;;AAEJ,qBAAa,yBAA0B,SAAQ,8BAM9C;CAAG;AAOJ,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAC7F,QAAQ,CAAC,KAAK,EAAE,CACd,KAAK,EAAE,eAAe,KACnB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,GAAG,cAAc,CAAC,CAAC;IACvE,QAAQ,CAAC,QAAQ,EAAE,CACjB,KAAK,EAAE,kBAAkB,KACtB,MAAM,CAAC,MAAM,CAChB,mBAAmB,EACnB,kBAAkB,GAAG,yBAAyB,GAAG,cAAc,CAChE,CAAC;IACF;0EACsE;IACtE,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;CACjG;AAOD,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AAIpD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { StorageFailure } from "./fuma-runtime";
|
|
3
|
+
import type { ScopeId } from "./ids";
|
|
4
|
+
export interface PluginStorageKeyInput {
|
|
5
|
+
readonly collection: string;
|
|
6
|
+
readonly key: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginStorageScopedKeyInput extends PluginStorageKeyInput {
|
|
9
|
+
readonly scope: ScopeId | string;
|
|
10
|
+
}
|
|
11
|
+
export interface PluginStorageListInput {
|
|
12
|
+
readonly collection: string;
|
|
13
|
+
readonly keyPrefix?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginStoragePutInput extends PluginStorageScopedKeyInput {
|
|
16
|
+
readonly data: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginStorageEntry<T = unknown> {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly scopeId: ScopeId | string;
|
|
21
|
+
readonly pluginId: string;
|
|
22
|
+
readonly collection: string;
|
|
23
|
+
readonly key: string;
|
|
24
|
+
readonly data: T;
|
|
25
|
+
readonly createdAt: Date;
|
|
26
|
+
readonly updatedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
export interface PluginStorageFacade {
|
|
29
|
+
readonly get: <T = unknown>(input: PluginStorageKeyInput) => Effect.Effect<PluginStorageEntry<T> | null, StorageFailure>;
|
|
30
|
+
readonly getAtScope: <T = unknown>(input: PluginStorageScopedKeyInput) => Effect.Effect<PluginStorageEntry<T> | null, StorageFailure>;
|
|
31
|
+
readonly list: <T = unknown>(input: PluginStorageListInput) => Effect.Effect<readonly PluginStorageEntry<T>[], StorageFailure>;
|
|
32
|
+
readonly put: <T = unknown>(input: PluginStoragePutInput) => Effect.Effect<PluginStorageEntry<T>, StorageFailure>;
|
|
33
|
+
readonly remove: (input: PluginStorageScopedKeyInput) => Effect.Effect<void, StorageFailure>;
|
|
34
|
+
}
|
|
35
|
+
export declare const pluginStorageId: (input: {
|
|
36
|
+
readonly pluginId: string;
|
|
37
|
+
readonly collection: string;
|
|
38
|
+
readonly key: string;
|
|
39
|
+
}) => string;
|
|
40
|
+
//# sourceMappingURL=plugin-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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