@dual-os/sdk 0.12.3 → 0.13.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 +1 -0
- package/dist/AgentChannel.js +2 -2
- package/dist/AgentChannelRuntime.d.ts +0 -2
- package/dist/AgentChannelRuntime.d.ts.map +1 -1
- package/dist/AgentChannelRuntime.js +5 -8
- package/dist/AgentChannelRuntime.js.map +1 -1
- package/dist/AiProvider.d.ts +1 -1
- package/dist/AiProvider.js +2 -2
- package/dist/AuthMethod.js +1 -1
- package/dist/AuthMethodExecution.js +2 -2
- package/dist/ConnectionResolver.d.ts +0 -1
- package/dist/ConnectionResolver.d.ts.map +1 -1
- package/dist/ConnectionResolver.js.map +1 -1
- package/dist/DualRegistry.d.ts +6 -6
- package/dist/DualRegistry.d.ts.map +1 -1
- package/dist/DualRegistry.js +1 -1
- package/dist/DualRuntime.d.ts +26 -26
- package/dist/DualRuntime.d.ts.map +1 -1
- package/dist/DualRuntime.js +6 -6
- package/dist/DualRuntime.js.map +1 -1
- package/dist/Group.d.ts +1 -1
- package/dist/Group.js +2 -2
- package/dist/Http.d.ts +1 -1
- package/dist/OAuthFlow.js +1 -1
- package/dist/Plugin.d.ts +46 -46
- package/dist/Plugin.js +3 -3
- package/dist/PluginRuntime.d.ts +0 -9
- package/dist/PluginRuntime.d.ts.map +1 -1
- package/dist/Runner.js +1 -1
- package/dist/Trigger.d.ts +3 -3
- package/dist/index.d.ts +14 -14
- package/dist/index.js +12 -12
- package/dist/internal/auth-context.d.ts +1 -1
- package/dist/internal/auth-execution.d.ts +1 -1
- package/dist/internal/auth-execution.d.ts.map +1 -1
- package/dist/internal/auth-execution.js.map +1 -1
- package/dist/internal/capabilities.d.ts +4 -4
- package/dist/internal/children.d.ts +5 -5
- package/dist/internal/children.js +2 -2
- package/dist/internal/dual/actions.d.ts +8 -8
- package/dist/internal/dual/actions.d.ts.map +1 -1
- package/dist/internal/dual/invoke.d.ts +6 -6
- package/dist/internal/dual/invoke.d.ts.map +1 -1
- package/dist/internal/dual/invoke.js +1 -1
- package/dist/internal/dual/invoke.js.map +1 -1
- package/dist/internal/dual/registry.d.ts +2 -2
- package/dist/internal/dual/triggers.d.ts +11 -11
- package/dist/internal/plugin-handlers.d.ts +11 -11
- package/dist/internal/plugin-handlers.d.ts.map +1 -1
- package/dist/internal/plugin-handlers.js +3 -3
- package/dist/internal/plugin-handlers.js.map +1 -1
- package/dist/internal/trigger-runtime-shared.d.ts +1 -1
- package/dist/internal/trigger-runtime-shared.d.ts.map +1 -1
- package/dist/internal/trigger-runtime-shared.js +2 -2
- package/dist/internal/trigger-runtime-shared.js.map +1 -1
- package/dist/internal/trigger-runtime.d.ts +1 -1
- package/dist/remote-runtime.d.ts +0 -2
- package/dist/remote-runtime.d.ts.map +1 -1
- package/dist/remote-runtime.js +12 -15
- package/dist/remote-runtime.js.map +1 -1
- package/package.json +2 -3
- package/src/AgentChannelRuntime.ts +3 -6
- package/src/ConnectionResolver.ts +0 -1
- package/src/DualRuntime.ts +13 -15
- package/src/internal/auth-execution.ts +12 -14
- package/src/internal/dual/invoke.ts +11 -14
- package/src/internal/plugin-handlers.ts +12 -13
- package/src/internal/trigger-runtime-shared.ts +3 -4
- package/src/remote-runtime.ts +1 -1
package/dist/PluginRuntime.d.ts
CHANGED
|
@@ -182,7 +182,6 @@ export declare const ExecutionRequest: Schema.Union<readonly [Schema.Struct<{
|
|
|
182
182
|
}>;
|
|
183
183
|
readonly tenant: Schema.Struct<{
|
|
184
184
|
readonly organizationId: Schema.NonEmptyString;
|
|
185
|
-
readonly teamId: Schema.NonEmptyString;
|
|
186
185
|
}>;
|
|
187
186
|
}>;
|
|
188
187
|
readonly files: Schema.optionalKey<Schema.Struct<{
|
|
@@ -421,7 +420,6 @@ export declare const Request: Schema.Union<readonly [Schema.Union<readonly [Sche
|
|
|
421
420
|
}>;
|
|
422
421
|
readonly tenant: Schema.Struct<{
|
|
423
422
|
readonly organizationId: Schema.NonEmptyString;
|
|
424
|
-
readonly teamId: Schema.NonEmptyString;
|
|
425
423
|
}>;
|
|
426
424
|
}>;
|
|
427
425
|
readonly files: Schema.optionalKey<Schema.Struct<{
|
|
@@ -793,7 +791,6 @@ export declare const encodeInput: (input: {
|
|
|
793
791
|
};
|
|
794
792
|
readonly tenant: {
|
|
795
793
|
readonly organizationId: string;
|
|
796
|
-
readonly teamId: string;
|
|
797
794
|
};
|
|
798
795
|
};
|
|
799
796
|
readonly files?: {
|
|
@@ -1087,7 +1084,6 @@ export declare const encodeInput: (input: {
|
|
|
1087
1084
|
};
|
|
1088
1085
|
readonly tenant: {
|
|
1089
1086
|
readonly organizationId: string;
|
|
1090
|
-
readonly teamId: string;
|
|
1091
1087
|
};
|
|
1092
1088
|
};
|
|
1093
1089
|
readonly files?: {
|
|
@@ -1382,7 +1378,6 @@ export declare const decodeInput: (input: unknown) => Effect.Effect<{
|
|
|
1382
1378
|
};
|
|
1383
1379
|
readonly tenant: {
|
|
1384
1380
|
readonly organizationId: string;
|
|
1385
|
-
readonly teamId: string;
|
|
1386
1381
|
};
|
|
1387
1382
|
};
|
|
1388
1383
|
readonly files?: {
|
|
@@ -1674,7 +1669,6 @@ export declare const Invocation: Schema.Struct<{
|
|
|
1674
1669
|
}>;
|
|
1675
1670
|
readonly tenant: Schema.Struct<{
|
|
1676
1671
|
readonly organizationId: Schema.NonEmptyString;
|
|
1677
|
-
readonly teamId: Schema.NonEmptyString;
|
|
1678
1672
|
}>;
|
|
1679
1673
|
}>;
|
|
1680
1674
|
readonly files: Schema.optionalKey<Schema.Struct<{
|
|
@@ -2046,7 +2040,6 @@ export declare const encodeRequest: (request: {
|
|
|
2046
2040
|
};
|
|
2047
2041
|
readonly tenant: {
|
|
2048
2042
|
readonly organizationId: string;
|
|
2049
|
-
readonly teamId: string;
|
|
2050
2043
|
};
|
|
2051
2044
|
};
|
|
2052
2045
|
readonly files?: {
|
|
@@ -2342,7 +2335,6 @@ export declare const verifyResponse: (request: {
|
|
|
2342
2335
|
};
|
|
2343
2336
|
readonly tenant: {
|
|
2344
2337
|
readonly organizationId: string;
|
|
2345
|
-
readonly teamId: string;
|
|
2346
2338
|
};
|
|
2347
2339
|
};
|
|
2348
2340
|
readonly files?: {
|
|
@@ -2697,7 +2689,6 @@ export declare const execute: (request: {
|
|
|
2697
2689
|
};
|
|
2698
2690
|
readonly tenant: {
|
|
2699
2691
|
readonly organizationId: string;
|
|
2700
|
-
readonly teamId: string;
|
|
2701
2692
|
};
|
|
2702
2693
|
};
|
|
2703
2694
|
readonly files?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRuntime.d.ts","names":["DualRuntime.
|
|
1
|
+
{"version":3,"file":"PluginRuntime.d.ts","names":["DualRuntime.Service","OAuthFlow.Service"],"sources":["../src/PluginRuntime.ts"],"mappings":";;;;;;;;;;;;;;;;;qBASa,6BAA6B;qBAS7B;qBACA;qBACA;;qBAEA;qBACA;;iBAGI;WACN,KAAK,eAAe,WAAW;WAC/B,iBAAiB,eAAe,WAAW;;;iBAIrC;WACN;WACA,SAAS;;;wBAIJ,YAAY,SAAS,YAAS,OAAA,gBAAA;;wBAqC9B,QAAQ,SAAS,WAAW,gBAAa,OAAA,aAAA;YAoB7C,2BAA2B,kBAAkB;qBAC5C,mBAAiB,OAAA;;;;;;YAOlB,sBAAsB,aAAa;qBAClC,cAAY,OAAA;;;;;;;;;;YAYb,6BAA6B,oBAAoB;qBAChD,qBAAmB,OAAA;;;;YAKpB,qBAAqB,YAAY;qBAChC,aAAW,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoCZ,gCAAgC,uBAAuB;qBACtD,wBAAsB,OAAA;;;;;;;;;;;;;;YASvB,0BAA0B,iBAAiB;qBAC1C,kBAAgB,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAjDa;;;;;;;;;WAqCE;;;;;;;;;UAgBjCA,UAAAC"}
|
package/dist/Runner.js
CHANGED
|
@@ -3,8 +3,8 @@ import { materializePlugin } from "./DualRegistry.js";
|
|
|
3
3
|
import { fromPlugin, toLayer } from "./DualRuntime.js";
|
|
4
4
|
import { layer, oauth2TokenRefresherLayer } from "./OAuthFlow.js";
|
|
5
5
|
import { isPlugin, make } from "./Plugin.js";
|
|
6
|
-
import { filesUnavailable } from "./remote-runtime.js";
|
|
7
6
|
import { PluginExecutionError, decodeInput, encodeOutput, execute, responseLimit } from "./PluginRuntime.js";
|
|
7
|
+
import { filesUnavailable } from "./remote-runtime.js";
|
|
8
8
|
import "./Runner.js";
|
|
9
9
|
import { Cause, ConfigProvider, Context, Effect, Fiber, Formatter, Inspectable, Layer, ManagedRuntime, Match, Predicate, Redacted, Schema, Scope, String, pipe } from "effect";
|
|
10
10
|
import { FetchHttpClient } from "effect/http";
|
package/dist/Trigger.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { EntryAuthMethods, EntryTrigger, TriggerAppError, TriggerEncodedOutput, TriggerEncodedState, TriggerIdOf, TriggerRuntimeRequirements } from "./internal/trigger-runtime-shared.js";
|
|
2
|
+
import { RuntimeConnectionErrorsFor } from "./internal/auth-execution.js";
|
|
1
3
|
import { Any as Any$1 } from "./AuthMethod.js";
|
|
2
|
-
import { ContextForMethods } from "./internal/auth-context.js";
|
|
3
4
|
import { ConnectionResolutionContext } from "./ConnectionResolver.js";
|
|
4
|
-
import {
|
|
5
|
-
import { EntryAuthMethods, EntryTrigger, TriggerAppError, TriggerEncodedOutput, TriggerEncodedState, TriggerIdOf, TriggerRuntimeRequirements } from "./internal/trigger-runtime-shared.js";
|
|
5
|
+
import { ContextForMethods } from "./internal/auth-context.js";
|
|
6
6
|
import { Context, Effect, Pipeable, Schema } from "effect";
|
|
7
7
|
declare namespace Trigger_d_exports {
|
|
8
8
|
export { ActivateSuccess, ActivationResult, Any, Config, ConfigSchema, Constructor, ContractOptions, DeactivateSuccess, EmitResult, EmittedEventsSuccess, Handler, InvalidTriggerConfigError, InvalidTriggerOutputError, InvalidTriggerStateError, KeyedEvent, LifecycleInput, LifecycleRequest, Output, OutputSchema, PollExecutionRequest, PollingInput, PollingRuntime, RuntimeContext, RuntimeContract, RuntimeMeta, RuntimePhase, RuntimeTriggerEntry, State, StateSchema, StateValue, Trigger, TriggerKind, TriggerOptions, TypeId, UnsupportedTriggerRuntimeError, VerifyResult, VerifySuccess, WebhookActivationInput, WebhookActivationRequest, WebhookExecutionRequest, WebhookLifecycleInput, WebhookRequest, WebhookResponse, WebhookRuntime, activate, bodyDigest, deactivate, handlerKey, isTrigger, parse, poll, polling, verify, verifyEcdsaP256, verifyHmac, verifyHmacSha256, verifyStandardWebhook, verifyToken, webhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { OAuth2TokenRefresher_d_exports } from "./OAuth2TokenRefresher.js";
|
|
2
|
-
import { AuthMethodBinding_d_exports } from "./AuthMethodBinding.js";
|
|
3
|
-
import { AuthMethodExecution_d_exports } from "./AuthMethodExecution.js";
|
|
4
|
-
import { AuthMethod_d_exports } from "./AuthMethod.js";
|
|
5
1
|
import { Action_d_exports } from "./Action.js";
|
|
6
2
|
import { AgentChannel_d_exports } from "./AgentChannel.js";
|
|
7
|
-
import {
|
|
8
|
-
import { Trigger_d_exports } from "./Trigger.js";
|
|
9
|
-
import { Group_d_exports } from "./Group.js";
|
|
10
|
-
import { DefinitionError_d_exports } from "./DefinitionError.js";
|
|
11
|
-
import { Plugin_d_exports } from "./Plugin.js";
|
|
3
|
+
import { AgentChannelConformance_d_exports } from "./AgentChannelConformance.js";
|
|
12
4
|
import { AgentChannelRuntime_d_exports } from "./AgentChannelRuntime.js";
|
|
13
5
|
import { AiProvider_d_exports } from "./AiProvider.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
6
|
+
import { AuthMethod_d_exports } from "./AuthMethod.js";
|
|
7
|
+
import { AuthMethodBinding_d_exports } from "./AuthMethodBinding.js";
|
|
8
|
+
import { AuthMethodExecution_d_exports } from "./AuthMethodExecution.js";
|
|
9
|
+
import { ConnectionResolver_d_exports } from "./ConnectionResolver.js";
|
|
10
|
+
import { DefinitionError_d_exports } from "./DefinitionError.js";
|
|
16
11
|
import { DualRegistry_d_exports } from "./DualRegistry.js";
|
|
12
|
+
import { DualRuntime_d_exports } from "./DualRuntime.js";
|
|
17
13
|
import { Files_d_exports } from "./Files.js";
|
|
14
|
+
import { Group_d_exports } from "./Group.js";
|
|
18
15
|
import { Http_d_exports } from "./Http.js";
|
|
19
16
|
import { Mcp_d_exports } from "./Mcp.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { ToolFile_d_exports } from "./ToolFile.js";
|
|
17
|
+
import { OAuth2TokenRefresher_d_exports } from "./OAuth2TokenRefresher.js";
|
|
18
|
+
import { Plugin_d_exports } from "./Plugin.js";
|
|
23
19
|
import { remote_runtime_d_exports } from "./remote-runtime.js";
|
|
20
|
+
import { ToolFile_d_exports } from "./ToolFile.js";
|
|
21
|
+
import { Trigger_d_exports } from "./Trigger.js";
|
|
22
|
+
import { PluginRuntime_d_exports } from "./PluginRuntime.js";
|
|
23
|
+
import { OAuthFlow_d_exports } from "./OAuthFlow.js";
|
|
24
24
|
export { Action_d_exports as Action, AgentChannel_d_exports as AgentChannel, AgentChannelConformance_d_exports as AgentChannelConformance, AgentChannelRuntime_d_exports as AgentChannelRuntime, AiProvider_d_exports as AiProvider, AuthMethod_d_exports as AuthMethod, AuthMethodBinding_d_exports as AuthMethodBinding, AuthMethodExecution_d_exports as AuthMethodExecution, ConnectionResolver_d_exports as ConnectionResolver, DefinitionError_d_exports as DefinitionError, DualRegistry_d_exports as DualRegistry, DualRuntime_d_exports as DualRuntime, Files_d_exports as Files, Group_d_exports as Group, Http_d_exports as Http, Mcp_d_exports as Mcp, OAuth2TokenRefresher_d_exports as OAuth2TokenRefresher, OAuthFlow_d_exports as OAuthFlow, Plugin_d_exports as Plugin, PluginRuntime_d_exports as PluginRuntime, remote_runtime_d_exports as RemoteRuntime, ToolFile_d_exports as ToolFile, Trigger_d_exports as Trigger };
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { DefinitionError_exports } from "./DefinitionError.js";
|
|
2
1
|
import { Action_exports } from "./Action.js";
|
|
3
|
-
import { AuthMethodBinding_exports } from "./AuthMethodBinding.js";
|
|
4
|
-
import { OAuth2TokenRefresher_exports } from "./OAuth2TokenRefresher.js";
|
|
5
|
-
import { AuthMethodExecution_exports } from "./AuthMethodExecution.js";
|
|
6
|
-
import { AuthMethod_exports } from "./AuthMethod.js";
|
|
7
|
-
import { Files_exports } from "./Files.js";
|
|
8
2
|
import { AgentChannel_exports } from "./AgentChannel.js";
|
|
9
|
-
import {
|
|
3
|
+
import { AgentChannelConformance_exports } from "./AgentChannelConformance.js";
|
|
10
4
|
import { AgentChannelRuntime_exports } from "./AgentChannelRuntime.js";
|
|
11
5
|
import { AiProvider_exports } from "./AiProvider.js";
|
|
6
|
+
import { AuthMethod_exports } from "./AuthMethod.js";
|
|
7
|
+
import { AuthMethodBinding_exports } from "./AuthMethodBinding.js";
|
|
8
|
+
import { AuthMethodExecution_exports } from "./AuthMethodExecution.js";
|
|
9
|
+
import { ConnectionResolver_exports } from "./ConnectionResolver.js";
|
|
10
|
+
import { DefinitionError_exports } from "./DefinitionError.js";
|
|
12
11
|
import { DualRegistry_exports } from "./DualRegistry.js";
|
|
13
|
-
import { Trigger_exports } from "./Trigger.js";
|
|
14
12
|
import { DualRuntime_exports } from "./DualRuntime.js";
|
|
15
|
-
import {
|
|
13
|
+
import { Files_exports } from "./Files.js";
|
|
16
14
|
import { Group_exports } from "./Group.js";
|
|
17
|
-
import { Mcp_exports } from "./Mcp.js";
|
|
18
|
-
import { ToolFile_exports } from "./ToolFile.js";
|
|
19
15
|
import { Http_exports } from "./Http.js";
|
|
20
|
-
import {
|
|
16
|
+
import { Mcp_exports } from "./Mcp.js";
|
|
17
|
+
import { OAuth2TokenRefresher_exports } from "./OAuth2TokenRefresher.js";
|
|
21
18
|
import { Plugin_exports } from "./Plugin.js";
|
|
22
19
|
import { remote_runtime_exports } from "./remote-runtime.js";
|
|
20
|
+
import { ToolFile_exports } from "./ToolFile.js";
|
|
21
|
+
import { Trigger_exports } from "./Trigger.js";
|
|
23
22
|
import { PluginRuntime_exports } from "./PluginRuntime.js";
|
|
23
|
+
import { OAuthFlow_exports } from "./OAuthFlow.js";
|
|
24
24
|
export { Action_exports as Action, AgentChannel_exports as AgentChannel, AgentChannelConformance_exports as AgentChannelConformance, AgentChannelRuntime_exports as AgentChannelRuntime, AiProvider_exports as AiProvider, AuthMethod_exports as AuthMethod, AuthMethodBinding_exports as AuthMethodBinding, AuthMethodExecution_exports as AuthMethodExecution, ConnectionResolver_exports as ConnectionResolver, DefinitionError_exports as DefinitionError, DualRegistry_exports as DualRegistry, DualRuntime_exports as DualRuntime, Files_exports as Files, Group_exports as Group, Http_exports as Http, Mcp_exports as Mcp, OAuth2TokenRefresher_exports as OAuth2TokenRefresher, OAuthFlow_exports as OAuthFlow, Plugin_exports as Plugin, PluginRuntime_exports as PluginRuntime, remote_runtime_exports as RemoteRuntime, ToolFile_exports as ToolFile, Trigger_exports as Trigger };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BindingFor, Context as Context$1 } from "../AuthMethodBinding.js";
|
|
2
1
|
import { Any, MaterialSchema, Requirements, SetupSchema, ValueSchema } from "../AuthMethod.js";
|
|
2
|
+
import { BindingFor, Context as Context$1 } from "../AuthMethodBinding.js";
|
|
3
3
|
import { ConnectionIdNotAllowedError, ConnectionReauthorizationRequiredError, ConnectionRequiredError, ConnectionResolutionContext, ConnectionResolverStoreError, ConnectionSelectionRequiredError, ConnectionTargetKind, InvalidConnectionIdError, InvalidResolvedConnectionError, Service } from "../ConnectionResolver.js";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
export type NonEmptyReadonlyArray<A> = readonly [A, ...A[]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-execution.d.ts","names":["AuthMethod.Any","AuthMethod.ValueSchema","AuthMethod.SetupSchema","AuthMethod.MaterialSchema","AuthMethod.Requirements","AuthMethodBinding.BindingFor","AuthMethodBinding.Context","ConnectionResolver.Service"],"sources":["../../src/internal/auth-execution.ts"],"mappings":";;;;YAqBY,sBAAsB,eAAe,MAAM;YAE3C,uBAAuB,yBAAyBA,SAC1D,+BAA8B,UAC1B,eAAeA,MACb,OAAO,MAAM,iBAAiBC,YAAuB;;;;;;;;;;YAajD,2BAA2B,yBAAyBD,SAC9D,+BAA8B,UAC1B,eAAeA,
|
|
1
|
+
{"version":3,"file":"auth-execution.d.ts","names":["AuthMethod.Any","AuthMethod.ValueSchema","AuthMethod.SetupSchema","AuthMethod.MaterialSchema","AuthMethod.Requirements","AuthMethodBinding.BindingFor","AuthMethodBinding.Context","ConnectionResolver.Service"],"sources":["../../src/internal/auth-execution.ts"],"mappings":";;;;YAqBY,sBAAsB,eAAe,MAAM;YAE3C,uBAAuB,yBAAyBA,SAC1D,+BAA8B,UAC1B,eAAeA,MACb,OAAO,MAAM,iBAAiBC,YAAuB;;;;;;;;;;YAajD,2BAA2B,yBAAyBD,SAC9D,+BAA8B,UAC1B,eAAeA,OACVE,YAAuB,gBAAgB,OAAO,MAC3C,OAAO,MAAM,iBAAiBA,YAAuB,oBAEzD,OAAO,MAAM,iBAAiBC,eAA0B,WACxD,OAAO,MAAM,iBAAiBF,YAAuB,WACrDG,aAAwB;YAItB,2BAA2B,yBAAyBJ,SAC5D,gCACE,2CAEI,0BACA,mCACA,2BACA,iCACA,yCACA;qBA0DG,4BAA2B;qBAE3B,qBAAsB,yBAAyBA,OAAgB,SACjEK,WAA6B;WAC1B,MAAMC,UAA0B;;qBAEjC,kBAAmB,GAAC,iBAAmB,QAAM,sBAAsB;qBAGnE,6BAA0B,YACzB,sBAAoB,kBAChB,2BACS,oBACP,yBAEjB,OAAO,cAAc;qBAKX,2BAA2B,gBAAgB,sBAAsBN,MAC5E,YAAY,sBACZ,kBACA,2BACA,oBACA,SAAS,SACT,kCACA,SAAS,4CACN,OAAO,OACVK,WAA6B,UAC3B,0BACA,mCACA,2BACA,iCACA,yCACA,8BACFE,UAA6B,uBAAuB,WAAW,2BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-execution.js","names":["AuthMethodBinding.isBindingForMethod","ConnectionResolver.Service","AuthMethodExecution.decodeSetup","AuthMethodExecution.resolveDecoded","AuthMethodExecution.resolveUnknown","AuthMethodBinding.makeBinding"],"sources":["../../src/internal/auth-execution.ts"],"sourcesContent":["import type { Schema } from \"effect\";\nimport { Effect } from \"effect\";\n\nimport type * as AuthMethod from \"../AuthMethod.ts\";\nimport * as AuthMethodBinding from \"../AuthMethodBinding.ts\";\nimport * as AuthMethodExecution from \"../AuthMethodExecution.ts\";\nimport {\n type ConnectionReauthorizationRequiredError,\n type ConnectionRequiredError,\n type ConnectionSelectionRequiredError,\n type ConnectionResolverStoreError,\n type InvalidConnectionIdError,\n ConnectionIdNotAllowedError,\n ConnectionResolver,\n type ConnectionResolutionContext,\n type ConnectionTargetKind,\n InvalidResolvedConnectionError,\n} from \"../ConnectionResolver.ts\";\n\nimport { decodeJson } from \"./schema-runtime.ts\";\n\nexport type NonEmptyReadonlyArray<A> = readonly [A, ...A[]];\n\nexport type AuthSchemaRequirements<Methods extends readonly AuthMethod.Any[]> =\n Methods[number] extends infer Method\n ? Method extends AuthMethod.Any\n ? Schema.Codec.DecodingServices<AuthMethod.ValueSchema<Method>>\n : never\n : never;\n\n/**\n * Everything connection resolution may touch for one of the allowed methods:\n * setup/material/value decoding plus the method's hook requirements.\n *\n * Hook dependencies are app-defined services a host cannot know about (a\n * plugin's API client, a token issuer); surfacing them here keeps them in the\n * requirement algebra so they are either discharged at the plugin/app\n * definition via `provide` or demanded generically from whoever invokes.\n */\nexport type AuthResolutionRequirements<Methods extends readonly AuthMethod.Any[]> =\n Methods[number] extends infer Method\n ? Method extends AuthMethod.Any\n ?\n | (AuthMethod.SetupSchema<Method> extends Schema.Top\n ? Schema.Codec.DecodingServices<AuthMethod.SetupSchema<Method>>\n : never)\n | Schema.Codec.DecodingServices<AuthMethod.MaterialSchema<Method>>\n | Schema.Codec.DecodingServices<AuthMethod.ValueSchema<Method>>\n | AuthMethod.Requirements<Method>\n : never\n : never;\n\nexport type RuntimeConnectionErrorsFor<Methods extends readonly AuthMethod.Any[]> =\n | ConnectionIdNotAllowedError\n | ([Methods[number]] extends [never]\n ? never\n :\n | ConnectionRequiredError\n | ConnectionSelectionRequiredError\n | InvalidConnectionIdError\n | InvalidResolvedConnectionError\n | ConnectionReauthorizationRequiredError\n | ConnectionResolverStoreError);\n\nconst knownAuthMethodIds = (methods: readonly AuthMethod.Any[]) =>\n methods.map(method => method.identifier);\n\nconst fullAuthMethodId = (providerId: string, method: AuthMethod.Any): string =>\n `${providerId}/${method.identifier}`;\n\nconst findMethod = (\n providerId: string,\n methods: readonly AuthMethod.Any[],\n methodId: string,\n): AuthMethod.Any | undefined =>\n methods.find(\n method => method.identifier === methodId || fullAuthMethodId(providerId, method) === methodId,\n );\n\nconst invalidResolvedAuth = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methodId: string,\n description: string,\n): InvalidResolvedConnectionError =>\n new InvalidResolvedConnectionError({\n description,\n methodId,\n phase,\n providerId,\n targetId,\n targetKind,\n });\n\nconst makeAuthContext: <Methods extends readonly AuthMethod.Any[]>(\n binding: AuthMethodBinding.BindingFor<Methods>,\n) => AuthMethodBinding.Context<Methods> = (binding: AuthMethodBinding.Binding) => {\n const context = {\n current: binding,\n is(\n methodOrBinding: AuthMethod.Any | AuthMethodBinding.Binding,\n maybeMethod?: AuthMethod.Any,\n ): boolean {\n return maybeMethod === undefined\n ? AuthMethodBinding.isBindingForMethod(context.current, methodOrBinding as AuthMethod.Any)\n : AuthMethodBinding.isBindingForMethod(\n methodOrBinding as AuthMethodBinding.Binding,\n maybeMethod,\n );\n },\n match(cases: Record<string, (binding: AuthMethodBinding.Binding) => unknown>) {\n return cases[context.current.methodId]!(context.current);\n },\n };\n\n return context as never;\n};\n\nexport const noAuthRuntimeContext = (): Record<never, never> => ({});\n\nexport const authRuntimeContext = <Methods extends readonly AuthMethod.Any[]>(\n binding: AuthMethodBinding.BindingFor<Methods>,\n): { readonly auth: AuthMethodBinding.Context<Methods> } => ({ auth: makeAuthContext(binding) });\n\nexport const toNonEmptyArray = <A>(values: readonly A[]): NonEmptyReadonlyArray<A> | undefined =>\n values.length === 0 ? undefined : [values[0]!, ...values.slice(1)];\n\nexport const failConnectionIdNotAllowed = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n connectionId: string,\n): Effect.Effect<never, ConnectionIdNotAllowedError> =>\n Effect.fail(\n new ConnectionIdNotAllowedError({ connectionId, phase, providerId, targetId, targetKind }),\n );\n\nexport const resolveRuntimeConnection: <Methods extends NonEmptyReadonlyArray<AuthMethod.Any>>(\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methods: Methods,\n connectionId: string | undefined,\n context: ConnectionResolutionContext | undefined,\n) => Effect.Effect<\n AuthMethodBinding.BindingFor<Methods>,\n | ConnectionRequiredError\n | ConnectionSelectionRequiredError\n | InvalidConnectionIdError\n | InvalidResolvedConnectionError\n | ConnectionReauthorizationRequiredError\n | ConnectionResolverStoreError,\n ConnectionResolver.Service | AuthSchemaRequirements<Methods> | AuthResolutionRequirements<Methods>\n> = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methods: NonEmptyReadonlyArray<AuthMethod.Any>,\n connectionId: string | undefined,\n context: ConnectionResolutionContext | undefined,\n) =>\n Effect.gen(function* () {\n const resolver = yield* ConnectionResolver.Service;\n const resolved = yield* resolver.resolve({\n target: { providerId, targetId, targetKind, ...(phase === undefined ? {} : { phase }) },\n ...(connectionId === undefined ? {} : { connectionId }),\n ...(context === undefined ? {} : { context }),\n });\n\n if (resolved.providerId !== providerId) {\n return yield* invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n resolved.methodId,\n `expected provider \"${providerId}\", got \"${resolved.providerId}\"`,\n );\n }\n\n const method = findMethod(providerId, methods, resolved.methodId);\n if (method === undefined) {\n return yield* invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n resolved.methodId,\n `method \"${resolved.methodId}\" is not registered for provider \"${providerId}\"; known methods: ${knownAuthMethodIds(methods).join(\", \")}`,\n );\n }\n\n const setup = yield* (\n resolved.encoding === \"json\" && method.setup !== undefined\n ? decodeJson(method.setup, resolved.setup)\n : AuthMethodExecution.decodeSetup(method, resolved.setup)\n ).pipe(\n Effect.mapError(error =>\n invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n method.identifier,\n error.message,\n ),\n ),\n );\n const value = yield* (\n resolved.encoding === \"json\"\n ? decodeJson(method.material, resolved.material).pipe(\n Effect.flatMap(material =>\n AuthMethodExecution.resolveDecoded(method, material, { setup }),\n ),\n )\n : AuthMethodExecution.resolveUnknown(method, resolved.material, { setup })\n ).pipe(\n Effect.mapError(error =>\n invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n method.identifier,\n error instanceof Error ? error.message : String(error),\n ),\n ),\n );\n\n return AuthMethodBinding.makeBinding({\n connectionId: resolved.connectionId,\n method,\n providerId,\n value,\n });\n }) as never;\n"],"mappings":";;;;;;AAgEA,MAAM,sBAAsB,YAC1B,QAAQ,KAAI,WAAU,OAAO,UAAU;AAEzC,MAAM,oBAAoB,YAAoB,WAC5C,GAAG,WAAW,GAAG,OAAO;AAE1B,MAAM,cACJ,YACA,SACA,aAEA,QAAQ,MACN,WAAU,OAAO,eAAe,YAAY,iBAAiB,YAAY,MAAM,MAAM,QACvF;AAEF,MAAM,uBACJ,YACA,UACA,OACA,YACA,UACA,gBAEA,IAAI,+BAA+B;CACjC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAEH,MAAM,mBAEqC,YAAuC;CAChF,MAAM,UAAU;EACd,SAAS;EACT,GACE,iBACA,aACS;GACT,OAAO,gBAAgB,KAAA,IACnBA,mBAAqC,QAAQ,SAAS,eAAiC,IACvFA,mBACE,iBACA,WACF;EACN;EACA,MAAM,OAAwE;GAC5E,OAAO,MAAM,QAAQ,QAAQ,SAAS,CAAE,QAAQ,OAAO;EACzD;CACF;CAEA,OAAO;AACT;AAEA,MAAa,8BAAoD,CAAC;AAElE,MAAa,sBACX,aAC2D,EAAE,MAAM,gBAAgB,OAAO,EAAE;AAE9F,MAAa,mBAAsB,WACjC,OAAO,WAAW,IAAI,KAAA,IAAY,CAAC,OAAO,IAAK,GAAG,OAAO,MAAM,CAAC,CAAC;AAEnE,MAAa,8BACX,YACA,UACA,OACA,YACA,iBAEA,OAAO,KACL,IAAI,4BAA4B;CAAE;CAAc;CAAO;CAAY;CAAU;AAAW,CAAC,CAC3F;AAEF,MAAa,4BAkBX,YACA,UACA,OACA,YACA,SACA,cACA,YAEA,OAAO,IAAI,aAAa;CAEtB,MAAM,WAAW,QAAO,OADAC,QAAAA,CACS,QAAQ;EACvC,QAAQ;GAAE;GAAY;GAAU;GAAY,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EAAG;EACtF,GAAI,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa;EACrD,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;CAC7C,CAAC;CAED,IAAI,SAAS,eAAe,YAC1B,OAAO,OAAO,oBACZ,YACA,UACA,OACA,YACA,SAAS,UACT,sBAAsB,WAAW,UAAU,SAAS,WAAW,EACjE;CAGF,MAAM,SAAS,WAAW,YAAY,SAAS,SAAS,QAAQ;CAChE,IAAI,WAAW,KAAA,GACb,OAAO,OAAO,oBACZ,YACA,UACA,OACA,YACA,SAAS,UACT,WAAW,SAAS,SAAS,oCAAoC,WAAW,oBAAoB,mBAAmB,OAAO,CAAC,CAAC,KAAK,IAAI,GACvI;CAGF,MAAM,QAAQ,QACZ,SAAS,aAAa,UAAU,OAAO,UAAU,KAAA,IAC7C,WAAW,OAAO,OAAO,SAAS,KAAK,IACvCC,YAAgC,QAAQ,SAAS,KAAK,EAAA,CAC1D,KACA,OAAO,UAAS,UACd,oBACE,YACA,UACA,OACA,YACA,OAAO,YACP,MAAM,OACR,CACF,CACF;CACA,MAAM,QAAQ,QACZ,SAAS,aAAa,SAClB,WAAW,OAAO,UAAU,SAAS,QAAQ,CAAC,CAAC,KAC7C,OAAO,SAAQ,aACbC,eAAmC,QAAQ,UAAU,EAAE,MAAM,CAAC,CAChE,CACF,IACAC,eAAmC,QAAQ,SAAS,UAAU,EAAE,MAAM,CAAC,EAAA,CAC3E,KACA,OAAO,UAAS,UACd,oBACE,YACA,UACA,OACA,YACA,OAAO,YACP,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD,CACF,CACF;CAEA,OAAOC,YAA8B;EACnC,cAAc,SAAS;EACvB;EACA;EACA;CACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"auth-execution.js","names":["AuthMethodBinding.isBindingForMethod","ConnectionResolver.Service","AuthMethodExecution.decodeSetup","AuthMethodExecution.resolveDecoded","AuthMethodExecution.resolveUnknown","AuthMethodBinding.makeBinding"],"sources":["../../src/internal/auth-execution.ts"],"sourcesContent":["import type { Schema } from \"effect\";\nimport { Effect } from \"effect\";\n\nimport type * as AuthMethod from \"../AuthMethod.ts\";\nimport * as AuthMethodBinding from \"../AuthMethodBinding.ts\";\nimport * as AuthMethodExecution from \"../AuthMethodExecution.ts\";\nimport {\n type ConnectionReauthorizationRequiredError,\n type ConnectionRequiredError,\n type ConnectionSelectionRequiredError,\n type ConnectionResolverStoreError,\n type InvalidConnectionIdError,\n ConnectionIdNotAllowedError,\n ConnectionResolver,\n type ConnectionResolutionContext,\n type ConnectionTargetKind,\n InvalidResolvedConnectionError,\n} from \"../ConnectionResolver.ts\";\n\nimport { decodeJson } from \"./schema-runtime.ts\";\n\nexport type NonEmptyReadonlyArray<A> = readonly [A, ...A[]];\n\nexport type AuthSchemaRequirements<Methods extends readonly AuthMethod.Any[]> =\n Methods[number] extends infer Method\n ? Method extends AuthMethod.Any\n ? Schema.Codec.DecodingServices<AuthMethod.ValueSchema<Method>>\n : never\n : never;\n\n/**\n * Everything connection resolution may touch for one of the allowed methods:\n * setup/material/value decoding plus the method's hook requirements.\n *\n * Hook dependencies are app-defined services a host cannot know about (a\n * plugin's API client, a token issuer); surfacing them here keeps them in the\n * requirement algebra so they are either discharged at the plugin/app\n * definition via `provide` or demanded generically from whoever invokes.\n */\nexport type AuthResolutionRequirements<Methods extends readonly AuthMethod.Any[]> =\n Methods[number] extends infer Method\n ? Method extends AuthMethod.Any\n ? | (AuthMethod.SetupSchema<Method> extends Schema.Top\n ? Schema.Codec.DecodingServices<AuthMethod.SetupSchema<Method>>\n : never)\n | Schema.Codec.DecodingServices<AuthMethod.MaterialSchema<Method>>\n | Schema.Codec.DecodingServices<AuthMethod.ValueSchema<Method>>\n | AuthMethod.Requirements<Method>\n : never\n : never;\n\nexport type RuntimeConnectionErrorsFor<Methods extends readonly AuthMethod.Any[]> =\n | ConnectionIdNotAllowedError\n | ([Methods[number]] extends [never]\n ? never\n : | ConnectionRequiredError\n | ConnectionSelectionRequiredError\n | InvalidConnectionIdError\n | InvalidResolvedConnectionError\n | ConnectionReauthorizationRequiredError\n | ConnectionResolverStoreError);\n\nconst knownAuthMethodIds = (methods: readonly AuthMethod.Any[]) =>\n methods.map(method => method.identifier);\n\nconst fullAuthMethodId = (providerId: string, method: AuthMethod.Any): string =>\n `${providerId}/${method.identifier}`;\n\nconst findMethod = (\n providerId: string,\n methods: readonly AuthMethod.Any[],\n methodId: string,\n): AuthMethod.Any | undefined =>\n methods.find(\n method => method.identifier === methodId || fullAuthMethodId(providerId, method) === methodId,\n );\n\nconst invalidResolvedAuth = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methodId: string,\n description: string,\n): InvalidResolvedConnectionError =>\n new InvalidResolvedConnectionError({\n description,\n methodId,\n phase,\n providerId,\n targetId,\n targetKind,\n });\n\nconst makeAuthContext: <Methods extends readonly AuthMethod.Any[]>(\n binding: AuthMethodBinding.BindingFor<Methods>,\n) => AuthMethodBinding.Context<Methods> = (binding: AuthMethodBinding.Binding) => {\n const context = {\n current: binding,\n is(\n methodOrBinding: AuthMethod.Any | AuthMethodBinding.Binding,\n maybeMethod?: AuthMethod.Any,\n ): boolean {\n return maybeMethod === undefined\n ? AuthMethodBinding.isBindingForMethod(context.current, methodOrBinding as AuthMethod.Any)\n : AuthMethodBinding.isBindingForMethod(\n methodOrBinding as AuthMethodBinding.Binding,\n maybeMethod,\n );\n },\n match(cases: Record<string, (binding: AuthMethodBinding.Binding) => unknown>) {\n return cases[context.current.methodId]!(context.current);\n },\n };\n\n return context as never;\n};\n\nexport const noAuthRuntimeContext = (): Record<never, never> => ({});\n\nexport const authRuntimeContext = <Methods extends readonly AuthMethod.Any[]>(\n binding: AuthMethodBinding.BindingFor<Methods>,\n): { readonly auth: AuthMethodBinding.Context<Methods> } => ({ auth: makeAuthContext(binding) });\n\nexport const toNonEmptyArray = <A>(values: readonly A[]): NonEmptyReadonlyArray<A> | undefined =>\n values.length === 0 ? undefined : [values[0]!, ...values.slice(1)];\n\nexport const failConnectionIdNotAllowed = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n connectionId: string,\n): Effect.Effect<never, ConnectionIdNotAllowedError> =>\n Effect.fail(\n new ConnectionIdNotAllowedError({ connectionId, phase, providerId, targetId, targetKind }),\n );\n\nexport const resolveRuntimeConnection: <Methods extends NonEmptyReadonlyArray<AuthMethod.Any>>(\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methods: Methods,\n connectionId: string | undefined,\n context: ConnectionResolutionContext | undefined,\n) => Effect.Effect<\n AuthMethodBinding.BindingFor<Methods>,\n | ConnectionRequiredError\n | ConnectionSelectionRequiredError\n | InvalidConnectionIdError\n | InvalidResolvedConnectionError\n | ConnectionReauthorizationRequiredError\n | ConnectionResolverStoreError,\n ConnectionResolver.Service | AuthSchemaRequirements<Methods> | AuthResolutionRequirements<Methods>\n> = (\n targetKind: ConnectionTargetKind,\n targetId: string,\n phase: string | undefined,\n providerId: string,\n methods: NonEmptyReadonlyArray<AuthMethod.Any>,\n connectionId: string | undefined,\n context: ConnectionResolutionContext | undefined,\n) =>\n Effect.gen(function* () {\n const resolver = yield* ConnectionResolver.Service;\n const resolved = yield* resolver.resolve({\n target: { providerId, targetId, targetKind, ...(phase === undefined ? {} : { phase }) },\n ...(connectionId === undefined ? {} : { connectionId }),\n ...(context === undefined ? {} : { context }),\n });\n\n if (resolved.providerId !== providerId) {\n return yield* invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n resolved.methodId,\n `expected provider \"${providerId}\", got \"${resolved.providerId}\"`,\n );\n }\n\n const method = findMethod(providerId, methods, resolved.methodId);\n if (method === undefined) {\n return yield* invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n resolved.methodId,\n `method \"${resolved.methodId}\" is not registered for provider \"${providerId}\"; known methods: ${knownAuthMethodIds(methods).join(\", \")}`,\n );\n }\n\n const setup = yield* (\n resolved.encoding === \"json\" && method.setup !== undefined\n ? decodeJson(method.setup, resolved.setup)\n : AuthMethodExecution.decodeSetup(method, resolved.setup)\n ).pipe(\n Effect.mapError(error =>\n invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n method.identifier,\n error.message,\n ),\n ),\n );\n const value = yield* (\n resolved.encoding === \"json\"\n ? decodeJson(method.material, resolved.material).pipe(\n Effect.flatMap(material =>\n AuthMethodExecution.resolveDecoded(method, material, { setup }),\n ),\n )\n : AuthMethodExecution.resolveUnknown(method, resolved.material, { setup })\n ).pipe(\n Effect.mapError(error =>\n invalidResolvedAuth(\n targetKind,\n targetId,\n phase,\n providerId,\n method.identifier,\n error instanceof Error ? error.message : String(error),\n ),\n ),\n );\n\n return AuthMethodBinding.makeBinding({\n connectionId: resolved.connectionId,\n method,\n providerId,\n value,\n });\n }) as never;\n"],"mappings":";;;;;;AA8DA,MAAM,sBAAsB,YAC1B,QAAQ,KAAI,WAAU,OAAO,UAAU;AAEzC,MAAM,oBAAoB,YAAoB,WAC5C,GAAG,WAAW,GAAG,OAAO;AAE1B,MAAM,cACJ,YACA,SACA,aAEA,QAAQ,MACN,WAAU,OAAO,eAAe,YAAY,iBAAiB,YAAY,MAAM,MAAM,QACvF;AAEF,MAAM,uBACJ,YACA,UACA,OACA,YACA,UACA,gBAEA,IAAI,+BAA+B;CACjC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAEH,MAAM,mBAEqC,YAAuC;CAChF,MAAM,UAAU;EACd,SAAS;EACT,GACE,iBACA,aACS;GACT,OAAO,gBAAgB,KAAA,IACnBA,mBAAqC,QAAQ,SAAS,eAAiC,IACvFA,mBACE,iBACA,WACF;EACN;EACA,MAAM,OAAwE;GAC5E,OAAO,MAAM,QAAQ,QAAQ,SAAS,CAAE,QAAQ,OAAO;EACzD;CACF;CAEA,OAA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ACZ,SAAS,aAAa,SAClB,WAAW,OAAO,UAAU,SAAS,QAAQ,CAAC,CAAC,KAC7C,OAAO,SAAQ,aACbC,eAAmC,QAAQ,UAAU,EAAE,MAAM,CAAC,CAChE,CACF,IACAC,eAAmC,QAAQ,SAAS,UAAU,EAAE,MAAM,CAAC,EAAA,CAC3E,KACA,OAAO,UAAS,UACd,oBACE,YACA,UACA,OACA,YACA,OAAO,YACP,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD,CACF,CACF;CAEA,OAAOC,YAA8B;EACnC,cAAc,SAAS;EACvB;EACA;EACA;CACF,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Any } from "../Action.js";
|
|
2
|
-
import { Any as Any$1 } from "../
|
|
3
|
-
import { Any as Any$2 } from "../
|
|
2
|
+
import { Any as Any$1 } from "../Group.js";
|
|
3
|
+
import { Any as Any$2 } from "../Trigger.js";
|
|
4
4
|
type StructuralOwner = {
|
|
5
|
-
readonly groups: readonly Any$
|
|
5
|
+
readonly groups: readonly Any$1[];
|
|
6
6
|
readonly actions: readonly Any[];
|
|
7
|
-
readonly triggers: readonly Any$
|
|
7
|
+
readonly triggers: readonly Any$2[];
|
|
8
8
|
};
|
|
9
9
|
export type WalkedCapability<Node> = {
|
|
10
10
|
/** Machine id relative to the provider (group path included). */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Any } from "../Action.js";
|
|
2
|
-
import { Any as Any$1 } from "../
|
|
3
|
-
import { Any as Any$2 } from "../
|
|
4
|
-
export type StructuralChild = Any$
|
|
2
|
+
import { Any as Any$1 } from "../Group.js";
|
|
3
|
+
import { Any as Any$2 } from "../Trigger.js";
|
|
4
|
+
export type StructuralChild = Any$1 | Any | Any$2;
|
|
5
5
|
export type StructuralChildKind = "group" | "action" | "trigger" | "agent-channel";
|
|
6
6
|
/**
|
|
7
7
|
* Keep the children assignable to `Target`, preserving tuple order.
|
|
8
8
|
*/
|
|
9
9
|
export type FilterChildren<Children extends readonly StructuralChild[], Target> = Children extends readonly [infer Head, ...infer Tail extends readonly StructuralChild[]] ? Head extends Target ? readonly [Head, ...FilterChildren<Tail, Target>] : FilterChildren<Tail, Target> : readonly [];
|
|
10
10
|
export type PartitionedChildren = {
|
|
11
|
-
readonly groups: readonly Any$
|
|
11
|
+
readonly groups: readonly Any$1[];
|
|
12
12
|
readonly actions: readonly Any[];
|
|
13
|
-
readonly triggers: readonly Any$
|
|
13
|
+
readonly triggers: readonly Any$2[];
|
|
14
14
|
};
|
|
15
15
|
export declare const partitionChildren: (children: readonly StructuralChild[]) => PartitionedChildren;
|
|
16
16
|
type IdentifiedChild = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuilderCollisionError } from "../DefinitionError.js";
|
|
2
1
|
import { isAction } from "../Action.js";
|
|
3
|
-
import {
|
|
2
|
+
import { BuilderCollisionError } from "../DefinitionError.js";
|
|
4
3
|
import { isGroup } from "../Group.js";
|
|
4
|
+
import { isTrigger } from "../Trigger.js";
|
|
5
5
|
// src/internal/children.ts
|
|
6
6
|
/**
|
|
7
7
|
* Shared structural-children machinery for Group and Plugin builders.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Any } from "../../
|
|
2
|
-
import { Any as Any$1 } from "../../
|
|
1
|
+
import { Any } from "../../Action.js";
|
|
2
|
+
import { Any as Any$1 } from "../../AuthMethod.js";
|
|
3
|
+
import { PluginInstallation } from "../../DualRuntime.js";
|
|
3
4
|
import { Any as Any$2 } from "../../Group.js";
|
|
5
|
+
import { Any as Any$3 } from "../../Plugin.js";
|
|
4
6
|
import { MachineIdSeparator } from "../identifier.js";
|
|
5
7
|
import { IsAny, IsGenericArray } from "../types.js";
|
|
6
|
-
|
|
7
|
-
import { PluginInstallation } from "../../DualRuntime.js";
|
|
8
|
-
interface ActionEntry<Id extends string = string, ActionDef extends Any$1 = Any$1> {
|
|
8
|
+
interface ActionEntry<Id extends string = string, ActionDef extends Any = Any> {
|
|
9
9
|
readonly actionId: Id;
|
|
10
10
|
readonly action: ActionDef;
|
|
11
11
|
}
|
|
12
|
-
type ActionEntriesFromActions<Actions extends readonly Any
|
|
12
|
+
type ActionEntriesFromActions<Actions extends readonly Any[], Prefix extends string> = IsGenericArray<Actions> extends true ? ActionEntry : Actions[number] extends (infer ActionDef) ? ActionDef extends Any ? ActionEntry<`${Prefix}${typeof MachineIdSeparator}${ActionDef["identifier"]}`, ActionDef> : never : never;
|
|
13
13
|
type ActionEntriesFromGroups<Groups extends readonly Any$2[], Prefix extends string> = IsGenericArray<Groups> extends true ? ActionEntry : Groups[number] extends (infer GroupDef) ? GroupDef extends Any$2 ? GroupActionEntries<GroupDef, `${Prefix}${typeof MachineIdSeparator}${GroupDef["identifier"]}`> : never : never;
|
|
14
14
|
type GroupActionEntries<GroupDef extends Any$2, Prefix extends string> = ActionEntriesFromActions<GroupDef["actions"], Prefix> | ActionEntriesFromGroups<GroupDef["groups"], Prefix>;
|
|
15
15
|
export type PluginActionEntries<P extends Any$3> = ActionEntriesFromActions<P["actions"], P["identifier"]> | ActionEntriesFromGroups<P["groups"], P["identifier"]>;
|
|
16
16
|
export type AllActionEntries<Plugins extends readonly Any$3[]> = IsAny<Plugins> extends true ? ActionEntry : IsGenericArray<Plugins> extends true ? ActionEntry : Plugins[number] extends (infer P) ? P extends Any$3 ? PluginActionEntries<P> : never : never;
|
|
17
|
-
type GroupActions<Groups extends readonly Any$2[]> = IsGenericArray<Groups> extends true ? Any
|
|
17
|
+
type GroupActions<Groups extends readonly Any$2[]> = IsGenericArray<Groups> extends true ? Any : Groups[number] extends (infer GroupDef) ? GroupDef extends Any$2 ? GroupDef["actions"][number] | GroupActions<GroupDef["groups"]> : never : never;
|
|
18
18
|
export type PluginActions<P extends Any$3> = P["actions"][number] | GroupActions<P["groups"]>;
|
|
19
|
-
export interface RuntimeActionEntry<out ActionId extends string = string, out ProviderId extends string = string, out ActionDef extends Any
|
|
19
|
+
export interface RuntimeActionEntry<out ActionId extends string = string, out ProviderId extends string = string, out ActionDef extends Any = Any, out AllowedMethods extends readonly Any$1[] = readonly Any$1[]> {
|
|
20
20
|
readonly actionId: ActionId;
|
|
21
21
|
readonly providerId: ProviderId;
|
|
22
22
|
readonly localId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","names":["Action.Any","Group.Any","Plugin.Any","AuthMethod.Any"],"sources":["../../../src/internal/dual/actions.ts"],"mappings":";;;;;;;UASU,YAAY,4BAA4B,kBAAkBA,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","names":["Action.Any","Group.Any","Plugin.Any","AuthMethod.Any"],"sources":["../../../src/internal/dual/actions.ts"],"mappings":";;;;;;;UASU,YAAY,4BAA4B,kBAAkBA,MAAaA;WACtE,UAAU;WACV,QAAQ;;KAGd,yBAAyB,yBAAyBA,OAAc,yBACnE,eAAe,wBACX,cACA,+BAA8B,aAC5B,kBAAkBA,MAChB,eAAe,gBAAgB,qBAAqB,2BAA2B;KAIpF,wBAAwB,wBAAwBC,SAAa,yBAChE,eAAe,uBACX,cACA,8BAA6B,YAC3B,iBAAiBA,QACf,mBACE,aACG,gBAAgB,qBAAqB;KAK/C,mBAAmB,iBAAiBA,OAAW,yBAChD,yBAAyB,qBAAqB,UAC9C,wBAAwB,oBAAoB;YAEpC,oBAAoB,UAAUC,SACtC,yBAAyB,cAAc,mBACvC,wBAAwB,aAAa;YAE7B,iBAAiB,yBAAyBA,WACpD,MAAM,wBACF,cACA,eAAe,wBACb,cACA,+BAA8B,KAC5B,UAAUA,QACR,oBAAoB;KAI3B,aAAa,wBAAwBD,WACxC,eAAe,uBACXD,MACA,8BAA6B,YAC3B,iBAAiBC,QACf,8BAA8B,aAAa;YAIzC,cAAc,UAAUC,SAAc,uBAAuB,aAAa;iBAErE,uBACX,sCACA,wCACA,kBAAkBF,MAAaA,SAC/B,gCAAgCG,mBAA4BA;WAEvD,UAAU;WACV,YAAY;WACZ;WACA;WACA,QAAQ;WACR,aAAa;;qBAeX,uBAAoB,wBACP,kCACd;;qBAQC,gBAAa,wBACA,sBAAoB,kBAC5B,qBAEf"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Any } from "../../
|
|
2
|
-
import {
|
|
1
|
+
import { Action, ActionHandlerFailure, Any, Handler, InputSchema, OutputSchema } from "../../Action.js";
|
|
2
|
+
import { Any as Any$1 } from "../../AuthMethod.js";
|
|
3
3
|
import { ConnectionError, ConnectionResolutionContext, Service } from "../../ConnectionResolver.js";
|
|
4
|
+
import { Any as Any$2 } from "../../Plugin.js";
|
|
4
5
|
import { AuthResolutionRequirements, AuthSchemaRequirements } from "../auth-execution.js";
|
|
5
6
|
import { ActionHandlerServiceOf } from "../plugin-handlers.js";
|
|
6
|
-
import { Any as Any$2 } from "../../Plugin.js";
|
|
7
7
|
import { PluginActionEntries } from "./actions.js";
|
|
8
8
|
import { Effect, Schema } from "effect";
|
|
9
9
|
export interface InvokeRequest {
|
|
@@ -54,8 +54,8 @@ export type InvokeError = ActionNotFoundError | InvokeResolvedActionError;
|
|
|
54
54
|
export type InvokeRequirementsFor<Plugins extends readonly Any$2[], ActionId extends string> = Plugins[number] extends (infer P) ? P extends Any$2 ? PluginRequirements<P, Extract<PluginActionEntries<P>, {
|
|
55
55
|
readonly actionId: ActionId;
|
|
56
56
|
}>["action"]> : never : never;
|
|
57
|
-
export type PluginRequirements<P extends Any$2, ActionDef extends Any
|
|
58
|
-
export declare const invokeResolvedAction: <ActionId extends string, Input extends Schema.Top, Output extends Schema.Top, ActionAuthMethods extends readonly Any[]>(providerId: string, actionId: ActionId, pluginVersion: string, action: Action<string, Input, Output>, authMethods: ActionAuthMethods, request: InvokeRequest) => Effect.Effect<InvokeSuccess<ActionId, Output["Type"]>, InvokeResolvedActionError, Handler<ActionId> | Input["DecodingServices"] | Output["EncodingServices"] | ([ActionAuthMethods[number]] extends [never] ? never : Service | AuthResolutionRequirements<ActionAuthMethods> | AuthSchemaRequirements<ActionAuthMethods>)>;
|
|
59
|
-
export declare const invokeResolvedActionJson: <ActionId extends string, Input extends Schema.Top, Output extends Schema.Top, ActionAuthMethods extends readonly Any[]>(providerId: string, actionId: ActionId, pluginVersion: string, action: Action<string, Input, Output>, authMethods: ActionAuthMethods, request: InvokeRequest) => Effect.Effect<InvokeSuccess<ActionId, Schema.Json>, InvokeResolvedActionError, Handler<ActionId> | Input["DecodingServices"] | Output["EncodingServices"] | ([ActionAuthMethods[number]] extends [never] ? never : Service | AuthResolutionRequirements<ActionAuthMethods> | AuthSchemaRequirements<ActionAuthMethods>)>;
|
|
57
|
+
export type PluginRequirements<P extends Any$2, ActionDef extends Any> = [ActionDef] extends [never] ? never : ActionHandlerServiceOf<P> | InputSchema<ActionDef>["DecodingServices"] | OutputSchema<ActionDef>["EncodingServices"] | ([P["authMethods"][number]] extends [never] ? never : Service | AuthSchemaRequirements<P["authMethods"]> | AuthResolutionRequirements<P["authMethods"]>);
|
|
58
|
+
export declare const invokeResolvedAction: <ActionId extends string, Input extends Schema.Top, Output extends Schema.Top, ActionAuthMethods extends readonly Any$1[]>(providerId: string, actionId: ActionId, pluginVersion: string, action: Action<string, Input, Output>, authMethods: ActionAuthMethods, request: InvokeRequest) => Effect.Effect<InvokeSuccess<ActionId, Output["Type"]>, InvokeResolvedActionError, Handler<ActionId> | Input["DecodingServices"] | Output["EncodingServices"] | ([ActionAuthMethods[number]] extends [never] ? never : Service | AuthResolutionRequirements<ActionAuthMethods> | AuthSchemaRequirements<ActionAuthMethods>)>;
|
|
59
|
+
export declare const invokeResolvedActionJson: <ActionId extends string, Input extends Schema.Top, Output extends Schema.Top, ActionAuthMethods extends readonly Any$1[]>(providerId: string, actionId: ActionId, pluginVersion: string, action: Action<string, Input, Output>, authMethods: ActionAuthMethods, request: InvokeRequest) => Effect.Effect<InvokeSuccess<ActionId, Schema.Json>, InvokeResolvedActionError, Handler<ActionId> | Input["DecodingServices"] | Output["EncodingServices"] | ([ActionAuthMethods[number]] extends [never] ? never : Service | AuthResolutionRequirements<ActionAuthMethods> | AuthSchemaRequirements<ActionAuthMethods>)>;
|
|
60
60
|
export {};
|
|
61
61
|
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","names":["Action.ActionHandlerFailure","Plugin.Any","Action.Any","Action.InputSchema","Action.OutputSchema","ConnectionResolverService","AuthMethod.Any","Action.Action","Action.Handler"],"sources":["../../../src/internal/dual/invoke.ts"],"mappings":";;;;;;;;iBAyBiB;WACN;;WAEA;WACA;WACA;WACA;WACA,UAAU;;iBAGJ,WAAW;WACjB,UAAU;WACV;WACA;;iBAGM,cAAc,kCAAkC;WACtD,MAAM;WACN,MAAM,WAAW;;;;;;qBAGf,mBAAmB;;;;qBAKnB,4BAA4B;;;;;;qBAK5B,gCAAgC;;;;qBAKhC,mCAAmC;;;;;;qBAKnC,iCAAiC;KAKzC,4BACD,0BACA,2BACA,6BACAA,uBACA;YAEQ,cAAc,sBAAsB;YAEpC,sBACV,yBAAyBC,SACzB,2BACE,+BAA8B,KAC9B,UAAUA,QACR,mBACE,GACA,QAAQ,oBAAoB;WAAe,UAAU;;YAKjD,mBAAmB,UAAUA,OAAY,kBAAkBC,
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","names":["Action.ActionHandlerFailure","Plugin.Any","Action.Any","Action.InputSchema","Action.OutputSchema","ConnectionResolverService","AuthMethod.Any","Action.Action","Action.Handler"],"sources":["../../../src/internal/dual/invoke.ts"],"mappings":";;;;;;;;iBAyBiB;WACN;;WAEA;WACA;WACA;WACA;WACA,UAAU;;iBAGJ,WAAW;WACjB,UAAU;WACV;WACA;;iBAGM,cAAc,kCAAkC;WACtD,MAAM;WACN,MAAM,WAAW;;;;;;qBAGf,mBAAmB;;;;qBAKnB,4BAA4B;;;;;;qBAK5B,gCAAgC;;;;qBAKhC,mCAAmC;;;;;;qBAKnC,iCAAiC;KAKzC,4BACD,0BACA,2BACA,6BACAA,uBACA;YAEQ,cAAc,sBAAsB;YAEpC,sBACV,yBAAyBC,SACzB,2BACE,+BAA8B,KAC9B,UAAUA,QACR,mBACE,GACA,QAAQ,oBAAoB;WAAe,UAAU;;YAKjD,mBAAmB,UAAUA,OAAY,kBAAkBC,QACrE,qCAGI,uBAAuB,KACvBC,YAAmB,iCACnBC,aAAoB,mCAClB,oDAEIC,UACA,uBAAuB,oBACvB,2BAA2B;qBAmJ1B,uBACX,yBACA,cAAc,OAAO,KACrB,eAAe,OAAO,KACtB,mCAAmCC,SAAgB,oBAEjC,UACR,UAAQ,uBACG,QACbC,eAAsB,OAAO,SAAO,aAC/B,mBAAiB,SACrB,kBAAa,OAAA,OAAA,cAAA,UAAA,iBAAA,2BAAAC,QAAA,YAAA,4BAAA,+BAAA,qDAAAH,UAAA,2BAAA,qBAAA,uBAAA;qBAYX,2BACX,yBACA,cAAc,OAAO,KACrB,eAAe,OAAO,KACtB,mCAAmCC,SAAgB,oBAEjC,UACR,UAAQ,uBACG,QACbC,eAAsB,OAAO,SAAO,aAC/B,mBAAiB,SACrB,kBAAa,OAAA,OAAA,cAAA,UAAA,OAAA,OAAA,2BAAAC,QAAA,YAAA,4BAAA,+BAAA,qDAAAH,UAAA,2BAAA,qBAAA,uBAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handlerKey } from "../../Action.js";
|
|
2
|
+
import { authRuntimeContext, failConnectionIdNotAllowed, noAuthRuntimeContext, resolveRuntimeConnection, toNonEmptyArray } from "../auth-execution.js";
|
|
2
3
|
import { findHandler, mergeUnder } from "../handler-context.js";
|
|
3
4
|
import { decodeJsonMapError } from "../schema-runtime.js";
|
|
4
|
-
import { authRuntimeContext, failConnectionIdNotAllowed, noAuthRuntimeContext, resolveRuntimeConnection, toNonEmptyArray } from "../auth-execution.js";
|
|
5
5
|
import { Effect, Schema, SchemaIssue } from "effect";
|
|
6
6
|
// src/internal/dual/invoke.ts
|
|
7
7
|
var FieldIssue = class extends Schema.Class("FieldIssue")({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.js","names":["Action.handlerKey"],"sources":["../../../src/internal/dual/invoke.ts"],"sourcesContent":["import { Effect, Schema, SchemaIssue } from \"effect\";\n\nimport * as Action from \"../../Action.ts\";\nimport type * as AuthMethod from \"../../AuthMethod.ts\";\nimport type {\n ConnectionError,\n ConnectionResolutionContext,\n Service as ConnectionResolverService,\n} from \"../../ConnectionResolver.ts\";\nimport type * as Plugin from \"../../Plugin.ts\";\nimport {\n authRuntimeContext,\n failConnectionIdNotAllowed,\n noAuthRuntimeContext,\n resolveRuntimeConnection,\n type AuthResolutionRequirements,\n type AuthSchemaRequirements,\n toNonEmptyArray,\n} from \"../auth-execution.ts\";\nimport { findHandler, mergeUnder } from \"../handler-context.ts\";\nimport type { ActionHandlerServiceOf } from \"../plugin-handlers.ts\";\nimport { decodeJsonMapError } from \"../schema-runtime.ts\";\n\nimport type { PluginActionEntries } from \"./actions.ts\";\n\nexport interface InvokeRequest {\n readonly actionId: string;\n /** The exact plugin release the caller pinned; another installed release does not run. */\n readonly actionVersion?: string;\n readonly pluginKey?: string;\n readonly input: unknown;\n readonly connectionId?: string;\n readonly context?: ConnectionResolutionContext;\n}\n\nexport interface InvokeMeta<ActionId extends string = string> {\n readonly actionId: ActionId;\n readonly providerId: string;\n readonly pluginVersion: string;\n}\n\nexport interface InvokeSuccess<ActionId extends string = string, Data = unknown> {\n readonly data: Data;\n readonly meta: InvokeMeta<ActionId>;\n}\n\nexport class FieldIssue extends Schema.Class<FieldIssue>(\"FieldIssue\")({\n message: Schema.String,\n path: Schema.String,\n}) {}\n\nexport class ActionNotFoundError extends Schema.TaggedError<ActionNotFoundError>()(\n \"ActionNotFoundError\",\n { actionId: Schema.String },\n) {}\n\nexport class InvalidActionInputError extends Schema.TaggedError<InvalidActionInputError>()(\n \"InvalidActionInputError\",\n { actionId: Schema.String, description: Schema.String, fields: Schema.Array(FieldIssue) },\n) {}\n\nexport class ActionHandlerNotFoundError extends Schema.TaggedError<ActionHandlerNotFoundError>()(\n \"ActionHandlerNotFoundError\",\n { actionId: Schema.String },\n) {}\n\nexport class InvalidActionOutputError extends Schema.TaggedError<InvalidActionOutputError>()(\n \"InvalidActionOutputError\",\n { actionId: Schema.String, description: Schema.String, fields: Schema.Array(FieldIssue) },\n) {}\n\ntype InvokeResolvedActionError =\n | InvalidActionInputError\n | InvalidActionOutputError\n | ActionHandlerNotFoundError\n | Action.ActionHandlerFailure\n | ConnectionError;\n\nexport type InvokeError = ActionNotFoundError | InvokeResolvedActionError;\n\nexport type InvokeRequirementsFor<\n Plugins extends readonly Plugin.Any[],\n ActionId extends string,\n> = Plugins[number] extends infer P\n ? P extends Plugin.Any\n ? PluginRequirements<\n P,\n Extract<PluginActionEntries<P>, { readonly actionId: ActionId }>[\"action\"]\n >\n : never\n : never;\n\nexport type PluginRequirements<P extends Plugin.Any, ActionDef extends Action.Any> = [\n ActionDef,\n] extends [never]\n ? never\n :\n | ActionHandlerServiceOf<P>\n | Action.InputSchema<ActionDef>[\"DecodingServices\"]\n | Action.OutputSchema<ActionDef>[\"EncodingServices\"]\n | ([P[\"authMethods\"][number]] extends [never]\n ? never\n :\n | ConnectionResolverService\n | AuthSchemaRequirements<P[\"authMethods\"]>\n | AuthResolutionRequirements<P[\"authMethods\"]>);\n\nconst schemaIssueFormatter = SchemaIssue.makeFormatterStandardSchemaV1();\n\nconst formatFieldPath = (path: readonly unknown[]): string => {\n let current = \"$\";\n\n for (const segment of path) {\n if (typeof segment === \"number\") {\n current += `[${segment}]`;\n continue;\n }\n\n const key = String(segment);\n current += /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n }\n\n return current;\n};\n\nconst schemaErrorFields = (error: Schema.SchemaError): readonly FieldIssue[] =>\n schemaIssueFormatter(error.issue).issues.map(\n issue => new FieldIssue({ message: issue.message, path: formatFieldPath(issue.path ?? []) }),\n );\n\nconst decodeActionInput = <Input extends Schema.Top>(\n actionId: string,\n schema: Input,\n input: unknown,\n): Effect.Effect<Input[\"Type\"], InvalidActionInputError, Input[\"DecodingServices\"]> =>\n decodeJsonMapError(\n schema,\n input,\n error =>\n new InvalidActionInputError({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n );\n\nconst validateActionOutput = <Output extends Schema.Top>(\n actionId: string,\n schema: Output,\n output: Output[\"Type\"],\n): Effect.Effect<Output[\"Type\"], InvalidActionOutputError, Output[\"EncodingServices\"]> =>\n Schema.encodeEffect(schema)(output).pipe(\n Effect.as(output),\n Effect.mapError(\n error =>\n new InvalidActionOutputError({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n ),\n );\n\nconst getActionHandler = <ActionId extends string>(\n providerId: string,\n actionId: ActionId,\n): Effect.Effect<Action.Handler<ActionId>, ActionHandlerNotFoundError, Action.Handler<ActionId>> =>\n Effect.context<Action.Handler<ActionId>>().pipe(\n Effect.flatMap(context => {\n const handler = findHandler(context, providerId, Action.handlerKey(actionId)) as\n | Action.Handler<ActionId>\n | undefined;\n\n return handler === undefined\n ? Effect.fail(new ActionHandlerNotFoundError({ actionId }))\n : Effect.succeed(handler);\n }),\n );\n\nconst invokeResolvedActionWithOutput = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n OutputValue,\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n finish: (\n output: unknown,\n ) => Effect.Effect<OutputValue, InvalidActionOutputError, Output[\"EncodingServices\"]>,\n): Effect.Effect<\n InvokeSuccess<ActionId, OutputValue>,\n InvokeResolvedActionError,\n | Action.Handler<ActionId>\n | Input[\"DecodingServices\"]\n | Output[\"EncodingServices\"]\n | ([ActionAuthMethods[number]] extends [never]\n ? never\n :\n | ConnectionResolverService\n | AuthSchemaRequirements<ActionAuthMethods>\n | AuthResolutionRequirements<ActionAuthMethods>)\n> => {\n const requiredAuthMethods = toNonEmptyArray(authMethods);\n\n if (requiredAuthMethods === undefined && request.connectionId !== undefined) {\n return failConnectionIdNotAllowed(\n \"action\",\n actionId,\n undefined,\n providerId,\n request.connectionId,\n );\n }\n\n return getActionHandler(providerId, actionId).pipe(\n Effect.flatMap(handler =>\n decodeActionInput(actionId, action.input, request.input).pipe(\n Effect.flatMap(decodedInput =>\n requiredAuthMethods === undefined ||\n // Only an explicit false skips auth for definitions built outside the SDK.\n (action.requireAuth === false && request.connectionId === undefined)\n ? Effect.suspend(() => handler.handler(decodedInput, noAuthRuntimeContext()))\n : resolveRuntimeConnection(\n \"action\",\n actionId,\n undefined,\n providerId,\n requiredAuthMethods,\n request.connectionId,\n request.context,\n ).pipe(\n Effect.flatMap(binding =>\n Effect.suspend(() => handler.handler(decodedInput, authRuntimeContext(binding))),\n ),\n ),\n ),\n Effect.updateContext(input => mergeUnder(handler.context, input)),\n ),\n ),\n Effect.flatMap(finish),\n Effect.map((data): InvokeSuccess<ActionId, OutputValue> => ({\n data,\n meta: { actionId, pluginVersion, providerId },\n })),\n );\n};\n\nexport const invokeResolvedAction = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n) =>\n invokeResolvedActionWithOutput(\n providerId,\n actionId,\n pluginVersion,\n action,\n authMethods,\n request,\n data => validateActionOutput(actionId, action.output, data as Output[\"Type\"]),\n );\n\nexport const invokeResolvedActionJson = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n) =>\n invokeResolvedActionWithOutput(\n providerId,\n actionId,\n pluginVersion,\n action,\n authMethods,\n request,\n data =>\n Schema.encodeUnknownEffect(Schema.toCodecJson(action.output))(data).pipe(\n Effect.mapError(error =>\n InvalidActionOutputError.make({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n ),\n ),\n );\n"],"mappings":";;;;;;AA8CA,IAAa,aAAb,cAAgC,OAAO,MAAkB,YAAY,CAAC,CAAC;CACrE,SAAS,OAAO;CAChB,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA,EAAE,UAAU,OAAO,OAAO,CAC5B,CAAC,CAAC,CAAC;AAEH,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CACxF,2BACA;CAAE,UAAU,OAAO;CAAQ,aAAa,OAAO;CAAQ,QAAQ,OAAO,MAAM,UAAU;AAAE,CAC1F,CAAC,CAAC,CAAC;AAEH,IAAa,6BAAb,cAAgD,OAAO,YAAwC,CAAC,CAC9F,8BACA,EAAE,UAAU,OAAO,OAAO,CAC5B,CAAC,CAAC,CAAC;AAEH,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA;CAAE,UAAU,OAAO;CAAQ,aAAa,OAAO;CAAQ,QAAQ,OAAO,MAAM,UAAU;AAAE,CAC1F,CAAC,CAAC,CAAC;AAsCH,MAAM,uBAAuB,YAAY,8BAA8B;AAEvE,MAAM,mBAAmB,SAAqC;CAC5D,IAAI,UAAU;CAEd,KAAK,MAAM,WAAW,MAAM;EAC1B,IAAI,OAAO,YAAY,UAAU;GAC/B,WAAW,IAAI,QAAQ;GACvB;EACF;EAEA,MAAM,MAAM,OAAO,OAAO;EAC1B,WAAW,8BAA8B,KAAK,GAAG,IAAI,IAAI,QAAQ,IAAI,KAAK,UAAU,GAAG,EAAE;CAC3F;CAEA,OAAO;AACT;AAEA,MAAM,qBAAqB,UACzB,qBAAqB,MAAM,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UACA,UACA,KAAA,GACA,YACA,qBACA,QAAQ,cACR,QAAQ,OACV,CAAC,CAAC,KACA,OAAO,SAAQ,YACb,OAAO,cAAc,QAAQ,QAAQ,cAAc,mBAAmB,OAAO,CAAC,CAAC,CACjF,CACF,CACN,GACA,OAAO,eAAc,UAAS,WAAW,QAAQ,SAAS,KAAK,CAAC,CAClE,CACF,GACA,OAAO,QAAQ,MAAM,GACrB,OAAO,KAAK,UAAgD;EAC1D;EACA,MAAM;GAAE;GAAU;GAAe;EAAW;CAC9C,EAAE,CACJ;AACF;AAEA,MAAa,wBAMX,YACA,UACA,eACA,QACA,aACA,YAEA,+BACE,YACA,UACA,eACA,QACA,aACA,UACA,SAAQ,qBAAqB,UAAU,OAAO,QAAQ,IAAsB,CAC9E;AAEF,MAAa,4BAMX,YACA,UACA,eACA,QACA,aACA,YAEA,+BACE,YACA,UACA,eACA,QACA,aACA,UACA,SACE,OAAO,oBAAoB,OAAO,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAClE,OAAO,UAAS,UACd,yBAAyB,KAAK;CAC5B;CACA,aAAa,MAAM;CACnB,QAAQ,kBAAkB,KAAK;AACjC,CAAC,CACH,CACF,CACJ"}
|
|
1
|
+
{"version":3,"file":"invoke.js","names":["Action.handlerKey"],"sources":["../../../src/internal/dual/invoke.ts"],"sourcesContent":["import { Effect, Schema, SchemaIssue } from \"effect\";\n\nimport * as Action from \"../../Action.ts\";\nimport type * as AuthMethod from \"../../AuthMethod.ts\";\nimport type {\n ConnectionError,\n ConnectionResolutionContext,\n Service as ConnectionResolverService,\n} from \"../../ConnectionResolver.ts\";\nimport type * as Plugin from \"../../Plugin.ts\";\nimport {\n authRuntimeContext,\n failConnectionIdNotAllowed,\n noAuthRuntimeContext,\n resolveRuntimeConnection,\n type AuthResolutionRequirements,\n type AuthSchemaRequirements,\n toNonEmptyArray,\n} from \"../auth-execution.ts\";\nimport { findHandler, mergeUnder } from \"../handler-context.ts\";\nimport type { ActionHandlerServiceOf } from \"../plugin-handlers.ts\";\nimport { decodeJsonMapError } from \"../schema-runtime.ts\";\n\nimport type { PluginActionEntries } from \"./actions.ts\";\n\nexport interface InvokeRequest {\n readonly actionId: string;\n /** The exact plugin release the caller pinned; another installed release does not run. */\n readonly actionVersion?: string;\n readonly pluginKey?: string;\n readonly input: unknown;\n readonly connectionId?: string;\n readonly context?: ConnectionResolutionContext;\n}\n\nexport interface InvokeMeta<ActionId extends string = string> {\n readonly actionId: ActionId;\n readonly providerId: string;\n readonly pluginVersion: string;\n}\n\nexport interface InvokeSuccess<ActionId extends string = string, Data = unknown> {\n readonly data: Data;\n readonly meta: InvokeMeta<ActionId>;\n}\n\nexport class FieldIssue extends Schema.Class<FieldIssue>(\"FieldIssue\")({\n message: Schema.String,\n path: Schema.String,\n}) {}\n\nexport class ActionNotFoundError extends Schema.TaggedError<ActionNotFoundError>()(\n \"ActionNotFoundError\",\n { actionId: Schema.String },\n) {}\n\nexport class InvalidActionInputError extends Schema.TaggedError<InvalidActionInputError>()(\n \"InvalidActionInputError\",\n { actionId: Schema.String, description: Schema.String, fields: Schema.Array(FieldIssue) },\n) {}\n\nexport class ActionHandlerNotFoundError extends Schema.TaggedError<ActionHandlerNotFoundError>()(\n \"ActionHandlerNotFoundError\",\n { actionId: Schema.String },\n) {}\n\nexport class InvalidActionOutputError extends Schema.TaggedError<InvalidActionOutputError>()(\n \"InvalidActionOutputError\",\n { actionId: Schema.String, description: Schema.String, fields: Schema.Array(FieldIssue) },\n) {}\n\ntype InvokeResolvedActionError =\n | InvalidActionInputError\n | InvalidActionOutputError\n | ActionHandlerNotFoundError\n | Action.ActionHandlerFailure\n | ConnectionError;\n\nexport type InvokeError = ActionNotFoundError | InvokeResolvedActionError;\n\nexport type InvokeRequirementsFor<\n Plugins extends readonly Plugin.Any[],\n ActionId extends string,\n> = Plugins[number] extends infer P\n ? P extends Plugin.Any\n ? PluginRequirements<\n P,\n Extract<PluginActionEntries<P>, { readonly actionId: ActionId }>[\"action\"]\n >\n : never\n : never;\n\nexport type PluginRequirements<P extends Plugin.Any, ActionDef extends Action.Any> = [\n ActionDef,\n] extends [never]\n ? never\n : | ActionHandlerServiceOf<P>\n | Action.InputSchema<ActionDef>[\"DecodingServices\"]\n | Action.OutputSchema<ActionDef>[\"EncodingServices\"]\n | ([P[\"authMethods\"][number]] extends [never]\n ? never\n : | ConnectionResolverService\n | AuthSchemaRequirements<P[\"authMethods\"]>\n | AuthResolutionRequirements<P[\"authMethods\"]>);\n\nconst schemaIssueFormatter = SchemaIssue.makeFormatterStandardSchemaV1();\n\nconst formatFieldPath = (path: readonly unknown[]): string => {\n let current = \"$\";\n\n for (const segment of path) {\n if (typeof segment === \"number\") {\n current += `[${segment}]`;\n continue;\n }\n\n const key = String(segment);\n current += /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n }\n\n return current;\n};\n\nconst schemaErrorFields = (error: Schema.SchemaError): readonly FieldIssue[] =>\n schemaIssueFormatter(error.issue).issues.map(\n issue => new FieldIssue({ message: issue.message, path: formatFieldPath(issue.path ?? []) }),\n );\n\nconst decodeActionInput = <Input extends Schema.Top>(\n actionId: string,\n schema: Input,\n input: unknown,\n): Effect.Effect<Input[\"Type\"], InvalidActionInputError, Input[\"DecodingServices\"]> =>\n decodeJsonMapError(\n schema,\n input,\n error =>\n new InvalidActionInputError({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n );\n\nconst validateActionOutput = <Output extends Schema.Top>(\n actionId: string,\n schema: Output,\n output: Output[\"Type\"],\n): Effect.Effect<Output[\"Type\"], InvalidActionOutputError, Output[\"EncodingServices\"]> =>\n Schema.encodeEffect(schema)(output).pipe(\n Effect.as(output),\n Effect.mapError(\n error =>\n new InvalidActionOutputError({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n ),\n );\n\nconst getActionHandler = <ActionId extends string>(\n providerId: string,\n actionId: ActionId,\n): Effect.Effect<Action.Handler<ActionId>, ActionHandlerNotFoundError, Action.Handler<ActionId>> =>\n Effect.context<Action.Handler<ActionId>>().pipe(\n Effect.flatMap(context => {\n const handler = findHandler(context, providerId, Action.handlerKey(actionId)) as\n | Action.Handler<ActionId>\n | undefined;\n\n return handler === undefined\n ? Effect.fail(new ActionHandlerNotFoundError({ actionId }))\n : Effect.succeed(handler);\n }),\n );\n\nconst invokeResolvedActionWithOutput = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n OutputValue,\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n finish: (\n output: unknown,\n ) => Effect.Effect<OutputValue, InvalidActionOutputError, Output[\"EncodingServices\"]>,\n): Effect.Effect<\n InvokeSuccess<ActionId, OutputValue>,\n InvokeResolvedActionError,\n | Action.Handler<ActionId>\n | Input[\"DecodingServices\"]\n | Output[\"EncodingServices\"]\n | ([ActionAuthMethods[number]] extends [never]\n ? never\n : | ConnectionResolverService\n | AuthSchemaRequirements<ActionAuthMethods>\n | AuthResolutionRequirements<ActionAuthMethods>)\n> => {\n const requiredAuthMethods = toNonEmptyArray(authMethods);\n\n if (requiredAuthMethods === undefined && request.connectionId !== undefined) {\n return failConnectionIdNotAllowed(\n \"action\",\n actionId,\n undefined,\n providerId,\n request.connectionId,\n );\n }\n\n return getActionHandler(providerId, actionId).pipe(\n Effect.flatMap(handler =>\n decodeActionInput(actionId, action.input, request.input).pipe(\n Effect.flatMap(decodedInput =>\n requiredAuthMethods === undefined ||\n // Only an explicit false skips auth for definitions built outside the SDK.\n (action.requireAuth === false && request.connectionId === undefined)\n ? Effect.suspend(() => handler.handler(decodedInput, noAuthRuntimeContext()))\n : resolveRuntimeConnection(\n \"action\",\n actionId,\n undefined,\n providerId,\n requiredAuthMethods,\n request.connectionId,\n request.context,\n ).pipe(\n Effect.flatMap(binding =>\n Effect.suspend(() => handler.handler(decodedInput, authRuntimeContext(binding))),\n ),\n ),\n ),\n Effect.updateContext(input => mergeUnder(handler.context, input)),\n ),\n ),\n Effect.flatMap(finish),\n Effect.map((data): InvokeSuccess<ActionId, OutputValue> => ({\n data,\n meta: { actionId, pluginVersion, providerId },\n })),\n );\n};\n\nexport const invokeResolvedAction = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n) =>\n invokeResolvedActionWithOutput(\n providerId,\n actionId,\n pluginVersion,\n action,\n authMethods,\n request,\n data => validateActionOutput(actionId, action.output, data as Output[\"Type\"]),\n );\n\nexport const invokeResolvedActionJson = <\n ActionId extends string,\n Input extends Schema.Top,\n Output extends Schema.Top,\n ActionAuthMethods extends readonly AuthMethod.Any[],\n>(\n providerId: string,\n actionId: ActionId,\n pluginVersion: string,\n action: Action.Action<string, Input, Output>,\n authMethods: ActionAuthMethods,\n request: InvokeRequest,\n) =>\n invokeResolvedActionWithOutput(\n providerId,\n actionId,\n pluginVersion,\n action,\n authMethods,\n request,\n data =>\n Schema.encodeUnknownEffect(Schema.toCodecJson(action.output))(data).pipe(\n Effect.mapError(error =>\n InvalidActionOutputError.make({\n actionId,\n description: error.message,\n fields: schemaErrorFields(error),\n }),\n ),\n ),\n );\n"],"mappings":";;;;;;AA8CA,IAAa,aAAb,cAAgC,OAAO,MAAkB,YAAY,CAAC,CAAC;CACrE,SAAS,OAAO;CAChB,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA,EAAE,UAAU,OAAO,OAAO,CAC5B,CAAC,CAAC,CAAC;AAEH,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CACxF,2BACA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A,UACA,eACA,QACA,aACA,YAEA,+BACE,YACA,UACA,eACA,QACA,aACA,UACA,SACE,OAAO,oBAAoB,OAAO,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAClE,OAAO,UAAS,UACd,yBAAyB,KAAK;CAC5B;CACA,aAAa,MAAM;CACnB,QAAQ,kBAAkB,KAAK;AACjC,CAAC,CACH,CACF,CACJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AuthMethodKind } from "../../AuthMethod.js";
|
|
2
1
|
import { Exposure, Features, RequiredChecks } from "../../AgentChannel.js";
|
|
3
|
-
import { Category } from "../../Plugin.js";
|
|
4
2
|
import { Any } from "../../AiProvider.js";
|
|
3
|
+
import { AuthMethodKind } from "../../AuthMethod.js";
|
|
5
4
|
import { PluginInstallation } from "../../DualRuntime.js";
|
|
5
|
+
import { Category } from "../../Plugin.js";
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
export interface MaterializedRegistryOptions {
|
|
8
8
|
readonly schemaJson?: ((schema: Schema.Top) => unknown) | undefined;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Any } from "../../AuthMethod.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Any as Any$
|
|
2
|
+
import { PluginInstallation } from "../../DualRuntime.js";
|
|
3
|
+
import { Any as Any$1 } from "../../Group.js";
|
|
4
|
+
import { Any as Any$2 } from "../../Plugin.js";
|
|
5
|
+
import { Any as Any$3, RuntimeTriggerEntry as RuntimeTriggerEntry$1 } from "../../Trigger.js";
|
|
4
6
|
import { MachineIdSeparator } from "../identifier.js";
|
|
5
7
|
import { IsAny, IsGenericArray } from "../types.js";
|
|
6
|
-
|
|
7
|
-
import { PluginInstallation } from "../../DualRuntime.js";
|
|
8
|
-
export interface TriggerEntry<Id extends string = string, ProviderId extends string = string, TriggerDef extends Any$1 = Any$1, AllowedMethods extends readonly Any[] = readonly Any[]> {
|
|
8
|
+
export interface TriggerEntry<Id extends string = string, ProviderId extends string = string, TriggerDef extends Any$3 = Any$3, AllowedMethods extends readonly Any[] = readonly Any[]> {
|
|
9
9
|
readonly triggerId: Id;
|
|
10
10
|
readonly providerId: ProviderId;
|
|
11
11
|
readonly trigger: TriggerDef;
|
|
12
12
|
readonly authMethods: AllowedMethods;
|
|
13
13
|
}
|
|
14
|
-
type TriggerEntriesFromTriggers<Triggers extends readonly Any$
|
|
15
|
-
type TriggerEntriesFromGroups<Groups extends readonly Any$
|
|
16
|
-
type GroupTriggerEntries<GroupDef extends Any$
|
|
17
|
-
type PluginTriggerEntries<P extends Any$
|
|
18
|
-
export type AllTriggerEntries<Plugins extends readonly Any$
|
|
19
|
-
export interface RuntimeTriggerEntry<out TriggerDef extends Any$
|
|
14
|
+
type TriggerEntriesFromTriggers<Triggers extends readonly Any$3[], ProviderId extends string, Prefix extends string, AllowedMethods extends readonly Any[]> = IsGenericArray<Triggers> extends true ? TriggerEntry<string, ProviderId, Any$3, AllowedMethods> : Triggers[number] extends (infer TriggerDef) ? TriggerDef extends Any$3 ? TriggerEntry<`${Prefix}${typeof MachineIdSeparator}${TriggerDef["identifier"]}`, ProviderId, TriggerDef, AllowedMethods> : never : never;
|
|
15
|
+
type TriggerEntriesFromGroups<Groups extends readonly Any$1[], ProviderId extends string, Prefix extends string, AllowedMethods extends readonly Any[]> = IsGenericArray<Groups> extends true ? TriggerEntry<string, ProviderId, Any$3, AllowedMethods> : Groups[number] extends (infer GroupDef) ? GroupDef extends Any$1 ? GroupTriggerEntries<GroupDef, ProviderId, `${Prefix}${typeof MachineIdSeparator}${GroupDef["identifier"]}`, AllowedMethods> : never : never;
|
|
16
|
+
type GroupTriggerEntries<GroupDef extends Any$1, ProviderId extends string, Prefix extends string, AllowedMethods extends readonly Any[]> = TriggerEntriesFromTriggers<GroupDef["triggers"], ProviderId, Prefix, AllowedMethods> | TriggerEntriesFromGroups<GroupDef["groups"], ProviderId, Prefix, AllowedMethods>;
|
|
17
|
+
type PluginTriggerEntries<P extends Any$2> = TriggerEntriesFromTriggers<P["triggers"], P["identifier"], P["identifier"], P["authMethods"]> | TriggerEntriesFromGroups<P["groups"], P["identifier"], P["identifier"], P["authMethods"]>;
|
|
18
|
+
export type AllTriggerEntries<Plugins extends readonly Any$2[]> = IsAny<Plugins> extends true ? TriggerEntry : IsGenericArray<Plugins> extends true ? TriggerEntry : Plugins[number] extends (infer P) ? P extends Any$2 ? PluginTriggerEntries<P> : never : never;
|
|
19
|
+
export interface RuntimeTriggerEntry<out TriggerDef extends Any$3 = Any$3, out AllowedMethods extends readonly Any[] = readonly Any[], out TriggerId extends string = string, out ProviderId extends string = string> extends RuntimeTriggerEntry$1<TriggerDef, AllowedMethods, TriggerId, ProviderId> {
|
|
20
20
|
readonly localId: string;
|
|
21
21
|
readonly pluginVersion: string;
|
|
22
22
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Any } from "../AuthMethod.js";
|
|
2
1
|
import { Handler } from "../AgentChannel.js";
|
|
3
|
-
import { Any
|
|
4
|
-
import { Any as Any$
|
|
2
|
+
import { Any } from "../AuthMethod.js";
|
|
3
|
+
import { Any as Any$1 } from "../Group.js";
|
|
4
|
+
import { Any as Any$2 } from "../Plugin.js";
|
|
5
|
+
import { Any as Any$3, Handler as Handler$1 } from "../Trigger.js";
|
|
5
6
|
import { MachineIdSeparator } from "./identifier.js";
|
|
6
7
|
import { IsGenericArray, JoinPrefix } from "./types.js";
|
|
7
|
-
import { Any as Any$3 } from "../Plugin.js";
|
|
8
8
|
import { Context, Effect } from "effect";
|
|
9
|
-
type LocalTriggerEntriesFromTriggers<Triggers extends readonly Any$
|
|
9
|
+
type LocalTriggerEntriesFromTriggers<Triggers extends readonly Any$3[], Prefix extends string, AllowedMethods extends readonly Any[]> = Triggers[number] extends (infer TriggerDef) ? TriggerDef extends Any$3 ? {
|
|
10
10
|
readonly localId: JoinPrefix<Prefix, TriggerDef["identifier"]>;
|
|
11
11
|
readonly trigger: TriggerDef;
|
|
12
12
|
readonly authMethods: AllowedMethods;
|
|
13
13
|
} : never : never;
|
|
14
|
-
type LocalTriggerEntriesFromGroups<GroupDef extends Any$
|
|
15
|
-
export type LocalTriggerEntries<P extends Any$
|
|
16
|
-
export type CanonicalTriggerId<P extends Any$
|
|
14
|
+
type LocalTriggerEntriesFromGroups<GroupDef extends Any$1, Prefix extends string, AllowedMethods extends readonly Any[]> = GroupDef extends unknown ? LocalTriggerEntriesFromTriggers<GroupDef["triggers"], JoinPrefix<Prefix, GroupDef["identifier"]>, AllowedMethods> | (IsGenericArray<GroupDef["groups"]> extends true ? LocalTriggerEntriesFromTriggers<readonly Any$3[], string, AllowedMethods> : LocalTriggerEntriesFromGroups<GroupDef["groups"][number], JoinPrefix<Prefix, GroupDef["identifier"]>, AllowedMethods>) : never;
|
|
15
|
+
export type LocalTriggerEntries<P extends Any$2> = LocalTriggerEntriesFromTriggers<P["triggers"], "", P["authMethods"]> | LocalTriggerEntriesFromGroups<P["groups"][number], "", P["authMethods"]>;
|
|
16
|
+
export type CanonicalTriggerId<P extends Any$2, LocalId extends string> = `${P["identifier"]}${typeof MachineIdSeparator}${LocalId}`;
|
|
17
17
|
/** Keyed by the plugin's capabilities, which `Plugin.provide` keeps, so a Layer serves only them. */
|
|
18
18
|
export interface ActionHandlerService<in out PluginId extends string, in out Actions extends readonly unknown[], in out Groups extends readonly unknown[]> {
|
|
19
19
|
readonly _: unique symbol;
|
|
@@ -21,8 +21,8 @@ export interface ActionHandlerService<in out PluginId extends string, in out Act
|
|
|
21
21
|
readonly actions: Actions;
|
|
22
22
|
readonly groups: Groups;
|
|
23
23
|
}
|
|
24
|
-
export type ActionHandlerServiceOf<P extends Any$
|
|
25
|
-
export type HandlerServices<P extends Any$
|
|
24
|
+
export type ActionHandlerServiceOf<P extends Any$2> = ActionHandlerService<P["identifier"], P["actions"], P["groups"]>;
|
|
25
|
+
export type HandlerServices<P extends Any$2> = ActionHandlerServiceOf<P> | ([P["agentChannels"][number]] extends [never] ? never : Handler<`${P["identifier"]}/${P["agentChannels"][number]["identifier"]}`>) | (LocalTriggerEntries<P> extends (infer Entry) ? Entry extends {
|
|
26
26
|
readonly localId: infer LocalId extends string;
|
|
27
27
|
} ? Handler$1<CanonicalTriggerId<P, LocalId>> : never : never);
|
|
28
28
|
interface Declarations {
|
|
@@ -31,6 +31,6 @@ interface Declarations {
|
|
|
31
31
|
readonly agentChannels: unknown;
|
|
32
32
|
}
|
|
33
33
|
/** Register a plugin's handlers as one Context group keyed by the plugin. */
|
|
34
|
-
export declare const toHandlers: (plugin: Any$
|
|
34
|
+
export declare const toHandlers: (plugin: Any$2, handlers: Declarations) => Effect.Effect<Context.Context<never>>;
|
|
35
35
|
export {};
|
|
36
36
|
//# sourceMappingURL=plugin-handlers.d.ts.map
|