@lifi/composer-sdk 0.8.1 → 0.10.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 (161) hide show
  1. package/README.md +4 -3
  2. package/dist/_virtual/_rolldown/runtime.cjs +33 -0
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/authoring/FlowBuilderCore.cjs +102 -120
  5. package/dist/authoring/FlowBuilderCore.cjs.map +1 -1
  6. package/dist/authoring/FlowBuilderCore.d.cts +58 -61
  7. package/dist/authoring/FlowBuilderCore.d.ts +58 -61
  8. package/dist/authoring/FlowBuilderCore.js +99 -97
  9. package/dist/authoring/FlowBuilderCore.js.map +1 -1
  10. package/dist/authoring/handles.cjs +25 -40
  11. package/dist/authoring/handles.cjs.map +1 -1
  12. package/dist/authoring/handles.d.cts +33 -34
  13. package/dist/authoring/handles.d.ts +33 -34
  14. package/dist/authoring/handles.js +21 -13
  15. package/dist/authoring/handles.js.map +1 -1
  16. package/dist/authoring/raw.cjs +85 -44
  17. package/dist/authoring/raw.cjs.map +1 -1
  18. package/dist/authoring/raw.d.cts +8 -8
  19. package/dist/authoring/raw.d.ts +8 -8
  20. package/dist/authoring/raw.js +83 -19
  21. package/dist/authoring/raw.js.map +1 -1
  22. package/dist/authoring/signatureArgs.cjs +81 -103
  23. package/dist/authoring/signatureArgs.cjs.map +1 -1
  24. package/dist/authoring/signatureArgs.d.cts +63 -64
  25. package/dist/authoring/signatureArgs.d.ts +63 -64
  26. package/dist/authoring/signatureArgs.js +76 -75
  27. package/dist/authoring/signatureArgs.js.map +1 -1
  28. package/dist/client.cjs +172 -220
  29. package/dist/client.cjs.map +1 -1
  30. package/dist/client.d.cts +131 -131
  31. package/dist/client.d.ts +131 -131
  32. package/dist/client.js +165 -198
  33. package/dist/client.js.map +1 -1
  34. package/dist/discovery.cjs +0 -17
  35. package/dist/discovery.d.cts +57 -56
  36. package/dist/discovery.d.ts +57 -56
  37. package/dist/discovery.js +1 -1
  38. package/dist/errors.cjs +211 -159
  39. package/dist/errors.cjs.map +1 -1
  40. package/dist/errors.d.cts +84 -84
  41. package/dist/errors.d.ts +84 -84
  42. package/dist/errors.js +201 -120
  43. package/dist/errors.js.map +1 -1
  44. package/dist/generated/config.generated.cjs +0 -17
  45. package/dist/generated/config.generated.d.cts +804 -936
  46. package/dist/generated/config.generated.d.ts +804 -936
  47. package/dist/generated/config.generated.js +1 -1
  48. package/dist/generated/guards.generated.cjs +25 -35
  49. package/dist/generated/guards.generated.cjs.map +1 -1
  50. package/dist/generated/guards.generated.d.cts +20 -4
  51. package/dist/generated/guards.generated.d.ts +20 -4
  52. package/dist/generated/guards.generated.js +19 -11
  53. package/dist/generated/guards.generated.js.map +1 -1
  54. package/dist/generated/materialisers.generated.cjs +25 -35
  55. package/dist/generated/materialisers.generated.cjs.map +1 -1
  56. package/dist/generated/materialisers.generated.d.cts +17 -4
  57. package/dist/generated/materialisers.generated.d.ts +17 -4
  58. package/dist/generated/materialisers.generated.js +19 -11
  59. package/dist/generated/materialisers.generated.js.map +1 -1
  60. package/dist/generated/operations.generated.cjs +236 -277
  61. package/dist/generated/operations.generated.cjs.map +1 -1
  62. package/dist/generated/operations.generated.d.cts +719 -708
  63. package/dist/generated/operations.generated.d.ts +719 -708
  64. package/dist/generated/operations.generated.js +235 -256
  65. package/dist/generated/operations.generated.js.map +1 -1
  66. package/dist/generated/preconditions.generated.cjs +25 -35
  67. package/dist/generated/preconditions.generated.cjs.map +1 -1
  68. package/dist/generated/preconditions.generated.d.cts +17 -4
  69. package/dist/generated/preconditions.generated.d.ts +17 -4
  70. package/dist/generated/preconditions.generated.js +19 -11
  71. package/dist/generated/preconditions.generated.js.map +1 -1
  72. package/dist/index.cjs +131 -97
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.d.cts +29 -43
  75. package/dist/index.d.ts +29 -43
  76. package/dist/index.js +96 -45
  77. package/dist/index.js.map +1 -1
  78. package/dist/outputs.cjs +11 -32
  79. package/dist/outputs.cjs.map +1 -1
  80. package/dist/outputs.d.cts +5 -5
  81. package/dist/outputs.d.ts +5 -5
  82. package/dist/outputs.js +10 -8
  83. package/dist/outputs.js.map +1 -1
  84. package/dist/raw.cjs +21 -33
  85. package/dist/raw.cjs.map +1 -1
  86. package/dist/raw.d.cts +8 -4
  87. package/dist/raw.d.ts +8 -4
  88. package/dist/raw.js +12 -7
  89. package/dist/raw.js.map +1 -1
  90. package/dist/reachability.cjs +82 -112
  91. package/dist/reachability.cjs.map +1 -1
  92. package/dist/reachability.d.cts +33 -59
  93. package/dist/reachability.d.ts +33 -59
  94. package/dist/reachability.js +81 -88
  95. package/dist/reachability.js.map +1 -1
  96. package/dist/resources.cjs +47 -32
  97. package/dist/resources.cjs.map +1 -1
  98. package/dist/resources.d.cts +50 -3
  99. package/dist/resources.d.ts +50 -3
  100. package/dist/resources.js +42 -9
  101. package/dist/resources.js.map +1 -1
  102. package/dist/responseSchemas.cjs +99 -111
  103. package/dist/responseSchemas.cjs.map +1 -1
  104. package/dist/responseSchemas.d.cts +34 -34
  105. package/dist/responseSchemas.d.ts +34 -34
  106. package/dist/responseSchemas.js +85 -66
  107. package/dist/responseSchemas.js.map +1 -1
  108. package/dist/routeAmount.cjs +61 -31
  109. package/dist/routeAmount.cjs.map +1 -1
  110. package/dist/routeAmount.d.cts +52 -2
  111. package/dist/routeAmount.d.ts +52 -2
  112. package/dist/routeAmount.js +56 -8
  113. package/dist/routeAmount.js.map +1 -1
  114. package/dist/run/inputs.cjs +56 -48
  115. package/dist/run/inputs.cjs.map +1 -1
  116. package/dist/run/inputs.d.cts +70 -74
  117. package/dist/run/inputs.d.ts +70 -74
  118. package/dist/run/inputs.js +54 -23
  119. package/dist/run/inputs.js.map +1 -1
  120. package/dist/run/simulate.cjs +38 -43
  121. package/dist/run/simulate.cjs.map +1 -1
  122. package/dist/run/simulate.d.cts +36 -36
  123. package/dist/run/simulate.d.ts +36 -36
  124. package/dist/run/simulate.js +37 -19
  125. package/dist/run/simulate.js.map +1 -1
  126. package/dist/sdk.cjs +55 -66
  127. package/dist/sdk.cjs.map +1 -1
  128. package/dist/sdk.d.cts +108 -111
  129. package/dist/sdk.d.ts +108 -111
  130. package/dist/sdk.js +52 -44
  131. package/dist/sdk.js.map +1 -1
  132. package/dist/types.cjs +0 -17
  133. package/dist/types.d.cts +22 -22
  134. package/dist/types.d.ts +22 -22
  135. package/dist/types.js +1 -1
  136. package/package.json +5 -5
  137. package/src/client.ts +2 -2
  138. package/src/examples/aaveClaimRewards.ts +2 -1
  139. package/src/examples/emitCustomEvent.ts +1 -2
  140. package/src/examples/run.ts +1 -1
  141. package/src/examples/transferTokens.ts +21 -17
  142. package/src/generated/config.generated.ts +20 -9
  143. package/src/generated/operations.generated.ts +28 -5
  144. package/dist/discovery.cjs.map +0 -1
  145. package/dist/discovery.js.map +0 -1
  146. package/dist/generated/config.generated.cjs.map +0 -1
  147. package/dist/generated/config.generated.js.map +0 -1
  148. package/dist/guards.generated-CDCgYGZo.d.cts +0 -24
  149. package/dist/guards.generated-CdYcs4h0.d.ts +0 -24
  150. package/dist/materialisers.generated-BMkBQgWZ.d.ts +0 -24
  151. package/dist/materialisers.generated-BWq5oePO.d.cts +0 -24
  152. package/dist/preconditions.generated-DblS13Wq.d.cts +0 -24
  153. package/dist/preconditions.generated-U7YpVh30.d.ts +0 -24
  154. package/dist/raw-BvRghN3r.d.ts +0 -20
  155. package/dist/raw-s1rer8X3.d.cts +0 -20
  156. package/dist/resources-BKlFxjo8.d.cts +0 -56
  157. package/dist/resources-CYis1_DS.d.ts +0 -56
  158. package/dist/routeAmount-DdbJYJyM.d.cts +0 -55
  159. package/dist/routeAmount-DdbJYJyM.d.ts +0 -55
  160. package/dist/types.cjs.map +0 -1
  161. package/dist/types.js.map +0 -1
@@ -1,39 +1,39 @@
1
- import { StaticSolType, SolType, Resource, Ref, BindValue } from '@lifi/compose-spec';
2
- import { OutputKind, TypedRef, TypedLiteral } from '../types.cjs';
3
-
1
+ import { OutputKind, TypedLiteral, TypedRef } from "../types.cjs";
2
+ import { BindValue, Ref, Resource, SolType, StaticSolType } from "@lifi/compose-spec";
3
+ //#region src/authoring/handles.d.ts
4
4
  /**
5
5
  * A handle referencing a flow input declared in the flow's input schema.
6
6
  * The phantom `__outputKind` field carries the type parameter through
7
7
  * TypeScript's structural type system without affecting runtime shape.
8
8
  */
9
- interface InputHandle<T extends OutputKind = OutputKind> {
10
- readonly _tag: 'input';
11
- readonly inputName: string;
12
- readonly __outputKind?: T;
9
+ export interface InputHandle<T extends OutputKind = OutputKind> {
10
+ readonly _tag: "input";
11
+ readonly inputName: string;
12
+ readonly __outputKind?: T;
13
13
  }
14
14
  /**
15
15
  * An input handle for a resource (token) input, carrying the resource
16
16
  * declaration alongside the reference.
17
17
  */
18
- interface ResourceInputHandle extends InputHandle<'resource'> {
19
- readonly resource: Resource;
18
+ export interface ResourceInputHandle extends InputHandle<"resource"> {
19
+ readonly resource: Resource;
20
20
  }
21
21
  /**
22
22
  * A handle referencing an output port of a previously declared operation node.
23
23
  * The phantom `__outputKind` field carries the type parameter through
24
24
  * TypeScript's structural type system without affecting runtime shape.
25
25
  */
26
- interface OutputHandle<T extends OutputKind = OutputKind> {
27
- readonly _tag: 'output';
28
- readonly nodeId: string;
29
- readonly portName: string;
30
- readonly __outputKind?: T;
26
+ export interface OutputHandle<T extends OutputKind = OutputKind> {
27
+ readonly _tag: "output";
28
+ readonly nodeId: string;
29
+ readonly portName: string;
30
+ readonly __outputKind?: T;
31
31
  }
32
32
  /**
33
33
  * What an output family's sizing parameter accepts, given the config field the
34
34
  * family counts from: an array of that field's elements, or a number.
35
35
  */
36
- type FamilySource<Field> = Field extends readonly (infer E)[] ? readonly E[] : number;
36
+ export type FamilySource<Field> = Field extends readonly (infer E)[] ? readonly E[] : number;
37
37
  /** Whether a number literal is a valid family count: a non-negative integer. */
38
38
  type IsCountLiteral<N extends number> = `${N}` extends `-${string}` | `${string}.${string}` | `${string}e${string}` ? false : true;
39
39
  /**
@@ -41,16 +41,14 @@ type IsCountLiteral<N extends number> = `${N}` extends `-${string}` | `${string}
41
41
  * not a valid count, gives an open array; {@link FamilyCount} rejects the
42
42
  * invalid literal at the call site.
43
43
  */
44
- type HandleTuple<N extends number, Acc extends readonly OutputHandle<'resource'>[] = readonly []> = number extends N ? readonly OutputHandle<'resource'>[] : IsCountLiteral<N> extends false ? readonly OutputHandle<'resource'>[] : Acc['length'] extends N ? Acc : HandleTuple<N, readonly [...Acc, OutputHandle<'resource'>]>;
44
+ type HandleTuple<N extends number, Acc extends readonly OutputHandle<"resource">[] = readonly []> = number extends N ? readonly OutputHandle<"resource">[] : IsCountLiteral<N> extends false ? readonly OutputHandle<"resource">[] : Acc["length"] extends N ? Acc : HandleTuple<N, readonly [...Acc, OutputHandle<"resource">]>;
45
45
  /**
46
46
  * The handles of an output family: one resource {@link OutputHandle} per
47
47
  * element of the config array the family counts from, or as many as the config
48
48
  * count. A literal array or count yields a tuple of that length, so indexing
49
49
  * past the last instance is a type error.
50
50
  */
51
- type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount extends readonly unknown[] ? {
52
- readonly [I in keyof TCount]: OutputHandle<'resource'>;
53
- } : TCount extends number ? HandleTuple<TCount> : never;
51
+ export type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount extends readonly unknown[] ? { readonly [I in keyof TCount]: OutputHandle<"resource">; } : TCount extends number ? HandleTuple<TCount> : never;
54
52
  /**
55
53
  * Holds the config value an output family counts from to the op's own type. A
56
54
  * runtime-sized array or count passes as is. A literal tuple must also satisfy
@@ -58,23 +56,23 @@ type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount ex
58
56
  * instead of at the server's bind step. A literal count must be a non-negative
59
57
  * integer.
60
58
  */
61
- type FamilyCount<TCount extends readonly unknown[] | number, Shape> = TCount extends readonly unknown[] ? number extends TCount['length'] ? unknown : TCount extends Shape ? unknown : {
62
- readonly 'output family config array has too few entries': never;
59
+ export type FamilyCount<TCount extends readonly unknown[] | number, Shape> = TCount extends readonly unknown[] ? number extends TCount["length"] ? unknown : TCount extends Shape ? unknown : {
60
+ readonly "output family config array has too few entries": never;
63
61
  } : TCount extends number ? IsCountLiteral<TCount> extends true ? unknown : {
64
- readonly 'output family count must be a non-negative integer': never;
62
+ readonly "output family count must be a non-negative integer": never;
65
63
  } : unknown;
66
64
  /** Discriminated union of all handle types that can be bound to operation arguments. */
67
- type AnyHandle = InputHandle | OutputHandle;
65
+ export type AnyHandle = InputHandle | OutputHandle;
68
66
  /** Type guard that narrows an {@link AnyHandle} to an {@link InputHandle}. */
69
- declare const isInputHandle: (h: AnyHandle) => h is InputHandle;
67
+ export declare const isInputHandle: (h: AnyHandle) => h is InputHandle;
70
68
  /** Type guard that narrows an {@link AnyHandle} to an {@link OutputHandle}. */
71
- declare const isOutputHandle: (h: AnyHandle) => h is OutputHandle;
69
+ export declare const isOutputHandle: (h: AnyHandle) => h is OutputHandle;
72
70
  /**
73
71
  * Converts a handle to a JSON `$ref` pointer used in the flow document.
74
72
  * Input handles become `"input.<name>"`; output handles become `"<nodeId>.<port>"`.
75
73
  */
76
- declare const handleToRef: (h: AnyHandle) => {
77
- $ref: string;
74
+ export declare const handleToRef: (h: AnyHandle) => {
75
+ $ref: string;
78
76
  };
79
77
  /**
80
78
  * For a bind slot expecting type T, widen the set of accepted handle types:
@@ -86,7 +84,7 @@ declare const handleToRef: (h: AnyHandle) => {
86
84
  * handles (resources are uint256 amounts).
87
85
  * - every other type keeps exact-SolType matching.
88
86
  */
89
- type SlotAssignable<T extends OutputKind> = T extends 'bytes32' ? StaticSolType | 'resource' : T extends 'uint256' ? T | 'resource' : T;
87
+ type SlotAssignable<T extends OutputKind> = T extends "bytes32" ? StaticSolType | "resource" : T extends "uint256" ? T | "resource" : T;
90
88
  /**
91
89
  * The values accepted by a typed slot that must resolve to a `$ref`:
92
90
  * - `OutputHandle<T>` / `InputHandle<T>` (same type)
@@ -97,11 +95,11 @@ type SlotAssignable<T extends OutputKind> = T extends 'bytes32' ? StaticSolType
97
95
  * Plain `{ $ref: '...' }` objects are **not** accepted - use `raw.ref<T>()`
98
96
  * to create a typed ref when you need to reference a raw path.
99
97
  */
100
- type RefBindable<T extends OutputKind> = OutputHandle<SlotAssignable<T>> | InputHandle<SlotAssignable<T>> | TypedRef<SlotAssignable<T>>;
98
+ export type RefBindable<T extends OutputKind> = OutputHandle<SlotAssignable<T>> | InputHandle<SlotAssignable<T>> | TypedRef<SlotAssignable<T>>;
101
99
  /**
102
100
  * Any ref-resolving bindable, with no per-slot type constraint.
103
101
  */
104
- type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
102
+ export type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
105
103
  /**
106
104
  * The set of values accepted by a typed operation bind slot: everything
107
105
  * {@link RefBindable} accepts, plus a {@link TypedLiteral} constant baked
@@ -110,12 +108,13 @@ type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
110
108
  *
111
109
  * Use `raw.literal<T>()` to create one.
112
110
  */
113
- type Bindable<T extends OutputKind> = RefBindable<T> | LiteralBindable<SlotAssignable<T>>;
111
+ export type Bindable<T extends OutputKind> = RefBindable<T> | LiteralBindable<SlotAssignable<T>>;
114
112
  type LiteralBindable<K extends OutputKind> = K extends SolType ? TypedLiteral<K> : never;
115
113
  /**
116
114
  * Converts a bindable to the wire `bind` value it denotes: handles become
117
115
  * `$ref` pointers, refs and literals pass through as-is.
118
116
  */
119
- declare const toBindValue: (bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref) => BindValue;
120
-
121
- export { type AnyHandle, type AnyRefBindable, type Bindable, type FamilyCount, type FamilySource, type InputHandle, type OutputFamilyHandles, type OutputHandle, type RefBindable, type ResourceInputHandle, handleToRef, isInputHandle, isOutputHandle, toBindValue };
117
+ export declare const toBindValue: (bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref) => BindValue;
118
+ //#endregion
119
+ export {};
120
+ //# sourceMappingURL=handles.d.cts.map
@@ -1,39 +1,39 @@
1
- import { StaticSolType, SolType, Resource, Ref, BindValue } from '@lifi/compose-spec';
2
- import { OutputKind, TypedRef, TypedLiteral } from '../types.js';
3
-
1
+ import { OutputKind, TypedLiteral, TypedRef } from "../types.js";
2
+ import { BindValue, Ref, Resource, SolType, StaticSolType } from "@lifi/compose-spec";
3
+ //#region src/authoring/handles.d.ts
4
4
  /**
5
5
  * A handle referencing a flow input declared in the flow's input schema.
6
6
  * The phantom `__outputKind` field carries the type parameter through
7
7
  * TypeScript's structural type system without affecting runtime shape.
8
8
  */
9
- interface InputHandle<T extends OutputKind = OutputKind> {
10
- readonly _tag: 'input';
11
- readonly inputName: string;
12
- readonly __outputKind?: T;
9
+ export interface InputHandle<T extends OutputKind = OutputKind> {
10
+ readonly _tag: "input";
11
+ readonly inputName: string;
12
+ readonly __outputKind?: T;
13
13
  }
14
14
  /**
15
15
  * An input handle for a resource (token) input, carrying the resource
16
16
  * declaration alongside the reference.
17
17
  */
18
- interface ResourceInputHandle extends InputHandle<'resource'> {
19
- readonly resource: Resource;
18
+ export interface ResourceInputHandle extends InputHandle<"resource"> {
19
+ readonly resource: Resource;
20
20
  }
21
21
  /**
22
22
  * A handle referencing an output port of a previously declared operation node.
23
23
  * The phantom `__outputKind` field carries the type parameter through
24
24
  * TypeScript's structural type system without affecting runtime shape.
25
25
  */
26
- interface OutputHandle<T extends OutputKind = OutputKind> {
27
- readonly _tag: 'output';
28
- readonly nodeId: string;
29
- readonly portName: string;
30
- readonly __outputKind?: T;
26
+ export interface OutputHandle<T extends OutputKind = OutputKind> {
27
+ readonly _tag: "output";
28
+ readonly nodeId: string;
29
+ readonly portName: string;
30
+ readonly __outputKind?: T;
31
31
  }
32
32
  /**
33
33
  * What an output family's sizing parameter accepts, given the config field the
34
34
  * family counts from: an array of that field's elements, or a number.
35
35
  */
36
- type FamilySource<Field> = Field extends readonly (infer E)[] ? readonly E[] : number;
36
+ export type FamilySource<Field> = Field extends readonly (infer E)[] ? readonly E[] : number;
37
37
  /** Whether a number literal is a valid family count: a non-negative integer. */
38
38
  type IsCountLiteral<N extends number> = `${N}` extends `-${string}` | `${string}.${string}` | `${string}e${string}` ? false : true;
39
39
  /**
@@ -41,16 +41,14 @@ type IsCountLiteral<N extends number> = `${N}` extends `-${string}` | `${string}
41
41
  * not a valid count, gives an open array; {@link FamilyCount} rejects the
42
42
  * invalid literal at the call site.
43
43
  */
44
- type HandleTuple<N extends number, Acc extends readonly OutputHandle<'resource'>[] = readonly []> = number extends N ? readonly OutputHandle<'resource'>[] : IsCountLiteral<N> extends false ? readonly OutputHandle<'resource'>[] : Acc['length'] extends N ? Acc : HandleTuple<N, readonly [...Acc, OutputHandle<'resource'>]>;
44
+ type HandleTuple<N extends number, Acc extends readonly OutputHandle<"resource">[] = readonly []> = number extends N ? readonly OutputHandle<"resource">[] : IsCountLiteral<N> extends false ? readonly OutputHandle<"resource">[] : Acc["length"] extends N ? Acc : HandleTuple<N, readonly [...Acc, OutputHandle<"resource">]>;
45
45
  /**
46
46
  * The handles of an output family: one resource {@link OutputHandle} per
47
47
  * element of the config array the family counts from, or as many as the config
48
48
  * count. A literal array or count yields a tuple of that length, so indexing
49
49
  * past the last instance is a type error.
50
50
  */
51
- type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount extends readonly unknown[] ? {
52
- readonly [I in keyof TCount]: OutputHandle<'resource'>;
53
- } : TCount extends number ? HandleTuple<TCount> : never;
51
+ export type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount extends readonly unknown[] ? { readonly [I in keyof TCount]: OutputHandle<"resource">; } : TCount extends number ? HandleTuple<TCount> : never;
54
52
  /**
55
53
  * Holds the config value an output family counts from to the op's own type. A
56
54
  * runtime-sized array or count passes as is. A literal tuple must also satisfy
@@ -58,23 +56,23 @@ type OutputFamilyHandles<TCount extends readonly unknown[] | number> = TCount ex
58
56
  * instead of at the server's bind step. A literal count must be a non-negative
59
57
  * integer.
60
58
  */
61
- type FamilyCount<TCount extends readonly unknown[] | number, Shape> = TCount extends readonly unknown[] ? number extends TCount['length'] ? unknown : TCount extends Shape ? unknown : {
62
- readonly 'output family config array has too few entries': never;
59
+ export type FamilyCount<TCount extends readonly unknown[] | number, Shape> = TCount extends readonly unknown[] ? number extends TCount["length"] ? unknown : TCount extends Shape ? unknown : {
60
+ readonly "output family config array has too few entries": never;
63
61
  } : TCount extends number ? IsCountLiteral<TCount> extends true ? unknown : {
64
- readonly 'output family count must be a non-negative integer': never;
62
+ readonly "output family count must be a non-negative integer": never;
65
63
  } : unknown;
66
64
  /** Discriminated union of all handle types that can be bound to operation arguments. */
67
- type AnyHandle = InputHandle | OutputHandle;
65
+ export type AnyHandle = InputHandle | OutputHandle;
68
66
  /** Type guard that narrows an {@link AnyHandle} to an {@link InputHandle}. */
69
- declare const isInputHandle: (h: AnyHandle) => h is InputHandle;
67
+ export declare const isInputHandle: (h: AnyHandle) => h is InputHandle;
70
68
  /** Type guard that narrows an {@link AnyHandle} to an {@link OutputHandle}. */
71
- declare const isOutputHandle: (h: AnyHandle) => h is OutputHandle;
69
+ export declare const isOutputHandle: (h: AnyHandle) => h is OutputHandle;
72
70
  /**
73
71
  * Converts a handle to a JSON `$ref` pointer used in the flow document.
74
72
  * Input handles become `"input.<name>"`; output handles become `"<nodeId>.<port>"`.
75
73
  */
76
- declare const handleToRef: (h: AnyHandle) => {
77
- $ref: string;
74
+ export declare const handleToRef: (h: AnyHandle) => {
75
+ $ref: string;
78
76
  };
79
77
  /**
80
78
  * For a bind slot expecting type T, widen the set of accepted handle types:
@@ -86,7 +84,7 @@ declare const handleToRef: (h: AnyHandle) => {
86
84
  * handles (resources are uint256 amounts).
87
85
  * - every other type keeps exact-SolType matching.
88
86
  */
89
- type SlotAssignable<T extends OutputKind> = T extends 'bytes32' ? StaticSolType | 'resource' : T extends 'uint256' ? T | 'resource' : T;
87
+ type SlotAssignable<T extends OutputKind> = T extends "bytes32" ? StaticSolType | "resource" : T extends "uint256" ? T | "resource" : T;
90
88
  /**
91
89
  * The values accepted by a typed slot that must resolve to a `$ref`:
92
90
  * - `OutputHandle<T>` / `InputHandle<T>` (same type)
@@ -97,11 +95,11 @@ type SlotAssignable<T extends OutputKind> = T extends 'bytes32' ? StaticSolType
97
95
  * Plain `{ $ref: '...' }` objects are **not** accepted - use `raw.ref<T>()`
98
96
  * to create a typed ref when you need to reference a raw path.
99
97
  */
100
- type RefBindable<T extends OutputKind> = OutputHandle<SlotAssignable<T>> | InputHandle<SlotAssignable<T>> | TypedRef<SlotAssignable<T>>;
98
+ export type RefBindable<T extends OutputKind> = OutputHandle<SlotAssignable<T>> | InputHandle<SlotAssignable<T>> | TypedRef<SlotAssignable<T>>;
101
99
  /**
102
100
  * Any ref-resolving bindable, with no per-slot type constraint.
103
101
  */
104
- type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
102
+ export type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
105
103
  /**
106
104
  * The set of values accepted by a typed operation bind slot: everything
107
105
  * {@link RefBindable} accepts, plus a {@link TypedLiteral} constant baked
@@ -110,12 +108,13 @@ type AnyRefBindable = InputHandle | OutputHandle | TypedRef;
110
108
  *
111
109
  * Use `raw.literal<T>()` to create one.
112
110
  */
113
- type Bindable<T extends OutputKind> = RefBindable<T> | LiteralBindable<SlotAssignable<T>>;
111
+ export type Bindable<T extends OutputKind> = RefBindable<T> | LiteralBindable<SlotAssignable<T>>;
114
112
  type LiteralBindable<K extends OutputKind> = K extends SolType ? TypedLiteral<K> : never;
115
113
  /**
116
114
  * Converts a bindable to the wire `bind` value it denotes: handles become
117
115
  * `$ref` pointers, refs and literals pass through as-is.
118
116
  */
119
- declare const toBindValue: (bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref) => BindValue;
120
-
121
- export { type AnyHandle, type AnyRefBindable, type Bindable, type FamilyCount, type FamilySource, type InputHandle, type OutputFamilyHandles, type OutputHandle, type RefBindable, type ResourceInputHandle, handleToRef, isInputHandle, isOutputHandle, toBindValue };
117
+ export declare const toBindValue: (bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref) => BindValue;
118
+ //#endregion
119
+ export {};
120
+ //# sourceMappingURL=handles.d.ts.map
@@ -1,19 +1,27 @@
1
+ //#region src/authoring/handles.ts
2
+ /** Type guard that narrows an {@link AnyHandle} to an {@link InputHandle}. */
1
3
  const isInputHandle = (h) => h._tag === "input";
4
+ /** Type guard that narrows an {@link AnyHandle} to an {@link OutputHandle}. */
2
5
  const isOutputHandle = (h) => h._tag === "output";
6
+ /**
7
+ * Converts a handle to a JSON `$ref` pointer used in the flow document.
8
+ * Input handles become `"input.<name>"`; output handles become `"<nodeId>.<port>"`.
9
+ */
3
10
  const handleToRef = (h) => {
4
- if (h._tag === "input") {
5
- if (!h.inputName) throw new Error("InputHandle has empty inputName");
6
- return { $ref: `input.${h.inputName}` };
7
- }
8
- if (!h.nodeId) throw new Error("OutputHandle has empty nodeId");
9
- if (!h.portName) throw new Error("OutputHandle has empty portName");
10
- return { $ref: `${h.nodeId}.${h.portName}` };
11
+ if (h._tag === "input") {
12
+ if (!h.inputName) throw new Error("InputHandle has empty inputName");
13
+ return { $ref: `input.${h.inputName}` };
14
+ }
15
+ if (!h.nodeId) throw new Error("OutputHandle has empty nodeId");
16
+ if (!h.portName) throw new Error("OutputHandle has empty portName");
17
+ return { $ref: `${h.nodeId}.${h.portName}` };
11
18
  };
19
+ /**
20
+ * Converts a bindable to the wire `bind` value it denotes: handles become
21
+ * `$ref` pointers, refs and literals pass through as-is.
22
+ */
12
23
  const toBindValue = (bindable) => "_tag" in bindable ? handleToRef(bindable) : bindable;
13
- export {
14
- handleToRef,
15
- isInputHandle,
16
- isOutputHandle,
17
- toBindValue
18
- };
24
+ //#endregion
25
+ export { handleToRef, isInputHandle, isOutputHandle, toBindValue };
26
+
19
27
  //# sourceMappingURL=handles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/authoring/handles.ts"],"sourcesContent":["import type {\n BindValue,\n Ref,\n Resource,\n SolType,\n StaticSolType,\n} from '@lifi/compose-spec';\n\nimport type { OutputKind, TypedLiteral, TypedRef } from '../types.js';\n\n/**\n * A handle referencing a flow input declared in the flow's input schema.\n * The phantom `__outputKind` field carries the type parameter through\n * TypeScript's structural type system without affecting runtime shape.\n */\nexport interface InputHandle<T extends OutputKind = OutputKind> {\n readonly _tag: 'input';\n readonly inputName: string;\n readonly __outputKind?: T;\n}\n\n/**\n * An input handle for a resource (token) input, carrying the resource\n * declaration alongside the reference.\n */\nexport interface ResourceInputHandle extends InputHandle<'resource'> {\n readonly resource: Resource;\n}\n\n/**\n * A handle referencing an output port of a previously declared operation node.\n * The phantom `__outputKind` field carries the type parameter through\n * TypeScript's structural type system without affecting runtime shape.\n */\nexport interface OutputHandle<T extends OutputKind = OutputKind> {\n readonly _tag: 'output';\n readonly nodeId: string;\n readonly portName: string;\n readonly __outputKind?: T;\n}\n\n/**\n * What an output family's sizing parameter accepts, given the config field the\n * family counts from: an array of that field's elements, or a number.\n */\nexport type FamilySource<Field> = Field extends readonly (infer E)[]\n ? readonly E[]\n : number;\n\n/** Whether a number literal is a valid family count: a non-negative integer. */\ntype IsCountLiteral<N extends number> = `${N}` extends\n `-${string}` | `${string}.${string}` | `${string}e${string}`\n ? false\n : true;\n\n/**\n * `N` resource handles as a tuple. A non-literal `number`, or a literal that is\n * not a valid count, gives an open array; {@link FamilyCount} rejects the\n * invalid literal at the call site.\n */\ntype HandleTuple<\n N extends number,\n Acc extends readonly OutputHandle<'resource'>[] = readonly [],\n> = number extends N\n ? readonly OutputHandle<'resource'>[]\n : IsCountLiteral<N> extends false\n ? readonly OutputHandle<'resource'>[]\n : Acc['length'] extends N\n ? Acc\n : HandleTuple<N, readonly [...Acc, OutputHandle<'resource'>]>;\n\n/**\n * The handles of an output family: one resource {@link OutputHandle} per\n * element of the config array the family counts from, or as many as the config\n * count. A literal array or count yields a tuple of that length, so indexing\n * past the last instance is a type error.\n */\nexport type OutputFamilyHandles<TCount extends readonly unknown[] | number> =\n TCount extends readonly unknown[]\n ? { readonly [I in keyof TCount]: OutputHandle<'resource'> }\n : TCount extends number\n ? HandleTuple<TCount>\n : never;\n\n/**\n * Holds the config value an output family counts from to the op's own type. A\n * runtime-sized array or count passes as is. A literal tuple must also satisfy\n * `Shape`, so a tuple shorter than the op's `minItems` fails at the call site\n * instead of at the server's bind step. A literal count must be a non-negative\n * integer.\n */\nexport type FamilyCount<\n TCount extends readonly unknown[] | number,\n Shape,\n> = TCount extends readonly unknown[]\n ? number extends TCount['length']\n ? unknown\n : TCount extends Shape\n ? unknown\n : { readonly 'output family config array has too few entries': never }\n : TCount extends number\n ? IsCountLiteral<TCount> extends true\n ? unknown\n : {\n readonly 'output family count must be a non-negative integer': never;\n }\n : unknown;\n\n/** Discriminated union of all handle types that can be bound to operation arguments. */\nexport type AnyHandle = InputHandle | OutputHandle;\n\n/** Type guard that narrows an {@link AnyHandle} to an {@link InputHandle}. */\nexport const isInputHandle = (h: AnyHandle): h is InputHandle =>\n h._tag === 'input';\n\n/** Type guard that narrows an {@link AnyHandle} to an {@link OutputHandle}. */\nexport const isOutputHandle = (h: AnyHandle): h is OutputHandle =>\n h._tag === 'output';\n\n/**\n * Converts a handle to a JSON `$ref` pointer used in the flow document.\n * Input handles become `\"input.<name>\"`; output handles become `\"<nodeId>.<port>\"`.\n */\nexport const handleToRef = (h: AnyHandle): { $ref: string } => {\n if (h._tag === 'input') {\n if (!h.inputName) throw new Error('InputHandle has empty inputName');\n return { $ref: `input.${h.inputName}` };\n }\n if (!h.nodeId) throw new Error('OutputHandle has empty nodeId');\n if (!h.portName) throw new Error('OutputHandle has empty portName');\n return { $ref: `${h.nodeId}.${h.portName}` };\n};\n\n/**\n * For a bind slot expecting type T, widen the set of accepted handle types:\n * - `'bytes32'` is the raw 32-byte word type: accept any static-32-byte handle\n * (`uint256`/`uintN`/`address`/`bool`/`bytes32`) plus `'resource'` (a uint256\n * amount). At the IR1 boundary every value is a type-erased word, so any\n * static-32-byte handle is a sound bind for a `bytes32` payload port.\n * - `'uint256'` keeps its existing widening to also accept `'resource'`-tagged\n * handles (resources are uint256 amounts).\n * - every other type keeps exact-SolType matching.\n */\ntype SlotAssignable<T extends OutputKind> = T extends 'bytes32'\n ? StaticSolType | 'resource'\n : T extends 'uint256'\n ? T | 'resource'\n : T;\n\n/**\n * The values accepted by a typed slot that must resolve to a `$ref`:\n * - `OutputHandle<T>` / `InputHandle<T>` (same type)\n * - For `'uint256'` slots, also `'resource'`-tagged handles\n * - For `'bytes32'` slots, any static-32-byte handle (and `'resource'`)\n * - `TypedRef<T>` (typed context refs, subject to `SlotAssignable`)\n *\n * Plain `{ $ref: '...' }` objects are **not** accepted - use `raw.ref<T>()`\n * to create a typed ref when you need to reference a raw path.\n */\nexport type RefBindable<T extends OutputKind> =\n | OutputHandle<SlotAssignable<T>>\n | InputHandle<SlotAssignable<T>>\n | TypedRef<SlotAssignable<T>>;\n\n/**\n * Any ref-resolving bindable, with no per-slot type constraint.\n */\nexport type AnyRefBindable = InputHandle | OutputHandle | TypedRef;\n\n/**\n * The set of values accepted by a typed operation bind slot: everything\n * {@link RefBindable} accepts, plus a {@link TypedLiteral} constant baked\n * into the flow document. A `'resource'` slot rejects a literal: a token\n * resource is not a scalar constant.\n *\n * Use `raw.literal<T>()` to create one.\n */\nexport type Bindable<T extends OutputKind> =\n RefBindable<T> | LiteralBindable<SlotAssignable<T>>;\n\n// Distributes over the slot's assignable kinds and keeps the scalar ones: a\n// `'resource'` slot has no scalar arm, so its literal arm collapses to\n// `never` and a literal is rejected outright.\ntype LiteralBindable<K extends OutputKind> = K extends SolType\n ? TypedLiteral<K>\n : never;\n\n/**\n * Converts a bindable to the wire `bind` value it denotes: handles become\n * `$ref` pointers, refs and literals pass through as-is.\n */\nexport const toBindValue = (\n bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref,\n): BindValue => ('_tag' in bindable ? handleToRef(bindable) : bindable);\n"],"mappings":"AAgHO,MAAM,gBAAgB,CAAC,MAC5B,EAAE,SAAS;AAGN,MAAM,iBAAiB,CAAC,MAC7B,EAAE,SAAS;AAMN,MAAM,cAAc,CAAC,MAAmC;AAC7D,MAAI,EAAE,SAAS,SAAS;AACtB,QAAI,CAAC,EAAE,UAAW,OAAM,IAAI,MAAM,iCAAiC;AACnE,WAAO,EAAE,MAAM,SAAS,EAAE,SAAS,GAAG;AAAA,EACxC;AACA,MAAI,CAAC,EAAE,OAAQ,OAAM,IAAI,MAAM,+BAA+B;AAC9D,MAAI,CAAC,EAAE,SAAU,OAAM,IAAI,MAAM,iCAAiC;AAClE,SAAO,EAAE,MAAM,GAAG,EAAE,MAAM,IAAI,EAAE,QAAQ,GAAG;AAC7C;AA4DO,MAAM,cAAc,CACzB,aACe,UAAU,WAAW,YAAY,QAAQ,IAAI;","names":[]}
1
+ {"version":3,"file":"handles.js","names":[],"sources":["../../src/authoring/handles.ts"],"sourcesContent":["import type {\n BindValue,\n Ref,\n Resource,\n SolType,\n StaticSolType,\n} from '@lifi/compose-spec';\n\nimport type { OutputKind, TypedLiteral, TypedRef } from '../types.js';\n\n/**\n * A handle referencing a flow input declared in the flow's input schema.\n * The phantom `__outputKind` field carries the type parameter through\n * TypeScript's structural type system without affecting runtime shape.\n */\nexport interface InputHandle<T extends OutputKind = OutputKind> {\n readonly _tag: 'input';\n readonly inputName: string;\n readonly __outputKind?: T;\n}\n\n/**\n * An input handle for a resource (token) input, carrying the resource\n * declaration alongside the reference.\n */\nexport interface ResourceInputHandle extends InputHandle<'resource'> {\n readonly resource: Resource;\n}\n\n/**\n * A handle referencing an output port of a previously declared operation node.\n * The phantom `__outputKind` field carries the type parameter through\n * TypeScript's structural type system without affecting runtime shape.\n */\nexport interface OutputHandle<T extends OutputKind = OutputKind> {\n readonly _tag: 'output';\n readonly nodeId: string;\n readonly portName: string;\n readonly __outputKind?: T;\n}\n\n/**\n * What an output family's sizing parameter accepts, given the config field the\n * family counts from: an array of that field's elements, or a number.\n */\nexport type FamilySource<Field> = Field extends readonly (infer E)[]\n ? readonly E[]\n : number;\n\n/** Whether a number literal is a valid family count: a non-negative integer. */\ntype IsCountLiteral<N extends number> = `${N}` extends\n `-${string}` | `${string}.${string}` | `${string}e${string}`\n ? false\n : true;\n\n/**\n * `N` resource handles as a tuple. A non-literal `number`, or a literal that is\n * not a valid count, gives an open array; {@link FamilyCount} rejects the\n * invalid literal at the call site.\n */\ntype HandleTuple<\n N extends number,\n Acc extends readonly OutputHandle<'resource'>[] = readonly [],\n> = number extends N\n ? readonly OutputHandle<'resource'>[]\n : IsCountLiteral<N> extends false\n ? readonly OutputHandle<'resource'>[]\n : Acc['length'] extends N\n ? Acc\n : HandleTuple<N, readonly [...Acc, OutputHandle<'resource'>]>;\n\n/**\n * The handles of an output family: one resource {@link OutputHandle} per\n * element of the config array the family counts from, or as many as the config\n * count. A literal array or count yields a tuple of that length, so indexing\n * past the last instance is a type error.\n */\nexport type OutputFamilyHandles<TCount extends readonly unknown[] | number> =\n TCount extends readonly unknown[]\n ? { readonly [I in keyof TCount]: OutputHandle<'resource'> }\n : TCount extends number\n ? HandleTuple<TCount>\n : never;\n\n/**\n * Holds the config value an output family counts from to the op's own type. A\n * runtime-sized array or count passes as is. A literal tuple must also satisfy\n * `Shape`, so a tuple shorter than the op's `minItems` fails at the call site\n * instead of at the server's bind step. A literal count must be a non-negative\n * integer.\n */\nexport type FamilyCount<\n TCount extends readonly unknown[] | number,\n Shape,\n> = TCount extends readonly unknown[]\n ? number extends TCount['length']\n ? unknown\n : TCount extends Shape\n ? unknown\n : { readonly 'output family config array has too few entries': never }\n : TCount extends number\n ? IsCountLiteral<TCount> extends true\n ? unknown\n : {\n readonly 'output family count must be a non-negative integer': never;\n }\n : unknown;\n\n/** Discriminated union of all handle types that can be bound to operation arguments. */\nexport type AnyHandle = InputHandle | OutputHandle;\n\n/** Type guard that narrows an {@link AnyHandle} to an {@link InputHandle}. */\nexport const isInputHandle = (h: AnyHandle): h is InputHandle =>\n h._tag === 'input';\n\n/** Type guard that narrows an {@link AnyHandle} to an {@link OutputHandle}. */\nexport const isOutputHandle = (h: AnyHandle): h is OutputHandle =>\n h._tag === 'output';\n\n/**\n * Converts a handle to a JSON `$ref` pointer used in the flow document.\n * Input handles become `\"input.<name>\"`; output handles become `\"<nodeId>.<port>\"`.\n */\nexport const handleToRef = (h: AnyHandle): { $ref: string } => {\n if (h._tag === 'input') {\n if (!h.inputName) throw new Error('InputHandle has empty inputName');\n return { $ref: `input.${h.inputName}` };\n }\n if (!h.nodeId) throw new Error('OutputHandle has empty nodeId');\n if (!h.portName) throw new Error('OutputHandle has empty portName');\n return { $ref: `${h.nodeId}.${h.portName}` };\n};\n\n/**\n * For a bind slot expecting type T, widen the set of accepted handle types:\n * - `'bytes32'` is the raw 32-byte word type: accept any static-32-byte handle\n * (`uint256`/`uintN`/`address`/`bool`/`bytes32`) plus `'resource'` (a uint256\n * amount). At the IR1 boundary every value is a type-erased word, so any\n * static-32-byte handle is a sound bind for a `bytes32` payload port.\n * - `'uint256'` keeps its existing widening to also accept `'resource'`-tagged\n * handles (resources are uint256 amounts).\n * - every other type keeps exact-SolType matching.\n */\ntype SlotAssignable<T extends OutputKind> = T extends 'bytes32'\n ? StaticSolType | 'resource'\n : T extends 'uint256'\n ? T | 'resource'\n : T;\n\n/**\n * The values accepted by a typed slot that must resolve to a `$ref`:\n * - `OutputHandle<T>` / `InputHandle<T>` (same type)\n * - For `'uint256'` slots, also `'resource'`-tagged handles\n * - For `'bytes32'` slots, any static-32-byte handle (and `'resource'`)\n * - `TypedRef<T>` (typed context refs, subject to `SlotAssignable`)\n *\n * Plain `{ $ref: '...' }` objects are **not** accepted - use `raw.ref<T>()`\n * to create a typed ref when you need to reference a raw path.\n */\nexport type RefBindable<T extends OutputKind> =\n | OutputHandle<SlotAssignable<T>>\n | InputHandle<SlotAssignable<T>>\n | TypedRef<SlotAssignable<T>>;\n\n/**\n * Any ref-resolving bindable, with no per-slot type constraint.\n */\nexport type AnyRefBindable = InputHandle | OutputHandle | TypedRef;\n\n/**\n * The set of values accepted by a typed operation bind slot: everything\n * {@link RefBindable} accepts, plus a {@link TypedLiteral} constant baked\n * into the flow document. A `'resource'` slot rejects a literal: a token\n * resource is not a scalar constant.\n *\n * Use `raw.literal<T>()` to create one.\n */\nexport type Bindable<T extends OutputKind> =\n RefBindable<T> | LiteralBindable<SlotAssignable<T>>;\n\n// Distributes over the slot's assignable kinds and keeps the scalar ones: a\n// `'resource'` slot has no scalar arm, so its literal arm collapses to\n// `never` and a literal is rejected outright.\ntype LiteralBindable<K extends OutputKind> = K extends SolType\n ? TypedLiteral<K>\n : never;\n\n/**\n * Converts a bindable to the wire `bind` value it denotes: handles become\n * `$ref` pointers, refs and literals pass through as-is.\n */\nexport const toBindValue = (\n bindable: InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref,\n): BindValue => ('_tag' in bindable ? handleToRef(bindable) : bindable);\n"],"mappings":";;AAgHA,MAAa,iBAAiB,MAC5B,EAAE,SAAS;;AAGb,MAAa,kBAAkB,MAC7B,EAAE,SAAS;;;;;AAMb,MAAa,eAAe,MAAmC;CAC7D,IAAI,EAAE,SAAS,SAAS;EACtB,IAAI,CAAC,EAAE,WAAW,MAAM,IAAI,MAAM,iCAAiC;EACnE,OAAO,EAAE,MAAM,SAAS,EAAE,YAAY;CACxC;CACA,IAAI,CAAC,EAAE,QAAQ,MAAM,IAAI,MAAM,+BAA+B;CAC9D,IAAI,CAAC,EAAE,UAAU,MAAM,IAAI,MAAM,iCAAiC;CAClE,OAAO,EAAE,MAAM,GAAG,EAAE,OAAO,GAAG,EAAE,WAAW;AAC7C;;;;;AA4DA,MAAa,eACX,aACe,UAAU,WAAW,YAAY,QAAQ,IAAI"}
@@ -1,48 +1,89 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var raw_exports = {};
20
- __export(raw_exports, {
21
- literal: () => literal,
22
- rawGuard: () => rawGuard,
23
- ref: () => ref
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/authoring/raw.ts
3
+ /**
4
+ * Creates a typed `$ref` pointer for use in bind slots.
5
+ *
6
+ * This is an **escape hatch** for referencing values that the typed builder
7
+ * API doesn't cover — for example, outputs of an `untypedOp` node or custom
8
+ * context paths. The caller is responsible for choosing the correct type
9
+ * parameter; no runtime validation occurs.
10
+ *
11
+ * Prefer typed handles (`OutputHandle`, `InputHandle`) and `builder.context`
12
+ * whenever possible. Use `ref` only when you need to construct a `$ref` path
13
+ * manually and want it accepted by a `Bindable<T>` slot.
14
+ *
15
+ * @typeParam T - The output kind this ref represents (e.g. `'address'`, `'uint256'`, `'resource'`).
16
+ * @param path - The `$ref` path (e.g. `"context.sender"`, `"myNode.result"`).
17
+ * @returns A {@link TypedRef} accepted by `Bindable<T>` slots matching `T`.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { raw } from '@lifi/composer-sdk';
22
+ *
23
+ * // Reference an untypedOp output in a typed operation:
24
+ * builder.untypedOp('custom', 'some.op', {
25
+ * bind: { x: { $ref: 'input.token' } },
26
+ * config: {},
27
+ * });
28
+ * builder.core.add('sum', {
29
+ * bind: {
30
+ * a: raw.ref<'uint256'>('custom.result'),
31
+ * b: someTypedHandle,
32
+ * },
33
+ * });
34
+ * ```
35
+ */
36
+ const ref = (path) => ({ $ref: path });
37
+ /**
38
+ * Creates a typed literal for use in bind slots: a constant baked into the
39
+ * flow document rather than supplied at run time.
40
+ *
41
+ * Prefer a declared flow input and `builder.inputs.<name>` — a value the
42
+ * caller supplies per run stays out of the document. Use a literal when the
43
+ * flow has no run of its own to take the value from: the `continuationFlow`
44
+ * of a `continuation.settle` node is stored by the settlement backend and
45
+ * re-run later against the deferred proceeds, so its delivery address has to
46
+ * be part of the committed document.
47
+ *
48
+ * @typeParam T - The Solidity type of the literal (e.g. `'address'`).
49
+ * @param kind - The literal's Solidity type.
50
+ * @param value - The literal value, as the wire format carries it: a string.
51
+ * @returns A {@link TypedLiteral} accepted by `Bindable<T>` slots matching `T`.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * import { raw } from '@lifi/composer-sdk';
56
+ *
57
+ * builder.core.transfer('deliver', {
58
+ * bind: {
59
+ * amount: zap.amountOut,
60
+ * recipient: raw.literal('address', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'),
61
+ * },
62
+ * config: {},
63
+ * });
64
+ * ```
65
+ */
66
+ const literal = (kind, value) => ({
67
+ kind,
68
+ value
24
69
  });
25
- module.exports = __toCommonJS(raw_exports);
26
- const ref = (path) => (
27
- // The brand is phantom, so the runtime value is the bare wire ref. This is
28
- // the only place a `TypedRef` is minted; the cast is what the brand buys.
29
- { $ref: path }
30
- );
31
- const literal = (kind, value) => ({ kind, value });
70
+ /**
71
+ * Creates a raw guard object for use in the `guards` array of an operation call.
72
+ *
73
+ * @param kind - The guard type (e.g. `"slippage"`).
74
+ * @param config - Guard-specific configuration (e.g. `{ toleranceBps: 300 }`).
75
+ * @returns An {@link AppliedGuard} object.
76
+ */
32
77
  const rawGuard = (kind, config = {}) => {
33
- if ("kind" in config) {
34
- throw new Error(
35
- `rawGuard: 'kind' must not appear in config (got "${String(
36
- config.kind
37
- )}"). Pass it as the first argument instead.`
38
- );
39
- }
40
- return { ...config, kind };
78
+ if ("kind" in config) throw new Error(`rawGuard: 'kind' must not appear in config (got "${String(config.kind)}"). Pass it as the first argument instead.`);
79
+ return {
80
+ ...config,
81
+ kind
82
+ };
41
83
  };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- literal,
45
- rawGuard,
46
- ref
47
- });
84
+ //#endregion
85
+ exports.literal = literal;
86
+ exports.rawGuard = rawGuard;
87
+ exports.ref = ref;
88
+
48
89
  //# sourceMappingURL=raw.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/authoring/raw.ts"],"sourcesContent":["import type { AppliedGuard, SolType } from '@lifi/compose-spec';\n\nimport type { OutputKind, TypedLiteral, TypedRef } from '../types.js';\n\n/**\n * Creates a typed `$ref` pointer for use in bind slots.\n *\n * This is an **escape hatch** for referencing values that the typed builder\n * API doesn't cover — for example, outputs of an `untypedOp` node or custom\n * context paths. The caller is responsible for choosing the correct type\n * parameter; no runtime validation occurs.\n *\n * Prefer typed handles (`OutputHandle`, `InputHandle`) and `builder.context`\n * whenever possible. Use `ref` only when you need to construct a `$ref` path\n * manually and want it accepted by a `Bindable<T>` slot.\n *\n * @typeParam T - The output kind this ref represents (e.g. `'address'`, `'uint256'`, `'resource'`).\n * @param path - The `$ref` path (e.g. `\"context.sender\"`, `\"myNode.result\"`).\n * @returns A {@link TypedRef} accepted by `Bindable<T>` slots matching `T`.\n *\n * @example\n * ```ts\n * import { raw } from '@lifi/composer-sdk';\n *\n * // Reference an untypedOp output in a typed operation:\n * builder.untypedOp('custom', 'some.op', {\n * bind: { x: { $ref: 'input.token' } },\n * config: {},\n * });\n * builder.core.add('sum', {\n * bind: {\n * a: raw.ref<'uint256'>('custom.result'),\n * b: someTypedHandle,\n * },\n * });\n * ```\n */\nexport const ref = <T extends OutputKind>(path: string): TypedRef<T> =>\n // The brand is phantom, so the runtime value is the bare wire ref. This is\n // the only place a `TypedRef` is minted; the cast is what the brand buys.\n ({ $ref: path }) as TypedRef<T>;\n\n/**\n * Creates a typed literal for use in bind slots: a constant baked into the\n * flow document rather than supplied at run time.\n *\n * Prefer a declared flow input and `builder.inputs.<name>` — a value the\n * caller supplies per run stays out of the document. Use a literal when the\n * flow has no run of its own to take the value from: the `continuationFlow`\n * of a `continuation.settle` node is stored by the settlement backend and\n * re-run later against the deferred proceeds, so its delivery address has to\n * be part of the committed document.\n *\n * @typeParam T - The Solidity type of the literal (e.g. `'address'`).\n * @param kind - The literal's Solidity type.\n * @param value - The literal value, as the wire format carries it: a string.\n * @returns A {@link TypedLiteral} accepted by `Bindable<T>` slots matching `T`.\n *\n * @example\n * ```ts\n * import { raw } from '@lifi/composer-sdk';\n *\n * builder.core.transfer('deliver', {\n * bind: {\n * amount: zap.amountOut,\n * recipient: raw.literal('address', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'),\n * },\n * config: {},\n * });\n * ```\n */\nexport const literal = <T extends SolType>(\n kind: T,\n value: string,\n): TypedLiteral<T> => ({ kind, value });\n\n/**\n * Creates a raw guard object for use in the `guards` array of an operation call.\n *\n * @param kind - The guard type (e.g. `\"slippage\"`).\n * @param config - Guard-specific configuration (e.g. `{ toleranceBps: 300 }`).\n * @returns An {@link AppliedGuard} object.\n */\nexport const rawGuard = (\n kind: string,\n config: Record<string, unknown> = {},\n): AppliedGuard => {\n if ('kind' in config) {\n throw new Error(\n `rawGuard: 'kind' must not appear in config (got \"${String(\n config.kind,\n )}\"). Pass it as the first argument instead.`,\n );\n }\n return { ...config, kind };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCO,MAAM,MAAM,CAAuB;AAAA;AAAA;AAAA,EAGvC,EAAE,MAAM,KAAK;AAAA;AA+BT,MAAM,UAAU,CACrB,MACA,WACqB,EAAE,MAAM,MAAM;AAS9B,MAAM,WAAW,CACtB,MACA,SAAkC,CAAC,MAClB;AACjB,MAAI,UAAU,QAAQ;AACpB,UAAM,IAAI;AAAA,MACR,oDAAoD;AAAA,QAClD,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO,EAAE,GAAG,QAAQ,KAAK;AAC3B;","names":[]}
1
+ {"version":3,"file":"raw.cjs","names":[],"sources":["../../src/authoring/raw.ts"],"sourcesContent":["import type { AppliedGuard, SolType } from '@lifi/compose-spec';\n\nimport type { OutputKind, TypedLiteral, TypedRef } from '../types.js';\n\n/**\n * Creates a typed `$ref` pointer for use in bind slots.\n *\n * This is an **escape hatch** for referencing values that the typed builder\n * API doesn't cover — for example, outputs of an `untypedOp` node or custom\n * context paths. The caller is responsible for choosing the correct type\n * parameter; no runtime validation occurs.\n *\n * Prefer typed handles (`OutputHandle`, `InputHandle`) and `builder.context`\n * whenever possible. Use `ref` only when you need to construct a `$ref` path\n * manually and want it accepted by a `Bindable<T>` slot.\n *\n * @typeParam T - The output kind this ref represents (e.g. `'address'`, `'uint256'`, `'resource'`).\n * @param path - The `$ref` path (e.g. `\"context.sender\"`, `\"myNode.result\"`).\n * @returns A {@link TypedRef} accepted by `Bindable<T>` slots matching `T`.\n *\n * @example\n * ```ts\n * import { raw } from '@lifi/composer-sdk';\n *\n * // Reference an untypedOp output in a typed operation:\n * builder.untypedOp('custom', 'some.op', {\n * bind: { x: { $ref: 'input.token' } },\n * config: {},\n * });\n * builder.core.add('sum', {\n * bind: {\n * a: raw.ref<'uint256'>('custom.result'),\n * b: someTypedHandle,\n * },\n * });\n * ```\n */\nexport const ref = <T extends OutputKind>(path: string): TypedRef<T> =>\n // The brand is phantom, so the runtime value is the bare wire ref. This is\n // the only place a `TypedRef` is minted; the cast is what the brand buys.\n ({ $ref: path }) as TypedRef<T>;\n\n/**\n * Creates a typed literal for use in bind slots: a constant baked into the\n * flow document rather than supplied at run time.\n *\n * Prefer a declared flow input and `builder.inputs.<name>` — a value the\n * caller supplies per run stays out of the document. Use a literal when the\n * flow has no run of its own to take the value from: the `continuationFlow`\n * of a `continuation.settle` node is stored by the settlement backend and\n * re-run later against the deferred proceeds, so its delivery address has to\n * be part of the committed document.\n *\n * @typeParam T - The Solidity type of the literal (e.g. `'address'`).\n * @param kind - The literal's Solidity type.\n * @param value - The literal value, as the wire format carries it: a string.\n * @returns A {@link TypedLiteral} accepted by `Bindable<T>` slots matching `T`.\n *\n * @example\n * ```ts\n * import { raw } from '@lifi/composer-sdk';\n *\n * builder.core.transfer('deliver', {\n * bind: {\n * amount: zap.amountOut,\n * recipient: raw.literal('address', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'),\n * },\n * config: {},\n * });\n * ```\n */\nexport const literal = <T extends SolType>(\n kind: T,\n value: string,\n): TypedLiteral<T> => ({ kind, value });\n\n/**\n * Creates a raw guard object for use in the `guards` array of an operation call.\n *\n * @param kind - The guard type (e.g. `\"slippage\"`).\n * @param config - Guard-specific configuration (e.g. `{ toleranceBps: 300 }`).\n * @returns An {@link AppliedGuard} object.\n */\nexport const rawGuard = (\n kind: string,\n config: Record<string, unknown> = {},\n): AppliedGuard => {\n if ('kind' in config) {\n throw new Error(\n `rawGuard: 'kind' must not appear in config (got \"${String(\n config.kind,\n )}\"). Pass it as the first argument instead.`,\n );\n }\n return { ...config, kind };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,OAA6B,UAGvC,EAAE,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BhB,MAAa,WACX,MACA,WACqB;CAAE;CAAM;AAAM;;;;;;;;AASrC,MAAa,YACX,MACA,SAAkC,CAAC,MAClB;CACjB,IAAI,UAAU,QACZ,MAAM,IAAI,MACR,oDAAoD,OAClD,OAAO,IACT,EAAE,2CACJ;CAEF,OAAO;EAAE,GAAG;EAAQ;CAAK;AAC3B"}
@@ -1,6 +1,6 @@
1
- import { AppliedGuard, SolType } from '@lifi/compose-spec';
2
- import { TypedLiteral, OutputKind, TypedRef } from '../types.cjs';
3
-
1
+ import { OutputKind, TypedLiteral, TypedRef } from "../types.cjs";
2
+ import { AppliedGuard, SolType } from "@lifi/compose-spec";
3
+ //#region src/authoring/raw.d.ts
4
4
  /**
5
5
  * Creates a typed `$ref` pointer for use in bind slots.
6
6
  *
@@ -34,7 +34,7 @@ import { TypedLiteral, OutputKind, TypedRef } from '../types.cjs';
34
34
  * });
35
35
  * ```
36
36
  */
37
- declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
37
+ export declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
38
38
  /**
39
39
  * Creates a typed literal for use in bind slots: a constant baked into the
40
40
  * flow document rather than supplied at run time.
@@ -64,7 +64,7 @@ declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
64
64
  * });
65
65
  * ```
66
66
  */
67
- declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiteral<T>;
67
+ export declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiteral<T>;
68
68
  /**
69
69
  * Creates a raw guard object for use in the `guards` array of an operation call.
70
70
  *
@@ -72,6 +72,6 @@ declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiter
72
72
  * @param config - Guard-specific configuration (e.g. `{ toleranceBps: 300 }`).
73
73
  * @returns An {@link AppliedGuard} object.
74
74
  */
75
- declare const rawGuard: (kind: string, config?: Record<string, unknown>) => AppliedGuard;
76
-
77
- export { literal, rawGuard, ref };
75
+ export declare const rawGuard: (kind: string, config?: Record<string, unknown>) => AppliedGuard;
76
+ //#endregion
77
+ //# sourceMappingURL=raw.d.cts.map
@@ -1,6 +1,6 @@
1
- import { AppliedGuard, SolType } from '@lifi/compose-spec';
2
- import { TypedLiteral, OutputKind, TypedRef } from '../types.js';
3
-
1
+ import { OutputKind, TypedLiteral, TypedRef } from "../types.js";
2
+ import { AppliedGuard, SolType } from "@lifi/compose-spec";
3
+ //#region src/authoring/raw.d.ts
4
4
  /**
5
5
  * Creates a typed `$ref` pointer for use in bind slots.
6
6
  *
@@ -34,7 +34,7 @@ import { TypedLiteral, OutputKind, TypedRef } from '../types.js';
34
34
  * });
35
35
  * ```
36
36
  */
37
- declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
37
+ export declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
38
38
  /**
39
39
  * Creates a typed literal for use in bind slots: a constant baked into the
40
40
  * flow document rather than supplied at run time.
@@ -64,7 +64,7 @@ declare const ref: <T extends OutputKind>(path: string) => TypedRef<T>;
64
64
  * });
65
65
  * ```
66
66
  */
67
- declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiteral<T>;
67
+ export declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiteral<T>;
68
68
  /**
69
69
  * Creates a raw guard object for use in the `guards` array of an operation call.
70
70
  *
@@ -72,6 +72,6 @@ declare const literal: <T extends SolType>(kind: T, value: string) => TypedLiter
72
72
  * @param config - Guard-specific configuration (e.g. `{ toleranceBps: 300 }`).
73
73
  * @returns An {@link AppliedGuard} object.
74
74
  */
75
- declare const rawGuard: (kind: string, config?: Record<string, unknown>) => AppliedGuard;
76
-
77
- export { literal, rawGuard, ref };
75
+ export declare const rawGuard: (kind: string, config?: Record<string, unknown>) => AppliedGuard;
76
+ //#endregion
77
+ //# sourceMappingURL=raw.d.ts.map