@executor-js/sdk 0.1.0 → 0.2.0
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/README.md +21 -29
- package/dist/api-errors.d.ts +10 -0
- package/dist/api-errors.d.ts.map +1 -0
- package/dist/blob.d.ts.map +1 -1
- package/dist/chunk-6SQWMOM4.js +51 -0
- package/dist/chunk-6SQWMOM4.js.map +1 -0
- package/dist/chunk-FPV6KONN.js +78 -0
- package/dist/chunk-FPV6KONN.js.map +1 -0
- package/dist/chunk-VLVPSIQ4.js +5532 -0
- package/dist/chunk-VLVPSIQ4.js.map +1 -0
- package/dist/client.d.ts +2 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -18
- package/dist/client.js.map +1 -1
- package/dist/connections.d.ts +7 -0
- package/dist/connections.d.ts.map +1 -1
- package/dist/core-schema.d.ts +83 -3
- package/dist/core-schema.d.ts.map +1 -1
- package/dist/core.js +92 -52
- package/dist/core.js.map +1 -1
- package/dist/credential-bindings.d.ts +173 -0
- package/dist/credential-bindings.d.ts.map +1 -0
- package/dist/credential-bindings.test.d.ts +2 -0
- package/dist/credential-bindings.test.d.ts.map +1 -0
- package/dist/errors.d.ts +27 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/executor.d.ts +47 -13
- package/dist/executor.d.ts.map +1 -1
- package/dist/hosted-http-client.d.ts +17 -0
- package/dist/hosted-http-client.d.ts.map +1 -0
- package/dist/hosted-http-client.test.d.ts +2 -0
- package/dist/hosted-http-client.test.d.ts.map +1 -0
- package/dist/ids.d.ts +2 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -18
- package/dist/index.js.map +1 -1
- package/dist/oauth-discovery.d.ts +19 -4
- package/dist/oauth-discovery.d.ts.map +1 -1
- package/dist/oauth-helpers.d.ts +21 -0
- package/dist/oauth-helpers.d.ts.map +1 -1
- package/dist/oauth-popup-types.d.ts.map +1 -1
- package/dist/oauth-service.d.ts +16 -5
- package/dist/oauth-service.d.ts.map +1 -1
- package/dist/oauth.d.ts +19 -16
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oxlint-plugin-executor.test.d.ts +2 -0
- package/dist/oxlint-plugin-executor.test.d.ts.map +1 -0
- package/dist/plugin.d.ts +59 -14
- package/dist/plugin.d.ts.map +1 -1
- package/dist/policies.d.ts +10 -15
- package/dist/policies.d.ts.map +1 -1
- package/dist/promise-executor.d.ts.map +1 -1
- package/dist/promise.d.ts +5 -3
- package/dist/promise.d.ts.map +1 -1
- package/dist/schema-types.d.ts.map +1 -1
- package/dist/scoped-adapter.d.ts +17 -2
- package/dist/scoped-adapter.d.ts.map +1 -1
- package/dist/secrets.d.ts +12 -0
- package/dist/secrets.d.ts.map +1 -1
- package/dist/test-config.d.ts +10 -0
- package/dist/test-config.d.ts.map +1 -0
- package/dist/testing.d.ts +30 -8
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +56 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +11 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/usage-visibility.test.d.ts +2 -0
- package/dist/usage-visibility.test.d.ts.map +1 -0
- package/dist/usages.d.ts +20 -0
- package/dist/usages.d.ts.map +1 -0
- package/package.json +25 -14
- package/dist/chunk-2WV7VSNL.js +0 -4440
- package/dist/chunk-2WV7VSNL.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"
|
|
|
6
6
|
export * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
7
7
|
export * as Atom from "effect/unstable/reactivity/Atom";
|
|
8
8
|
export * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi";
|
|
9
|
-
export { useAtomValue, useAtomSet, useAtomMount, useAtomRefresh
|
|
9
|
+
export { useAtomValue, useAtomSet, useAtomMount, useAtomRefresh } from "@effect/atom-react";
|
|
10
10
|
export interface PageDecl {
|
|
11
11
|
/** Path relative to the plugin's mount point, e.g. `/`, `/edit/$id`. */
|
|
12
12
|
readonly path: string;
|
|
@@ -66,9 +66,6 @@ export interface SourcePlugin {
|
|
|
66
66
|
readonly variant?: "badge" | "panel";
|
|
67
67
|
readonly onAction?: () => void;
|
|
68
68
|
}>;
|
|
69
|
-
readonly signIn?: ComponentType<{
|
|
70
|
-
readonly sourceId: string;
|
|
71
|
-
}>;
|
|
72
69
|
readonly presets?: readonly SourcePreset[];
|
|
73
70
|
/** Trigger early download of the plugin's lazy component chunks (add/edit/etc.).
|
|
74
71
|
* Call from the host on intent (hover/focus) so the chunks land before the
|
|
@@ -107,7 +104,7 @@ export interface CreatePluginAtomClientOptions {
|
|
|
107
104
|
/** Override the base URL. Defaults to `/api` (host strips this prefix
|
|
108
105
|
* when forwarding to the Effect handler) — same convention as the
|
|
109
106
|
* core `ExecutorApiClient`. */
|
|
110
|
-
readonly baseUrl?: string;
|
|
107
|
+
readonly baseUrl?: string | (() => string);
|
|
111
108
|
}
|
|
112
109
|
/**
|
|
113
110
|
* Build a typed reactive client for a plugin's HttpApiGroup.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,aAAa,EAIb,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAC;AAOtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAC;AACtE,OAAO,K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;GAUG;AACH,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,EAEzE,OAAO,CAAC,EACR,UAAS,6BAAkC,kGAgB5C,CAAC;AA0BF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,4BAA4B,GAClC,UAAU,CAAC,OAAO,aAAa,CAAC,CAkBlC;AAWD,qDAAqD;AACrD,eAAO,MAAM,gBAAgB,QAAO,SAAS,gBAAgB,EAClB,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,QAAO,SAAS,YAAY,EACR,CAAC;AAElD,qFAAqF;AACrF,eAAO,MAAM,wBAAwB,QAAO,SAAS,oBAAoB,EACR,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -7,32 +7,28 @@ import {
|
|
|
7
7
|
useMemo
|
|
8
8
|
} from "react";
|
|
9
9
|
import { HttpApi } from "effect/unstable/httpapi";
|
|
10
|
-
import { FetchHttpClient } from "effect/unstable/http";
|
|
10
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
11
11
|
import * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi";
|
|
12
12
|
import { Schema } from "effect";
|
|
13
13
|
import { HttpApi as HttpApi2, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
14
14
|
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
15
15
|
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
16
16
|
import * as AtomHttpApi2 from "effect/unstable/reactivity/AtomHttpApi";
|
|
17
|
-
import {
|
|
18
|
-
useAtomValue,
|
|
19
|
-
useAtomSet,
|
|
20
|
-
useAtomMount,
|
|
21
|
-
useAtomRefresh
|
|
22
|
-
} from "@effect/atom-react";
|
|
17
|
+
import { useAtomValue, useAtomSet, useAtomMount, useAtomRefresh } from "@effect/atom-react";
|
|
23
18
|
var defineClientPlugin = (spec) => spec;
|
|
24
19
|
var createPluginAtomClient = (group, options = {}) => {
|
|
25
20
|
const { baseUrl = "/api" } = options;
|
|
26
21
|
const pluginId = group.identifier;
|
|
27
22
|
const bundle = HttpApi.make(`plugin-${pluginId}`).add(group);
|
|
28
|
-
return AtomHttpApi.Service()(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
return AtomHttpApi.Service()(`Plugin_${pluginId}Client`, {
|
|
24
|
+
api: bundle,
|
|
25
|
+
httpClient: FetchHttpClient.layer,
|
|
26
|
+
...typeof baseUrl === "function" ? {
|
|
27
|
+
transformClient: HttpClient.mapRequest(
|
|
28
|
+
(request) => HttpClientRequest.prependUrl(request, baseUrl())
|
|
29
|
+
)
|
|
30
|
+
} : { baseUrl }
|
|
31
|
+
});
|
|
36
32
|
};
|
|
37
33
|
var ExecutorPluginsContext = createContext(null);
|
|
38
34
|
ExecutorPluginsContext.displayName = "ExecutorPluginsContext";
|
|
@@ -56,9 +52,7 @@ function ExecutorPluginsProvider(props) {
|
|
|
56
52
|
var usePluginsCtx = (hookName) => {
|
|
57
53
|
const ctx = useContext(ExecutorPluginsContext);
|
|
58
54
|
if (!ctx) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
`${hookName} must be called inside an <ExecutorPluginsProvider>.`
|
|
61
|
-
);
|
|
55
|
+
throw new Error(`${hookName} must be called inside an <ExecutorPluginsProvider>.`);
|
|
62
56
|
}
|
|
63
57
|
return ctx;
|
|
64
58
|
};
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/sdk/client — frontend half of the plugin SDK.\n//\n// Plugins import from this entry to register pages/widgets and consume\n// their own typed reactive client. Server bundles must NOT import this\n// module — it pulls in React + @effect/atom-react. Plugin packages should\n// keep React/atom imports inside `./client.tsx` and Effect/Node imports\n// inside `./server.ts`; shared schema definitions go in `./shared.ts` and\n// can be imported from both halves.\n// ---------------------------------------------------------------------------\n\nimport {\n createContext,\n createElement,\n useContext,\n useEffect,\n useMemo,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { HttpApi } from \"effect/unstable/httpapi\";\nimport type { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { FetchHttpClient } from \"effect/unstable/http\";\nimport * as AtomHttpApi from \"effect/unstable/reactivity/AtomHttpApi\";\n\n// ---------------------------------------------------------------------------\n// Re-exports — the curated set of primitives a plugin author needs to\n// build a typed reactive UI without reaching into `effect/*` directly.\n// ---------------------------------------------------------------------------\n\nexport { Schema } from \"effect\";\nexport { HttpApi, HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\n\nexport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nexport * as Atom from \"effect/unstable/reactivity/Atom\";\nexport * as AtomHttpApi from \"effect/unstable/reactivity/AtomHttpApi\";\n\nexport {\n useAtomValue,\n useAtomSet,\n useAtomMount,\n useAtomRefresh,\n} from \"@effect/atom-react\";\n\n// ---------------------------------------------------------------------------\n// defineClientPlugin — declarative spec for the frontend half of a plugin.\n//\n// Mirror of `definePlugin` on the server, but everything here is React /\n// browser-only. The host treats the value as data: collects routes,\n// widgets, and slot components from every loaded plugin and mounts them\n// alongside the host's own UI.\n// ---------------------------------------------------------------------------\n\nexport interface PageDecl {\n /** Path relative to the plugin's mount point, e.g. `/`, `/edit/$id`. */\n readonly path: string;\n readonly component: ComponentType;\n /** Optional sidebar nav metadata — the host renders these alongside its\n * own nav links. Omit to register a page without a nav entry. */\n readonly nav?: {\n readonly label: string;\n readonly section?: string;\n };\n}\n\nexport interface WidgetProps {\n readonly scopeId?: string;\n}\n\nexport interface WidgetDecl {\n readonly id: string;\n readonly component: ComponentType<WidgetProps>;\n readonly size?: \"half\" | \"full\";\n}\n\n/**\n * Open record of host-defined slot components a plugin can fill. Slot\n * names are part of the host UI contract — plugins opt in by registering\n * a component for the slot they care about. Adding a slot is a host-side\n * change; plugin authors don't define new slots.\n */\nexport type SlotComponent = ComponentType<Record<string, unknown>>;\n\n// ---------------------------------------------------------------------------\n// SourcePlugin / SourcePreset — UI contract for plugins that expose\n// \"sources\" (OpenAPI specs, MCP servers, GraphQL endpoints, etc.). The\n// host owns the source list / detail chrome; the plugin owns the\n// add-flow, edit form, and (optional) summary + sign-in buttons.\n//\n// Lives here, not in `@executor-js/react`, so it's part of the plugin\n// contract: a plugin's `./client` entry assembles its `sourcePlugin`\n// alongside `pages`/`widgets`, and the host derives the union list\n// from `virtual:executor/plugins-client`.\n// ---------------------------------------------------------------------------\n\nexport interface SourcePreset {\n /** Unique id (e.g. \"stripe\", \"github-graphql\"). */\n readonly id: string;\n readonly name: string;\n readonly summary: string;\n /** URL passed as `initialUrl` to the add form. Omit for presets that\n * don't use a URL (e.g. stdio MCP presets). */\n readonly url?: string;\n /** Optional icon URL (favicon, logo). */\n readonly icon?: string;\n /** Shown in the top-level grid on the sources page when true. */\n readonly featured?: boolean;\n}\n\nexport interface SourcePlugin {\n /** Unique key matching the SDK plugin id (e.g. \"openapi\"). */\n readonly key: string;\n readonly label: string;\n readonly add: ComponentType<{\n readonly onComplete: () => void;\n readonly onCancel: () => void;\n readonly initialUrl?: string;\n readonly initialPreset?: string;\n readonly initialNamespace?: string;\n }>;\n readonly edit: ComponentType<{\n readonly sourceId: string;\n readonly onSave: () => void;\n }>;\n readonly summary?: ComponentType<{\n readonly sourceId: string;\n readonly variant?: \"badge\" | \"panel\";\n readonly onAction?: () => void;\n }>;\n readonly signIn?: ComponentType<{\n readonly sourceId: string;\n }>;\n readonly presets?: readonly SourcePreset[];\n /** Trigger early download of the plugin's lazy component chunks (add/edit/etc.).\n * Call from the host on intent (hover/focus) so the chunks land before the\n * user navigates into the add page. Idempotent. */\n readonly preload?: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// SecretProviderPlugin — UI contract for plugins that contribute secret\n// providers (1Password, WorkOS Vault, etc.). The host owns the secrets\n// page chrome; the plugin owns the settings card rendered inside.\n// ---------------------------------------------------------------------------\n\nexport interface SecretProviderPlugin {\n /** Unique key matching the SDK plugin id (e.g. \"onepassword\"). */\n readonly key: string;\n readonly label: string;\n readonly settings: ComponentType<Record<string, never>>;\n}\n\nexport interface ClientPluginSpec<TId extends string = string> {\n readonly id: TId;\n readonly pages?: readonly PageDecl[];\n readonly widgets?: readonly WidgetDecl[];\n readonly slots?: Record<string, SlotComponent>;\n /** Source plugin contribution — populated by plugins that expose\n * `kind` rows in the core `source` table (openapi, mcp, graphql,\n * google-discovery). The host's sources page derives its provider\n * list from the union of every loaded plugin's `sourcePlugin`. */\n readonly sourcePlugin?: SourcePlugin;\n /** Secret provider plugin contribution — populated by plugins that\n * also ship a `secretProviders` (or related) server-side capability\n * AND want to expose a settings card on the host's secrets page. */\n readonly secretProviderPlugin?: SecretProviderPlugin;\n}\n\n/**\n * Identity factory — returns the spec unchanged but pins the inferred\n * literal type of `id` so the host can index plugin records by id with\n * full autocomplete. Plugins export this as their package's default\n * (or named) export from `./client`.\n */\nexport const defineClientPlugin = <const TId extends string>(\n spec: ClientPluginSpec<TId>,\n): ClientPluginSpec<TId> => spec;\n\n// ---------------------------------------------------------------------------\n// createPluginAtomClient — typed reactive HTTP client for one plugin.\n//\n// Wraps the plugin's `HttpApiGroup` in a per-plugin `HttpApi`, then\n// hands back an `AtomHttpApi.Service` keyed to that bundle. The\n// resulting service exposes `.query(\"group\", \"endpoint\", opts)` and\n// `.mutation(\"group\", \"endpoint\")` factories — same shape as the host's\n// existing `ExecutorApiClient` (see packages/react/src/api/client.tsx).\n// Per-endpoint payload/response/error types flow through from the\n// imported group, so plugin client code typechecks without codegen.\n//\n// The plugin id (used for the Service Tag and the synthetic API id) is\n// read from `group.identifier` — the same string the plugin passed to\n// `HttpApiGroup.make(\"foo\")`. No second-source duplication.\n// ---------------------------------------------------------------------------\n\nexport interface CreatePluginAtomClientOptions {\n /** Override the base URL. Defaults to `/api` (host strips this prefix\n * when forwarding to the Effect handler) — same convention as the\n * core `ExecutorApiClient`. */\n readonly baseUrl?: string;\n}\n\n/**\n * Build a typed reactive client for a plugin's HttpApiGroup.\n *\n * const FooClient = createPluginAtomClient(FooApi)\n * export const fooThings = FooClient.query(\"foo\", \"listThings\", { ... })\n * export const fooSync = FooClient.mutation(\"foo\", \"syncThing\")\n *\n * Each plugin gets a private service Tag (`Plugin_<id>Client`) keyed by\n * the group's `identifier`, so multiple plugins coexist in the same\n * React tree without colliding.\n */\nexport const createPluginAtomClient = <\n G extends HttpApiGroup.HttpApiGroup<string, HttpApiEndpoint.Any, boolean>,\n>(\n group: G,\n options: CreatePluginAtomClientOptions = {},\n) => {\n const { baseUrl = \"/api\" } = options;\n const pluginId = group.identifier;\n const bundle = HttpApi.make(`plugin-${pluginId}`).add(group);\n return AtomHttpApi.Service<`Plugin_${G[\"identifier\"]}Client`>()(\n `Plugin_${pluginId}Client`,\n {\n api: bundle,\n httpClient: FetchHttpClient.layer,\n baseUrl,\n },\n );\n};\n\n// ---------------------------------------------------------------------------\n// ExecutorPluginsProvider + hooks — host-level distribution of the loaded\n// `ClientPluginSpec[]` via React context.\n//\n// The host wraps once at the root of its tree (typically reading from\n// `virtual:executor/plugins-client`); pages and shared components consume\n// via the focused hooks (`useSourcePlugins` etc.) so they don't import\n// from any host-app aggregator file. Pages stay portable across hosts —\n// the same component renders against whatever plugin set the surrounding\n// `<ExecutorPluginsProvider>` provides.\n//\n// Hooks throw if no provider is in scope so missing setup fails loudly;\n// matches the pattern of `useScope` / `useAuth` already in the codebase.\n// ---------------------------------------------------------------------------\n\ninterface ExecutorPluginsContextValue {\n readonly plugins: readonly ClientPluginSpec[];\n readonly sourcePlugins: readonly SourcePlugin[];\n readonly secretProviderPlugins: readonly SecretProviderPlugin[];\n}\n\nconst ExecutorPluginsContext = createContext<\n ExecutorPluginsContextValue | null\n>(null);\nExecutorPluginsContext.displayName = \"ExecutorPluginsContext\";\n\nexport interface ExecutorPluginsProviderProps {\n readonly plugins: readonly ClientPluginSpec[];\n readonly children: ReactNode;\n}\n\nexport function ExecutorPluginsProvider(\n props: ExecutorPluginsProviderProps,\n): ReturnType<typeof createElement> {\n const { plugins, children } = props;\n const value = useMemo<ExecutorPluginsContextValue>(\n () => ({\n plugins,\n sourcePlugins: plugins.flatMap((p) => (p.sourcePlugin ? [p.sourcePlugin] : [])),\n secretProviderPlugins: plugins.flatMap((p) =>\n p.secretProviderPlugin ? [p.secretProviderPlugin] : [],\n ),\n }),\n [plugins],\n );\n // Kick off lazy chunk downloads for every source plugin once the host\n // mounts, so navigating into an add/edit page doesn't suspend.\n useEffect(() => {\n for (const sp of value.sourcePlugins) sp.preload?.();\n }, [value.sourcePlugins]);\n return createElement(ExecutorPluginsContext.Provider, { value }, children);\n}\n\nconst usePluginsCtx = (hookName: string): ExecutorPluginsContextValue => {\n const ctx = useContext(ExecutorPluginsContext);\n if (!ctx) {\n throw new Error(\n `${hookName} must be called inside an <ExecutorPluginsProvider>.`,\n );\n }\n return ctx;\n};\n\n/** Full list of loaded `ClientPluginSpec` values. */\nexport const useClientPlugins = (): readonly ClientPluginSpec[] =>\n usePluginsCtx(\"useClientPlugins\").plugins;\n\n/** Source plugins extracted from `clientPlugins[].sourcePlugin`. */\nexport const useSourcePlugins = (): readonly SourcePlugin[] =>\n usePluginsCtx(\"useSourcePlugins\").sourcePlugins;\n\n/** Secret-provider plugins extracted from `clientPlugins[].secretProviderPlugin`. */\nexport const useSecretProviderPlugins = (): readonly SecretProviderPlugin[] =>\n usePluginsCtx(\"useSecretProviderPlugins\").secretProviderPlugins;\n"],"mappings":";AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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kD;AACvE,QAAM,MAAM,WAAW,sBAAsB;AAC7C,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR,GAAG,QAAQ;AAAA,IACb;AAAA,EACF;AACA,SAAO;AACT;AAGO,IAAM,mBAAmB,MAC9B,cAAc,kBAAkB,EAAE;AAG7B,IAAM,mBAAmB,MAC9B,cAAc,kBAAkB,EAAE;AAG7B,IAAM,2BAA2B,MACtC,cAAc,0BAA0B,EAAE;","names":["HttpApi","AtomHttpApi"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/sdk/client — frontend half of the plugin SDK.\n//\n// Plugins import from this entry to register pages/widgets and consume\n// their own typed reactive client. Server bundles must NOT import this\n// module — it pulls in React + @effect/atom-react. Plugin packages should\n// keep React/atom imports inside `./client.tsx` and Effect/Node imports\n// inside `./server.ts`; shared schema definitions go in `./shared.ts` and\n// can be imported from both halves.\n// ---------------------------------------------------------------------------\n\nimport {\n createContext,\n createElement,\n useContext,\n useEffect,\n useMemo,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { HttpApi } from \"effect/unstable/httpapi\";\nimport type { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { FetchHttpClient, HttpClient, HttpClientRequest } from \"effect/unstable/http\";\nimport * as AtomHttpApi from \"effect/unstable/reactivity/AtomHttpApi\";\n\n// ---------------------------------------------------------------------------\n// Re-exports — the curated set of primitives a plugin author needs to\n// build a typed reactive UI without reaching into `effect/*` directly.\n// ---------------------------------------------------------------------------\n\nexport { Schema } from \"effect\";\nexport { HttpApi, HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\n\nexport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nexport * as Atom from \"effect/unstable/reactivity/Atom\";\nexport * as AtomHttpApi from \"effect/unstable/reactivity/AtomHttpApi\";\n\nexport { useAtomValue, useAtomSet, useAtomMount, useAtomRefresh } from \"@effect/atom-react\";\n\n// ---------------------------------------------------------------------------\n// defineClientPlugin — declarative spec for the frontend half of a plugin.\n//\n// Mirror of `definePlugin` on the server, but everything here is React /\n// browser-only. The host treats the value as data: collects routes,\n// widgets, and slot components from every loaded plugin and mounts them\n// alongside the host's own UI.\n// ---------------------------------------------------------------------------\n\nexport interface PageDecl {\n /** Path relative to the plugin's mount point, e.g. `/`, `/edit/$id`. */\n readonly path: string;\n readonly component: ComponentType;\n /** Optional sidebar nav metadata — the host renders these alongside its\n * own nav links. Omit to register a page without a nav entry. */\n readonly nav?: {\n readonly label: string;\n readonly section?: string;\n };\n}\n\nexport interface WidgetProps {\n readonly scopeId?: string;\n}\n\nexport interface WidgetDecl {\n readonly id: string;\n readonly component: ComponentType<WidgetProps>;\n readonly size?: \"half\" | \"full\";\n}\n\n/**\n * Open record of host-defined slot components a plugin can fill. Slot\n * names are part of the host UI contract — plugins opt in by registering\n * a component for the slot they care about. Adding a slot is a host-side\n * change; plugin authors don't define new slots.\n */\nexport type SlotComponent = ComponentType<Record<string, unknown>>;\n\n// ---------------------------------------------------------------------------\n// SourcePlugin / SourcePreset — UI contract for plugins that expose\n// \"sources\" (OpenAPI specs, MCP servers, GraphQL endpoints, etc.). The\n// host owns the source list / detail chrome; the plugin owns the\n// add-flow, edit form, and (optional) summary + sign-in buttons.\n//\n// Lives here, not in `@executor-js/react`, so it's part of the plugin\n// contract: a plugin's `./client` entry assembles its `sourcePlugin`\n// alongside `pages`/`widgets`, and the host derives the union list\n// from `virtual:executor/plugins-client`.\n// ---------------------------------------------------------------------------\n\nexport interface SourcePreset {\n /** Unique id (e.g. \"stripe\", \"github-graphql\"). */\n readonly id: string;\n readonly name: string;\n readonly summary: string;\n /** URL passed as `initialUrl` to the add form. Omit for presets that\n * don't use a URL (e.g. stdio MCP presets). */\n readonly url?: string;\n /** Optional icon URL (favicon, logo). */\n readonly icon?: string;\n /** Shown in the top-level grid on the sources page when true. */\n readonly featured?: boolean;\n}\n\nexport interface SourcePlugin {\n /** Unique key matching the SDK plugin id (e.g. \"openapi\"). */\n readonly key: string;\n readonly label: string;\n readonly add: ComponentType<{\n readonly onComplete: () => void;\n readonly onCancel: () => void;\n readonly initialUrl?: string;\n readonly initialPreset?: string;\n readonly initialNamespace?: string;\n }>;\n readonly edit: ComponentType<{\n readonly sourceId: string;\n readonly onSave: () => void;\n }>;\n readonly summary?: ComponentType<{\n readonly sourceId: string;\n readonly variant?: \"badge\" | \"panel\";\n readonly onAction?: () => void;\n }>;\n readonly presets?: readonly SourcePreset[];\n /** Trigger early download of the plugin's lazy component chunks (add/edit/etc.).\n * Call from the host on intent (hover/focus) so the chunks land before the\n * user navigates into the add page. Idempotent. */\n readonly preload?: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// SecretProviderPlugin — UI contract for plugins that contribute secret\n// providers (1Password, WorkOS Vault, etc.). The host owns the secrets\n// page chrome; the plugin owns the settings card rendered inside.\n// ---------------------------------------------------------------------------\n\nexport interface SecretProviderPlugin {\n /** Unique key matching the SDK plugin id (e.g. \"onepassword\"). */\n readonly key: string;\n readonly label: string;\n readonly settings: ComponentType<Record<string, never>>;\n}\n\nexport interface ClientPluginSpec<TId extends string = string> {\n readonly id: TId;\n readonly pages?: readonly PageDecl[];\n readonly widgets?: readonly WidgetDecl[];\n readonly slots?: Record<string, SlotComponent>;\n /** Source plugin contribution — populated by plugins that expose\n * `kind` rows in the core `source` table (openapi, mcp, graphql,\n * google-discovery). The host's sources page derives its provider\n * list from the union of every loaded plugin's `sourcePlugin`. */\n readonly sourcePlugin?: SourcePlugin;\n /** Secret provider plugin contribution — populated by plugins that\n * also ship a `secretProviders` (or related) server-side capability\n * AND want to expose a settings card on the host's secrets page. */\n readonly secretProviderPlugin?: SecretProviderPlugin;\n}\n\n/**\n * Identity factory — returns the spec unchanged but pins the inferred\n * literal type of `id` so the host can index plugin records by id with\n * full autocomplete. Plugins export this as their package's default\n * (or named) export from `./client`.\n */\nexport const defineClientPlugin = <const TId extends string>(\n spec: ClientPluginSpec<TId>,\n): ClientPluginSpec<TId> => spec;\n\n// ---------------------------------------------------------------------------\n// createPluginAtomClient — typed reactive HTTP client for one plugin.\n//\n// Wraps the plugin's `HttpApiGroup` in a per-plugin `HttpApi`, then\n// hands back an `AtomHttpApi.Service` keyed to that bundle. The\n// resulting service exposes `.query(\"group\", \"endpoint\", opts)` and\n// `.mutation(\"group\", \"endpoint\")` factories — same shape as the host's\n// existing `ExecutorApiClient` (see packages/react/src/api/client.tsx).\n// Per-endpoint payload/response/error types flow through from the\n// imported group, so plugin client code typechecks without codegen.\n//\n// The plugin id (used for the Service Tag and the synthetic API id) is\n// read from `group.identifier` — the same string the plugin passed to\n// `HttpApiGroup.make(\"foo\")`. No second-source duplication.\n// ---------------------------------------------------------------------------\n\nexport interface CreatePluginAtomClientOptions {\n /** Override the base URL. Defaults to `/api` (host strips this prefix\n * when forwarding to the Effect handler) — same convention as the\n * core `ExecutorApiClient`. */\n readonly baseUrl?: string | (() => string);\n}\n\n/**\n * Build a typed reactive client for a plugin's HttpApiGroup.\n *\n * const FooClient = createPluginAtomClient(FooApi)\n * export const fooThings = FooClient.query(\"foo\", \"listThings\", { ... })\n * export const fooSync = FooClient.mutation(\"foo\", \"syncThing\")\n *\n * Each plugin gets a private service Tag (`Plugin_<id>Client`) keyed by\n * the group's `identifier`, so multiple plugins coexist in the same\n * React tree without colliding.\n */\nexport const createPluginAtomClient = <\n G extends HttpApiGroup.HttpApiGroup<string, HttpApiEndpoint.Any, boolean>,\n>(\n group: G,\n options: CreatePluginAtomClientOptions = {},\n) => {\n const { baseUrl = \"/api\" } = options;\n const pluginId = group.identifier;\n const bundle = HttpApi.make(`plugin-${pluginId}`).add(group);\n return AtomHttpApi.Service<`Plugin_${G[\"identifier\"]}Client`>()(`Plugin_${pluginId}Client`, {\n api: bundle,\n httpClient: FetchHttpClient.layer,\n ...(typeof baseUrl === \"function\"\n ? {\n transformClient: HttpClient.mapRequest((request) =>\n HttpClientRequest.prependUrl(request, baseUrl()),\n ),\n }\n : { baseUrl }),\n });\n};\n\n// ---------------------------------------------------------------------------\n// ExecutorPluginsProvider + hooks — host-level distribution of the loaded\n// `ClientPluginSpec[]` via React context.\n//\n// The host wraps once at the root of its tree (typically reading from\n// `virtual:executor/plugins-client`); pages and shared components consume\n// via the focused hooks (`useSourcePlugins` etc.) so they don't import\n// from any host-app aggregator file. Pages stay portable across hosts —\n// the same component renders against whatever plugin set the surrounding\n// `<ExecutorPluginsProvider>` provides.\n//\n// Hooks throw if no provider is in scope so missing setup fails loudly;\n// matches the pattern of `useScope` / `useAuth` already in the codebase.\n// ---------------------------------------------------------------------------\n\ninterface ExecutorPluginsContextValue {\n readonly plugins: readonly ClientPluginSpec[];\n readonly sourcePlugins: readonly SourcePlugin[];\n readonly secretProviderPlugins: readonly SecretProviderPlugin[];\n}\n\nconst ExecutorPluginsContext = createContext<ExecutorPluginsContextValue | null>(null);\nExecutorPluginsContext.displayName = \"ExecutorPluginsContext\";\n\nexport interface ExecutorPluginsProviderProps {\n readonly plugins: readonly ClientPluginSpec[];\n readonly children: ReactNode;\n}\n\nexport function ExecutorPluginsProvider(\n props: ExecutorPluginsProviderProps,\n): ReturnType<typeof createElement> {\n const { plugins, children } = props;\n const value = useMemo<ExecutorPluginsContextValue>(\n () => ({\n plugins,\n sourcePlugins: plugins.flatMap((p) => (p.sourcePlugin ? [p.sourcePlugin] : [])),\n secretProviderPlugins: plugins.flatMap((p) =>\n p.secretProviderPlugin ? [p.secretProviderPlugin] : [],\n ),\n }),\n [plugins],\n );\n // Kick off lazy chunk downloads for every source plugin once the host\n // mounts, so navigating into an add/edit page doesn't suspend.\n useEffect(() => {\n for (const sp of value.sourcePlugins) sp.preload?.();\n }, [value.sourcePlugins]);\n return createElement(ExecutorPluginsContext.Provider, { value }, children);\n}\n\nconst usePluginsCtx = (hookName: string): ExecutorPluginsContextValue => {\n const ctx = useContext(ExecutorPluginsContext);\n if (!ctx) {\n // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant\n throw new Error(`${hookName} must be called inside an <ExecutorPluginsProvider>.`);\n }\n return ctx;\n};\n\n/** Full list of loaded `ClientPluginSpec` values. */\nexport const useClientPlugins = (): readonly ClientPluginSpec[] =>\n usePluginsCtx(\"useClientPlugins\").plugins;\n\n/** Source plugins extracted from `clientPlugins[].sourcePlugin`. */\nexport const useSourcePlugins = (): readonly SourcePlugin[] =>\n usePluginsCtx(\"useSourcePlugins\").sourcePlugins;\n\n/** Secret-provider plugins extracted from `clientPlugins[].secretProviderPlugin`. */\nexport const useSecretProviderPlugins = (): readonly SecretProviderPlugin[] =>\n usePluginsCtx(\"useSecretProviderPlugins\").secretProviderPlugins;\n"],"mappings":";AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,eAAe;AAExB,SAAS,iBAAiB,YAAY,yBAAyB;AAC/D,YAAY,iBAAiB;AAO7B,SAAS,cAAc;AACvB,SAAS,WAAAA,UAAS,iBAAiB,oBAAoB;AAEvD,YAAY,iBAAiB;AAC7B,YAAY,UAAU;AACtB,YAAYC,kBAAiB;AAE7B,SAAS,cAAc,YAAY,cAAc,sBAAsB;AAiIhE,IAAM,qBAAqB,CAChC,SAC0B;AAoCrB,IAAM,yBAAyB,CAGpC,OACA,UAAyC,CAAC,MACvC;AACH,QAAM,EAAE,UAAU,OAAO,IAAI;AAC7B,QAAM,WAAW,MAAM;AACvB,QAAM,SAAS,QAAQ,KAAK,UAAU,QAAQ,EAAE,EAAE,IAAI,KAAK;AAC3D,SAAmB,oBAA2C,EAAE,UAAU,QAAQ,UAAU;AAAA,IAC1F,KAAK;AAAA,IACL,YAAY,gBAAgB;AAAA,IAC5B,GAAI,OAAO,YAAY,aACnB;AAAA,MACE,iBAAiB,WAAW;AAAA,QAAW,CAAC,YACtC,kBAAkB,WAAW,SAAS,QAAQ,CAAC;AAAA,MACjD;AAAA,IACF,IACA,EAAE,QAAQ;AAAA,EAChB,CAAC;AACH;AAuBA,IAAM,yBAAyB,cAAkD,IAAI;AACrF,uBAAuB,cAAc;AAO9B,SAAS,wBACd,OACkC;AAClC,QAAM,EAAE,SAAS,SAAS,IAAI;AAC9B,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA,eAAe,QAAQ,QAAQ,CAAC,MAAO,EAAE,eAAe,CAAC,EAAE,YAAY,IAAI,CAAC,CAAE;AAAA,MAC9E,uBAAuB,QAAQ;AAAA,QAAQ,CAAC,MACtC,EAAE,uBAAuB,CAAC,EAAE,oBAAoB,IAAI,CAAC;AAAA,MACvD;AAAA,IACF;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAGA,YAAU,MAAM;AACd,eAAW,MAAM,MAAM,cAAe,IAAG,UAAU;AAAA,EACrD,GAAG,CAAC,MAAM,aAAa,CAAC;AACxB,SAAO,cAAc,uBAAuB,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC3E;AAEA,IAAM,gBAAgB,CAAC,aAAkD;AACvE,QAAM,MAAM,WAAW,sBAAsB;AAC7C,MAAI,CAAC,KAAK;AAER,UAAM,IAAI,MAAM,GAAG,QAAQ,sDAAsD;AAAA,EACnF;AACA,SAAO;AACT;AAGO,IAAM,mBAAmB,MAC9B,cAAc,kBAAkB,EAAE;AAG7B,IAAM,mBAAmB,MAC9B,cAAc,kBAAkB,EAAE;AAG7B,IAAM,2BAA2B,MACtC,cAAc,0BAA0B,EAAE;","names":["HttpApi","AtomHttpApi"]}
|
package/dist/connections.d.ts
CHANGED
|
@@ -103,5 +103,12 @@ declare const UpdateConnectionTokensInput_base: Schema.Class<UpdateConnectionTok
|
|
|
103
103
|
}>, {}>;
|
|
104
104
|
export declare class UpdateConnectionTokensInput extends UpdateConnectionTokensInput_base {
|
|
105
105
|
}
|
|
106
|
+
declare const RemoveConnectionInput_base: Schema.Class<RemoveConnectionInput, Schema.Struct<{
|
|
107
|
+
readonly id: Schema.brand<Schema.String, "ConnectionId">;
|
|
108
|
+
/** Scope id whose connection row and owned token secrets should be removed. */
|
|
109
|
+
readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
|
|
110
|
+
}>, {}>;
|
|
111
|
+
export declare class RemoveConnectionInput extends RemoveConnectionInput_base {
|
|
112
|
+
}
|
|
106
113
|
export {};
|
|
107
114
|
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAY,MAAM,OAAO,CAAC;AAWxD;;;WAGW;AACX,eAAO,MAAM,uBAAuB,+CAA+C,CAAC;AACpF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAC;;;;;;;;IAexE,oEAAoE;;IAEpE;sEACkE;;;;;;AAVpE,qBAAa,aAAc,SAAQ,kBAejC;CAAG;;IAeH;+DAC2D;;IAE3D;yDACqD;;;;AALvD,qBAAa,aAAc,SAAQ,kBAQjC;CAAG;;;IAMH;;6DAEyD;;;;;;;IAOzD,wEAAwE;;;;AAb1E,qBAAa,qBAAsB,SAAQ,0BAgBzC;CAAG;;;;AAQL,qBAAa,sBAAuB,SAAQ,
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAY,MAAM,OAAO,CAAC;AAWxD;;;WAGW;AACX,eAAO,MAAM,uBAAuB,+CAA+C,CAAC;AACpF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAC;;;;;;;;IAexE,oEAAoE;;IAEpE;sEACkE;;;;;;AAVpE,qBA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M,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,CACjB,KAAK,EAAE,sBAAsB,KAC1B,MAAM,CAAC,MAAM,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;CACrE;;;;;;;;;;AASD,qBAAa,2BAA4B,SAAQ,gCAU/C;CAAG;;;IAMH,+EAA+E;;;AAJjF,qBAAa,qBAAsB,SAAQ,0BAMzC;CAAG"}
|
package/dist/core-schema.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InferDBFieldsOutput } from "@executor-js/storage-core";
|
|
2
|
+
export declare const credentialBindingKinds: ["text", "secret", "connection"];
|
|
2
3
|
export declare const coreSchema: {
|
|
3
4
|
readonly source: {
|
|
4
5
|
readonly fields: {
|
|
@@ -177,9 +178,8 @@ export declare const coreSchema: {
|
|
|
177
178
|
readonly required: true;
|
|
178
179
|
readonly index: true;
|
|
179
180
|
};
|
|
180
|
-
/** Routing key into `plugin.connectionProviders`.
|
|
181
|
-
*
|
|
182
|
-
* `google-discovery:google`). Mirrors `secret.provider`. */
|
|
181
|
+
/** Routing key into `plugin.connectionProviders`. OAuth2 connections
|
|
182
|
+
* use the shared `oauth2` provider. Mirrors `secret.provider`. */
|
|
183
183
|
readonly provider: {
|
|
184
184
|
readonly type: "string";
|
|
185
185
|
readonly required: true;
|
|
@@ -279,6 +279,72 @@ export declare const coreSchema: {
|
|
|
279
279
|
};
|
|
280
280
|
};
|
|
281
281
|
};
|
|
282
|
+
readonly credential_binding: {
|
|
283
|
+
readonly fields: {
|
|
284
|
+
readonly id: {
|
|
285
|
+
readonly type: "string";
|
|
286
|
+
readonly required: true;
|
|
287
|
+
};
|
|
288
|
+
readonly scope_id: {
|
|
289
|
+
readonly type: "string";
|
|
290
|
+
readonly required: true;
|
|
291
|
+
readonly index: true;
|
|
292
|
+
};
|
|
293
|
+
readonly plugin_id: {
|
|
294
|
+
readonly type: "string";
|
|
295
|
+
readonly required: true;
|
|
296
|
+
readonly index: true;
|
|
297
|
+
};
|
|
298
|
+
readonly source_id: {
|
|
299
|
+
readonly type: "string";
|
|
300
|
+
readonly required: true;
|
|
301
|
+
readonly index: true;
|
|
302
|
+
};
|
|
303
|
+
readonly source_scope_id: {
|
|
304
|
+
readonly type: "string";
|
|
305
|
+
readonly required: true;
|
|
306
|
+
readonly index: true;
|
|
307
|
+
};
|
|
308
|
+
readonly slot_key: {
|
|
309
|
+
readonly type: "string";
|
|
310
|
+
readonly required: true;
|
|
311
|
+
readonly index: true;
|
|
312
|
+
};
|
|
313
|
+
/** "text" | "secret" | "connection". */
|
|
314
|
+
readonly kind: {
|
|
315
|
+
readonly type: ["text", "secret", "connection"];
|
|
316
|
+
readonly required: true;
|
|
317
|
+
readonly index: true;
|
|
318
|
+
};
|
|
319
|
+
readonly text_value: {
|
|
320
|
+
readonly type: "string";
|
|
321
|
+
readonly required: false;
|
|
322
|
+
};
|
|
323
|
+
readonly secret_id: {
|
|
324
|
+
readonly type: "string";
|
|
325
|
+
readonly required: false;
|
|
326
|
+
readonly index: true;
|
|
327
|
+
};
|
|
328
|
+
readonly secret_scope_id: {
|
|
329
|
+
readonly type: "string";
|
|
330
|
+
readonly required: false;
|
|
331
|
+
readonly index: true;
|
|
332
|
+
};
|
|
333
|
+
readonly connection_id: {
|
|
334
|
+
readonly type: "string";
|
|
335
|
+
readonly required: false;
|
|
336
|
+
readonly index: true;
|
|
337
|
+
};
|
|
338
|
+
readonly created_at: {
|
|
339
|
+
readonly type: "date";
|
|
340
|
+
readonly required: true;
|
|
341
|
+
};
|
|
342
|
+
readonly updated_at: {
|
|
343
|
+
readonly type: "date";
|
|
344
|
+
readonly required: true;
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
282
348
|
readonly tool_policy: {
|
|
283
349
|
readonly fields: {
|
|
284
350
|
readonly id: {
|
|
@@ -327,6 +393,19 @@ export type ToolRow = InferDBFieldsOutput<CoreSchema["tool"]["fields"]> & Record
|
|
|
327
393
|
export type DefinitionRow = InferDBFieldsOutput<CoreSchema["definition"]["fields"]> & Record<string, unknown>;
|
|
328
394
|
export type SecretRow = InferDBFieldsOutput<CoreSchema["secret"]["fields"]> & Record<string, unknown>;
|
|
329
395
|
export type ConnectionRow = InferDBFieldsOutput<CoreSchema["connection"]["fields"]> & Record<string, unknown>;
|
|
396
|
+
type CredentialBindingRowFields = InferDBFieldsOutput<CoreSchema["credential_binding"]["fields"]>;
|
|
397
|
+
type CredentialBindingRowBase = Omit<CredentialBindingRowFields, "kind" | "text_value" | "secret_id" | "secret_scope_id" | "connection_id">;
|
|
398
|
+
export type CredentialBindingRow = CredentialBindingRowBase & ({
|
|
399
|
+
kind: "text";
|
|
400
|
+
text_value: string;
|
|
401
|
+
} | {
|
|
402
|
+
kind: "secret";
|
|
403
|
+
secret_id: string;
|
|
404
|
+
secret_scope_id?: string;
|
|
405
|
+
} | {
|
|
406
|
+
kind: "connection";
|
|
407
|
+
connection_id: string;
|
|
408
|
+
}) & Record<string, unknown>;
|
|
330
409
|
export type ToolPolicyRow = InferDBFieldsOutput<CoreSchema["tool_policy"]["fields"]> & Record<string, unknown>;
|
|
331
410
|
export type ToolPolicyAction = "approve" | "require_approval" | "block";
|
|
332
411
|
export declare const TOOL_POLICY_ACTIONS: readonly ["approve", "require_approval", "block"];
|
|
@@ -369,4 +448,5 @@ export interface DefinitionsInput {
|
|
|
369
448
|
readonly scope: string;
|
|
370
449
|
readonly definitions: Record<string, unknown>;
|
|
371
450
|
}
|
|
451
|
+
export {};
|
|
372
452
|
//# sourceMappingURL=core-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-schema.d.ts","sourceRoot":"","sources":["../src/core-schema.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"core-schema.d.ts","sourceRoot":"","sources":["../src/core-schema.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,mBAAmB,EAAE,MAAM,2BAA2B,C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|
+
resolveSecretBackedMap
|
|
7
|
+
} from "./chunk-6SQWMOM4.js";
|
|
8
|
+
import {
|
|
9
|
+
definePlugin,
|
|
10
|
+
defineSchema,
|
|
11
|
+
makeTestConfig
|
|
12
|
+
} from "./chunk-FPV6KONN.js";
|
|
13
|
+
import {
|
|
14
|
+
ConfiguredCredentialBinding,
|
|
15
|
+
ConfiguredCredentialValue,
|
|
16
|
+
ConfiguredCredentialValueSchema,
|
|
2
17
|
ConnectionId,
|
|
18
|
+
ConnectionInUseError,
|
|
3
19
|
ConnectionNotFoundError,
|
|
4
20
|
ConnectionProviderNotRegisteredError,
|
|
5
21
|
ConnectionProviderState,
|
|
@@ -8,10 +24,18 @@ import {
|
|
|
8
24
|
ConnectionRefreshError,
|
|
9
25
|
ConnectionRefreshNotSupportedError,
|
|
10
26
|
CreateConnectionInput,
|
|
27
|
+
CredentialBindingId,
|
|
28
|
+
CredentialBindingKind,
|
|
29
|
+
CredentialBindingRef,
|
|
30
|
+
CredentialBindingResolutionStatus,
|
|
31
|
+
CredentialBindingSlotInput,
|
|
32
|
+
CredentialBindingSourceInput,
|
|
33
|
+
CredentialBindingValue,
|
|
11
34
|
ElicitationAction,
|
|
12
35
|
ElicitationDeclinedError,
|
|
13
36
|
ElicitationResponse,
|
|
14
37
|
FormElicitation,
|
|
38
|
+
HostedOutboundRequestBlocked,
|
|
15
39
|
NoHandlerError,
|
|
16
40
|
OAUTH2_DEFAULT_TIMEOUT_MS,
|
|
17
41
|
OAUTH2_PROVIDER_KEY,
|
|
@@ -33,15 +57,22 @@ import {
|
|
|
33
57
|
OAuthStrategy,
|
|
34
58
|
PluginNotLoadedError,
|
|
35
59
|
PolicyId,
|
|
60
|
+
RemoveConnectionInput,
|
|
61
|
+
RemoveCredentialBindingInput,
|
|
62
|
+
RemoveSecretInput,
|
|
63
|
+
ReplaceCredentialBindingValue,
|
|
64
|
+
ReplaceCredentialBindingsInput,
|
|
65
|
+
ResolvedCredentialSlot,
|
|
36
66
|
Scope,
|
|
37
67
|
ScopeId,
|
|
38
|
-
|
|
39
|
-
SecretBackedValue,
|
|
68
|
+
ScopedSecretCredentialInput,
|
|
40
69
|
SecretId,
|
|
70
|
+
SecretInUseError,
|
|
41
71
|
SecretNotFoundError,
|
|
42
72
|
SecretOwnedByConnectionError,
|
|
43
73
|
SecretRef,
|
|
44
74
|
SecretResolutionError,
|
|
75
|
+
SetCredentialBindingInput,
|
|
45
76
|
SetSecretInput,
|
|
46
77
|
SourceDetectionResult,
|
|
47
78
|
SourceNotFoundError,
|
|
@@ -56,6 +87,8 @@ import {
|
|
|
56
87
|
ToolSchema,
|
|
57
88
|
UpdateConnectionTokensInput,
|
|
58
89
|
UrlElicitation,
|
|
90
|
+
Usage,
|
|
91
|
+
assertSupportedOAuthEndpointUrl,
|
|
59
92
|
beginDynamicAuthorization,
|
|
60
93
|
buildAuthorizationUrl,
|
|
61
94
|
buildToolTypeScriptPreview,
|
|
@@ -64,15 +97,20 @@ import {
|
|
|
64
97
|
createExecutor,
|
|
65
98
|
createPkceCodeChallenge,
|
|
66
99
|
createPkceCodeVerifier,
|
|
67
|
-
|
|
100
|
+
credentialBindingId,
|
|
101
|
+
credentialBindingRowToRef,
|
|
102
|
+
credentialBindingValueFromRow,
|
|
103
|
+
credentialSlotKey,
|
|
104
|
+
credentialSlotPart,
|
|
68
105
|
discoverAuthorizationServerMetadata,
|
|
69
106
|
discoverProtectedResourceMetadata,
|
|
70
107
|
effectivePolicyFromSorted,
|
|
71
108
|
exchangeAuthorizationCode,
|
|
72
109
|
exchangeClientCredentials,
|
|
73
|
-
|
|
110
|
+
isSupportedOAuthEndpointUrl,
|
|
74
111
|
isToolPolicyAction,
|
|
75
112
|
isValidPattern,
|
|
113
|
+
makeHostedHttpClientLayer,
|
|
76
114
|
makeInMemoryBlobStore,
|
|
77
115
|
makeOAuth2Service,
|
|
78
116
|
matchPattern,
|
|
@@ -80,16 +118,16 @@ import {
|
|
|
80
118
|
refreshAccessToken,
|
|
81
119
|
registerDynamicClient,
|
|
82
120
|
resolveEffectivePolicy,
|
|
83
|
-
resolveSecretBackedMap,
|
|
84
121
|
resolveToolPolicy,
|
|
85
122
|
rowToToolPolicy,
|
|
86
123
|
schemaToTypeScriptPreview,
|
|
87
124
|
schemaToTypeScriptPreviewWithDefs,
|
|
88
|
-
shouldRefreshToken
|
|
89
|
-
|
|
125
|
+
shouldRefreshToken,
|
|
126
|
+
validateHostedOutboundUrl
|
|
127
|
+
} from "./chunk-VLVPSIQ4.js";
|
|
90
128
|
|
|
91
129
|
// src/index.ts
|
|
92
|
-
import { Context, Effect, Layer, Schema, Data, Option } from "effect";
|
|
130
|
+
import { Context, Effect, Layer, Schema as Schema2, Data, Option } from "effect";
|
|
93
131
|
import {
|
|
94
132
|
HttpApi,
|
|
95
133
|
HttpApiBuilder,
|
|
@@ -106,48 +144,6 @@ import { StorageError, UniqueViolationError } from "@executor-js/storage-core";
|
|
|
106
144
|
var OAUTH_POPUP_MESSAGE_TYPE = "executor:oauth-result";
|
|
107
145
|
var isOAuthPopupResult = (value) => typeof value === "object" && value !== null && value.type === OAUTH_POPUP_MESSAGE_TYPE;
|
|
108
146
|
|
|
109
|
-
// src/plugin.ts
|
|
110
|
-
var defineSchema = (schema) => schema;
|
|
111
|
-
function definePlugin(authorFactory) {
|
|
112
|
-
return (options) => {
|
|
113
|
-
const {
|
|
114
|
-
storage: storageOverride,
|
|
115
|
-
...rest
|
|
116
|
-
} = options ?? {};
|
|
117
|
-
const hasAuthorOptions = Object.keys(rest).length > 0;
|
|
118
|
-
const spec = authorFactory(
|
|
119
|
-
hasAuthorOptions ? rest : void 0
|
|
120
|
-
);
|
|
121
|
-
return {
|
|
122
|
-
...spec,
|
|
123
|
-
storage: storageOverride ?? spec.storage
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// src/testing.ts
|
|
129
|
-
import { makeMemoryAdapter } from "@executor-js/storage-core/testing/memory";
|
|
130
|
-
var makeTestConfig = (options) => {
|
|
131
|
-
const scopes = options?.scopes ?? [
|
|
132
|
-
new Scope({
|
|
133
|
-
id: ScopeId.make("test-scope"),
|
|
134
|
-
name: options?.scopeName ?? "test",
|
|
135
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
136
|
-
})
|
|
137
|
-
];
|
|
138
|
-
const schema = collectSchemas(options?.plugins ?? []);
|
|
139
|
-
return {
|
|
140
|
-
scopes,
|
|
141
|
-
adapter: makeMemoryAdapter({ schema }),
|
|
142
|
-
blobs: makeInMemoryBlobStore(),
|
|
143
|
-
plugins: options?.plugins,
|
|
144
|
-
// Tests default to auto-accepting elicitation prompts. Override via
|
|
145
|
-
// a wrapping spread if a test exercises a real handler:
|
|
146
|
-
// { ...makeTestConfig(...), onElicitation: customHandler }
|
|
147
|
-
onElicitation: "accept-all"
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
147
|
// src/schema-refs.ts
|
|
152
148
|
var REF_PATTERN = /^#\/(?:\$defs|definitions)\/(.+)$/;
|
|
153
149
|
var parseRefName = (ref) => ref.match(REF_PATTERN)?.[1];
|
|
@@ -233,8 +229,24 @@ var reattachDefs = (schema, defs) => {
|
|
|
233
229
|
}
|
|
234
230
|
return { ...schema, $defs: attached };
|
|
235
231
|
};
|
|
232
|
+
|
|
233
|
+
// src/api-errors.ts
|
|
234
|
+
import { Schema } from "effect";
|
|
235
|
+
var InternalError = class extends Schema.TaggedErrorClass()(
|
|
236
|
+
"InternalError",
|
|
237
|
+
{
|
|
238
|
+
/** Opaque correlation id for backend lookup (Sentry event id, log line, etc.). */
|
|
239
|
+
traceId: Schema.String
|
|
240
|
+
},
|
|
241
|
+
{ httpApiStatus: 500 }
|
|
242
|
+
) {
|
|
243
|
+
};
|
|
236
244
|
export {
|
|
245
|
+
ConfiguredCredentialBinding,
|
|
246
|
+
ConfiguredCredentialValue,
|
|
247
|
+
ConfiguredCredentialValueSchema,
|
|
237
248
|
ConnectionId,
|
|
249
|
+
ConnectionInUseError,
|
|
238
250
|
ConnectionNotFoundError,
|
|
239
251
|
ConnectionProviderNotRegisteredError,
|
|
240
252
|
ConnectionProviderState,
|
|
@@ -244,12 +256,20 @@ export {
|
|
|
244
256
|
ConnectionRefreshNotSupportedError,
|
|
245
257
|
Context,
|
|
246
258
|
CreateConnectionInput,
|
|
259
|
+
CredentialBindingId,
|
|
260
|
+
CredentialBindingKind,
|
|
261
|
+
CredentialBindingRef,
|
|
262
|
+
CredentialBindingResolutionStatus,
|
|
263
|
+
CredentialBindingSlotInput,
|
|
264
|
+
CredentialBindingSourceInput,
|
|
265
|
+
CredentialBindingValue,
|
|
247
266
|
Data,
|
|
248
267
|
Effect,
|
|
249
268
|
ElicitationAction,
|
|
250
269
|
ElicitationDeclinedError,
|
|
251
270
|
ElicitationResponse,
|
|
252
271
|
FormElicitation,
|
|
272
|
+
HostedOutboundRequestBlocked,
|
|
253
273
|
HttpApi,
|
|
254
274
|
HttpApiBuilder,
|
|
255
275
|
HttpApiClient,
|
|
@@ -257,6 +277,7 @@ export {
|
|
|
257
277
|
HttpApiGroup,
|
|
258
278
|
HttpApiMiddleware,
|
|
259
279
|
HttpApiSchema,
|
|
280
|
+
InternalError,
|
|
260
281
|
Layer,
|
|
261
282
|
NoHandlerError,
|
|
262
283
|
OAUTH2_DEFAULT_TIMEOUT_MS,
|
|
@@ -281,16 +302,25 @@ export {
|
|
|
281
302
|
Option,
|
|
282
303
|
PluginNotLoadedError,
|
|
283
304
|
PolicyId,
|
|
284
|
-
|
|
305
|
+
RemoveConnectionInput,
|
|
306
|
+
RemoveCredentialBindingInput,
|
|
307
|
+
RemoveSecretInput,
|
|
308
|
+
ReplaceCredentialBindingValue,
|
|
309
|
+
ReplaceCredentialBindingsInput,
|
|
310
|
+
ResolvedCredentialSlot,
|
|
311
|
+
Schema2 as Schema,
|
|
285
312
|
Scope,
|
|
286
313
|
ScopeId,
|
|
314
|
+
ScopedSecretCredentialInput,
|
|
287
315
|
SecretBackedMap,
|
|
288
316
|
SecretBackedValue,
|
|
289
317
|
SecretId,
|
|
318
|
+
SecretInUseError,
|
|
290
319
|
SecretNotFoundError,
|
|
291
320
|
SecretOwnedByConnectionError,
|
|
292
321
|
SecretRef,
|
|
293
322
|
SecretResolutionError,
|
|
323
|
+
SetCredentialBindingInput,
|
|
294
324
|
SetSecretInput,
|
|
295
325
|
SourceDetectionResult,
|
|
296
326
|
SourceNotFoundError,
|
|
@@ -307,6 +337,8 @@ export {
|
|
|
307
337
|
UniqueViolationError,
|
|
308
338
|
UpdateConnectionTokensInput,
|
|
309
339
|
UrlElicitation,
|
|
340
|
+
Usage,
|
|
341
|
+
assertSupportedOAuthEndpointUrl,
|
|
310
342
|
beginDynamicAuthorization,
|
|
311
343
|
buildAuthorizationUrl,
|
|
312
344
|
buildToolTypeScriptPreview,
|
|
@@ -316,6 +348,11 @@ export {
|
|
|
316
348
|
createExecutor,
|
|
317
349
|
createPkceCodeChallenge,
|
|
318
350
|
createPkceCodeVerifier,
|
|
351
|
+
credentialBindingId,
|
|
352
|
+
credentialBindingRowToRef,
|
|
353
|
+
credentialBindingValueFromRow,
|
|
354
|
+
credentialSlotKey,
|
|
355
|
+
credentialSlotPart,
|
|
319
356
|
defineExecutorConfig,
|
|
320
357
|
definePlugin,
|
|
321
358
|
defineSchema,
|
|
@@ -327,8 +364,10 @@ export {
|
|
|
327
364
|
hoistDefinitions,
|
|
328
365
|
isOAuthPopupResult,
|
|
329
366
|
isSecretBackedRef,
|
|
367
|
+
isSupportedOAuthEndpointUrl,
|
|
330
368
|
isToolPolicyAction,
|
|
331
369
|
isValidPattern,
|
|
370
|
+
makeHostedHttpClientLayer,
|
|
332
371
|
makeInMemoryBlobStore,
|
|
333
372
|
makeOAuth2Service,
|
|
334
373
|
makeTestConfig,
|
|
@@ -345,6 +384,7 @@ export {
|
|
|
345
384
|
schemaToTypeScriptPreview,
|
|
346
385
|
schemaToTypeScriptPreviewWithDefs,
|
|
347
386
|
shouldRefreshToken,
|
|
348
|
-
typedAdapter
|
|
387
|
+
typedAdapter,
|
|
388
|
+
validateHostedOutboundUrl
|
|
349
389
|
};
|
|
350
390
|
//# sourceMappingURL=core.js.map
|