@zapier/zapier-sdk 0.3.0 → 0.4.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/dist/index.cjs +2001 -0
- package/dist/index.d.mts +840 -0
- package/dist/index.d.ts +840 -20
- package/dist/index.mjs +1955 -0
- package/package.json +19 -7
- package/src/api/client.ts +84 -16
- package/src/api/types.ts +9 -1
- package/src/auth.ts +19 -287
- package/src/functions/fetch/index.ts +180 -0
- package/src/functions/fetch/info.ts +8 -0
- package/src/functions/fetch/schemas.ts +46 -0
- package/src/functions/findFirstAuthentication/schemas.ts +3 -13
- package/src/functions/findUniqueAuthentication/schemas.ts +3 -13
- package/src/functions/generateTypes/index.ts +15 -0
- package/src/functions/generateTypes/schemas.ts +3 -10
- package/src/functions/getAction/schemas.ts +3 -13
- package/src/functions/getApp/schemas.ts +2 -13
- package/src/functions/getAuthentication/index.ts +0 -1
- package/src/functions/getAuthentication/schemas.ts +3 -17
- package/src/functions/listActions/schemas.ts +3 -13
- package/src/functions/listApps/schemas.ts +2 -13
- package/src/functions/listAuthentications/index.ts +0 -1
- package/src/functions/listAuthentications/schemas.ts +3 -15
- package/src/functions/listFields/schemas.ts +3 -13
- package/src/functions/runAction/index.ts +0 -1
- package/src/functions/runAction/schemas.ts +6 -15
- package/src/index.ts +4 -2
- package/src/plugins/apps/index.ts +35 -9
- package/src/sdk.ts +20 -22
- package/src/types/domain.ts +16 -0
- package/src/types/sdk.ts +13 -1
- package/tsconfig.json +2 -2
- package/tsup.config.ts +21 -0
- package/dist/api/auth.d.ts +0 -8
- package/dist/api/auth.js +0 -29
- package/dist/api/client.d.ts +0 -8
- package/dist/api/client.js +0 -119
- package/dist/api/debug.d.ts +0 -12
- package/dist/api/debug.js +0 -50
- package/dist/api/index.d.ts +0 -28
- package/dist/api/index.js +0 -52
- package/dist/api/polling.d.ts +0 -17
- package/dist/api/polling.js +0 -34
- package/dist/api/types.d.ts +0 -147
- package/dist/api/types.js +0 -9
- package/dist/auth.d.ts +0 -59
- package/dist/auth.js +0 -261
- package/dist/functions/bundleCode/index.d.ts +0 -11
- package/dist/functions/bundleCode/index.js +0 -91
- package/dist/functions/bundleCode/info.d.ts +0 -27
- package/dist/functions/bundleCode/info.js +0 -11
- package/dist/functions/bundleCode/schemas.d.ts +0 -27
- package/dist/functions/bundleCode/schemas.js +0 -22
- package/dist/functions/findFirstAuthentication/index.d.ts +0 -12
- package/dist/functions/findFirstAuthentication/index.js +0 -21
- package/dist/functions/findFirstAuthentication/info.d.ts +0 -30
- package/dist/functions/findFirstAuthentication/info.js +0 -11
- package/dist/functions/findFirstAuthentication/schemas.d.ts +0 -42
- package/dist/functions/findFirstAuthentication/schemas.js +0 -25
- package/dist/functions/findUniqueAuthentication/index.d.ts +0 -13
- package/dist/functions/findUniqueAuthentication/index.js +0 -28
- package/dist/functions/findUniqueAuthentication/info.d.ts +0 -30
- package/dist/functions/findUniqueAuthentication/info.js +0 -11
- package/dist/functions/findUniqueAuthentication/schemas.d.ts +0 -42
- package/dist/functions/findUniqueAuthentication/schemas.js +0 -25
- package/dist/functions/generateTypes/index.d.ts +0 -11
- package/dist/functions/generateTypes/index.js +0 -305
- package/dist/functions/generateTypes/info.d.ts +0 -21
- package/dist/functions/generateTypes/info.js +0 -11
- package/dist/functions/generateTypes/schemas.d.ts +0 -30
- package/dist/functions/generateTypes/schemas.js +0 -14
- package/dist/functions/getAction/index.d.ts +0 -12
- package/dist/functions/getAction/index.js +0 -26
- package/dist/functions/getAction/info.d.ts +0 -18
- package/dist/functions/getAction/info.js +0 -11
- package/dist/functions/getAction/schemas.d.ts +0 -30
- package/dist/functions/getAction/schemas.js +0 -13
- package/dist/functions/getApp/index.d.ts +0 -12
- package/dist/functions/getApp/index.js +0 -37
- package/dist/functions/getApp/info.d.ts +0 -12
- package/dist/functions/getApp/info.js +0 -11
- package/dist/functions/getApp/schemas.d.ts +0 -24
- package/dist/functions/getApp/schemas.js +0 -11
- package/dist/functions/getAuthentication/index.d.ts +0 -13
- package/dist/functions/getAuthentication/index.js +0 -38
- package/dist/functions/getAuthentication/info.d.ts +0 -12
- package/dist/functions/getAuthentication/info.js +0 -11
- package/dist/functions/getAuthentication/schemas.d.ts +0 -26
- package/dist/functions/getAuthentication/schemas.js +0 -16
- package/dist/functions/listActions/index.d.ts +0 -12
- package/dist/functions/listActions/index.js +0 -128
- package/dist/functions/listActions/info.d.ts +0 -15
- package/dist/functions/listActions/info.js +0 -11
- package/dist/functions/listActions/schemas.d.ts +0 -27
- package/dist/functions/listActions/schemas.js +0 -14
- package/dist/functions/listApps/index.d.ts +0 -12
- package/dist/functions/listApps/index.js +0 -50
- package/dist/functions/listApps/info.d.ts +0 -18
- package/dist/functions/listApps/info.js +0 -11
- package/dist/functions/listApps/schemas.d.ts +0 -30
- package/dist/functions/listApps/schemas.js +0 -15
- package/dist/functions/listAuthentications/index.d.ts +0 -12
- package/dist/functions/listAuthentications/index.js +0 -131
- package/dist/functions/listAuthentications/info.d.ts +0 -30
- package/dist/functions/listAuthentications/info.js +0 -11
- package/dist/functions/listAuthentications/schemas.d.ts +0 -44
- package/dist/functions/listAuthentications/schemas.js +0 -25
- package/dist/functions/listFields/index.d.ts +0 -12
- package/dist/functions/listFields/index.js +0 -65
- package/dist/functions/listFields/info.d.ts +0 -24
- package/dist/functions/listFields/info.js +0 -11
- package/dist/functions/listFields/schemas.d.ts +0 -36
- package/dist/functions/listFields/schemas.js +0 -17
- package/dist/functions/runAction/index.d.ts +0 -12
- package/dist/functions/runAction/index.js +0 -86
- package/dist/functions/runAction/info.d.ts +0 -24
- package/dist/functions/runAction/info.js +0 -11
- package/dist/functions/runAction/schemas.d.ts +0 -38
- package/dist/functions/runAction/schemas.js +0 -15
- package/dist/index.js +0 -57
- package/dist/plugins/apps/index.d.ts +0 -8
- package/dist/plugins/apps/index.js +0 -77
- package/dist/plugins/apps/info.d.ts +0 -6
- package/dist/plugins/apps/info.js +0 -13
- package/dist/plugins/apps/types.d.ts +0 -21
- package/dist/plugins/apps/types.js +0 -2
- package/dist/resolvers/actionKey.d.ts +0 -8
- package/dist/resolvers/actionKey.js +0 -20
- package/dist/resolvers/actionType.d.ts +0 -8
- package/dist/resolvers/actionType.js +0 -21
- package/dist/resolvers/appKey.d.ts +0 -6
- package/dist/resolvers/appKey.js +0 -8
- package/dist/resolvers/authenticationId.d.ts +0 -8
- package/dist/resolvers/authenticationId.js +0 -29
- package/dist/resolvers/index.d.ts +0 -39
- package/dist/resolvers/index.js +0 -105
- package/dist/resolvers/inputs.d.ts +0 -7
- package/dist/resolvers/inputs.js +0 -15
- package/dist/schema-utils.d.ts +0 -44
- package/dist/schema-utils.js +0 -76
- package/dist/schemas/Action.d.ts +0 -21
- package/dist/schemas/Action.js +0 -31
- package/dist/schemas/App.d.ts +0 -19
- package/dist/schemas/App.js +0 -32
- package/dist/schemas/Auth.d.ts +0 -27
- package/dist/schemas/Auth.js +0 -42
- package/dist/schemas/Field.d.ts +0 -15
- package/dist/schemas/Field.js +0 -25
- package/dist/sdk.d.ts +0 -6
- package/dist/sdk.js +0 -90
- package/dist/types/domain.d.ts +0 -25
- package/dist/types/domain.js +0 -21
- package/dist/types/events.d.ts +0 -37
- package/dist/types/events.js +0 -8
- package/dist/types/properties.d.ts +0 -21
- package/dist/types/properties.js +0 -52
- package/dist/types/sdk.d.ts +0 -24
- package/dist/types/sdk.js +0 -2
package/dist/schema-utils.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withFormatter = withFormatter;
|
|
4
|
-
exports.getFormatMetadata = getFormatMetadata;
|
|
5
|
-
exports.withOutputSchema = withOutputSchema;
|
|
6
|
-
exports.getOutputSchema = getOutputSchema;
|
|
7
|
-
exports.withResolver = withResolver;
|
|
8
|
-
exports.getSchemaDescription = getSchemaDescription;
|
|
9
|
-
exports.getFieldDescriptions = getFieldDescriptions;
|
|
10
|
-
exports.withPositional = withPositional;
|
|
11
|
-
exports.isPositional = isPositional;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
// Helper function to add format metadata to schemas
|
|
14
|
-
function withFormatter(schema, formatMeta) {
|
|
15
|
-
// Store format metadata on the schema definition
|
|
16
|
-
schema._def.formatMeta = formatMeta;
|
|
17
|
-
return schema;
|
|
18
|
-
}
|
|
19
|
-
// Helper function to get format metadata from a schema
|
|
20
|
-
function getFormatMetadata(schema) {
|
|
21
|
-
return schema._def.formatMeta;
|
|
22
|
-
}
|
|
23
|
-
// Helper function to link input schemas to output schemas
|
|
24
|
-
function withOutputSchema(inputSchema, outputSchema) {
|
|
25
|
-
// Store output schema reference on the input schema
|
|
26
|
-
inputSchema._def.outputSchema = outputSchema;
|
|
27
|
-
return inputSchema;
|
|
28
|
-
}
|
|
29
|
-
// Helper function to get output schema from an input schema
|
|
30
|
-
function getOutputSchema(inputSchema) {
|
|
31
|
-
return inputSchema._def.outputSchema;
|
|
32
|
-
}
|
|
33
|
-
// Helper function to add resolver metadata to schemas
|
|
34
|
-
function withResolver(schema, config) {
|
|
35
|
-
// Store resolver metadata on the schema definition
|
|
36
|
-
schema._def.resolverMeta = config;
|
|
37
|
-
return schema;
|
|
38
|
-
}
|
|
39
|
-
// ============================================================================
|
|
40
|
-
// Schema Description Utilities
|
|
41
|
-
// ============================================================================
|
|
42
|
-
function getSchemaDescription(schema) {
|
|
43
|
-
return schema.description;
|
|
44
|
-
}
|
|
45
|
-
function getFieldDescriptions(schema) {
|
|
46
|
-
const descriptions = {};
|
|
47
|
-
const shape = schema.shape;
|
|
48
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
49
|
-
if (fieldSchema instanceof zod_1.z.ZodType && fieldSchema.description) {
|
|
50
|
-
descriptions[key] = fieldSchema.description;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return descriptions;
|
|
54
|
-
}
|
|
55
|
-
// Helper function to mark a parameter as positional for CLI
|
|
56
|
-
function withPositional(schema) {
|
|
57
|
-
// Store positional metadata on the schema definition
|
|
58
|
-
schema._def.positionalMeta = { positional: true };
|
|
59
|
-
return schema;
|
|
60
|
-
}
|
|
61
|
-
// Helper function to check if a parameter should be positional
|
|
62
|
-
function isPositional(schema) {
|
|
63
|
-
// Check the current schema first
|
|
64
|
-
if (schema._def.positionalMeta?.positional) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
// If this is a ZodOptional, check the inner type
|
|
68
|
-
if (schema instanceof zod_1.z.ZodOptional) {
|
|
69
|
-
return isPositional(schema._def.innerType);
|
|
70
|
-
}
|
|
71
|
-
// If this is a ZodDefault, check the inner type
|
|
72
|
-
if (schema instanceof zod_1.z.ZodDefault) {
|
|
73
|
-
return isPositional(schema._def.innerType);
|
|
74
|
-
}
|
|
75
|
-
return false;
|
|
76
|
-
}
|
package/dist/schemas/Action.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const ActionItemSchema: z.ZodObject<{
|
|
3
|
-
key: z.ZodString;
|
|
4
|
-
name: z.ZodOptional<z.ZodString>;
|
|
5
|
-
type: z.ZodString;
|
|
6
|
-
appKey: z.ZodOptional<z.ZodString>;
|
|
7
|
-
description: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
type: string;
|
|
10
|
-
key: string;
|
|
11
|
-
appKey?: string | undefined;
|
|
12
|
-
name?: string | undefined;
|
|
13
|
-
description?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
type: string;
|
|
16
|
-
key: string;
|
|
17
|
-
appKey?: string | undefined;
|
|
18
|
-
name?: string | undefined;
|
|
19
|
-
description?: string | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
export type ActionItem = z.infer<typeof ActionItemSchema>;
|
package/dist/schemas/Action.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionItemSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schema_utils_1 = require("../schema-utils");
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Action Schemas
|
|
8
|
-
// ============================================================================
|
|
9
|
-
exports.ActionItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
|
|
10
|
-
key: zod_1.z.string(),
|
|
11
|
-
name: zod_1.z.string().optional(),
|
|
12
|
-
type: zod_1.z.string(),
|
|
13
|
-
appKey: zod_1.z.string().optional(),
|
|
14
|
-
description: zod_1.z.string().optional(),
|
|
15
|
-
}), {
|
|
16
|
-
format: (item) => {
|
|
17
|
-
const details = [];
|
|
18
|
-
details.push({ text: `Type: ${item.type}`, style: "accent" });
|
|
19
|
-
if (item.appKey) {
|
|
20
|
-
details.push({ text: `App: ${item.appKey}`, style: "normal" });
|
|
21
|
-
}
|
|
22
|
-
if (item.description) {
|
|
23
|
-
details.push({ text: item.description, style: "dim" });
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
title: item.name || item.key,
|
|
27
|
-
subtitle: `(${item.key})`,
|
|
28
|
-
details,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
});
|
package/dist/schemas/App.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export { FormattedItem, FormatMetadata } from "../schema-utils";
|
|
3
|
-
export declare const AppItemSchema: z.ZodObject<{
|
|
4
|
-
key: z.ZodString;
|
|
5
|
-
name: z.ZodOptional<z.ZodString>;
|
|
6
|
-
description: z.ZodOptional<z.ZodString>;
|
|
7
|
-
category: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
key: string;
|
|
10
|
-
name?: string | undefined;
|
|
11
|
-
description?: string | undefined;
|
|
12
|
-
category?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
key: string;
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
description?: string | undefined;
|
|
17
|
-
category?: string | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
export type AppItem = z.infer<typeof AppItemSchema>;
|
package/dist/schemas/App.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppItemSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schema_utils_1 = require("../schema-utils");
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// App Schemas
|
|
8
|
-
// ============================================================================
|
|
9
|
-
exports.AppItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
|
|
10
|
-
key: zod_1.z.string(),
|
|
11
|
-
name: zod_1.z.string().optional(),
|
|
12
|
-
description: zod_1.z.string().optional(),
|
|
13
|
-
category: zod_1.z.string().optional(),
|
|
14
|
-
}), {
|
|
15
|
-
format: (item) => {
|
|
16
|
-
const details = [];
|
|
17
|
-
if (item.description) {
|
|
18
|
-
details.push({ text: item.description, style: "dim" });
|
|
19
|
-
}
|
|
20
|
-
if (item.category) {
|
|
21
|
-
details.push({
|
|
22
|
-
text: `Category: ${item.category}`,
|
|
23
|
-
style: "accent",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
title: item.name || item.key,
|
|
28
|
-
subtitle: `(${item.key})`,
|
|
29
|
-
details,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
});
|
package/dist/schemas/Auth.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const AuthItemSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodNumber;
|
|
4
|
-
title: z.ZodOptional<z.ZodString>;
|
|
5
|
-
identifier: z.ZodOptional<z.ZodString>;
|
|
6
|
-
account_id: z.ZodOptional<z.ZodString>;
|
|
7
|
-
is_private: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
-
shared_with_all: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
-
marked_stale_at: z.ZodOptional<z.ZodString>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
id: number;
|
|
12
|
-
title?: string | undefined;
|
|
13
|
-
identifier?: string | undefined;
|
|
14
|
-
account_id?: string | undefined;
|
|
15
|
-
is_private?: boolean | undefined;
|
|
16
|
-
shared_with_all?: boolean | undefined;
|
|
17
|
-
marked_stale_at?: string | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
id: number;
|
|
20
|
-
title?: string | undefined;
|
|
21
|
-
identifier?: string | undefined;
|
|
22
|
-
account_id?: string | undefined;
|
|
23
|
-
is_private?: boolean | undefined;
|
|
24
|
-
shared_with_all?: boolean | undefined;
|
|
25
|
-
marked_stale_at?: string | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
export type AuthItem = z.infer<typeof AuthItemSchema>;
|
package/dist/schemas/Auth.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthItemSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schema_utils_1 = require("../schema-utils");
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Auth Schemas
|
|
8
|
-
// ============================================================================
|
|
9
|
-
exports.AuthItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
|
|
10
|
-
id: zod_1.z.number(),
|
|
11
|
-
title: zod_1.z.string().optional(),
|
|
12
|
-
identifier: zod_1.z.string().optional(),
|
|
13
|
-
account_id: zod_1.z.string().optional(),
|
|
14
|
-
is_private: zod_1.z.boolean().optional(),
|
|
15
|
-
shared_with_all: zod_1.z.boolean().optional(),
|
|
16
|
-
marked_stale_at: zod_1.z.string().optional(),
|
|
17
|
-
}), {
|
|
18
|
-
format: (item) => {
|
|
19
|
-
const details = [];
|
|
20
|
-
if (item.identifier) {
|
|
21
|
-
details.push({
|
|
22
|
-
text: `Identifier: ${item.identifier}`,
|
|
23
|
-
style: "accent",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
details.push({
|
|
27
|
-
text: `Account: ${item.account_id || "unknown"} | Private: ${item.is_private || false} | Shared: ${item.shared_with_all || false}`,
|
|
28
|
-
style: "dim",
|
|
29
|
-
});
|
|
30
|
-
if (item.marked_stale_at) {
|
|
31
|
-
details.push({
|
|
32
|
-
text: `⚠️ Marked stale: ${new Date(item.marked_stale_at).toLocaleDateString()}`,
|
|
33
|
-
style: "warning",
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
title: item.title || `Authentication ${item.id}`,
|
|
38
|
-
subtitle: `(ID: ${item.id})`,
|
|
39
|
-
details,
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
});
|
package/dist/schemas/Field.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const FieldItemSchema: z.ZodObject<{
|
|
3
|
-
key: z.ZodString;
|
|
4
|
-
name: z.ZodOptional<z.ZodString>;
|
|
5
|
-
description: z.ZodOptional<z.ZodString>;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
key: string;
|
|
8
|
-
name?: string | undefined;
|
|
9
|
-
description?: string | undefined;
|
|
10
|
-
}, {
|
|
11
|
-
key: string;
|
|
12
|
-
name?: string | undefined;
|
|
13
|
-
description?: string | undefined;
|
|
14
|
-
}>;
|
|
15
|
-
export type FieldItem = z.infer<typeof FieldItemSchema>;
|
package/dist/schemas/Field.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FieldItemSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schema_utils_1 = require("../schema-utils");
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Field Schemas
|
|
8
|
-
// ============================================================================
|
|
9
|
-
exports.FieldItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
|
|
10
|
-
key: zod_1.z.string(),
|
|
11
|
-
name: zod_1.z.string().optional(),
|
|
12
|
-
description: zod_1.z.string().optional(),
|
|
13
|
-
}), {
|
|
14
|
-
format: (item) => {
|
|
15
|
-
const details = [];
|
|
16
|
-
if (item.description) {
|
|
17
|
-
details.push({ text: item.description, style: "dim" });
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
title: item.name || item.key,
|
|
21
|
-
subtitle: `(${item.key})`,
|
|
22
|
-
details,
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
});
|
package/dist/sdk.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BaseSdkOptions } from "./types/domain";
|
|
2
|
-
import type { ZapierSdk } from "./types/sdk";
|
|
3
|
-
export type { ZapierSdk } from "./types/sdk";
|
|
4
|
-
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
5
|
-
}
|
|
6
|
-
export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
package/dist/sdk.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createZapierSdk = createZapierSdk;
|
|
4
|
-
const api_1 = require("./api");
|
|
5
|
-
const auth_1 = require("./auth");
|
|
6
|
-
// Import function implementations
|
|
7
|
-
const listApps_1 = require("./functions/listApps");
|
|
8
|
-
const getApp_1 = require("./functions/getApp");
|
|
9
|
-
const listActions_1 = require("./functions/listActions");
|
|
10
|
-
const getAction_1 = require("./functions/getAction");
|
|
11
|
-
const runAction_1 = require("./functions/runAction");
|
|
12
|
-
const listAuthentications_1 = require("./functions/listAuthentications");
|
|
13
|
-
const getAuthentication_1 = require("./functions/getAuthentication");
|
|
14
|
-
const findFirstAuthentication_1 = require("./functions/findFirstAuthentication");
|
|
15
|
-
const findUniqueAuthentication_1 = require("./functions/findUniqueAuthentication");
|
|
16
|
-
const listFields_1 = require("./functions/listFields");
|
|
17
|
-
const generateTypes_1 = require("./functions/generateTypes");
|
|
18
|
-
const bundleCode_1 = require("./functions/bundleCode");
|
|
19
|
-
// Import function registry info objects (only for CLI registry)
|
|
20
|
-
const info_1 = require("./functions/listApps/info");
|
|
21
|
-
const info_2 = require("./functions/getApp/info");
|
|
22
|
-
const info_3 = require("./functions/listActions/info");
|
|
23
|
-
const info_4 = require("./functions/getAction/info");
|
|
24
|
-
const info_5 = require("./functions/runAction/info");
|
|
25
|
-
const info_6 = require("./functions/listAuthentications/info");
|
|
26
|
-
const info_7 = require("./functions/getAuthentication/info");
|
|
27
|
-
const info_8 = require("./functions/findFirstAuthentication/info");
|
|
28
|
-
const info_9 = require("./functions/findUniqueAuthentication/info");
|
|
29
|
-
const info_10 = require("./functions/listFields/info");
|
|
30
|
-
const info_11 = require("./functions/generateTypes/info");
|
|
31
|
-
const info_12 = require("./functions/bundleCode/info");
|
|
32
|
-
// Function registry as array - uses names from function info objects
|
|
33
|
-
const functionRegistry = [
|
|
34
|
-
info_1.listAppsInfo,
|
|
35
|
-
info_2.getAppInfo,
|
|
36
|
-
info_3.listActionsInfo,
|
|
37
|
-
info_4.getActionInfo,
|
|
38
|
-
info_5.runActionInfo,
|
|
39
|
-
info_6.listAuthenticationsInfo,
|
|
40
|
-
info_7.getAuthenticationInfo,
|
|
41
|
-
info_8.findFirstAuthenticationInfo,
|
|
42
|
-
info_9.findUniqueAuthenticationInfo,
|
|
43
|
-
info_10.listFieldsInfo,
|
|
44
|
-
info_11.generateTypesInfo,
|
|
45
|
-
info_12.bundleCodeInfo,
|
|
46
|
-
];
|
|
47
|
-
// Import plugin functions
|
|
48
|
-
const index_1 = require("./plugins/apps/index");
|
|
49
|
-
function createZapierSdk(options = {}) {
|
|
50
|
-
const { fetch: customFetch = globalThis.fetch, baseUrl = "https://zapier.com", token, getToken, onEvent, debug = false, } = options;
|
|
51
|
-
// If no explicit token or getToken provided, try env var then CLI config with event callbacks
|
|
52
|
-
const resolvedGetToken = getToken ||
|
|
53
|
-
(!token
|
|
54
|
-
? () => (0, auth_1.getTokenFromEnvOrConfig)({ onEvent, fetch: customFetch })
|
|
55
|
-
: undefined);
|
|
56
|
-
// Create the API client
|
|
57
|
-
const api = (0, api_1.createZapierApi)({
|
|
58
|
-
baseUrl,
|
|
59
|
-
token,
|
|
60
|
-
getToken: resolvedGetToken,
|
|
61
|
-
debug,
|
|
62
|
-
fetch: customFetch,
|
|
63
|
-
});
|
|
64
|
-
// Create plugins directly - TypeScript will enforce correct implementation
|
|
65
|
-
const appsPlugin = (0, index_1.createAppsPlugin)({
|
|
66
|
-
api,
|
|
67
|
-
token,
|
|
68
|
-
});
|
|
69
|
-
// Compose final SDK - TypeScript will enforce we have all required properties
|
|
70
|
-
const fullSdk = {
|
|
71
|
-
// Registry for CLI
|
|
72
|
-
__registry: functionRegistry,
|
|
73
|
-
// Function implementations with API config injection
|
|
74
|
-
listApps: (options = {}) => (0, listApps_1.listApps)({ ...options, api }),
|
|
75
|
-
getApp: (options) => (0, getApp_1.getApp)({ ...options, api }),
|
|
76
|
-
listActions: (options = {}) => (0, listActions_1.listActions)({ ...options, api }),
|
|
77
|
-
getAction: (options) => (0, getAction_1.getAction)({ ...options, api }),
|
|
78
|
-
runAction: (options) => (0, runAction_1.runAction)({ ...options, api }),
|
|
79
|
-
listAuthentications: (options = {}) => (0, listAuthentications_1.listAuthentications)({ ...options, api }),
|
|
80
|
-
getAuthentication: (options) => (0, getAuthentication_1.getAuthentication)({ ...options, api }),
|
|
81
|
-
findFirstAuthentication: (options = {}) => (0, findFirstAuthentication_1.findFirstAuthentication)({ ...options, api }),
|
|
82
|
-
findUniqueAuthentication: (options = {}) => (0, findUniqueAuthentication_1.findUniqueAuthentication)({ ...options, api }),
|
|
83
|
-
listFields: (options) => (0, listFields_1.listFields)({ ...options, api }),
|
|
84
|
-
generateTypes: (options) => (0, generateTypes_1.generateTypes)({ ...options, api }),
|
|
85
|
-
bundleCode: (options) => (0, bundleCode_1.bundleCode)(options), // No API config needed
|
|
86
|
-
// Add plugins
|
|
87
|
-
apps: appsPlugin,
|
|
88
|
-
};
|
|
89
|
-
return fullSdk;
|
|
90
|
-
}
|
package/dist/types/domain.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type { Integration, Action, Trigger, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, } from "../api/types";
|
|
2
|
-
import type { EventCallback } from "./events";
|
|
3
|
-
export interface ActionExecutionOptions {
|
|
4
|
-
inputs?: Record<string, any>;
|
|
5
|
-
authenticationId?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface AuthObject {
|
|
8
|
-
id: number;
|
|
9
|
-
}
|
|
10
|
-
export interface BaseSdkOptions {
|
|
11
|
-
token?: string;
|
|
12
|
-
getToken?: () => Promise<string | undefined>;
|
|
13
|
-
onEvent?: EventCallback;
|
|
14
|
-
fetch?: typeof fetch;
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare class ZapierSdkError extends Error {
|
|
19
|
-
code?: string | undefined;
|
|
20
|
-
constructor(message: string, code?: string | undefined);
|
|
21
|
-
}
|
|
22
|
-
export declare class AppNotFoundError extends ZapierSdkError {
|
|
23
|
-
appKey: string;
|
|
24
|
-
constructor(appKey: string);
|
|
25
|
-
}
|
package/dist/types/domain.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppNotFoundError = exports.ZapierSdkError = void 0;
|
|
4
|
-
// Error Classes
|
|
5
|
-
class ZapierSdkError extends Error {
|
|
6
|
-
constructor(message, code) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.code = code;
|
|
9
|
-
this.name = "ZapierSdkError";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.ZapierSdkError = ZapierSdkError;
|
|
13
|
-
class AppNotFoundError extends ZapierSdkError {
|
|
14
|
-
constructor(appKey) {
|
|
15
|
-
super(`App "${appKey}" not found`);
|
|
16
|
-
this.name = "AppNotFoundError";
|
|
17
|
-
this.code = "APP_NOT_FOUND";
|
|
18
|
-
this.appKey = appKey;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.AppNotFoundError = AppNotFoundError;
|
package/dist/types/events.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK Event System
|
|
3
|
-
*
|
|
4
|
-
* This module provides common event type definitions for the SDK's
|
|
5
|
-
* event system, including authentication, API, and loading events.
|
|
6
|
-
*/
|
|
7
|
-
export interface SdkEvent {
|
|
8
|
-
type: string;
|
|
9
|
-
payload?: Record<string, any>;
|
|
10
|
-
timestamp?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface AuthEvent extends SdkEvent {
|
|
13
|
-
type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
|
|
14
|
-
payload?: {
|
|
15
|
-
message?: string;
|
|
16
|
-
error?: string;
|
|
17
|
-
operation?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export interface ApiEvent extends SdkEvent {
|
|
21
|
-
type: "api_request" | "api_response" | "api_error";
|
|
22
|
-
payload?: {
|
|
23
|
-
url?: string;
|
|
24
|
-
method?: string;
|
|
25
|
-
status?: number;
|
|
26
|
-
duration?: number;
|
|
27
|
-
error?: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface LoadingEvent extends SdkEvent {
|
|
31
|
-
type: "loading_start" | "loading_end";
|
|
32
|
-
payload?: {
|
|
33
|
-
operation?: string;
|
|
34
|
-
resource?: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export type EventCallback = (event: SdkEvent) => void;
|
package/dist/types/events.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const AppKeyPropertySchema: z.ZodString;
|
|
3
|
-
export declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
4
|
-
export declare const ActionKeyPropertySchema: z.ZodString;
|
|
5
|
-
export declare const AuthenticationIdPropertySchema: z.ZodNumber;
|
|
6
|
-
export declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
7
|
-
export declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
8
|
-
export declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
9
|
-
export declare const OutputPropertySchema: z.ZodString;
|
|
10
|
-
export declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
-
export declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
12
|
-
export type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
|
|
13
|
-
export type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
|
|
14
|
-
export type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
|
|
15
|
-
export type AuthenticationIdProperty = z.infer<typeof AuthenticationIdPropertySchema>;
|
|
16
|
-
export type InputsProperty = z.infer<typeof InputsPropertySchema>;
|
|
17
|
-
export type LimitProperty = z.infer<typeof LimitPropertySchema>;
|
|
18
|
-
export type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
|
|
19
|
-
export type OutputProperty = z.infer<typeof OutputPropertySchema>;
|
|
20
|
-
export type DebugProperty = z.infer<typeof DebugPropertySchema>;
|
|
21
|
-
export type ParamsProperty = z.infer<typeof ParamsPropertySchema>;
|
package/dist/types/properties.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParamsPropertySchema = exports.DebugPropertySchema = exports.OutputPropertySchema = exports.OffsetPropertySchema = exports.LimitPropertySchema = exports.InputsPropertySchema = exports.AuthenticationIdPropertySchema = exports.ActionKeyPropertySchema = exports.ActionTypePropertySchema = exports.AppKeyPropertySchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const schema_utils_1 = require("../schema-utils");
|
|
6
|
-
// Shared property definitions for common parameters across functions
|
|
7
|
-
// These can be reused in function schemas without duplication
|
|
8
|
-
exports.AppKeyPropertySchema = (0, schema_utils_1.withPositional)(zod_1.z.string().min(1).describe("App slug (e.g., 'slack', 'github')"));
|
|
9
|
-
exports.ActionTypePropertySchema = zod_1.z
|
|
10
|
-
.enum([
|
|
11
|
-
"read",
|
|
12
|
-
"read_bulk",
|
|
13
|
-
"write",
|
|
14
|
-
"run",
|
|
15
|
-
"search",
|
|
16
|
-
"search_or_write",
|
|
17
|
-
"search_and_write",
|
|
18
|
-
"filter",
|
|
19
|
-
])
|
|
20
|
-
.describe("Action type that matches the action's defined type");
|
|
21
|
-
exports.ActionKeyPropertySchema = zod_1.z
|
|
22
|
-
.string()
|
|
23
|
-
.min(1)
|
|
24
|
-
.describe("Action key to execute");
|
|
25
|
-
exports.AuthenticationIdPropertySchema = zod_1.z
|
|
26
|
-
.number()
|
|
27
|
-
.int()
|
|
28
|
-
.describe("Authentication ID to use for this action");
|
|
29
|
-
exports.InputsPropertySchema = zod_1.z
|
|
30
|
-
.record(zod_1.z.any())
|
|
31
|
-
.describe("Input parameters for the action");
|
|
32
|
-
exports.LimitPropertySchema = zod_1.z
|
|
33
|
-
.number()
|
|
34
|
-
.int()
|
|
35
|
-
.min(1)
|
|
36
|
-
.max(1000)
|
|
37
|
-
.default(50)
|
|
38
|
-
.describe("Maximum number of items to return");
|
|
39
|
-
exports.OffsetPropertySchema = zod_1.z
|
|
40
|
-
.number()
|
|
41
|
-
.int()
|
|
42
|
-
.min(0)
|
|
43
|
-
.default(0)
|
|
44
|
-
.describe("Number of items to skip for pagination");
|
|
45
|
-
exports.OutputPropertySchema = zod_1.z.string().describe("Output file path");
|
|
46
|
-
exports.DebugPropertySchema = zod_1.z
|
|
47
|
-
.boolean()
|
|
48
|
-
.default(false)
|
|
49
|
-
.describe("Enable debug logging");
|
|
50
|
-
exports.ParamsPropertySchema = zod_1.z
|
|
51
|
-
.record(zod_1.z.any())
|
|
52
|
-
.describe("Additional parameters");
|
package/dist/types/sdk.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ListActionsSdkFunction } from "../functions/listActions/schemas";
|
|
2
|
-
import type { GetActionSdkFunction } from "../functions/getAction/schemas";
|
|
3
|
-
import type { GetAppSdkFunction } from "../functions/getApp/schemas";
|
|
4
|
-
import type { RunActionSdkFunction } from "../functions/runAction/schemas";
|
|
5
|
-
import type { ListFieldsSdkFunction } from "../functions/listFields/schemas";
|
|
6
|
-
import type { ListAuthenticationsSdkFunction } from "../functions/listAuthentications/schemas";
|
|
7
|
-
import type { GetAuthenticationSdkFunction } from "../functions/getAuthentication/schemas";
|
|
8
|
-
import type { FindFirstAuthenticationSdkFunction } from "../functions/findFirstAuthentication/schemas";
|
|
9
|
-
import type { FindUniqueAuthenticationSdkFunction } from "../functions/findUniqueAuthentication/schemas";
|
|
10
|
-
import type { GenerateTypesSdkFunction } from "../functions/generateTypes/schemas";
|
|
11
|
-
import type { ListAppsSdkFunction } from "../functions/listApps/schemas";
|
|
12
|
-
import type { BundleCodeSdkFunction } from "../functions/bundleCode/schemas";
|
|
13
|
-
import type { AppsPluginSdkExtension } from "../plugins/apps/types";
|
|
14
|
-
export interface ZapierSdkFunctions extends ListActionsSdkFunction, GetActionSdkFunction, GetAppSdkFunction, RunActionSdkFunction, ListFieldsSdkFunction, ListAuthenticationsSdkFunction, GetAuthenticationSdkFunction, FindFirstAuthenticationSdkFunction, FindUniqueAuthenticationSdkFunction, GenerateTypesSdkFunction, ListAppsSdkFunction, BundleCodeSdkFunction {
|
|
15
|
-
}
|
|
16
|
-
export interface ZapierSdkPlugins extends AppsPluginSdkExtension {
|
|
17
|
-
}
|
|
18
|
-
export interface ZapierSdk extends ZapierSdkFunctions, ZapierSdkPlugins {
|
|
19
|
-
__registry: Array<{
|
|
20
|
-
name: string;
|
|
21
|
-
inputSchema: any;
|
|
22
|
-
implementation: Function;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
package/dist/types/sdk.js
DELETED