@xentom/integration-framework 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +836 -0
- package/dist/controls/base.d.ts +14 -0
- package/dist/controls/base.js +0 -0
- package/dist/controls/expression.d.ts +15 -0
- package/dist/controls/expression.js +0 -0
- package/dist/controls/index.d.ts +155 -0
- package/dist/controls/index.js +30 -0
- package/dist/controls/select.d.ts +32 -0
- package/dist/controls/select.js +0 -0
- package/dist/controls/switch.d.ts +6 -0
- package/dist/controls/switch.js +0 -0
- package/dist/controls/text.d.ts +29 -0
- package/dist/controls/text.js +7 -0
- package/dist/env.d.ts +46 -0
- package/dist/env.js +19 -0
- package/dist/generic.d.ts +37 -0
- package/dist/generic.js +31 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/integration.d.ts +84 -0
- package/dist/integration.js +5 -0
- package/dist/nodes/base.d.ts +45 -0
- package/dist/nodes/base.js +0 -0
- package/dist/nodes/callable.d.ts +98 -0
- package/dist/nodes/callable.js +0 -0
- package/dist/nodes/index.d.ts +111 -0
- package/dist/nodes/index.js +48 -0
- package/dist/nodes/pure.d.ts +77 -0
- package/dist/nodes/pure.js +0 -0
- package/dist/nodes/trigger.d.ts +124 -0
- package/dist/nodes/trigger.js +0 -0
- package/dist/nodes/utils.d.ts +13 -0
- package/dist/nodes/utils.js +1 -0
- package/dist/pins/base.d.ts +13 -0
- package/dist/pins/base.js +0 -0
- package/dist/pins/data.d.ts +95 -0
- package/dist/pins/data.js +0 -0
- package/dist/pins/exec.d.ts +61 -0
- package/dist/pins/exec.js +0 -0
- package/dist/pins/index.d.ts +97 -0
- package/dist/pins/index.js +47 -0
- package/dist/pins/utils.d.ts +25 -0
- package/dist/pins/utils.js +0 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +1 -0
- package/dist/webhook.d.ts +33 -0
- package/dist/webhook.js +0 -0
- package/package.json +34 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type DataPin, type DataPinBuilder } from './data';
|
|
2
|
+
import { type ExecPin, type ExecPinBuilder } from './exec';
|
|
3
|
+
export * from './base';
|
|
4
|
+
export * from './data';
|
|
5
|
+
export * from './exec';
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export type Pin = DataPin | ExecPin;
|
|
8
|
+
export type PinRecord<P extends Pin = Pin> = Record<string, P>;
|
|
9
|
+
export declare enum PinType {
|
|
10
|
+
/**
|
|
11
|
+
* Represents a data pin, used for inputs and outputs of an node.
|
|
12
|
+
*/
|
|
13
|
+
Data = "data",
|
|
14
|
+
/**
|
|
15
|
+
* Represents an exec pin, used for executable outputs of an node.
|
|
16
|
+
* Only applicable within triggers and callable nodes.
|
|
17
|
+
*/
|
|
18
|
+
Exec = "exec"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Utilities for defining pins used in nodes.
|
|
22
|
+
*
|
|
23
|
+
* Includes:
|
|
24
|
+
* - `data`: Defines a data pin, used for passing inputs and outputs.
|
|
25
|
+
* - `exec`: Defines an exec pin, used to control execution flow in triggers and callable nodes.
|
|
26
|
+
*/
|
|
27
|
+
export declare const pins: {
|
|
28
|
+
/**
|
|
29
|
+
* Creates a data pin, used for passing input or output values in an node.
|
|
30
|
+
* The pin can include a custom schema, control, and example values to guide users.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* Basic usage:
|
|
34
|
+
* ```ts
|
|
35
|
+
* i.pins.data()
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* Customizing the pin with additional properties:
|
|
40
|
+
* ```ts
|
|
41
|
+
* i.pins.data({
|
|
42
|
+
* displayName: 'Message',
|
|
43
|
+
* description: 'A message to send',
|
|
44
|
+
* control: i.controls.text({
|
|
45
|
+
* placeholder: 'Hello, world!',
|
|
46
|
+
* }),
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* Using inside a node:
|
|
52
|
+
* ```ts
|
|
53
|
+
* i.nodes.pure({
|
|
54
|
+
* outputs: {
|
|
55
|
+
* value: i.pins.data({
|
|
56
|
+
* control: i.controls.text(),
|
|
57
|
+
* }),
|
|
58
|
+
* },
|
|
59
|
+
* });
|
|
60
|
+
*/
|
|
61
|
+
data: DataPinBuilder;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an exec pin, used to define an executable output from an node.
|
|
64
|
+
* Exec pins are only supported within triggers and callable nodes.
|
|
65
|
+
* They can optionally include scoped data outputs, separate from global node outputs.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* Basic usage:
|
|
69
|
+
* ```ts
|
|
70
|
+
* i.pins.exec()
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* Customizing the exec pin with additional properties:
|
|
75
|
+
* ```ts
|
|
76
|
+
* i.pins.exec({
|
|
77
|
+
* displayName: 'Process Item',
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* Using exec pin with scoped outputs:
|
|
83
|
+
* ```ts
|
|
84
|
+
* i.nodes.callable({
|
|
85
|
+
* outputs: {
|
|
86
|
+
* completed: i.pins.exec(),
|
|
87
|
+
* iteration: i.pins.exec({
|
|
88
|
+
* outputs: {
|
|
89
|
+
* element: i.pins.data(),
|
|
90
|
+
* index: i.pins.data(),
|
|
91
|
+
* },
|
|
92
|
+
* }),
|
|
93
|
+
* },
|
|
94
|
+
* });
|
|
95
|
+
*/
|
|
96
|
+
exec: ExecPinBuilder;
|
|
97
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export * from './base';
|
|
2
|
+
export * from './data';
|
|
3
|
+
export * from './exec';
|
|
4
|
+
export * from './utils';
|
|
5
|
+
export var PinType;
|
|
6
|
+
(function (PinType) {
|
|
7
|
+
/**
|
|
8
|
+
* Represents a data pin, used for inputs and outputs of an node.
|
|
9
|
+
*/
|
|
10
|
+
PinType["Data"] = "data";
|
|
11
|
+
/**
|
|
12
|
+
* Represents an exec pin, used for executable outputs of an node.
|
|
13
|
+
* Only applicable within triggers and callable nodes.
|
|
14
|
+
*/
|
|
15
|
+
PinType["Exec"] = "exec";
|
|
16
|
+
})(PinType || (PinType = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Utilities for defining pins used in nodes.
|
|
19
|
+
*
|
|
20
|
+
* Includes:
|
|
21
|
+
* - `data`: Defines a data pin, used for passing inputs and outputs.
|
|
22
|
+
* - `exec`: Defines an exec pin, used to control execution flow in triggers and callable nodes.
|
|
23
|
+
*/
|
|
24
|
+
export const pins = {
|
|
25
|
+
data: (definition) => ({
|
|
26
|
+
...definition,
|
|
27
|
+
type: PinType.Data,
|
|
28
|
+
// @ts-expect-error -- -
|
|
29
|
+
with(definition) {
|
|
30
|
+
return {
|
|
31
|
+
...this,
|
|
32
|
+
...definition,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
exec: (definition) => ({
|
|
37
|
+
...definition,
|
|
38
|
+
type: PinType.Exec,
|
|
39
|
+
// @ts-expect-error -- -
|
|
40
|
+
with(definition) {
|
|
41
|
+
return {
|
|
42
|
+
...this,
|
|
43
|
+
...definition,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Pin, type PinRecord } from '.';
|
|
2
|
+
import { type DataPin } from './data';
|
|
3
|
+
import { type ExecPin } from './exec';
|
|
4
|
+
export type InferPinRecordOutput<R extends PinRecord> = {
|
|
5
|
+
[K in keyof R as R[K] extends DataPin ? K : never]: InferPinOutput<R[K]>;
|
|
6
|
+
} & {
|
|
7
|
+
[K in FlattenExecPinOutputs<R>]: GetExecPinOutputType<R, K>;
|
|
8
|
+
};
|
|
9
|
+
export type FlattenExecPinOutputs<R extends PinRecord> = {
|
|
10
|
+
[K in keyof R]: R[K] extends ExecPin<infer O> ? `${K & string}.${keyof O & string}` : never;
|
|
11
|
+
}[keyof R];
|
|
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
|
+
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> = {
|
|
15
|
+
[K in keyof R as R[K] extends DataPin ? undefined extends InferPinInput<R[K]> ? never : K : never]: InferPinInput<R[K]>;
|
|
16
|
+
} & {
|
|
17
|
+
[K in keyof R as R[K] extends DataPin ? undefined extends InferPinInput<R[K]> ? K : never : never]?: InferPinInput<R[K]>;
|
|
18
|
+
};
|
|
19
|
+
export type InferPinInput<P extends Pin> = P extends DataPin<infer I, infer _> ? I : never;
|
|
20
|
+
export type ExtractPinsOfType<R extends PinRecord, P extends Pin> = {
|
|
21
|
+
[K in keyof R as R[K] extends P ? K : never]: R[K] extends P ? R[K] : never;
|
|
22
|
+
};
|
|
23
|
+
export type PinRecordHasPinType<R extends PinRecord, P extends DataPin | ExecPin> = {
|
|
24
|
+
[K in keyof R]: R[K] extends P ? K : never;
|
|
25
|
+
}[keyof R] extends never ? false : true;
|
|
File without changes
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type HasRequiredKeys<T> = keyof T extends never ? false : {
|
|
2
|
+
[K in keyof T]-?: undefined extends T[K] ? false : true;
|
|
3
|
+
}[keyof T] extends true ? true : false;
|
|
4
|
+
export type ContainsFunction<T> = [Extract<T, Function>] extends [never] ? false : true;
|
|
5
|
+
export type Serialize<T> = ContainsFunction<T> extends true ? SerializeFunction<T> : T extends object ? SerializeObject<T> : T;
|
|
6
|
+
export type SerializeFunction<T> = ContainsFunction<T> extends true ? true | Exclude<T, Function> : T;
|
|
7
|
+
export type SerializeObject<T extends object> = {
|
|
8
|
+
[K in keyof T]: Serialize<T[K]>;
|
|
9
|
+
};
|
|
10
|
+
export type ConditionalOptional<C extends boolean, V> = C extends true ? V | undefined : Exclude<V, undefined>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Webhook {
|
|
2
|
+
/**
|
|
3
|
+
* The external URL that an external service can call to trigger the webhook handler.
|
|
4
|
+
*/
|
|
5
|
+
url: string;
|
|
6
|
+
/**
|
|
7
|
+
* Registers a handler for incoming webhook requests to the URL.
|
|
8
|
+
* The handler is invoked when the external service sends an HTTP request.
|
|
9
|
+
* Returns an unsubscribe function to clean up the handler.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* subscribe(opts) {
|
|
14
|
+
* const unsubscribe = opts.webhook.subscribe((req) => {
|
|
15
|
+
* // Handle incoming webhook request
|
|
16
|
+
* return new Response('OK');
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* return () => {
|
|
20
|
+
* unsubscribe();
|
|
21
|
+
* };
|
|
22
|
+
* },
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
subscribe: (handler: WebhookHandler) => () => void;
|
|
26
|
+
}
|
|
27
|
+
export type WebhookHandler = (request: Request) => Promise<void | Response> | (void | Response);
|
|
28
|
+
export interface WebhookRequestData {
|
|
29
|
+
url: string;
|
|
30
|
+
method: string;
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
body: ArrayBuffer;
|
|
33
|
+
}
|
package/dist/webhook.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xentom/integration-framework",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint",
|
|
12
|
+
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"clean": "git clean -xdf .cache .turbo node_modules dist",
|
|
15
|
+
"build": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"CLAUDE.md"
|
|
20
|
+
],
|
|
21
|
+
"imports": {
|
|
22
|
+
"#src/*": "./src/*.ts"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@standard-schema/spec": "^1.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@xentom/style-guide": "0.0.0",
|
|
29
|
+
"eslint": "^9.31.0",
|
|
30
|
+
"prettier": "^3.6.2",
|
|
31
|
+
"typescript": "^5.8.3"
|
|
32
|
+
},
|
|
33
|
+
"prettier": "@xentom/style-guide/prettier"
|
|
34
|
+
}
|