@xentom/integration-framework 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +837 -836
- package/README.md +203 -0
- package/dist/auth/basic.d.ts +56 -0
- package/dist/auth/basic.js +0 -0
- package/dist/auth/index.d.ts +18 -0
- package/dist/auth/index.js +23 -0
- package/dist/auth/oauth2.d.ts +26 -0
- package/dist/auth/oauth2.js +10 -0
- package/dist/auth/token.d.ts +40 -0
- package/dist/auth/token.js +0 -0
- package/dist/controls/base.d.ts +2 -0
- package/dist/controls/expression.d.ts +5 -2
- package/dist/controls/index.d.ts +14 -1
- package/dist/controls/select.d.ts +41 -5
- package/dist/controls/switch.d.ts +3 -0
- package/dist/controls/text.d.ts +3 -0
- package/dist/env.d.ts +17 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/integration.d.ts +55 -13
- package/dist/integration.js +0 -2
- package/dist/nodes/base.d.ts +8 -13
- package/dist/nodes/callable.d.ts +11 -0
- package/dist/nodes/index.d.ts +15 -10
- package/dist/nodes/index.js +17 -0
- package/dist/nodes/pure.d.ts +9 -4
- package/dist/nodes/trigger.d.ts +10 -1
- package/dist/nodes/utils.d.ts +1 -0
- package/dist/nodes/utils.js +1 -0
- package/dist/pins/data.d.ts +34 -15
- package/dist/pins/exec.d.ts +11 -2
- package/dist/pins/index.d.ts +6 -0
- package/dist/pins/utils.d.ts +4 -2
- package/dist/utils.d.ts +1 -0
- package/package.json +6 -4
package/dist/integration.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type Auth, type AuthResponse } from './auth';
|
|
1
2
|
import { type EnvRecord, type InferEnvRecordOutput } from './env';
|
|
2
|
-
import { type
|
|
3
|
-
import { type Serialize } from './utils';
|
|
3
|
+
import { type NodeRecord } from './nodes';
|
|
4
|
+
import { type PartialKeyValues, type Serialize } from './utils';
|
|
4
5
|
import { type Webhook } from './webhook';
|
|
5
|
-
export interface Integration<NR extends NodeRecord = NodeRecord, E extends EnvRecord = EnvRecord> {
|
|
6
|
+
export interface Integration<NR extends NodeRecord = NodeRecord, A extends Auth = Auth, E extends EnvRecord = EnvRecord> {
|
|
6
7
|
/**
|
|
7
8
|
* Nodes that are available in this integration.
|
|
8
9
|
*
|
|
@@ -16,8 +17,51 @@ export interface Integration<NR extends NodeRecord = NodeRecord, E extends EnvRe
|
|
|
16
17
|
* }),
|
|
17
18
|
* },
|
|
18
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
* @remarks `Record<string, Node>`
|
|
19
22
|
*/
|
|
20
23
|
nodes: NR;
|
|
24
|
+
/**
|
|
25
|
+
* Authentication method for this integration.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* auth: i.auth.basic(),
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* auth: i.auth.basic({
|
|
35
|
+
* username: { label: 'Username', description: 'Your username for authentication' },
|
|
36
|
+
* password: { label: 'Password', description: 'Your password for authentication' },
|
|
37
|
+
* }),
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* auth: i.auth.oauth2({
|
|
43
|
+
* authUrl: 'https://example.com/oauth/authorize',
|
|
44
|
+
* tokenUrl: 'https://example.com/oauth/token',
|
|
45
|
+
* scopes: ['read', 'write'],
|
|
46
|
+
* }),
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* auth: i.auth.token(),
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* auth: i.auth.token({
|
|
57
|
+
* token: { label: 'Token', description: 'Your token for authentication' },
|
|
58
|
+
* }),
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @remarks `Auth`
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
auth?: A;
|
|
21
65
|
/**
|
|
22
66
|
* Environment variables that are required by this integration.
|
|
23
67
|
* These variables will be prompted for during integration setup
|
|
@@ -36,6 +80,8 @@ export interface Integration<NR extends NodeRecord = NodeRecord, E extends EnvRe
|
|
|
36
80
|
* }),
|
|
37
81
|
* },
|
|
38
82
|
* ```
|
|
83
|
+
*
|
|
84
|
+
* @remarks `Record<string, Env>`
|
|
39
85
|
*/
|
|
40
86
|
env?: E;
|
|
41
87
|
/**
|
|
@@ -49,7 +95,7 @@ export interface Integration<NR extends NodeRecord = NodeRecord, E extends EnvRe
|
|
|
49
95
|
* },
|
|
50
96
|
* ```
|
|
51
97
|
*/
|
|
52
|
-
start?: (opts: IntegrationOptions) => Promise<void> | void;
|
|
98
|
+
start?: (opts: IntegrationOptions<A, InferEnvRecordOutput<E>>) => Promise<void> | void;
|
|
53
99
|
/**
|
|
54
100
|
* This function is called when the integration stops.
|
|
55
101
|
* You can clean up resources or save state here.
|
|
@@ -61,9 +107,11 @@ export interface Integration<NR extends NodeRecord = NodeRecord, E extends EnvRe
|
|
|
61
107
|
* },
|
|
62
108
|
* ```
|
|
63
109
|
*/
|
|
64
|
-
stop?: (opts: IntegrationOptions) => Promise<void> | void;
|
|
110
|
+
stop?: (opts: PartialKeyValues<IntegrationOptions<A, InferEnvRecordOutput<E>>, 'state'>) => Promise<void> | void;
|
|
65
111
|
}
|
|
66
|
-
export interface IntegrationOptions {
|
|
112
|
+
export interface IntegrationOptions<A extends Auth = never, E extends Record<string, unknown> = Record<string, unknown>> {
|
|
113
|
+
auth: AuthResponse<A>;
|
|
114
|
+
env: E;
|
|
67
115
|
state: IntegrationState;
|
|
68
116
|
webhook: Webhook;
|
|
69
117
|
}
|
|
@@ -75,10 +123,4 @@ export interface IntegrationOptions {
|
|
|
75
123
|
export interface IntegrationState {
|
|
76
124
|
}
|
|
77
125
|
export type IntegrationDefinition = Serialize<Integration>;
|
|
78
|
-
export
|
|
79
|
-
nodes: InferNodeRecordOutput<I['nodes']>;
|
|
80
|
-
env: InferEnvRecordOutput<NonNullable<I['env']>>;
|
|
81
|
-
}
|
|
82
|
-
export declare function integration<NR extends NodeRecord<any>, E extends EnvRecord>(definition: Integration<NR, E>): Integration<NR, E> & {
|
|
83
|
-
$infer: InferIntegrationOutput<Integration<NR, E>>;
|
|
84
|
-
};
|
|
126
|
+
export declare function integration<NR extends NodeRecord<any>, A extends Auth = never, E extends EnvRecord = never>(definition: Integration<NR, A, E>): Integration<NR, A, E>;
|
package/dist/integration.js
CHANGED
package/dist/nodes/base.d.ts
CHANGED
|
@@ -6,10 +6,11 @@ export type BaseNodeOutputs = PinRecord<DataPin | ExecPin>;
|
|
|
6
6
|
*/
|
|
7
7
|
export interface BaseNode<I extends BaseNodeInputs = BaseNodeInputs, O extends BaseNodeOutputs = BaseNodeOutputs> {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Specifies the group that this node belongs to within a hierarchy.
|
|
10
|
+
* Groups make it easier to organize and filter nodes in the user interface.
|
|
11
|
+
* You can create nested or expandable groups by separating levels with a slash (/).
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
group?: string;
|
|
13
14
|
/**
|
|
14
15
|
* Optional display name for the node, used in the UI.
|
|
15
16
|
* If not specified, the node's exported identifier will be used and automatically converted to title case.
|
|
@@ -25,21 +26,15 @@ export interface BaseNode<I extends BaseNodeInputs = BaseNodeInputs, O extends B
|
|
|
25
26
|
/**
|
|
26
27
|
* Defines the input pins for the node.
|
|
27
28
|
* These specify the data required for the node to run.
|
|
29
|
+
*
|
|
30
|
+
* @remarks `Record<string, DataPin>`
|
|
28
31
|
*/
|
|
29
32
|
inputs?: I;
|
|
30
33
|
/**
|
|
31
34
|
* Defines the output pins for the node.
|
|
32
35
|
* These represent the result or side effects of running the node.
|
|
33
|
-
*/
|
|
34
|
-
outputs?: O;
|
|
35
|
-
}
|
|
36
|
-
export interface NodeCategory {
|
|
37
|
-
/**
|
|
38
|
-
* Defines the category path used to group the node in the UI.
|
|
39
|
-
* Each segment in the array represents a level in the category hierarchy.
|
|
40
36
|
*
|
|
41
|
-
* @
|
|
42
|
-
* ['AI', 'Text']
|
|
37
|
+
* @remarks `Record<string, DataPin | ExecPin>`
|
|
43
38
|
*/
|
|
44
|
-
|
|
39
|
+
outputs?: O;
|
|
45
40
|
}
|
package/dist/nodes/callable.d.ts
CHANGED
|
@@ -11,12 +11,17 @@ export type CallableNodeOutputs = PinRecord<DataPin | ExecPin>;
|
|
|
11
11
|
* CallableNode is a type of node that can be called by other nodes.
|
|
12
12
|
*/
|
|
13
13
|
export interface CallableNode<I extends CallableNodeInputs = CallableNodeInputs, O extends CallableNodeOutputs = CallableNodeOutputs> extends BaseNode<I, O> {
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
14
17
|
type: NodeType.Callable;
|
|
15
18
|
/**
|
|
16
19
|
* Runs the node with the provided inputs, state, and context.
|
|
17
20
|
* This method is invoked when the node is called by another node.
|
|
18
21
|
*
|
|
19
22
|
* @param opts - Options containing the execution context, state, inputs, variables, webhook, and next callback.
|
|
23
|
+
*
|
|
24
|
+
* @remarks `run(opts: CallableNodeRunOptions): Promise<void> | void`
|
|
20
25
|
*/
|
|
21
26
|
run(opts: CallableNodeRunOptions<I, O>): void | Promise<void>;
|
|
22
27
|
}
|
|
@@ -46,6 +51,8 @@ export interface CallableNodeRunOptions<I extends CallableNodeInputs, O extends
|
|
|
46
51
|
/**
|
|
47
52
|
* The resolved input values for the node, typically based on user configuration
|
|
48
53
|
* or outputs from preceding nodes in the workflow.
|
|
54
|
+
*
|
|
55
|
+
* @remarks `Record<string, unknown>`
|
|
49
56
|
*/
|
|
50
57
|
inputs: InferPinRecordOutput<I>;
|
|
51
58
|
/**
|
|
@@ -58,6 +65,8 @@ export interface CallableNodeRunOptions<I extends CallableNodeInputs, O extends
|
|
|
58
65
|
/**
|
|
59
66
|
* Webhook utility exposing the integration's public URL.
|
|
60
67
|
* Can be shared with external systems to send data back into the workflow.
|
|
68
|
+
*
|
|
69
|
+
* @remarks `{ url: string }`
|
|
61
70
|
*/
|
|
62
71
|
webhook: Pick<Webhook, 'url'>;
|
|
63
72
|
/**
|
|
@@ -80,6 +89,8 @@ export interface CallableNodeRunOptions<I extends CallableNodeInputs, O extends
|
|
|
80
89
|
* value: Math.random(),
|
|
81
90
|
* });
|
|
82
91
|
* ```
|
|
92
|
+
*
|
|
93
|
+
* @remarks `NodeNextCallback`
|
|
83
94
|
*/
|
|
84
95
|
next: NodeNextCallback<O>;
|
|
85
96
|
}
|
package/dist/nodes/index.d.ts
CHANGED
|
@@ -28,15 +28,7 @@ export declare enum NodeType {
|
|
|
28
28
|
*/
|
|
29
29
|
Pure = "pure"
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
* Collection of utilities for defining workflow nodes.
|
|
33
|
-
*
|
|
34
|
-
* Includes:
|
|
35
|
-
* - `trigger`: Defines a trigger that starts a workflow in response to internal or external events.
|
|
36
|
-
* - `callable`: Defines a node that performs side effects and explicitly control workflow execution.
|
|
37
|
-
* - `pure`: Defines a side-effect-free, deterministic node that computes outputs from inputs.
|
|
38
|
-
*/
|
|
39
|
-
export declare const nodes: {
|
|
31
|
+
export interface Nodes {
|
|
40
32
|
/**
|
|
41
33
|
* Defines a trigger that starts a workflow in response to internal or external events
|
|
42
34
|
* such as incoming webhooks, scheduled timers, or custom event sources.
|
|
@@ -108,4 +100,17 @@ export declare const nodes: {
|
|
|
108
100
|
* ```
|
|
109
101
|
*/
|
|
110
102
|
pure: PureNodeBuilder;
|
|
111
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Creates a group of nodes with a common prefix.
|
|
105
|
+
*/
|
|
106
|
+
group: (name: string) => Omit<Nodes, 'group'>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Collection of utilities for defining workflow nodes.
|
|
110
|
+
*
|
|
111
|
+
* Includes:
|
|
112
|
+
* - `trigger`: Defines a trigger that starts a workflow in response to internal or external events.
|
|
113
|
+
* - `callable`: Defines a node that performs side effects and explicitly control workflow execution.
|
|
114
|
+
* - `pure`: Defines a side-effect-free, deterministic node that computes outputs from inputs.
|
|
115
|
+
*/
|
|
116
|
+
export declare const nodes: Nodes;
|
package/dist/nodes/index.js
CHANGED
|
@@ -45,4 +45,21 @@ export const nodes = {
|
|
|
45
45
|
...definition,
|
|
46
46
|
type: NodeType.Pure,
|
|
47
47
|
}),
|
|
48
|
+
group: (name) => ({
|
|
49
|
+
trigger: (definition) => ({
|
|
50
|
+
group: name,
|
|
51
|
+
...definition,
|
|
52
|
+
type: NodeType.Trigger,
|
|
53
|
+
}),
|
|
54
|
+
callable: (definition) => ({
|
|
55
|
+
group: name,
|
|
56
|
+
...definition,
|
|
57
|
+
type: NodeType.Callable,
|
|
58
|
+
}),
|
|
59
|
+
pure: (definition) => ({
|
|
60
|
+
group: name,
|
|
61
|
+
...definition,
|
|
62
|
+
type: NodeType.Pure,
|
|
63
|
+
}),
|
|
64
|
+
}),
|
|
48
65
|
};
|
package/dist/nodes/pure.d.ts
CHANGED
|
@@ -11,10 +11,7 @@ export type PureNodeOutputs = PinRecord<DataPin>;
|
|
|
11
11
|
*/
|
|
12
12
|
export interface PureNode<I extends PureNodeInputs = PureNodeInputs, O extends PureNodeOutputs = PureNodeOutputs> extends BaseNode<I, O> {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Pure nodes do not mutate any external or internal state and produce outputs solely based on their inputs.
|
|
16
|
-
* They cannot be triggered directly or independently, they must be connected to an input pin.
|
|
17
|
-
* The `run` function is executed automatically when the node is required as part of a data flow.
|
|
14
|
+
* @internal
|
|
18
15
|
*/
|
|
19
16
|
type: NodeType.Pure;
|
|
20
17
|
/**
|
|
@@ -28,6 +25,8 @@ export interface PureNode<I extends PureNodeInputs = PureNodeInputs, O extends P
|
|
|
28
25
|
* opts.outputs.result = opts.inputs.a + opts.inputs.b;
|
|
29
26
|
* }
|
|
30
27
|
* ```
|
|
28
|
+
*
|
|
29
|
+
* @remarks `run(opts: PureNodeRunOptions): Promise<void> | void`
|
|
31
30
|
*/
|
|
32
31
|
run?(opts: PureNodeRunOptions<I, O>): Promise<void> | void;
|
|
33
32
|
}
|
|
@@ -54,11 +53,15 @@ export interface PureNodeRunOptions<I extends PureNodeInputs = PureNodeInputs, O
|
|
|
54
53
|
/**
|
|
55
54
|
* The resolved input values for the node, typically based on user configuration
|
|
56
55
|
* or outputs from preceding steps in the workflow.
|
|
56
|
+
*
|
|
57
|
+
* @remarks `Record<string, unknown>`
|
|
57
58
|
*/
|
|
58
59
|
inputs: InferPinRecordOutput<I>;
|
|
59
60
|
/**
|
|
60
61
|
* The object used to assign output values from the node.
|
|
61
62
|
* Each output pin should be populated within the `run` function to pass values forward in the workflow.
|
|
63
|
+
*
|
|
64
|
+
* @remarks `Record<string, unknown>`
|
|
62
65
|
*/
|
|
63
66
|
outputs: InferPinRecordInput<O>;
|
|
64
67
|
/**
|
|
@@ -71,6 +74,8 @@ export interface PureNodeRunOptions<I extends PureNodeInputs = PureNodeInputs, O
|
|
|
71
74
|
/**
|
|
72
75
|
* Webhook utility exposing the integration's public URL.
|
|
73
76
|
* Can be shared with external systems to send data back into the workflow.
|
|
77
|
+
*
|
|
78
|
+
* @remarks `{ url: string }`
|
|
74
79
|
*/
|
|
75
80
|
webhook: Pick<Webhook, 'url'>;
|
|
76
81
|
}
|
package/dist/nodes/trigger.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ import { type NodeType } from './index';
|
|
|
10
10
|
export type TriggerNodeInputs = PinRecord<DataPin>;
|
|
11
11
|
export type TriggerNodeOutputs = PinRecord<DataPin | ExecPin>;
|
|
12
12
|
export interface TriggerNode<I extends TriggerNodeInputs = TriggerNodeInputs, O extends TriggerNodeOutputs = TriggerNodeOutputs> extends BaseNode<I, O> {
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
13
16
|
type: NodeType.Trigger;
|
|
14
17
|
/**
|
|
15
18
|
* Registers a callback to subscribe to internal or external events.
|
|
@@ -62,10 +65,12 @@ export interface TriggerNode<I extends TriggerNodeInputs = TriggerNodeInputs, O
|
|
|
62
65
|
* };
|
|
63
66
|
* }
|
|
64
67
|
* ```
|
|
68
|
+
*
|
|
69
|
+
* @remarks `subscribe(opts: TriggerSubscribeOptions): () => void`
|
|
65
70
|
*/
|
|
66
71
|
subscribe(opts: TriggerSubscribeOptions<I, O>): TriggerSubscribeCleanup;
|
|
67
72
|
}
|
|
68
|
-
export type TriggerSubscribeCleanup = Promise<(() => void) | void> | (
|
|
73
|
+
export type TriggerSubscribeCleanup = (() => Promise<void>) | (() => void) | Promise<void> | Promise<() => Promise<void>> | Promise<() => void> | void;
|
|
69
74
|
export interface TriggerSubscribeOptions<I extends TriggerNodeInputs, O extends TriggerNodeOutputs> {
|
|
70
75
|
/**
|
|
71
76
|
* Information about the node instance being executed.
|
|
@@ -88,6 +93,8 @@ export interface TriggerSubscribeOptions<I extends TriggerNodeInputs, O extends
|
|
|
88
93
|
/**
|
|
89
94
|
* The resolved input values for the trigger, typically based on user configuration
|
|
90
95
|
* or outputs from preceding steps in the workflow.
|
|
96
|
+
*
|
|
97
|
+
* @remarks `Record<string, unknown>`
|
|
91
98
|
*/
|
|
92
99
|
inputs: InferPinRecordOutput<I>;
|
|
93
100
|
/**
|
|
@@ -117,6 +124,8 @@ export interface TriggerSubscribeOptions<I extends TriggerNodeInputs, O extends
|
|
|
117
124
|
* value: Math.random(),
|
|
118
125
|
* });
|
|
119
126
|
* ```
|
|
127
|
+
*
|
|
128
|
+
* @remarks `NodeNextCallback`
|
|
120
129
|
*/
|
|
121
130
|
next: NodeNextCallback<O, [ctx?: TriggerRunContext]>;
|
|
122
131
|
}
|
package/dist/nodes/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Node, type NodeRecord } from '.';
|
|
2
2
|
import { type InferPinRecordInput, type InferPinRecordOutput, type PinRecord } from '../pins';
|
|
3
3
|
export declare const DefaultExecPinName = "__exec";
|
|
4
|
+
export declare const DefaultErrorPinName = "__error";
|
|
4
5
|
export type InferNodeRecordOutput<R extends NodeRecord> = {
|
|
5
6
|
[K in keyof R]: InferNodeOutput<R[K]>;
|
|
6
7
|
};
|
package/dist/nodes/utils.js
CHANGED
package/dist/pins/data.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { type PinType } from '.';
|
|
3
|
+
import { type Auth } from '../auth';
|
|
3
4
|
import { type Control } from '../controls';
|
|
4
5
|
import { type IntegrationOptions } from '../integration';
|
|
5
6
|
import { type ConditionalOptional } from '../utils';
|
|
6
7
|
import { type BasePin } from './base';
|
|
7
|
-
export interface DataPin<Input = any, Output = Input, Optional extends boolean = boolean> extends BasePin {
|
|
8
|
+
export interface DataPin<Input = any, Output = Input, Optional extends boolean = boolean, MultiSelect extends boolean = boolean> extends BasePin {
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
8
12
|
type: PinType.Data;
|
|
9
13
|
/**
|
|
10
14
|
* Validation schema compatible with the Standard Schema specification.
|
|
@@ -18,8 +22,10 @@ export interface DataPin<Input = any, Output = Input, Optional extends boolean =
|
|
|
18
22
|
* ```ts
|
|
19
23
|
* v.pipe(v.string(), v.trim())
|
|
20
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* @remarks `StandardSchemaV1 | (opts: IntegrationOptions) => StandardSchemaV1`
|
|
21
27
|
*/
|
|
22
|
-
schema?:
|
|
28
|
+
schema?: DataPinSchema<Input, Output>;
|
|
23
29
|
/**
|
|
24
30
|
* Optional control configuration that defines how the pin should be rendered in the UI.
|
|
25
31
|
* Supports various input types such as text fields, select dropdowns, and toggles.
|
|
@@ -30,8 +36,10 @@ export interface DataPin<Input = any, Output = Input, Optional extends boolean =
|
|
|
30
36
|
* label: 'Message',
|
|
31
37
|
* })
|
|
32
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @remarks `Control | false`
|
|
33
41
|
*/
|
|
34
|
-
control?: false | Control<ConditionalOptional<Optional, Input
|
|
42
|
+
control?: false | Control<ConditionalOptional<Optional, Input>, MultiSelect>;
|
|
35
43
|
/**
|
|
36
44
|
* Optional examples that provide users with predefined values for the pin.
|
|
37
45
|
* Each example includes a title and a value to illustrate the expected input format
|
|
@@ -56,6 +64,8 @@ export interface DataPin<Input = any, Output = Input, Optional extends boolean =
|
|
|
56
64
|
* },
|
|
57
65
|
* ]
|
|
58
66
|
* ```
|
|
67
|
+
*
|
|
68
|
+
* @remarks `DataPinExample[]`
|
|
59
69
|
*/
|
|
60
70
|
examples?: DataPinExample<ConditionalOptional<Optional, Input & {}>>[];
|
|
61
71
|
/**
|
|
@@ -67,9 +77,27 @@ export interface DataPin<Input = any, Output = Input, Optional extends boolean =
|
|
|
67
77
|
* ```ts
|
|
68
78
|
* optional: true,
|
|
69
79
|
* ```
|
|
80
|
+
*
|
|
81
|
+
* @remarks `boolean`
|
|
70
82
|
*/
|
|
71
83
|
optional?: Optional;
|
|
72
84
|
}
|
|
85
|
+
export interface DataPinExtendable<Input = any, Output = Input, Optional extends boolean = boolean, MultiSelect extends boolean = boolean> extends DataPin<Input, Output, Optional, MultiSelect> {
|
|
86
|
+
/**
|
|
87
|
+
* A function that builds a new pin with the given definition.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* i.pins.data().with({
|
|
92
|
+
* description: 'A message to send',
|
|
93
|
+
* })
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @remarks `DataPinBuilder`
|
|
97
|
+
*/
|
|
98
|
+
with: DataPinBuilder<Input, Output, Optional, MultiSelect>;
|
|
99
|
+
}
|
|
100
|
+
export type DataPinSchema<Input = any, Output = Input> = StandardSchemaV1<Input, Output> | ((opts: IntegrationOptions<Auth>) => StandardSchemaV1<Input, Output>);
|
|
73
101
|
export interface DataPinExample<I> {
|
|
74
102
|
/**
|
|
75
103
|
* A human-readable title for the example, providing context or a brief description.
|
|
@@ -78,18 +106,9 @@ export interface DataPinExample<I> {
|
|
|
78
106
|
/**
|
|
79
107
|
* The value of the example, which can be any valid input type for the pin.
|
|
80
108
|
* This value is used to illustrate how the pin can be utilized in practice.
|
|
109
|
+
*
|
|
110
|
+
* @remarks `unknown`
|
|
81
111
|
*/
|
|
82
112
|
value: I;
|
|
83
113
|
}
|
|
84
|
-
export type DataPinBuilder<ParentInput = any, ParentOutput = ParentInput, ParentOptional extends boolean = false> = <Input = ParentInput, Output = undefined extends ParentOutput ? Input : ParentOutput, Optional extends boolean = ParentOptional>(definition?: Omit<DataPin<Input, Output, Optional>, 'type' | 'with'>) => NoInfer<
|
|
85
|
-
/**
|
|
86
|
-
* A function that builds a new pin with the given definition.
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```ts
|
|
90
|
-
* i.pins.data().with({
|
|
91
|
-
* description: 'A message to send',
|
|
92
|
-
* })
|
|
93
|
-
*/
|
|
94
|
-
with: DataPinBuilder<Input, Output, Optional>;
|
|
95
|
-
}>;
|
|
114
|
+
export type DataPinBuilder<ParentInput = any, ParentOutput = ParentInput, ParentOptional extends boolean = false, ParentMultiSelect extends boolean = false> = <Input = ParentInput, Output = undefined extends ParentOutput ? Input : ParentOutput, Optional extends boolean = ParentOptional, MultiSelect extends boolean = ParentMultiSelect>(definition?: Omit<DataPin<Input, Output, Optional, MultiSelect>, 'type' | 'with'>) => NoInfer<DataPinExtendable<ConditionalOptional<Optional, Input>, ConditionalOptional<Optional, Output>, Optional, MultiSelect>>;
|
package/dist/pins/exec.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { type PinRecord, type PinType } from '.';
|
|
|
2
2
|
import { type BasePin } from './base';
|
|
3
3
|
import { type DataPin } from './data';
|
|
4
4
|
export interface ExecPin<PR extends PinRecord<DataPin> = PinRecord<DataPin>> extends BasePin {
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
type: PinType.Exec;
|
|
6
9
|
/**
|
|
7
10
|
* Optional outputs for the exec pin, defined as a set of named data pins.
|
|
@@ -44,10 +47,12 @@ export interface ExecPin<PR extends PinRecord<DataPin> = PinRecord<DataPin>> ext
|
|
|
44
47
|
* },
|
|
45
48
|
* });
|
|
46
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @remarks `Record<string, DataPin>`
|
|
47
52
|
*/
|
|
48
53
|
outputs?: PR;
|
|
49
54
|
}
|
|
50
|
-
export
|
|
55
|
+
export interface ExecPinExtendable<PR extends PinRecord<DataPin> = PinRecord<DataPin>> extends ExecPin<PR> {
|
|
51
56
|
/**
|
|
52
57
|
* A function that builds a new pin with the given definition.
|
|
53
58
|
*
|
|
@@ -56,6 +61,10 @@ export type ExecPinBuilder<ParentPR extends PinRecord<DataPin> = PinRecord<DataP
|
|
|
56
61
|
* i.pins.exec().with({
|
|
57
62
|
* description: 'A message to send',
|
|
58
63
|
* })
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks `ExecPinBuilder`
|
|
59
67
|
*/
|
|
60
68
|
with: ExecPinBuilder<PR>;
|
|
61
|
-
}
|
|
69
|
+
}
|
|
70
|
+
export type ExecPinBuilder<ParentPR extends PinRecord<DataPin> = PinRecord<DataPin>> = <PR extends PinRecord<DataPin> = ParentPR>(definition?: Omit<ExecPin<PR>, 'type' | 'with'>) => ExecPinExtendable<PR>;
|
package/dist/pins/index.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export declare const pins: {
|
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
|
+
* Using a type parameter when no schema is defined:
|
|
40
|
+
* ```ts
|
|
41
|
+
* i.pins.data<string>()
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
39
45
|
* Customizing the pin with additional properties:
|
|
40
46
|
* ```ts
|
|
41
47
|
* i.pins.data({
|
package/dist/pins/utils.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export type FlattenExecPinOutputs<R extends PinRecord> = {
|
|
|
11
11
|
}[keyof R];
|
|
12
12
|
export type GetExecPinOutputType<R extends PinRecord, FlatKey extends string> = FlatKey extends `${infer ExecKey}.${infer OutputKey}` ? ExecKey extends keyof R ? R[ExecKey] extends ExecPin<infer O> ? OutputKey extends keyof O ? InferPinOutput<O[OutputKey]> : never : never : never : never;
|
|
13
13
|
export type InferPinOutput<P extends Pin> = P extends DataPin<infer I, infer O> ? (0 extends 1 & O ? I : O) : never;
|
|
14
|
-
export type InferPinRecordInput<R extends PinRecord> =
|
|
14
|
+
export type InferPinRecordInput<R extends PinRecord> = InferPinRecordInputRequired<R> & InferPinRecordInputOptional<R>;
|
|
15
|
+
export type InferPinRecordInputRequired<R extends PinRecord> = {
|
|
15
16
|
[K in keyof R as R[K] extends DataPin ? undefined extends InferPinInput<R[K]> ? never : K : never]: InferPinInput<R[K]>;
|
|
16
|
-
}
|
|
17
|
+
};
|
|
18
|
+
export type InferPinRecordInputOptional<R extends PinRecord> = {
|
|
17
19
|
[K in keyof R as R[K] extends DataPin ? undefined extends InferPinInput<R[K]> ? K : never : never]?: InferPinInput<R[K]>;
|
|
18
20
|
};
|
|
19
21
|
export type InferPinInput<P extends Pin> = P extends DataPin<infer I, infer _> ? I : never;
|
package/dist/utils.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export type SerializeObject<T extends object> = {
|
|
|
8
8
|
[K in keyof T]: Serialize<T[K]>;
|
|
9
9
|
};
|
|
10
10
|
export type ConditionalOptional<C extends boolean, V> = C extends true ? V | undefined : Exclude<V, undefined>;
|
|
11
|
+
export type PartialKeyValues<T, K extends keyof T> = Omit<T, K> & Record<K, Partial<T[K]>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xentom/integration-framework",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
14
|
"clean": "git clean -xdf .cache .turbo node_modules dist",
|
|
15
|
+
"postinstall": "tsc",
|
|
15
16
|
"build": "tsc"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
@@ -25,10 +26,11 @@
|
|
|
25
26
|
"@standard-schema/spec": "^1.0.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
29
|
+
"@types/bun": "^1.3.0",
|
|
30
|
+
"@xentom/style-guide": "^0.0.0",
|
|
31
|
+
"eslint": "^9.37.0",
|
|
30
32
|
"prettier": "^3.6.2",
|
|
31
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.9.3"
|
|
32
34
|
},
|
|
33
35
|
"prettier": "@xentom/style-guide/prettier"
|
|
34
36
|
}
|