@dual-os/sdk 0.0.0-stage → 0.8.0-next.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.
Files changed (214) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +19 -2
  3. package/dist/Action.d.ts +201 -0
  4. package/dist/Action.d.ts.map +1 -0
  5. package/dist/Action.js +172 -0
  6. package/dist/Action.js.map +1 -0
  7. package/dist/AgentChannel.d.ts +1717 -0
  8. package/dist/AgentChannel.d.ts.map +1 -0
  9. package/dist/AgentChannel.js +708 -0
  10. package/dist/AgentChannel.js.map +1 -0
  11. package/dist/AgentChannelConformance.d.ts +1543 -0
  12. package/dist/AgentChannelConformance.d.ts.map +1 -0
  13. package/dist/AgentChannelConformance.js +163 -0
  14. package/dist/AgentChannelConformance.js.map +1 -0
  15. package/dist/AgentChannelRuntime.d.ts +78 -0
  16. package/dist/AgentChannelRuntime.d.ts.map +1 -0
  17. package/dist/AgentChannelRuntime.js +270 -0
  18. package/dist/AgentChannelRuntime.js.map +1 -0
  19. package/dist/AiProvider.d.ts +132 -0
  20. package/dist/AiProvider.d.ts.map +1 -0
  21. package/dist/AiProvider.js +100 -0
  22. package/dist/AiProvider.js.map +1 -0
  23. package/dist/AuthMethod.d.ts +381 -0
  24. package/dist/AuthMethod.d.ts.map +1 -0
  25. package/dist/AuthMethod.js +225 -0
  26. package/dist/AuthMethod.js.map +1 -0
  27. package/dist/AuthMethodBinding.d.ts +77 -0
  28. package/dist/AuthMethodBinding.d.ts.map +1 -0
  29. package/dist/AuthMethodBinding.js +31 -0
  30. package/dist/AuthMethodBinding.js.map +1 -0
  31. package/dist/AuthMethodExecution.d.ts +223 -0
  32. package/dist/AuthMethodExecution.d.ts.map +1 -0
  33. package/dist/AuthMethodExecution.js +277 -0
  34. package/dist/AuthMethodExecution.js.map +1 -0
  35. package/dist/ConnectionResolver.d.ts +219 -0
  36. package/dist/ConnectionResolver.d.ts.map +1 -0
  37. package/dist/ConnectionResolver.js +153 -0
  38. package/dist/ConnectionResolver.js.map +1 -0
  39. package/dist/DefinitionError.d.ts +67 -0
  40. package/dist/DefinitionError.d.ts.map +1 -0
  41. package/dist/DefinitionError.js +82 -0
  42. package/dist/DefinitionError.js.map +1 -0
  43. package/dist/DualRegistry.d.ts +71 -0
  44. package/dist/DualRegistry.d.ts.map +1 -0
  45. package/dist/DualRegistry.js +96 -0
  46. package/dist/DualRegistry.js.map +1 -0
  47. package/dist/DualRuntime.d.ts +279 -0
  48. package/dist/DualRuntime.d.ts.map +1 -0
  49. package/dist/DualRuntime.js +311 -0
  50. package/dist/DualRuntime.js.map +1 -0
  51. package/dist/Files.d.ts +80 -0
  52. package/dist/Files.d.ts.map +1 -0
  53. package/dist/Files.js +66 -0
  54. package/dist/Files.js.map +1 -0
  55. package/dist/Group.d.ts +106 -0
  56. package/dist/Group.d.ts.map +1 -0
  57. package/dist/Group.js +86 -0
  58. package/dist/Group.js.map +1 -0
  59. package/dist/Http.d.ts +342 -0
  60. package/dist/Http.d.ts.map +1 -0
  61. package/dist/Http.js +677 -0
  62. package/dist/Http.js.map +1 -0
  63. package/dist/Mcp.d.ts +109 -0
  64. package/dist/Mcp.d.ts.map +1 -0
  65. package/dist/Mcp.js +176 -0
  66. package/dist/Mcp.js.map +1 -0
  67. package/dist/OAuth2TokenRefresher.d.ts +18 -0
  68. package/dist/OAuth2TokenRefresher.d.ts.map +1 -0
  69. package/dist/OAuth2TokenRefresher.js +19 -0
  70. package/dist/OAuth2TokenRefresher.js.map +1 -0
  71. package/dist/OAuthFlow.d.ts +71 -0
  72. package/dist/OAuthFlow.d.ts.map +1 -0
  73. package/dist/OAuthFlow.js +488 -0
  74. package/dist/OAuthFlow.js.map +1 -0
  75. package/dist/Plugin.d.ts +383 -0
  76. package/dist/Plugin.d.ts.map +1 -0
  77. package/dist/Plugin.js +249 -0
  78. package/dist/Plugin.js.map +1 -0
  79. package/dist/PluginRuntime.d.ts +3186 -0
  80. package/dist/PluginRuntime.d.ts.map +1 -0
  81. package/dist/PluginRuntime.js +331 -0
  82. package/dist/PluginRuntime.js.map +1 -0
  83. package/dist/Runner.d.ts +1 -0
  84. package/dist/Runner.js +124 -0
  85. package/dist/Runner.js.map +1 -0
  86. package/dist/ToolFile.d.ts +23 -0
  87. package/dist/ToolFile.d.ts.map +1 -0
  88. package/dist/ToolFile.js +33 -0
  89. package/dist/ToolFile.js.map +1 -0
  90. package/dist/Trigger.d.ts +358 -0
  91. package/dist/Trigger.d.ts.map +1 -0
  92. package/dist/Trigger.js +287 -0
  93. package/dist/Trigger.js.map +1 -0
  94. package/dist/_virtual/_rolldown/runtime.js +13 -0
  95. package/dist/index.d.ts +24 -0
  96. package/dist/index.js +24 -0
  97. package/dist/internal/auth-context.d.ts +23 -0
  98. package/dist/internal/auth-context.d.ts.map +1 -0
  99. package/dist/internal/auth-context.js +1 -0
  100. package/dist/internal/auth-execution.d.ts +27 -0
  101. package/dist/internal/auth-execution.d.ts.map +1 -0
  102. package/dist/internal/auth-execution.js +66 -0
  103. package/dist/internal/auth-execution.js.map +1 -0
  104. package/dist/internal/auth-runtime.d.ts +5 -0
  105. package/dist/internal/auth-runtime.d.ts.map +1 -0
  106. package/dist/internal/auth-runtime.js +16 -0
  107. package/dist/internal/auth-runtime.js.map +1 -0
  108. package/dist/internal/capabilities.d.ts +24 -0
  109. package/dist/internal/capabilities.d.ts.map +1 -0
  110. package/dist/internal/capabilities.js +22 -0
  111. package/dist/internal/capabilities.js.map +1 -0
  112. package/dist/internal/children.d.ts +34 -0
  113. package/dist/internal/children.d.ts.map +1 -0
  114. package/dist/internal/children.js +53 -0
  115. package/dist/internal/children.js.map +1 -0
  116. package/dist/internal/collection-utils.d.ts +4 -0
  117. package/dist/internal/collection-utils.d.ts.map +1 -0
  118. package/dist/internal/collection-utils.js +6 -0
  119. package/dist/internal/collection-utils.js.map +1 -0
  120. package/dist/internal/dual/actions.d.ts +33 -0
  121. package/dist/internal/dual/actions.d.ts.map +1 -0
  122. package/dist/internal/dual/actions.js +26 -0
  123. package/dist/internal/dual/actions.js.map +1 -0
  124. package/dist/internal/dual/invoke.d.ts +63 -0
  125. package/dist/internal/dual/invoke.d.ts.map +1 -0
  126. package/dist/internal/dual/invoke.js +75 -0
  127. package/dist/internal/dual/invoke.js.map +1 -0
  128. package/dist/internal/dual/registry.d.ts +125 -0
  129. package/dist/internal/dual/registry.d.ts.map +1 -0
  130. package/dist/internal/dual/registry.js +172 -0
  131. package/dist/internal/dual/registry.js.map +1 -0
  132. package/dist/internal/dual/triggers.d.ts +29 -0
  133. package/dist/internal/dual/triggers.d.ts.map +1 -0
  134. package/dist/internal/dual/triggers.js +26 -0
  135. package/dist/internal/dual/triggers.js.map +1 -0
  136. package/dist/internal/handler-context.d.ts +9 -0
  137. package/dist/internal/handler-context.d.ts.map +1 -0
  138. package/dist/internal/handler-context.js +31 -0
  139. package/dist/internal/handler-context.js.map +1 -0
  140. package/dist/internal/identifier.d.ts +6 -0
  141. package/dist/internal/identifier.d.ts.map +1 -0
  142. package/dist/internal/identifier.js +28 -0
  143. package/dist/internal/identifier.js.map +1 -0
  144. package/dist/internal/plugin-handlers.d.ts +38 -0
  145. package/dist/internal/plugin-handlers.d.ts.map +1 -0
  146. package/dist/internal/plugin-handlers.js +52 -0
  147. package/dist/internal/plugin-handlers.js.map +1 -0
  148. package/dist/internal/proto.d.ts +7 -0
  149. package/dist/internal/proto.d.ts.map +1 -0
  150. package/dist/internal/proto.js +10 -0
  151. package/dist/internal/proto.js.map +1 -0
  152. package/dist/internal/schema-runtime.d.ts +6 -0
  153. package/dist/internal/schema-runtime.d.ts.map +1 -0
  154. package/dist/internal/schema-runtime.js +10 -0
  155. package/dist/internal/schema-runtime.js.map +1 -0
  156. package/dist/internal/trigger-runtime-shared.d.ts +41 -0
  157. package/dist/internal/trigger-runtime-shared.d.ts.map +1 -0
  158. package/dist/internal/trigger-runtime-shared.js +132 -0
  159. package/dist/internal/trigger-runtime-shared.js.map +1 -0
  160. package/dist/internal/trigger-runtime.d.ts +12 -0
  161. package/dist/internal/trigger-runtime.d.ts.map +1 -0
  162. package/dist/internal/trigger-runtime.js +95 -0
  163. package/dist/internal/trigger-runtime.js.map +1 -0
  164. package/dist/internal/types.d.ts +7 -0
  165. package/dist/internal/types.d.ts.map +1 -0
  166. package/dist/internal/types.js +1 -0
  167. package/dist/remote-runtime.d.ts +585 -0
  168. package/dist/remote-runtime.d.ts.map +1 -0
  169. package/dist/remote-runtime.js +367 -0
  170. package/dist/remote-runtime.js.map +1 -0
  171. package/package.json +55 -4
  172. package/src/Action.ts +370 -0
  173. package/src/AgentChannel.ts +860 -0
  174. package/src/AgentChannelConformance.ts +124 -0
  175. package/src/AgentChannelRuntime.ts +616 -0
  176. package/src/AiProvider.ts +255 -0
  177. package/src/AuthMethod.ts +954 -0
  178. package/src/AuthMethodBinding.ts +112 -0
  179. package/src/AuthMethodExecution.ts +542 -0
  180. package/src/ConnectionResolver.ts +265 -0
  181. package/src/DefinitionError.ts +115 -0
  182. package/src/DualRegistry.ts +152 -0
  183. package/src/DualRuntime.ts +1081 -0
  184. package/src/Files.ts +89 -0
  185. package/src/Group.ts +292 -0
  186. package/src/Http.ts +1205 -0
  187. package/src/Mcp.ts +299 -0
  188. package/src/OAuth2TokenRefresher.ts +22 -0
  189. package/src/OAuthFlow.ts +874 -0
  190. package/src/Plugin.ts +912 -0
  191. package/src/PluginRuntime.ts +414 -0
  192. package/src/Runner.ts +248 -0
  193. package/src/ToolFile.ts +28 -0
  194. package/src/Trigger.ts +722 -0
  195. package/src/index.ts +158 -0
  196. package/src/internal/auth-context.ts +27 -0
  197. package/src/internal/auth-execution.ts +241 -0
  198. package/src/internal/auth-runtime.ts +20 -0
  199. package/src/internal/capabilities.ts +55 -0
  200. package/src/internal/children.ts +126 -0
  201. package/src/internal/collection-utils.ts +8 -0
  202. package/src/internal/dual/actions.ts +116 -0
  203. package/src/internal/dual/invoke.ts +307 -0
  204. package/src/internal/dual/registry.ts +340 -0
  205. package/src/internal/dual/triggers.ts +128 -0
  206. package/src/internal/handler-context.ts +57 -0
  207. package/src/internal/identifier.ts +27 -0
  208. package/src/internal/plugin-handlers.ts +146 -0
  209. package/src/internal/proto.ts +8 -0
  210. package/src/internal/schema-runtime.ts +15 -0
  211. package/src/internal/trigger-runtime-shared.ts +449 -0
  212. package/src/internal/trigger-runtime.ts +223 -0
  213. package/src/internal/types.ts +12 -0
  214. package/src/remote-runtime.ts +469 -0
@@ -0,0 +1,106 @@
1
+ import { Any as Any$1 } from "./Action.js";
2
+ import { Any as Any$2 } from "./Trigger.js";
3
+ import { FilterChildren } from "./internal/children.js";
4
+ import { Pipeable } from "effect";
5
+ declare namespace Group_d_exports {
6
+ export { ActionsFromChildren, AddChildren, Any, Group, GroupOptions, GroupsFromChildren, StructuralChild, TriggersFromChildren, TypeId, add, isGroup, make, withAction, withActions, withDescription, withGroup, withGroups, withName, withTrigger, withTriggers };
7
+ }
8
+ /** @since 0.0.0 @category type ids */
9
+ export declare const TypeId: "@dual-os/sdk/Group";
10
+ /** @since 0.0.0 @category type ids */
11
+ export type TypeId = typeof TypeId;
12
+ /** @since 0.0.0 @category type-level */
13
+ export interface Any extends Pipeable.Pipeable {
14
+ readonly [TypeId]: TypeId;
15
+ readonly identifier: string;
16
+ readonly name: string | undefined;
17
+ readonly description: string | undefined;
18
+ readonly groups: readonly Any[];
19
+ readonly actions: readonly Any$1[];
20
+ readonly triggers: readonly Any$2[];
21
+ }
22
+ /** @since 0.0.0 @category models */
23
+ export interface GroupOptions<Identifier extends string = string> {
24
+ readonly identifier: Identifier;
25
+ readonly name?: string;
26
+ readonly description?: string;
27
+ }
28
+ /** @since 0.0.0 @category models */
29
+ export interface Group<out Identifier extends string = string, out Groups extends readonly Any[] = readonly [], out Actions extends readonly Any$1[] = readonly [], out Triggers extends readonly Any$2[] = readonly []> extends Pipeable.Pipeable {
30
+ readonly [TypeId]: TypeId;
31
+ readonly identifier: Identifier;
32
+ readonly name: string | undefined;
33
+ readonly description: string | undefined;
34
+ readonly groups: Groups;
35
+ readonly actions: Actions;
36
+ readonly triggers: Triggers;
37
+ }
38
+ export type StructuralChild = Any | Any$1 | Any$2;
39
+ export type GroupsFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<Children, Any>;
40
+ export type ActionsFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<Children, Any$1>;
41
+ export type TriggersFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<Children, Any$2>;
42
+ /**
43
+ * Result of appending children to a group; shared by every child combinator so
44
+ * their overloads stay declarative.
45
+ *
46
+ * @since 0.0.0
47
+ * @category type-level
48
+ */
49
+ export type AddChildren<Self extends Any, AddedGroups extends readonly Any[] = readonly [], AddedActions extends readonly Any$1[] = readonly [], AddedTriggers extends readonly Any$2[] = readonly []> = Self extends Group<infer Identifier, infer Groups, infer Actions, infer Triggers> ? Group<Identifier, readonly [...Groups, ...AddedGroups], readonly [...Actions, ...AddedActions], readonly [...Triggers, ...AddedTriggers]> : never;
50
+ /** @since 0.0.0 @category constructors */
51
+ export declare const make: <const Identifier extends string>(identifier: Identifier) => Group<Identifier>;
52
+ /** @since 0.0.0 @category guards */
53
+ export declare const isGroup: (u: unknown) => u is Any;
54
+ /** @since 0.0.0 @category combinators */
55
+ export declare const withName: {
56
+ (name: string): <G extends Group<any, any, any, any>>(group: G) => G;
57
+ <G extends Group<any, any, any, any>>(group: G, name: string): G;
58
+ };
59
+ /** @since 0.0.0 @category combinators */
60
+ export declare const withDescription: {
61
+ (description: string): <G extends Group<any, any, any, any>>(group: G) => G;
62
+ <G extends Group<any, any, any, any>>(group: G, description: string): G;
63
+ };
64
+ /** @since 0.0.0 @category combinators */
65
+ export declare const withGroups: {
66
+ <const AddedGroups extends readonly Any[]>(groups: AddedGroups): <Self extends Any>(group: Self) => AddChildren<Self, AddedGroups>;
67
+ <Self extends Any, const AddedGroups extends readonly Any[]>(group: Self, groups: AddedGroups): AddChildren<Self, AddedGroups>;
68
+ };
69
+ /** @since 0.0.0 @category combinators */
70
+ export declare const withActions: {
71
+ <const AddedActions extends readonly Any$1[]>(actions: AddedActions): <Self extends Any>(group: Self) => AddChildren<Self, readonly [], AddedActions>;
72
+ <Self extends Any, const AddedActions extends readonly Any$1[]>(group: Self, actions: AddedActions): AddChildren<Self, readonly [], AddedActions>;
73
+ };
74
+ /** @since 0.0.0 @category combinators */
75
+ export declare const withTriggers: {
76
+ <const AddedTriggers extends readonly Any$2[]>(triggers: AddedTriggers): <Self extends Any>(group: Self) => AddChildren<Self, readonly [], readonly [], AddedTriggers>;
77
+ <Self extends Any, const AddedTriggers extends readonly Any$2[]>(group: Self, triggers: AddedTriggers): AddChildren<Self, readonly [], readonly [], AddedTriggers>;
78
+ };
79
+ /** @since 0.0.0 @category combinators */
80
+ export declare const withGroup: {
81
+ <const AddedGroup extends Any>(group: AddedGroup): <Self extends Any>(value: Self) => AddChildren<Self, readonly [AddedGroup]>;
82
+ <Self extends Any, const AddedGroup extends Any>(value: Self, group: AddedGroup): AddChildren<Self, readonly [AddedGroup]>;
83
+ };
84
+ /** @since 0.0.0 @category combinators */
85
+ export declare const withAction: {
86
+ <const AddedAction extends Any$1>(action: AddedAction): <Self extends Any>(value: Self) => AddChildren<Self, readonly [], readonly [AddedAction]>;
87
+ <Self extends Any, const AddedAction extends Any$1>(value: Self, action: AddedAction): AddChildren<Self, readonly [], readonly [AddedAction]>;
88
+ };
89
+ /** @since 0.0.0 @category combinators */
90
+ export declare const withTrigger: {
91
+ <const AddedTrigger extends Any$2>(trigger: AddedTrigger): <Self extends Any>(value: Self) => AddChildren<Self, readonly [], readonly [], readonly [AddedTrigger]>;
92
+ <Self extends Any, const AddedTrigger extends Any$2>(value: Self, trigger: AddedTrigger): AddChildren<Self, readonly [], readonly [], readonly [AddedTrigger]>;
93
+ };
94
+ /**
95
+ * Add mixed structural children to a group.
96
+ *
97
+ * @since 0.0.0
98
+ * @category combinators
99
+ */
100
+ export declare const add: {
101
+ <const Children extends readonly StructuralChild[]>(...children: Children): <Self extends Any>(group: Self) => AddChildren<Self, GroupsFromChildren<Children>, ActionsFromChildren<Children>, TriggersFromChildren<Children>>;
102
+ <Self extends Any, const Children extends readonly StructuralChild[]>(group: Self, ...children: Children): AddChildren<Self, GroupsFromChildren<Children>, ActionsFromChildren<Children>, TriggersFromChildren<Children>>;
103
+ };
104
+ //#endregion
105
+ export { Group_d_exports };
106
+ //# sourceMappingURL=Group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Group.d.ts","names":["Action.Any","Trigger.Any"],"sources":["../src/Group.ts"],"mappings":";;;;;;;;qBAwBa;;YAED,gBAAgB;;iBAGX,YAAY,SAAS;YAC1B,SAAS;WACV;WACA;WACA;WACA,iBAAiB;WACjB,kBAAkBA;WAClB,mBAAmBC;;;iBAIb,aAAa;WACnB,YAAY;WACZ;WACA;;;iBAIM,UACX,wCACA,wBAAwB,yBACxB,yBAAyBD,2BACzB,0BAA0BC,+BAEtB,SAAS;YACP,SAAS;WACV,YAAY;WACZ;WACA;WACA,QAAQ;WACR,SAAS;WACT,UAAU;;YAGT,kBAAkB,MAAMD,QAAaC;YAErC,mBAAmB,0BAA0B,qBAAqB,eAC5E,UACA;YAGU,oBAAoB,0BAA0B,qBAAqB,eAC7E,UACAD;YAGU,qBAAqB,0BAA0B,qBAAqB,eAC9E,UACAC;;;;;;;;YAUU,YACV,aAAa,KACb,6BAA6B,qBAC7B,8BAA8BD,uBAC9B,+BAA+BC,yBAE/B,aAAa,YAAY,kBAAkB,cAAc,eAAe,YACpE,MACE,yBACa,WAAW,2BACX,YAAY,4BACZ,aAAa;;qBAwDrB,aAAc,2BAAyB,YAAc,eAAa,MAAM;;qBAIxE,UAAO,eAAiB,KAAK;;qBAG7B;GACV,gBAAgB,UAAU,2BAA2B,OAAO,MAAM;GAClE,UAAU,2BAA2B,OAAO,GAAG,eAAe;;;qBAapD;GACV,uBAAuB,UAAU,2BAA2B,OAAO,MAAM;GACzE,UAAU,2BAA2B,OAAO,GAAG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 import { validateIdentifier } from "./internal/identifier.js";
3
+ import { PipeableProto } from "./internal/proto.js";
4
+ import { appendElements } from "./internal/collection-utils.js";
5
+ import { assertUniqueMixedChildIdentifiers, assertUniqueStructuralChildIdentifiers, partitionChildren } from "./internal/children.js";
6
+ import { Function, Predicate } from "effect";
7
+ //#region src/Group.ts
8
+ var Group_exports = /* @__PURE__ */ __exportAll({
9
+ TypeId: () => TypeId,
10
+ add: () => add,
11
+ isGroup: () => isGroup,
12
+ make: () => make,
13
+ withAction: () => withAction,
14
+ withActions: () => withActions,
15
+ withDescription: () => withDescription,
16
+ withGroup: () => withGroup,
17
+ withGroups: () => withGroups,
18
+ withName: () => withName,
19
+ withTrigger: () => withTrigger,
20
+ withTriggers: () => withTriggers
21
+ });
22
+ /** @since 0.0.0 @category type ids */
23
+ const TypeId = "@dual-os/sdk/Group";
24
+ const optionsFromGroup = (group) => ({
25
+ identifier: group.identifier,
26
+ ...group.name === void 0 ? {} : { name: group.name },
27
+ ...group.description === void 0 ? {} : { description: group.description }
28
+ });
29
+ const Proto = {
30
+ ...PipeableProto,
31
+ [TypeId]: TypeId
32
+ };
33
+ const makeGroup = (options, groups, actions, triggers) => {
34
+ validateIdentifier("group", options.identifier);
35
+ return Object.assign(Object.create(Proto), {
36
+ actions,
37
+ description: options.description,
38
+ groups,
39
+ identifier: options.identifier,
40
+ name: options.name,
41
+ triggers
42
+ });
43
+ };
44
+ const appendChildren = (group, children, childKind) => {
45
+ if (childKind === void 0) assertUniqueMixedChildIdentifiers("group", group.identifier, group, children);
46
+ else assertUniqueStructuralChildIdentifiers("group", group.identifier, group, children, childKind);
47
+ const partitioned = partitionChildren(children);
48
+ return makeGroup(optionsFromGroup(group), appendElements(group.groups, partitioned.groups), appendElements(group.actions, partitioned.actions), appendElements(group.triggers, partitioned.triggers));
49
+ };
50
+ /** @since 0.0.0 @category constructors */
51
+ const make = (identifier) => makeGroup({ identifier }, [], [], []);
52
+ /** @since 0.0.0 @category guards */
53
+ const isGroup = (u) => Predicate.hasProperty(u, TypeId);
54
+ /** @since 0.0.0 @category combinators */
55
+ const withName = Function.dual(2, (group, name) => makeGroup({
56
+ ...optionsFromGroup(group),
57
+ name
58
+ }, group.groups, group.actions, group.triggers));
59
+ /** @since 0.0.0 @category combinators */
60
+ const withDescription = Function.dual(2, (group, description) => makeGroup({
61
+ ...optionsFromGroup(group),
62
+ description
63
+ }, group.groups, group.actions, group.triggers));
64
+ /** @since 0.0.0 @category combinators */
65
+ const withGroups = Function.dual(2, (group, groups) => appendChildren(group, groups, "group"));
66
+ /** @since 0.0.0 @category combinators */
67
+ const withActions = Function.dual(2, (group, actions) => appendChildren(group, actions, "action"));
68
+ /** @since 0.0.0 @category combinators */
69
+ const withTriggers = Function.dual(2, (group, triggers) => appendChildren(group, triggers, "trigger"));
70
+ /** @since 0.0.0 @category combinators */
71
+ const withGroup = Function.dual(2, (value, group) => appendChildren(value, [group], "group"));
72
+ /** @since 0.0.0 @category combinators */
73
+ const withAction = Function.dual(2, (value, action) => appendChildren(value, [action], "action"));
74
+ /** @since 0.0.0 @category combinators */
75
+ const withTrigger = Function.dual(2, (value, trigger) => appendChildren(value, [trigger], "trigger"));
76
+ /**
77
+ * Add mixed structural children to a group.
78
+ *
79
+ * @since 0.0.0
80
+ * @category combinators
81
+ */
82
+ const add = Function.dual((args) => isGroup(args[0]), (group, ...children) => appendChildren(group, children));
83
+ //#endregion
84
+ export { Group_exports, TypeId, add, isGroup, make, withAction, withActions, withDescription, withGroup, withGroups, withName, withTrigger, withTriggers };
85
+
86
+ //# sourceMappingURL=Group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Group.js","names":["Func"],"sources":["../src/Group.ts"],"sourcesContent":["/**\n * Canonical group definition builders and types for the Dual SDK.\n *\n * Groups are structural namespaces nested beneath providers or other groups.\n *\n * @since 0.0.0\n */\nimport type { Pipeable } from \"effect\";\nimport { Function as Func, Predicate } from \"effect\";\n\nimport type * as Action from \"./Action.ts\";\nimport {\n assertUniqueMixedChildIdentifiers,\n assertUniqueStructuralChildIdentifiers,\n type FilterChildren,\n partitionChildren,\n type StructuralChildKind,\n} from \"./internal/children.ts\";\nimport { appendElements } from \"./internal/collection-utils.ts\";\nimport { validateIdentifier } from \"./internal/identifier.ts\";\nimport { PipeableProto } from \"./internal/proto.ts\";\nimport type * as Trigger from \"./Trigger.ts\";\n\n/** @since 0.0.0 @category type ids */\nexport const TypeId = \"@dual-os/sdk/Group\" as const;\n/** @since 0.0.0 @category type ids */\nexport type TypeId = typeof TypeId;\n\n/** @since 0.0.0 @category type-level */\nexport interface Any extends Pipeable.Pipeable {\n readonly [TypeId]: TypeId;\n readonly identifier: string;\n readonly name: string | undefined;\n readonly description: string | undefined;\n readonly groups: readonly Any[];\n readonly actions: readonly Action.Any[];\n readonly triggers: readonly Trigger.Any[];\n}\n\n/** @since 0.0.0 @category models */\nexport interface GroupOptions<Identifier extends string = string> {\n readonly identifier: Identifier;\n readonly name?: string;\n readonly description?: string;\n}\n\n/** @since 0.0.0 @category models */\nexport interface Group<\n out Identifier extends string = string,\n out Groups extends readonly Any[] = readonly [],\n out Actions extends readonly Action.Any[] = readonly [],\n out Triggers extends readonly Trigger.Any[] = readonly [],\n>\n extends Pipeable.Pipeable {\n readonly [TypeId]: TypeId;\n readonly identifier: Identifier;\n readonly name: string | undefined;\n readonly description: string | undefined;\n readonly groups: Groups;\n readonly actions: Actions;\n readonly triggers: Triggers;\n}\n\nexport type StructuralChild = Any | Action.Any | Trigger.Any;\n\nexport type GroupsFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<\n Children,\n Any\n>;\n\nexport type ActionsFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<\n Children,\n Action.Any\n>;\n\nexport type TriggersFromChildren<Children extends readonly StructuralChild[]> = FilterChildren<\n Children,\n Trigger.Any\n>;\n\n/**\n * Result of appending children to a group; shared by every child combinator so\n * their overloads stay declarative.\n *\n * @since 0.0.0\n * @category type-level\n */\nexport type AddChildren<\n Self extends Any,\n AddedGroups extends readonly Any[] = readonly [],\n AddedActions extends readonly Action.Any[] = readonly [],\n AddedTriggers extends readonly Trigger.Any[] = readonly [],\n> =\n Self extends Group<infer Identifier, infer Groups, infer Actions, infer Triggers>\n ? Group<\n Identifier,\n readonly [...Groups, ...AddedGroups],\n readonly [...Actions, ...AddedActions],\n readonly [...Triggers, ...AddedTriggers]\n >\n : never;\n\nconst optionsFromGroup = (group: Any): GroupOptions => ({\n identifier: group.identifier,\n ...(group.name === undefined ? {} : { name: group.name }),\n ...(group.description === undefined ? {} : { description: group.description }),\n});\n\nconst Proto = { ...PipeableProto, [TypeId]: TypeId };\n\nconst makeGroup = <\n Identifier extends string,\n Groups extends readonly Any[],\n Actions extends readonly Action.Any[],\n Triggers extends readonly Trigger.Any[],\n>(\n options: GroupOptions<Identifier>,\n groups: Groups,\n actions: Actions,\n triggers: Triggers,\n): Group<Identifier, Groups, Actions, Triggers> => {\n validateIdentifier(\"group\", options.identifier);\n\n return Object.assign(Object.create(Proto), {\n actions,\n description: options.description,\n groups,\n identifier: options.identifier,\n name: options.name,\n triggers,\n }) as Group<Identifier, Groups, Actions, Triggers>;\n};\n\nconst appendChildren = (\n group: Any,\n children: readonly StructuralChild[],\n childKind?: StructuralChildKind,\n): Any => {\n if (childKind === undefined) {\n assertUniqueMixedChildIdentifiers(\"group\", group.identifier, group, children);\n } else {\n assertUniqueStructuralChildIdentifiers(\"group\", group.identifier, group, children, childKind);\n }\n\n const partitioned = partitionChildren(children);\n return makeGroup(\n optionsFromGroup(group),\n appendElements(group.groups, partitioned.groups),\n appendElements(group.actions, partitioned.actions),\n appendElements(group.triggers, partitioned.triggers),\n );\n};\n\n/** @since 0.0.0 @category constructors */\nexport const make = <const Identifier extends string>(identifier: Identifier): Group<Identifier> =>\n makeGroup({ identifier }, [] as const, [] as const, [] as const);\n\n/** @since 0.0.0 @category guards */\nexport const isGroup = (u: unknown): u is Any => Predicate.hasProperty(u, TypeId);\n\n/** @since 0.0.0 @category combinators */\nexport const withName: {\n (name: string): <G extends Group<any, any, any, any>>(group: G) => G;\n <G extends Group<any, any, any, any>>(group: G, name: string): G;\n} = Func.dual(\n 2,\n <G extends Group<any, any, any, any>>(group: G, name: string): G =>\n makeGroup(\n { ...optionsFromGroup(group), name },\n group.groups,\n group.actions,\n group.triggers,\n ) as G,\n);\n\n/** @since 0.0.0 @category combinators */\nexport const withDescription: {\n (description: string): <G extends Group<any, any, any, any>>(group: G) => G;\n <G extends Group<any, any, any, any>>(group: G, description: string): G;\n} = Func.dual(\n 2,\n <G extends Group<any, any, any, any>>(group: G, description: string): G =>\n makeGroup(\n { ...optionsFromGroup(group), description },\n group.groups,\n group.actions,\n group.triggers,\n ) as G,\n);\n\n/** @since 0.0.0 @category combinators */\nexport const withGroups: {\n <const AddedGroups extends readonly Any[]>(\n groups: AddedGroups,\n ): <Self extends Any>(group: Self) => AddChildren<Self, AddedGroups>;\n <Self extends Any, const AddedGroups extends readonly Any[]>(\n group: Self,\n groups: AddedGroups,\n ): AddChildren<Self, AddedGroups>;\n} = Func.dual(2, (group: Any, groups: readonly Any[]) => appendChildren(group, groups, \"group\"));\n\n/** @since 0.0.0 @category combinators */\nexport const withActions: {\n <const AddedActions extends readonly Action.Any[]>(\n actions: AddedActions,\n ): <Self extends Any>(group: Self) => AddChildren<Self, readonly [], AddedActions>;\n <Self extends Any, const AddedActions extends readonly Action.Any[]>(\n group: Self,\n actions: AddedActions,\n ): AddChildren<Self, readonly [], AddedActions>;\n} = Func.dual(2, (group: Any, actions: readonly Action.Any[]) =>\n appendChildren(group, actions, \"action\"),\n);\n\n/** @since 0.0.0 @category combinators */\nexport const withTriggers: {\n <const AddedTriggers extends readonly Trigger.Any[]>(\n triggers: AddedTriggers,\n ): <Self extends Any>(group: Self) => AddChildren<Self, readonly [], readonly [], AddedTriggers>;\n <Self extends Any, const AddedTriggers extends readonly Trigger.Any[]>(\n group: Self,\n triggers: AddedTriggers,\n ): AddChildren<Self, readonly [], readonly [], AddedTriggers>;\n} = Func.dual(2, (group: Any, triggers: readonly Trigger.Any[]) =>\n appendChildren(group, triggers, \"trigger\"),\n);\n\n/** @since 0.0.0 @category combinators */\nexport const withGroup: {\n <const AddedGroup extends Any>(\n group: AddedGroup,\n ): <Self extends Any>(value: Self) => AddChildren<Self, readonly [AddedGroup]>;\n <Self extends Any, const AddedGroup extends Any>(\n value: Self,\n group: AddedGroup,\n ): AddChildren<Self, readonly [AddedGroup]>;\n} = Func.dual(2, (value: Any, group: Any) => appendChildren(value, [group], \"group\"));\n\n/** @since 0.0.0 @category combinators */\nexport const withAction: {\n <const AddedAction extends Action.Any>(\n action: AddedAction,\n ): <Self extends Any>(value: Self) => AddChildren<Self, readonly [], readonly [AddedAction]>;\n <Self extends Any, const AddedAction extends Action.Any>(\n value: Self,\n action: AddedAction,\n ): AddChildren<Self, readonly [], readonly [AddedAction]>;\n} = Func.dual(2, (value: Any, action: Action.Any) => appendChildren(value, [action], \"action\"));\n\n/** @since 0.0.0 @category combinators */\nexport const withTrigger: {\n <const AddedTrigger extends Trigger.Any>(\n trigger: AddedTrigger,\n ): <Self extends Any>(\n value: Self,\n ) => AddChildren<Self, readonly [], readonly [], readonly [AddedTrigger]>;\n <Self extends Any, const AddedTrigger extends Trigger.Any>(\n value: Self,\n trigger: AddedTrigger,\n ): AddChildren<Self, readonly [], readonly [], readonly [AddedTrigger]>;\n} = Func.dual(2, (value: Any, trigger: Trigger.Any) => appendChildren(value, [trigger], \"trigger\"));\n\n/**\n * Add mixed structural children to a group.\n *\n * @since 0.0.0\n * @category combinators\n */\nexport const add: {\n <const Children extends readonly StructuralChild[]>(\n ...children: Children\n ): <Self extends Any>(\n group: Self,\n ) => AddChildren<\n Self,\n GroupsFromChildren<Children>,\n ActionsFromChildren<Children>,\n TriggersFromChildren<Children>\n >;\n <Self extends Any, const Children extends readonly StructuralChild[]>(\n group: Self,\n ...children: Children\n ): AddChildren<\n Self,\n GroupsFromChildren<Children>,\n ActionsFromChildren<Children>,\n TriggersFromChildren<Children>\n >;\n} = Func.dual(\n args => isGroup(args[0]),\n (group: Any, ...children: readonly StructuralChild[]) => appendChildren(group, children),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,SAAS;AA8EtB,MAAM,oBAAoB,WAA8B;CACtD,YAAY,MAAM;CAClB,GAAI,MAAM,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;CACvD,GAAI,MAAM,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,MAAM,YAAY;AAC9E;AAEA,MAAM,QAAQ;CAAE,GAAG;EAAgB,SAAS;AAAO;AAEnD,MAAM,aAMJ,SACA,QACA,SACA,aACiD;CACjD,mBAAmB,SAAS,QAAQ,UAAU;CAE9C,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA,aAAa,QAAQ;EACrB;EACA,YAAY,QAAQ;EACpB,MAAM,QAAQ;EACd;CACF,CAAC;AACH;AAEA,MAAM,kBACJ,OACA,UACA,cACQ;CACR,IAAI,cAAc,KAAA,GAChB,kCAAkC,SAAS,MAAM,YAAY,OAAO,QAAQ;MAE5E,uCAAuC,SAAS,MAAM,YAAY,OAAO,UAAU,SAAS;CAG9F,MAAM,cAAc,kBAAkB,QAAQ;CAC9C,OAAO,UACL,iBAAiB,KAAK,GACtB,eAAe,MAAM,QAAQ,YAAY,MAAM,GAC/C,eAAe,MAAM,SAAS,YAAY,OAAO,GACjD,eAAe,MAAM,UAAU,YAAY,QAAQ,CACrD;AACF;;AAGA,MAAa,QAAyC,eACpD,UAAU,EAAE,WAAW,GAAG,CAAC,GAAY,CAAC,GAAY,CAAC,CAAU;;AAGjE,MAAa,WAAW,MAAyB,UAAU,YAAY,GAAG,MAAM;;AAGhF,MAAa,WAGTA,SAAK,KACP,IACsC,OAAU,SAC9C,UACE;CAAE,GAAG,iBAAiB,KAAK;CAAG;AAAK,GACnC,MAAM,QACN,MAAM,SACN,MAAM,QACR,CACJ;;AAGA,MAAa,kBAGTA,SAAK,KACP,IACsC,OAAU,gBAC9C,UACE;CAAE,GAAG,iBAAiB,KAAK;CAAG;AAAY,GAC1C,MAAM,QACN,MAAM,SACN,MAAM,QACR,CACJ;;AAGA,MAAa,aAQTA,SAAK,KAAK,IAAI,OAAY,WAA2B,eAAe,OAAO,QAAQ,OAAO,CAAC;;AAG/F,MAAa,cAQTA,SAAK,KAAK,IAAI,OAAY,YAC5B,eAAe,OAAO,SAAS,QAAQ,CACzC;;AAGA,MAAa,eAQTA,SAAK,KAAK,IAAI,OAAY,aAC5B,eAAe,OAAO,UAAU,SAAS,CAC3C;;AAGA,MAAa,YAQTA,SAAK,KAAK,IAAI,OAAY,UAAe,eAAe,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;;AAGpF,MAAa,aAQTA,SAAK,KAAK,IAAI,OAAY,WAAuB,eAAe,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;;AAG9F,MAAa,cAUTA,SAAK,KAAK,IAAI,OAAY,YAAyB,eAAe,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;;;;;;;AAQlG,MAAa,MAoBTA,SAAK,MACP,SAAQ,QAAQ,KAAK,EAAE,IACtB,OAAY,GAAG,aAAyC,eAAe,OAAO,QAAQ,CACzF"}
package/dist/Http.d.ts ADDED
@@ -0,0 +1,342 @@
1
+ import { Any } from "./AuthMethod.js";
2
+ import { ActionHandlerError, ActionHandlerFailure, HandlerContext, RetryableActionHandlerError } from "./Action.js";
3
+ import { File as File$1 } from "./Files.js";
4
+ import "./Http.js";
5
+ import { Effect, Record, Schema } from "effect";
6
+ import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http";
7
+ declare namespace Http_d_exports {
8
+ export { Base64FromFile, Base64UrlFromFile, Contract, DataUriFromFile, DateTimeFromRfc2822, DateTimeFromUnixSeconds, Decoded, DecodedEndpoint, Endpoint, File, FileFromBase64, FileFromBase64Url, FileFromDataUri, Handler, Http_d_exports as Http, Rfc2822FromDateTime, UnixSecondsFromDateTime, Variant, continuation, decoded, form, literal, make, params, path, preauthenticated, segments, withFile, withForm };
9
+ }
10
+ /**
11
+ * An action's input and output schemas.
12
+ *
13
+ * @since 0.0.0
14
+ * @category models
15
+ */
16
+ export interface Contract {
17
+ readonly input: Schema.Top;
18
+ readonly output: Schema.Top;
19
+ }
20
+ /**
21
+ * Runs an action: its input in, its output or a failure out.
22
+ *
23
+ * @since 0.0.0
24
+ * @category models
25
+ */
26
+ export type Handler<Methods extends readonly Any[], Input, Output> = (input: Input, context: HandlerContext<Methods>) => Effect.Effect<Output, ActionHandlerFailure, HttpClient.HttpClient>;
27
+ /**
28
+ * A file input: a ToolFile as a download returns it, or just its bytes with a type and name.
29
+ *
30
+ * @since 0.0.0
31
+ * @category schemas
32
+ */
33
+ export type File = typeof File.Type;
34
+ export declare const File: Schema.Struct<{
35
+ readonly _tag: Schema.optionalKey<Schema.Literal<"ToolFile">>;
36
+ readonly contentBase64: Schema.Uint8ArrayFromBase64;
37
+ readonly contentType: Schema.optionalKey<Schema.NullOr<Schema.String>>;
38
+ readonly filename: Schema.optionalKey<Schema.NullOr<Schema.String>>;
39
+ readonly sizeBytes: Schema.optionalKey<Schema.Natural>;
40
+ }>;
41
+ /**
42
+ * A file the API returns as a Base64 string inside JSON, decoded into a ToolFile with its content
43
+ * type recognized from the bytes.
44
+ *
45
+ * @since 0.0.0
46
+ * @category schemas
47
+ */
48
+ export declare const FileFromBase64: Schema.decodeTo<Schema.TaggedStruct<"ToolFile", {
49
+ readonly contentBase64: Schema.String;
50
+ readonly contentType: Schema.NullOr<Schema.String>;
51
+ readonly filename: Schema.NullOr<Schema.String>;
52
+ readonly sizeBytes: Schema.Natural;
53
+ }>, Schema.String, never, never>;
54
+ /**
55
+ * {@link FileFromBase64} for an API that writes the file in Base64Url.
56
+ *
57
+ * @since 0.0.0
58
+ * @category schemas
59
+ */
60
+ export declare const FileFromBase64Url: Schema.decodeTo<Schema.TaggedStruct<"ToolFile", {
61
+ readonly contentBase64: Schema.String;
62
+ readonly contentType: Schema.NullOr<Schema.String>;
63
+ readonly filename: Schema.NullOr<Schema.String>;
64
+ readonly sizeBytes: Schema.Natural;
65
+ }>, Schema.String, never, never>;
66
+ /**
67
+ * A {@link File} input the API reads as a Base64 string inside JSON.
68
+ *
69
+ * @since 0.0.0
70
+ * @category schemas
71
+ */
72
+ export declare const Base64FromFile: Schema.decodeTo<Schema.String, Schema.Struct<{
73
+ readonly _tag: Schema.optionalKey<Schema.Literal<"ToolFile">>;
74
+ readonly contentBase64: Schema.Uint8ArrayFromBase64;
75
+ readonly contentType: Schema.optionalKey<Schema.NullOr<Schema.String>>;
76
+ readonly filename: Schema.optionalKey<Schema.NullOr<Schema.String>>;
77
+ readonly sizeBytes: Schema.optionalKey<Schema.Natural>;
78
+ }>, never, never>;
79
+ /**
80
+ * {@link Base64FromFile} for an API that reads the file in Base64Url.
81
+ *
82
+ * @since 0.0.0
83
+ * @category schemas
84
+ */
85
+ export declare const Base64UrlFromFile: Schema.decodeTo<Schema.String, Schema.Struct<{
86
+ readonly _tag: Schema.optionalKey<Schema.Literal<"ToolFile">>;
87
+ readonly contentBase64: Schema.Uint8ArrayFromBase64;
88
+ readonly contentType: Schema.optionalKey<Schema.NullOr<Schema.String>>;
89
+ readonly filename: Schema.optionalKey<Schema.NullOr<Schema.String>>;
90
+ readonly sizeBytes: Schema.optionalKey<Schema.Natural>;
91
+ }>, never, never>;
92
+ /**
93
+ * {@link FileFromBase64} for an API that writes the file as a data URI, which also carries its
94
+ * content type.
95
+ *
96
+ * @since 0.0.0
97
+ * @category schemas
98
+ */
99
+ export declare const FileFromDataUri: Schema.decodeTo<Schema.TaggedStruct<"ToolFile", {
100
+ readonly contentBase64: Schema.String;
101
+ readonly contentType: Schema.NullOr<Schema.String>;
102
+ readonly filename: Schema.NullOr<Schema.String>;
103
+ readonly sizeBytes: Schema.Natural;
104
+ }>, Schema.String, never, never>;
105
+ /**
106
+ * {@link Base64FromFile} for an API that reads the file as a data URI, built from the file's
107
+ * content type.
108
+ *
109
+ * @since 0.0.0
110
+ * @category schemas
111
+ */
112
+ export declare const DataUriFromFile: Schema.decodeTo<Schema.String, Schema.Struct<{
113
+ readonly _tag: Schema.optionalKey<Schema.Literal<"ToolFile">>;
114
+ readonly contentBase64: Schema.Uint8ArrayFromBase64;
115
+ readonly contentType: Schema.optionalKey<Schema.NullOr<Schema.String>>;
116
+ readonly filename: Schema.optionalKey<Schema.NullOr<Schema.String>>;
117
+ readonly sizeBytes: Schema.optionalKey<Schema.Natural>;
118
+ }>, never, never>;
119
+ /**
120
+ * A date-time the API writes as Unix seconds, decoded into an ISO 8601 UTC string.
121
+ *
122
+ * @since 0.0.0
123
+ * @category schemas
124
+ */
125
+ export declare const DateTimeFromUnixSeconds: Schema.decodeTo<Schema.String, Schema.Codec<number, number, never, never>, never, never>;
126
+ /**
127
+ * An ISO 8601 date-time input the API reads as Unix seconds.
128
+ *
129
+ * @since 0.0.0
130
+ * @category schemas
131
+ */
132
+ export declare const UnixSecondsFromDateTime: Schema.decodeTo<Schema.Codec<number, number, never, never>, Schema.String, never, never>;
133
+ /**
134
+ * A date-time the API writes in RFC 2822 form, decoded into an ISO 8601 UTC string.
135
+ *
136
+ * @since 0.0.0
137
+ * @category schemas
138
+ */
139
+ export declare const DateTimeFromRfc2822: Schema.decodeTo<Schema.String, Schema.Codec<string, string, never, never>, never, never>;
140
+ /**
141
+ * An ISO 8601 date-time input the API reads in RFC 2822 form.
142
+ *
143
+ * @since 0.0.0
144
+ * @category schemas
145
+ */
146
+ export declare const Rfc2822FromDateTime: Schema.decodeTo<Schema.Codec<string, string, never, never>, Schema.String, never, never>;
147
+ /**
148
+ * An action output whose response decodes into a different shape, such as a file the API sends as
149
+ * Base64: the action declares the decoded shape and the call decodes the response with `wire`.
150
+ *
151
+ * @since 0.0.0
152
+ * @category models
153
+ */
154
+ export interface Decoded<Wire extends Schema.Top> {
155
+ readonly _tag: "Decoded";
156
+ readonly wire: Wire;
157
+ }
158
+ /**
159
+ * Declares an output by the response schema it decodes from; see {@link Decoded}.
160
+ *
161
+ * @since 0.0.0
162
+ * @category constructors
163
+ */
164
+ export declare function decoded<const Wire extends Schema.Top>(wire: Wire): Decoded<Wire>;
165
+ type Request = HttpClientRequest.HttpClientRequest | Effect.Effect<HttpClientRequest.HttpClientRequest, ActionHandlerError>;
166
+ /** `binary` returns a released version's base64 `ToolFile`; `file` stores the body as a file. */
167
+ type Body = "json" | "text" | "binary" | "file" | "void" | "unknown";
168
+ /**
169
+ * A response status, media type and decoding mode advertised by an HTTP action.
170
+ *
171
+ * @since 0.4.1
172
+ * @category models
173
+ */
174
+ export interface Variant {
175
+ readonly status?: number;
176
+ readonly contentType: string;
177
+ readonly body: Body;
178
+ readonly headers?: readonly string[];
179
+ }
180
+ type Media = {
181
+ readonly contentBase64: Uint8Array;
182
+ readonly contentType?: string | null;
183
+ } | File$1;
184
+ type Upload = {
185
+ readonly mode: "media";
186
+ readonly media: Media;
187
+ } | {
188
+ readonly mode: "multipart";
189
+ readonly media: Media;
190
+ readonly metadata: unknown;
191
+ } | {
192
+ readonly mode: "start";
193
+ readonly contentType: string;
194
+ readonly metadata?: unknown;
195
+ readonly totalBytes: number;
196
+ } | {
197
+ readonly mode: "chunk";
198
+ readonly sessionUrl: string;
199
+ readonly totalBytes: number;
200
+ readonly offset: number;
201
+ readonly media: Media;
202
+ } | {
203
+ readonly mode: "status";
204
+ readonly sessionUrl: string;
205
+ readonly totalBytes: number;
206
+ };
207
+ /**
208
+ * Encodes a path parameter as one segment.
209
+ *
210
+ * @since 0.0.0
211
+ * @category encoding
212
+ */
213
+ export declare function path(value: unknown): string;
214
+ /**
215
+ * Encodes a path parameter written inside single quotes, an OData string literal, doubling its
216
+ * quotes: `O'Brien` in `People('{name}')` is sent as `People('O''Brien')`.
217
+ *
218
+ * @since 0.0.0
219
+ * @category encoding
220
+ */
221
+ export declare function literal(value: unknown): string;
222
+ /**
223
+ * Encodes a path parameter whose slashes stay path separators.
224
+ *
225
+ * @since 0.0.0
226
+ * @category encoding
227
+ */
228
+ export declare function segments(value: unknown): string;
229
+ /**
230
+ * Query, header or form entries, repeating array values unless their name is joined, and encoding
231
+ * `deep` names as bracketed keys such as `metadata[plan]` and `expand[0]`. A joined name is
232
+ * comma-separated, or separated by the delimiter it is paired with, such as `["ids", "|"]`.
233
+ * `exploded` object parameters use their property names as query keys (`role=vet&active=true`).
234
+ *
235
+ * @since 0.0.0
236
+ * @category encoding
237
+ */
238
+ export declare function params(fields: Record.ReadonlyRecord<string, unknown>, joined?: readonly (string | readonly [string, string])[], deep?: readonly string[], exploded?: readonly string[]): (readonly [string, string])[];
239
+ /**
240
+ * Multipart form fields, sending each {@link File} as a file part.
241
+ *
242
+ * @since 0.0.0
243
+ * @category encoding
244
+ */
245
+ export declare function form(payload: Record.ReadonlyRecord<string, unknown>): Record<string, (string | globalThis.File | undefined)[]>;
246
+ /**
247
+ * Sends a file as the raw request body.
248
+ *
249
+ * @since 0.1.0
250
+ * @category encoding
251
+ */
252
+ export declare const withFile: (request: HttpClientRequest.HttpClientRequest, file: {
253
+ readonly _tag: "File";
254
+ readonly contentType: string;
255
+ readonly id: string;
256
+ readonly name: string;
257
+ readonly sizeBytes: number;
258
+ }) => Effect.Effect<HttpClientRequest.HttpClientRequest, ActionHandlerError, never>;
259
+ /**
260
+ * Sends multipart form fields, each {@link Files.File} as a file part.
261
+ *
262
+ * @since 0.1.0
263
+ * @category encoding
264
+ */
265
+ export declare const withForm: (request: HttpClientRequest.HttpClientRequest, payload: Record.ReadonlyRecord<string, unknown>) => Effect.Effect<HttpClientRequest.HttpClientRequest, ActionHandlerError, never>;
266
+ /**
267
+ * Follows a returned next-page link on the operation's own origin: only its path and query are
268
+ * taken, so the connection's host routing applies and credentials never reach another host.
269
+ *
270
+ * @since 0.0.0
271
+ * @category requests
272
+ */
273
+ export declare function continuation(request: HttpClientRequest.HttpClientRequest, nextLink?: string): Effect.Effect<never, ActionHandlerError, never> | Effect.Effect<HttpClientRequest.HttpClientRequest, never, never>;
274
+ /**
275
+ * A request to a preauthenticated upload URL, which is sent without the connection's credentials.
276
+ *
277
+ * @since 0.0.0
278
+ * @category requests
279
+ */
280
+ export declare function preauthenticated(method: (url: string) => HttpClientRequest.HttpClientRequest, url: string, ...steps: readonly ((request: HttpClientRequest.HttpClientRequest) => HttpClientRequest.HttpClientRequest)[]): Effect.Effect<never, ActionHandlerError, never> | Effect.Effect<HttpClientRequest.HttpClientRequest, never, never>;
281
+ /**
282
+ * One API operation as {@link make} returns it: its contract and the call that performs it. The
283
+ * `Context` parameter lets a package name its handler context once, so declaration files print
284
+ * `Endpoint<Context, …>` instead of repeating its auth methods in every action.
285
+ *
286
+ * @since 0.0.0
287
+ * @category models
288
+ */
289
+ export interface Endpoint<Context, Input extends Schema.Top, Output extends Schema.Top> {
290
+ readonly input: Input;
291
+ readonly output: Output;
292
+ readonly run: (input: Input["Type"], context: Context) => Effect.Effect<Output["Type"], ActionHandlerFailure, HttpClient.HttpClient>;
293
+ }
294
+ /**
295
+ * An {@link Endpoint} whose output is the decoded type of the response schema it keeps as `wire`.
296
+ *
297
+ * @since 0.0.0
298
+ * @category models
299
+ */
300
+ export interface DecodedEndpoint<Context, Input extends Schema.Top, Wire extends Schema.Top> {
301
+ readonly input: Input;
302
+ readonly output: Schema.toType<Wire>;
303
+ readonly wire: Wire;
304
+ readonly run: (input: Input["Type"], context: Context) => Effect.Effect<Wire["Type"], ActionHandlerFailure, HttpClient.HttpClient>;
305
+ }
306
+ /**
307
+ * Binds the runtime to a package's auth module: the calls a generated version file makes. Its
308
+ * `authorize` applies a connection's credentials to the client. Its optional `checkResponse` fails
309
+ * a successful response that reports a failed call, such as Slack's `{ ok: false, error }`.
310
+ * `preauthenticatedUploadUrl` restricts credential-free upload requests and every redirect to
311
+ * provider-approved HTTPS URLs, without changing authenticated calls or other providers.
312
+ *
313
+ * @since 0.0.0
314
+ * @category constructors
315
+ */
316
+ export declare function make<const Methods extends readonly Any[], Context extends HandlerContext<Methods> = HandlerContext<Methods>>(auth: {
317
+ readonly authorize: (client: HttpClient.HttpClient, context: HandlerContext<Methods>) => HttpClient.HttpClient;
318
+ readonly checkResponse?: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<void, ActionHandlerError | HttpClientError.HttpClientError>;
319
+ readonly preauthenticatedUploadUrl?: Schema.Schema<string>;
320
+ }): {
321
+ endpoint: {
322
+ <const Input extends Schema.Top, const Output extends Schema.Top>(contract: {
323
+ readonly input: Input;
324
+ readonly output: Output;
325
+ }, run: (input: Input["Type"], context: Context, output: Output) => Effect.Effect<Output["Type"], ActionHandlerFailure, HttpClient.HttpClient>): Endpoint<Context, Input, Output>;
326
+ <const Input extends Schema.Top, const Wire extends Schema.Top>(contract: {
327
+ readonly input: Input;
328
+ readonly output: Decoded<Wire>;
329
+ }, run: (input: Input["Type"], context: Context, output: Wire) => Effect.Effect<Wire["Type"], ActionHandlerFailure, HttpClient.HttpClient>): DecodedEndpoint<Context, Input, Wire>;
330
+ };
331
+ execute: <Output extends Schema.Top>(context: Context | undefined, output: Output, request: Request, body: Body) => Effect.Effect<Output["Type"], ActionHandlerError | RetryableActionHandlerError, HttpClient.HttpClient | Output["DecodingServices"]>;
332
+ googleUpload: <Output extends Schema.Top>(context: Context, output: Output, request: HttpClientRequest.HttpClientRequest, payload: Upload, options: {
333
+ readonly maxSize?: number;
334
+ readonly resumable?: string;
335
+ }) => Effect.Effect<Output["Type"], ActionHandlerError | RetryableActionHandlerError, HttpClient.HttpClient | Output["DecodingServices"]>;
336
+ graphql: <Output extends Schema.Top>(context: Context, output: Output, request: Request, field: string) => Effect.Effect<Output["Type"], ActionHandlerError | RetryableActionHandlerError, HttpClient.HttpClient | Output["DecodingServices"]>;
337
+ mcp: <Output extends Schema.Top>(context: Context, output: Output, server: string, tool: string, args: unknown, structured: boolean) => Effect.Effect<Output["Type"], ActionHandlerError | RetryableActionHandlerError, HttpClient.HttpClient | Exclude<Output["DecodingServices"], import("effect/Scope").Scope>>;
338
+ variants: <Output extends Schema.Top>(context: Context | undefined, output: Output, request: Request, declared: readonly Variant[], media?: boolean | undefined) => Effect.Effect<Output["Type"], ActionHandlerError | RetryableActionHandlerError, HttpClient.HttpClient | Output["DecodingServices"]>;
339
+ };
340
+ //#endregion
341
+ export { Http_d_exports as Http, Http_d_exports };
342
+ //# sourceMappingURL=Http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Http.d.ts","names":["AuthMethod.Any","Action.HandlerContext","Action.ActionHandlerFailure","Action.ActionHandlerError","Files.File","Action.RetryableActionHandlerError"],"sources":["../src/Http.ts"],"mappings":";;;;;;;;;;;;;;;iBAkFiB;WACN,OAAO,OAAO;WACd,QAAQ,OAAO;;;;;;;;YASd,QAAQ,yBAAyBA,OAAkB,OAAO,WACpE,OAAO,OACP,SAASC,eAAsB,aAC5B,OAAO,OAAO,QAAQC,sBAA6B,WAAW;;;;;;;YAQvD,cAAc,KAAK;qBAClB,MAAI,OAAA;;;;;;;;;;;;;;qBAkJJ,gBAAc,OAAA,SAAA,OAAA;;;;;IAAqB,OAAA;;;;;;;qBAQnC,mBAAiB,OAAA,SAAA,OAAA;;;;;IAAwB,OAAA;;;;;;;qBAQzC,gBAAc,OAAA,SAAA,OAAA,QAAA,OAAA;;;;;;;;;;;;;qBAQd,mBAAiB,OAAA,SAAA,OAAA,QAAA,OAAA;;;;;;;;;;;;;;qBASjB,iBAAe,OAAA,SAAA,OAAA;;;;;IAAuB,OAAA;;;;;;;;qBAStC,iBAAe,OAAA,SAAA,OAAA,QAAA,OAAA;;;;;;;;;;;;;qBAgEf,yBAAuB,OAAA,SAAA,OAAA,QAAA,OAAA;;;;;;;qBAQvB,yBAAuB,OAAA,SAAA,OAAA,qCAAA,OAAA;;;;;;;qBAQvB,qBAAmB,OAAA,SAAA,OAAA,QAAA,OAAA;;;;;;;qBAQnB,qBAAmB,OAAA,SAAA,OAAA,qCAAA,OAAA;;;;;;;;iBASf,QA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