@zapier/zapier-sdk 0.37.0 → 0.39.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/CHANGELOG.md +12 -0
- package/README.md +56 -49
- package/dist/apps.cjs +9036 -0
- package/dist/apps.d.mts +23 -0
- package/dist/apps.d.ts +23 -0
- package/dist/apps.mjs +9034 -0
- package/dist/define/apps-entrypoint.d.ts +3 -0
- package/dist/define/apps-entrypoint.d.ts.map +1 -0
- package/dist/define/apps-entrypoint.js +1 -0
- package/dist/define/apps-registry-keys.d.ts +2 -0
- package/dist/define/apps-registry-keys.d.ts.map +1 -0
- package/dist/define/apps-registry-keys.js +2 -0
- package/dist/define/apps-registry.d.ts +13 -0
- package/dist/define/apps-registry.d.ts.map +1 -0
- package/dist/define/apps-registry.js +31 -0
- package/dist/define/apps-registry.json +9010 -0
- package/dist/define/apps.d.ts +11 -0
- package/dist/define/apps.d.ts.map +1 -0
- package/dist/define/apps.js +2 -0
- package/dist/define/define.d.ts +13 -0
- package/dist/define/define.d.ts.map +1 -0
- package/dist/define/define.js +93 -0
- package/dist/define/helpers.d.ts +8 -0
- package/dist/define/helpers.d.ts.map +1 -0
- package/dist/define/helpers.js +6 -0
- package/dist/define/index.d.ts +5 -0
- package/dist/define/index.d.ts.map +1 -0
- package/dist/define/index.js +2 -0
- package/dist/define/types.d.ts +235 -0
- package/dist/define/types.d.ts.map +1 -0
- package/dist/define/types.js +1 -0
- package/dist/define.cjs +113 -0
- package/dist/define.d.mts +254 -0
- package/dist/define.d.ts +254 -0
- package/dist/define.mjs +107 -0
- package/dist/index.cjs +145 -41
- package/dist/index.d.mts +38 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +145 -42
- package/dist/plugins/capabilities/index.d.ts +22 -0
- package/dist/plugins/capabilities/index.d.ts.map +1 -0
- package/dist/plugins/capabilities/index.js +76 -0
- package/dist/plugins/findFirstConnection/schemas.d.ts +1 -0
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -0
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.d.ts +2 -1
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +10 -3
- package/dist/plugins/listConnections/schemas.d.ts +1 -0
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +5 -0
- package/dist/plugins/manifest/index.d.ts +1 -0
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +1 -0
- package/dist/plugins/manifest/schemas.d.ts +9 -0
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +9 -0
- package/dist/plugins/tables/deleteTable/index.d.ts +2 -1
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +1 -0
- package/dist/plugins/tables/listTables/index.d.ts +2 -1
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +14 -6
- package/dist/plugins/tables/listTables/schemas.d.ts +1 -0
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/schemas.js +5 -1
- package/dist/resolvers/connectionId.d.ts.map +1 -1
- package/dist/resolvers/connectionId.js +13 -23
- package/dist/resolvers/tableId.d.ts.map +1 -1
- package/dist/resolvers/tableId.js +17 -6
- package/dist/sdk.d.ts +3 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +3 -0
- package/dist/types/sdk.d.ts +3 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +9 -0
- package/dist/utils/pagination-utils.d.ts +6 -0
- package/dist/utils/pagination-utils.d.ts.map +1 -1
- package/dist/utils/pagination-utils.js +8 -0
- package/dist/utils/schema-utils.d.ts +6 -1
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/package.json +23 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { App } from "./apps-registry";
|
|
2
|
+
export { App };
|
|
3
|
+
export type BuiltinApp = (typeof App)[keyof typeof App];
|
|
4
|
+
/**
|
|
5
|
+
* AppRef is a string — the implementation name (e.g. "SlackCLIAPI").
|
|
6
|
+
* Built-in apps via App.slack are branded strings for per-app type safety.
|
|
7
|
+
* Lookup is case-insensitive: App.slack, App.Slack, App.SLACK all resolve.
|
|
8
|
+
* Unknown keys pass through as implementation names: App["MyCLIAPI@1.0.0"].
|
|
9
|
+
*/
|
|
10
|
+
export type AppRef = string;
|
|
11
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/define/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,CAAC;AAEf,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { AppRef } from "./apps";
|
|
3
|
+
import type { ConnectionlessToolConfig, ConnectionlessToolFn, SingleConnToolConfig, MultiConnToolConfig, ToolFn, ConnectionlessDurableConfig, ConnectionlessDurableFn, SingleConnDurableConfig, MultiConnDurableConfig, DurableFn, ConnectionlessComponentConfig, SingleConnComponentConfig, MultiConnComponentConfig, SingleConnectionCtx, MultiConnectionCtx, ComponentFn } from "./types";
|
|
4
|
+
export declare function defineTool<TInput extends z.ZodType>(config: ConnectionlessToolConfig<TInput>): ConnectionlessToolFn<TInput>;
|
|
5
|
+
export declare function defineTool<TInput extends z.ZodType, TApp extends AppRef>(config: SingleConnToolConfig<TInput, TApp>): ToolFn<TInput, TApp>;
|
|
6
|
+
export declare function defineTool<TInput extends z.ZodType, TConn extends Record<string, AppRef>>(config: MultiConnToolConfig<TInput, TConn>): ToolFn<TInput, TConn>;
|
|
7
|
+
export declare function defineDurable<TInput extends z.ZodType>(config: ConnectionlessDurableConfig<TInput>): ConnectionlessDurableFn<TInput>;
|
|
8
|
+
export declare function defineDurable<TInput extends z.ZodType, TApp extends AppRef>(config: SingleConnDurableConfig<TInput, TApp>): DurableFn<TInput, TApp>;
|
|
9
|
+
export declare function defineDurable<TInput extends z.ZodType, TConn extends Record<string, AppRef>>(config: MultiConnDurableConfig<TInput, TConn>): DurableFn<TInput, TConn>;
|
|
10
|
+
export declare function defineComponent<TProps>(config: ConnectionlessComponentConfig<TProps>): ComponentFn<TProps>;
|
|
11
|
+
export declare function defineComponent<TProps, TApp extends AppRef>(config: SingleConnComponentConfig<TProps, TApp>): ComponentFn<TProps & SingleConnectionCtx<TApp>>;
|
|
12
|
+
export declare function defineComponent<TProps, TConn extends Record<string, AppRef>>(config: MultiConnComponentConfig<TProps, TConn>): ComponentFn<TProps & MultiConnectionCtx<TConn>>;
|
|
13
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/define/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,EACN,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,SAAS,EACT,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,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AAW,CAAC,MAAM,CAAC,CAAC;AAEvB,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,EACzD,MAAM,EAAE,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,GAC9C,WAAW,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AAEnD,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1E,MAAM,EAAE,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,GAC9C,WAAW,CAAC,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function toJsonSchema(schema) {
|
|
2
|
+
return schema.toJSONSchema();
|
|
3
|
+
}
|
|
4
|
+
function buildDescribe(meta) {
|
|
5
|
+
return () => ({
|
|
6
|
+
kind: meta.kind,
|
|
7
|
+
name: meta.name,
|
|
8
|
+
description: meta.description,
|
|
9
|
+
inputSchema: meta.inputSchema ? toJsonSchema(meta.inputSchema) : undefined,
|
|
10
|
+
connection: meta.connection,
|
|
11
|
+
connections: meta.connections,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function defineTool(config) {
|
|
15
|
+
const execute = () => {
|
|
16
|
+
throw new Error(`defineTool("${config.name}") is not callable yet. ` +
|
|
17
|
+
"Runtime resolution is coming in Phase 2.");
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(execute, "name", {
|
|
20
|
+
value: config.name,
|
|
21
|
+
writable: false,
|
|
22
|
+
});
|
|
23
|
+
return Object.assign(execute, {
|
|
24
|
+
kind: "tool",
|
|
25
|
+
description: config.description,
|
|
26
|
+
connection: config.connection,
|
|
27
|
+
connections: config.connections,
|
|
28
|
+
inputSchema: config.inputSchema,
|
|
29
|
+
inputDependencies: config.inputDependencies,
|
|
30
|
+
run: config.run,
|
|
31
|
+
options: config.options,
|
|
32
|
+
schema: config.schema,
|
|
33
|
+
digest: config.digest,
|
|
34
|
+
describe: buildDescribe({
|
|
35
|
+
kind: "tool",
|
|
36
|
+
name: config.name,
|
|
37
|
+
description: config.description,
|
|
38
|
+
inputSchema: config.inputSchema,
|
|
39
|
+
connection: config.connection,
|
|
40
|
+
connections: config.connections,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function defineDurable(config) {
|
|
45
|
+
const execute = () => {
|
|
46
|
+
throw new Error(`defineDurable("${config.name}") is not callable yet. ` +
|
|
47
|
+
"Runtime resolution is coming in Phase 2.");
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(execute, "name", {
|
|
50
|
+
value: config.name,
|
|
51
|
+
writable: false,
|
|
52
|
+
});
|
|
53
|
+
return Object.assign(execute, {
|
|
54
|
+
kind: "durable",
|
|
55
|
+
description: config.description,
|
|
56
|
+
connection: config.connection,
|
|
57
|
+
connections: config.connections,
|
|
58
|
+
inputSchema: config.inputSchema,
|
|
59
|
+
inputDependencies: config.inputDependencies,
|
|
60
|
+
run: config.run,
|
|
61
|
+
describe: buildDescribe({
|
|
62
|
+
kind: "durable",
|
|
63
|
+
name: config.name,
|
|
64
|
+
description: config.description,
|
|
65
|
+
inputSchema: config.inputSchema,
|
|
66
|
+
connection: config.connection,
|
|
67
|
+
connections: config.connections,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export function defineComponent(config) {
|
|
72
|
+
const component = () => {
|
|
73
|
+
throw new Error(`defineComponent("${config.name}") is not callable yet. ` +
|
|
74
|
+
"Runtime resolution is coming in Phase 2.");
|
|
75
|
+
};
|
|
76
|
+
Object.defineProperty(component, "name", {
|
|
77
|
+
value: config.name,
|
|
78
|
+
writable: false,
|
|
79
|
+
});
|
|
80
|
+
return Object.assign(component, {
|
|
81
|
+
kind: "component",
|
|
82
|
+
description: config.description,
|
|
83
|
+
connection: "connection" in config ? config.connection : undefined,
|
|
84
|
+
connections: "connections" in config ? config.connections : undefined,
|
|
85
|
+
describe: buildDescribe({
|
|
86
|
+
kind: "component",
|
|
87
|
+
name: config.name,
|
|
88
|
+
description: config.description,
|
|
89
|
+
connection: "connection" in config ? config.connection : undefined,
|
|
90
|
+
connections: "connections" in config ? config.connections : undefined,
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResolveDirective } from "./types";
|
|
2
|
+
export declare function optionsFrom(tool: unknown, binds?: Record<string, {
|
|
3
|
+
$ref: string;
|
|
4
|
+
}>): ResolveDirective;
|
|
5
|
+
export declare function schemaFrom(tool: unknown, binds?: Record<string, {
|
|
6
|
+
$ref: string;
|
|
7
|
+
}>): ResolveDirective;
|
|
8
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/define/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACvC,gBAAgB,CAElB;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,EACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACvC,gBAAgB,CAElB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { BuiltinApp, AppRef } from "./apps";
|
|
2
|
+
export { defineTool, defineDurable, defineComponent } from "./define";
|
|
3
|
+
export { optionsFrom, schemaFrom } from "./helpers";
|
|
4
|
+
export type { ZapierClient, DefineContext, ToolContext, SingleConnectionToolContext, MultiConnectionToolContext, DurableContext, ComponentCtx, StepOptions, WaitOptions, CallbackOptions, ConnectionId, SingleConnExecuteOptions, MultiConnExecuteOptions, RefProxy, ResolveDirective, WithInputDependencies, WithResultProcessors, DescribeResult, ConnectionlessToolConfig, SingleConnToolConfig, MultiConnToolConfig, ToolFn, ConnectionlessToolFn, ConnectionlessDurableConfig, SingleConnDurableConfig, MultiConnDurableConfig, DurableResult, DurableFn, ConnectionlessDurableFn, ReservedComponentProps, AssertNoReservedComponentProps, SingleConnectionCtx, MultiConnectionCtx, ConnectionlessComponentConfig, SingleConnComponentConfig, MultiConnComponentConfig, ComponentConfig, ComponentFn, } from "./types";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/define/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpD,YAAY,EAEV,YAAY,EAGZ,aAAa,EACb,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,cAAc,EACd,YAAY,EAGZ,WAAW,EACX,WAAW,EACX,eAAe,EAGf,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EAGvB,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EAGpB,cAAc,EAGd,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EAGpB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,SAAS,EACT,uBAAuB,EAGvB,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,EACnB,kBAAkB,EAClB,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,EACf,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { AppRef } from "./apps";
|
|
3
|
+
export interface ZapierClient {
|
|
4
|
+
fetch(url: string, options: {
|
|
5
|
+
connection?: string;
|
|
6
|
+
method?: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
body?: string | Record<string, unknown> | null;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}): Promise<Response>;
|
|
11
|
+
}
|
|
12
|
+
export interface DefineContext {
|
|
13
|
+
zapier: ZapierClient;
|
|
14
|
+
}
|
|
15
|
+
export interface StepOptions<T> {
|
|
16
|
+
name: string;
|
|
17
|
+
run: () => Promise<T>;
|
|
18
|
+
maxAttempts?: number;
|
|
19
|
+
retryDelaySeconds?: number;
|
|
20
|
+
outputSchema?: z.ZodSchema<T>;
|
|
21
|
+
}
|
|
22
|
+
export interface WaitOptions {
|
|
23
|
+
name: string;
|
|
24
|
+
seconds: number;
|
|
25
|
+
}
|
|
26
|
+
export interface CallbackOptions<T = unknown> {
|
|
27
|
+
name: string;
|
|
28
|
+
timeoutSeconds?: number;
|
|
29
|
+
payloadSchema?: z.ZodSchema<T>;
|
|
30
|
+
}
|
|
31
|
+
export type ToolContext = DefineContext;
|
|
32
|
+
export interface SingleConnectionToolContext extends DefineContext {
|
|
33
|
+
connection: string;
|
|
34
|
+
}
|
|
35
|
+
export interface MultiConnectionToolContext<TConn extends Record<string, AppRef>> extends DefineContext {
|
|
36
|
+
connections: {
|
|
37
|
+
[K in keyof TConn]: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface DurableContext extends DefineContext {
|
|
41
|
+
step<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
42
|
+
step<T>(options: StepOptions<T>): Promise<T>;
|
|
43
|
+
wait(name: string, seconds: number): Promise<void>;
|
|
44
|
+
wait(options: WaitOptions): Promise<void>;
|
|
45
|
+
createCallback(name: string): Promise<[Promise<unknown>, string]>;
|
|
46
|
+
createCallback<T>(options: CallbackOptions<T>): Promise<[Promise<T>, string]>;
|
|
47
|
+
}
|
|
48
|
+
export type ComponentCtx = DefineContext;
|
|
49
|
+
declare const CONNECTION_BRAND: unique symbol;
|
|
50
|
+
export type ConnectionId<TApp extends AppRef> = string & {
|
|
51
|
+
readonly [CONNECTION_BRAND]: TApp;
|
|
52
|
+
};
|
|
53
|
+
export interface SingleConnExecuteOptions<TApp extends AppRef> {
|
|
54
|
+
connection: ConnectionId<TApp>;
|
|
55
|
+
}
|
|
56
|
+
export interface MultiConnExecuteOptions<TConn extends Record<string, AppRef>> {
|
|
57
|
+
connections: {
|
|
58
|
+
[K in keyof TConn]: ConnectionId<TConn[K]>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export type RefProxy<K extends string> = {
|
|
62
|
+
[P in K]: {
|
|
63
|
+
$ref: P;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type ResolveDirective = {
|
|
67
|
+
kind: "options";
|
|
68
|
+
tool: unknown;
|
|
69
|
+
binds?: Record<string, {
|
|
70
|
+
$ref: string;
|
|
71
|
+
}>;
|
|
72
|
+
} | {
|
|
73
|
+
kind: "schema";
|
|
74
|
+
tool: unknown;
|
|
75
|
+
binds?: Record<string, {
|
|
76
|
+
$ref: string;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
export interface WithInputDependencies<TInput extends z.ZodType> {
|
|
80
|
+
inputDependencies?: ($: RefProxy<keyof z.infer<TInput> & string>) => Record<string, ResolveDirective>;
|
|
81
|
+
}
|
|
82
|
+
export interface WithResultProcessors {
|
|
83
|
+
options?: (result: unknown) => Array<{
|
|
84
|
+
label: string;
|
|
85
|
+
value: string;
|
|
86
|
+
}>;
|
|
87
|
+
schema?: (result: unknown) => z.ZodType;
|
|
88
|
+
digest?: (result: unknown) => unknown;
|
|
89
|
+
}
|
|
90
|
+
export interface DescribeResult {
|
|
91
|
+
kind: "tool" | "durable" | "component";
|
|
92
|
+
name: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
inputSchema?: Record<string, unknown>;
|
|
95
|
+
connection?: AppRef;
|
|
96
|
+
connections?: Record<string, AppRef>;
|
|
97
|
+
}
|
|
98
|
+
export interface ConnectionlessToolConfig<TInput extends z.ZodType> extends WithInputDependencies<TInput>, WithResultProcessors {
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
connection?: never;
|
|
102
|
+
connections?: never;
|
|
103
|
+
inputSchema: TInput;
|
|
104
|
+
run: (ctx: ToolContext, input: z.infer<TInput>) => Promise<unknown>;
|
|
105
|
+
}
|
|
106
|
+
export interface SingleConnToolConfig<TInput extends z.ZodType, TApp extends AppRef = AppRef> extends WithInputDependencies<TInput>, WithResultProcessors {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
connection: TApp;
|
|
110
|
+
connections?: never;
|
|
111
|
+
inputSchema: TInput;
|
|
112
|
+
run: (ctx: SingleConnectionToolContext, input: z.infer<TInput>) => Promise<unknown>;
|
|
113
|
+
}
|
|
114
|
+
export interface MultiConnToolConfig<TInput extends z.ZodType, TConn extends Record<string, AppRef>> extends WithInputDependencies<TInput>, WithResultProcessors {
|
|
115
|
+
name: string;
|
|
116
|
+
description: string;
|
|
117
|
+
connection?: never;
|
|
118
|
+
connections: TConn;
|
|
119
|
+
inputSchema: TInput;
|
|
120
|
+
run: (ctx: MultiConnectionToolContext<TConn>, input: z.infer<TInput>) => Promise<unknown>;
|
|
121
|
+
}
|
|
122
|
+
interface ToolFnMeta<TInput extends z.ZodType, TConn extends AppRef | Record<string, AppRef> | undefined> extends WithInputDependencies<TInput>, WithResultProcessors {
|
|
123
|
+
kind: "tool";
|
|
124
|
+
name: string;
|
|
125
|
+
description: string;
|
|
126
|
+
connection: TConn extends AppRef ? TConn : undefined;
|
|
127
|
+
connections: TConn extends Record<string, AppRef> ? TConn : undefined;
|
|
128
|
+
inputSchema: TInput;
|
|
129
|
+
run: TConn extends Record<string, AppRef> ? (ctx: MultiConnectionToolContext<TConn>, input: z.infer<TInput>) => Promise<unknown> : TConn extends AppRef ? (ctx: SingleConnectionToolContext, input: z.infer<TInput>) => Promise<unknown> : (ctx: ToolContext, input: z.infer<TInput>) => Promise<unknown>;
|
|
130
|
+
describe(): DescribeResult;
|
|
131
|
+
}
|
|
132
|
+
export type ToolFn<TInput extends z.ZodType, TConn extends AppRef | Record<string, AppRef>> = (TConn extends AppRef ? (input: z.infer<TInput>, opts: SingleConnExecuteOptions<TConn>) => Promise<unknown> : TConn extends Record<string, AppRef> ? (input: z.infer<TInput>, opts: MultiConnExecuteOptions<TConn>) => Promise<unknown> : never) & ToolFnMeta<TInput, TConn>;
|
|
133
|
+
export type ConnectionlessToolFn<TInput extends z.ZodType> = ((input: z.infer<TInput>) => Promise<unknown>) & ToolFnMeta<TInput, undefined>;
|
|
134
|
+
export interface ConnectionlessDurableConfig<TInput extends z.ZodType> extends WithInputDependencies<TInput> {
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
connection?: never;
|
|
138
|
+
connections?: never;
|
|
139
|
+
inputSchema: TInput;
|
|
140
|
+
run: (ctx: DurableContext, input: z.infer<TInput>) => Promise<unknown>;
|
|
141
|
+
}
|
|
142
|
+
export interface SingleConnDurableConfig<TInput extends z.ZodType, TApp extends AppRef = AppRef> extends WithInputDependencies<TInput> {
|
|
143
|
+
name: string;
|
|
144
|
+
description: string;
|
|
145
|
+
connection: TApp;
|
|
146
|
+
connections?: never;
|
|
147
|
+
inputSchema: TInput;
|
|
148
|
+
run: (ctx: DurableContext & {
|
|
149
|
+
connection: string;
|
|
150
|
+
}, input: z.infer<TInput>) => Promise<unknown>;
|
|
151
|
+
}
|
|
152
|
+
export interface MultiConnDurableConfig<TInput extends z.ZodType, TConn extends Record<string, AppRef>> extends WithInputDependencies<TInput> {
|
|
153
|
+
name: string;
|
|
154
|
+
description: string;
|
|
155
|
+
connection?: never;
|
|
156
|
+
connections: TConn;
|
|
157
|
+
inputSchema: TInput;
|
|
158
|
+
run: (ctx: DurableContext & {
|
|
159
|
+
connections: {
|
|
160
|
+
[K in keyof TConn]: string;
|
|
161
|
+
};
|
|
162
|
+
}, input: z.infer<TInput>) => Promise<unknown>;
|
|
163
|
+
}
|
|
164
|
+
export interface DurableResult<T = unknown> {
|
|
165
|
+
done: boolean;
|
|
166
|
+
result?: T;
|
|
167
|
+
error?: Error;
|
|
168
|
+
executionId?: string;
|
|
169
|
+
}
|
|
170
|
+
interface DurableFnMeta<TInput extends z.ZodType, TConn extends AppRef | Record<string, AppRef> | undefined> extends WithInputDependencies<TInput> {
|
|
171
|
+
kind: "durable";
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
connection: TConn extends AppRef ? TConn : undefined;
|
|
175
|
+
connections: TConn extends Record<string, AppRef> ? TConn : undefined;
|
|
176
|
+
inputSchema: TInput;
|
|
177
|
+
run: TConn extends Record<string, AppRef> ? (ctx: DurableContext & {
|
|
178
|
+
connections: {
|
|
179
|
+
[K in keyof TConn]: string;
|
|
180
|
+
};
|
|
181
|
+
}, input: z.infer<TInput>) => Promise<unknown> : TConn extends AppRef ? (ctx: DurableContext & {
|
|
182
|
+
connection: string;
|
|
183
|
+
}, input: z.infer<TInput>) => Promise<unknown> : (ctx: DurableContext, input: z.infer<TInput>) => Promise<unknown>;
|
|
184
|
+
describe(): DescribeResult;
|
|
185
|
+
}
|
|
186
|
+
export type ConnectionlessDurableFn<TInput extends z.ZodType> = ((input: z.infer<TInput>) => Promise<DurableResult>) & DurableFnMeta<TInput, undefined>;
|
|
187
|
+
export type DurableFn<TInput extends z.ZodType, TConn extends AppRef | Record<string, AppRef>> = (TConn extends AppRef ? (input: z.infer<TInput>, opts: SingleConnExecuteOptions<TConn>) => Promise<DurableResult> : TConn extends Record<string, AppRef> ? (input: z.infer<TInput>, opts: MultiConnExecuteOptions<TConn>) => Promise<DurableResult> : never) & DurableFnMeta<TInput, TConn>;
|
|
188
|
+
export interface ReservedComponentProps {
|
|
189
|
+
connection?: never;
|
|
190
|
+
connections?: never;
|
|
191
|
+
zapier?: never;
|
|
192
|
+
}
|
|
193
|
+
export type AssertNoReservedComponentProps<TProps> = Extract<keyof TProps, keyof ReservedComponentProps> extends never ? TProps : never;
|
|
194
|
+
export interface SingleConnectionCtx<TApp extends AppRef> {
|
|
195
|
+
connection: ConnectionId<TApp>;
|
|
196
|
+
connections?: never;
|
|
197
|
+
}
|
|
198
|
+
export interface MultiConnectionCtx<TConn extends Record<string, AppRef>> {
|
|
199
|
+
connection?: never;
|
|
200
|
+
connections: {
|
|
201
|
+
[K in keyof TConn]: ConnectionId<TConn[K]>;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface ConnectionlessComponentConfig<TProps> {
|
|
205
|
+
name: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
connection?: never;
|
|
208
|
+
connections?: never;
|
|
209
|
+
render: (props: AssertNoReservedComponentProps<TProps> & ComponentCtx) => unknown;
|
|
210
|
+
}
|
|
211
|
+
export interface SingleConnComponentConfig<TProps, TApp extends AppRef> {
|
|
212
|
+
name: string;
|
|
213
|
+
description?: string;
|
|
214
|
+
connection: TApp;
|
|
215
|
+
connections?: never;
|
|
216
|
+
render: (props: AssertNoReservedComponentProps<TProps> & SingleConnectionCtx<TApp> & ComponentCtx) => unknown;
|
|
217
|
+
}
|
|
218
|
+
export interface MultiConnComponentConfig<TProps, TConn extends Record<string, AppRef>> {
|
|
219
|
+
name: string;
|
|
220
|
+
description?: string;
|
|
221
|
+
connection?: never;
|
|
222
|
+
connections: TConn;
|
|
223
|
+
render: (props: AssertNoReservedComponentProps<TProps> & MultiConnectionCtx<TConn> & ComponentCtx) => unknown;
|
|
224
|
+
}
|
|
225
|
+
export type ComponentConfig<TProps> = ConnectionlessComponentConfig<TProps> | SingleConnComponentConfig<TProps, AppRef> | MultiConnComponentConfig<TProps, Record<string, AppRef>>;
|
|
226
|
+
export type ComponentFn<TProps> = ((props: TProps) => unknown) & {
|
|
227
|
+
kind: "component";
|
|
228
|
+
name: string;
|
|
229
|
+
description?: string;
|
|
230
|
+
connection?: AppRef;
|
|
231
|
+
connections?: Record<string, AppRef>;
|
|
232
|
+
describe(): DescribeResult;
|
|
233
|
+
};
|
|
234
|
+
export {};
|
|
235
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/define/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,MAAM,WAAW,YAAY;IAC3B,KAAK,CACH,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtB;AAID,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;CACtB;AAID,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAA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AAE,CACN,KAAK,EAAE,8BAA8B,CAAC,MAAM,CAAC,GAC3C,kBAAkB,CAAC,KAAK,CAAC,GACzB,YAAY,KACX,OAAO,CAAC;CACd;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,IAC9B,6BAA6B,CAAC,MAAM,CAAC,GACrC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAI7D,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG;IAC/D,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,IAAI,cAAc,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/define.cjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/define/define.ts
|
|
4
|
+
function toJsonSchema(schema) {
|
|
5
|
+
return schema.toJSONSchema();
|
|
6
|
+
}
|
|
7
|
+
function buildDescribe(meta) {
|
|
8
|
+
return () => ({
|
|
9
|
+
kind: meta.kind,
|
|
10
|
+
name: meta.name,
|
|
11
|
+
description: meta.description,
|
|
12
|
+
inputSchema: meta.inputSchema ? toJsonSchema(meta.inputSchema) : void 0,
|
|
13
|
+
connection: meta.connection,
|
|
14
|
+
connections: meta.connections
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function defineTool(config) {
|
|
18
|
+
const execute = () => {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`defineTool("${config.name}") is not callable yet. Runtime resolution is coming in Phase 2.`
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(execute, "name", {
|
|
24
|
+
value: config.name,
|
|
25
|
+
writable: false
|
|
26
|
+
});
|
|
27
|
+
return Object.assign(execute, {
|
|
28
|
+
kind: "tool",
|
|
29
|
+
description: config.description,
|
|
30
|
+
connection: config.connection,
|
|
31
|
+
connections: config.connections,
|
|
32
|
+
inputSchema: config.inputSchema,
|
|
33
|
+
inputDependencies: config.inputDependencies,
|
|
34
|
+
run: config.run,
|
|
35
|
+
options: config.options,
|
|
36
|
+
schema: config.schema,
|
|
37
|
+
digest: config.digest,
|
|
38
|
+
describe: buildDescribe({
|
|
39
|
+
kind: "tool",
|
|
40
|
+
name: config.name,
|
|
41
|
+
description: config.description,
|
|
42
|
+
inputSchema: config.inputSchema,
|
|
43
|
+
connection: config.connection,
|
|
44
|
+
connections: config.connections
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function defineDurable(config) {
|
|
49
|
+
const execute = () => {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`defineDurable("${config.name}") is not callable yet. Runtime resolution is coming in Phase 2.`
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(execute, "name", {
|
|
55
|
+
value: config.name,
|
|
56
|
+
writable: false
|
|
57
|
+
});
|
|
58
|
+
return Object.assign(execute, {
|
|
59
|
+
kind: "durable",
|
|
60
|
+
description: config.description,
|
|
61
|
+
connection: config.connection,
|
|
62
|
+
connections: config.connections,
|
|
63
|
+
inputSchema: config.inputSchema,
|
|
64
|
+
inputDependencies: config.inputDependencies,
|
|
65
|
+
run: config.run,
|
|
66
|
+
describe: buildDescribe({
|
|
67
|
+
kind: "durable",
|
|
68
|
+
name: config.name,
|
|
69
|
+
description: config.description,
|
|
70
|
+
inputSchema: config.inputSchema,
|
|
71
|
+
connection: config.connection,
|
|
72
|
+
connections: config.connections
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function defineComponent(config) {
|
|
77
|
+
const component = () => {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`defineComponent("${config.name}") is not callable yet. Runtime resolution is coming in Phase 2.`
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
Object.defineProperty(component, "name", {
|
|
83
|
+
value: config.name,
|
|
84
|
+
writable: false
|
|
85
|
+
});
|
|
86
|
+
return Object.assign(component, {
|
|
87
|
+
kind: "component",
|
|
88
|
+
description: config.description,
|
|
89
|
+
connection: "connection" in config ? config.connection : void 0,
|
|
90
|
+
connections: "connections" in config ? config.connections : void 0,
|
|
91
|
+
describe: buildDescribe({
|
|
92
|
+
kind: "component",
|
|
93
|
+
name: config.name,
|
|
94
|
+
description: config.description,
|
|
95
|
+
connection: "connection" in config ? config.connection : void 0,
|
|
96
|
+
connections: "connections" in config ? config.connections : void 0
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/define/helpers.ts
|
|
102
|
+
function optionsFrom(tool, binds) {
|
|
103
|
+
return { kind: "options", tool, binds };
|
|
104
|
+
}
|
|
105
|
+
function schemaFrom(tool, binds) {
|
|
106
|
+
return { kind: "schema", tool, binds };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.defineComponent = defineComponent;
|
|
110
|
+
exports.defineDurable = defineDurable;
|
|
111
|
+
exports.defineTool = defineTool;
|
|
112
|
+
exports.optionsFrom = optionsFrom;
|
|
113
|
+
exports.schemaFrom = schemaFrom;
|