@zapier/zapier-sdk 0.13.3 → 0.13.5
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/dist/api/schemas.d.ts +174 -174
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/index.cjs +457 -11
- package/dist/index.d.mts +389 -158
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +428 -15
- package/dist/plugins/api/index.d.ts +1 -3
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/builders.d.ts +13 -0
- package/dist/plugins/eventEmission/builders.d.ts.map +1 -0
- package/dist/plugins/eventEmission/builders.js +78 -0
- package/dist/plugins/eventEmission/index.d.ts +34 -0
- package/dist/plugins/eventEmission/index.d.ts.map +1 -0
- package/dist/plugins/eventEmission/index.js +216 -0
- package/dist/plugins/eventEmission/index.test.d.ts +5 -0
- package/dist/plugins/eventEmission/index.test.d.ts.map +1 -0
- package/dist/plugins/eventEmission/index.test.js +143 -0
- package/dist/plugins/eventEmission/transport.d.ts +37 -0
- package/dist/plugins/eventEmission/transport.d.ts.map +1 -0
- package/dist/plugins/eventEmission/transport.js +96 -0
- package/dist/plugins/eventEmission/transport.test.d.ts +5 -0
- package/dist/plugins/eventEmission/transport.test.d.ts.map +1 -0
- package/dist/plugins/eventEmission/transport.test.js +153 -0
- package/dist/plugins/eventEmission/types.d.ts +53 -0
- package/dist/plugins/eventEmission/types.d.ts.map +1 -0
- package/dist/plugins/eventEmission/types.js +1 -0
- package/dist/plugins/eventEmission/utils.d.ts +45 -0
- package/dist/plugins/eventEmission/utils.d.ts.map +1 -0
- package/dist/plugins/eventEmission/utils.js +114 -0
- package/dist/plugins/fetch/schemas.d.ts +4 -4
- package/dist/plugins/getAction/schemas.d.ts +2 -2
- package/dist/plugins/listActions/index.test.js +3 -1
- package/dist/plugins/listActions/schemas.d.ts +2 -2
- package/dist/plugins/listAuthentications/index.test.js +3 -1
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -4
- package/dist/plugins/listInputFields/schemas.d.ts +2 -2
- package/dist/plugins/manifest/index.d.ts +9 -1
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +19 -7
- package/dist/plugins/manifest/index.test.js +4 -2
- package/dist/plugins/request/schemas.d.ts +4 -4
- package/dist/plugins/runAction/schemas.d.ts +2 -2
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/actionType.js +2 -3
- package/dist/resolvers/authenticationId.d.ts.map +1 -1
- package/dist/schemas/Action.d.ts +2 -2
- package/dist/schemas/App.d.ts +30 -30
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +4 -1
- package/dist/types/sdk.d.ts +5 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/telemetry-events.d.ts +76 -0
- package/dist/types/telemetry-events.d.ts.map +1 -0
- package/dist/types/telemetry-events.js +8 -0
- package/package.json +1 -1
- package/src/constants.ts +6 -0
- package/src/index.ts +24 -0
- package/src/plugins/api/index.ts +1 -5
- package/src/plugins/eventEmission/builders.ts +115 -0
- package/src/plugins/eventEmission/index.test.ts +169 -0
- package/src/plugins/eventEmission/index.ts +294 -0
- package/src/plugins/eventEmission/transport.test.ts +214 -0
- package/src/plugins/eventEmission/transport.ts +135 -0
- package/src/plugins/eventEmission/types.ts +58 -0
- package/src/plugins/eventEmission/utils.ts +121 -0
- package/src/plugins/listActions/index.test.ts +3 -1
- package/src/plugins/listAuthentications/index.test.ts +3 -1
- package/src/plugins/manifest/index.test.ts +4 -4
- package/src/plugins/manifest/index.ts +39 -14
- package/src/resolvers/actionType.ts +4 -3
- package/src/resolvers/authenticationId.ts +2 -1
- package/src/sdk.ts +5 -1
- package/src/types/sdk.ts +7 -1
- package/src/types/telemetry-events.ts +85 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface EventContext {
|
|
2
|
+
customuser_id?: number | null;
|
|
3
|
+
account_id?: number | null;
|
|
4
|
+
identity_id?: number | null;
|
|
5
|
+
visitor_id?: string | null;
|
|
6
|
+
correlation_id?: string | null;
|
|
7
|
+
selected_api?: string | null;
|
|
8
|
+
app_id?: number | null;
|
|
9
|
+
app_version_id?: number | null;
|
|
10
|
+
zap_id?: number | null;
|
|
11
|
+
node_id?: number | null;
|
|
12
|
+
environment?: string | null;
|
|
13
|
+
sdk_version?: string | null;
|
|
14
|
+
operation_type?: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface ErrorEventData {
|
|
17
|
+
error_message: string;
|
|
18
|
+
is_user_facing: boolean;
|
|
19
|
+
error_type?: string | null;
|
|
20
|
+
error_status_code?: number | null;
|
|
21
|
+
error_stack_trace?: string | null;
|
|
22
|
+
error_source_method?: string | null;
|
|
23
|
+
error_source_file?: string | null;
|
|
24
|
+
error_line_number?: number | null;
|
|
25
|
+
operation_type?: string | null;
|
|
26
|
+
operation_key?: string | null;
|
|
27
|
+
error_severity?: string | null;
|
|
28
|
+
is_recoverable?: boolean | null;
|
|
29
|
+
error_metadata?: Record<string, string | null> | null;
|
|
30
|
+
parent_error_id?: string | null;
|
|
31
|
+
error_occurred_timestamp_ms?: number | null;
|
|
32
|
+
error_code?: string | null;
|
|
33
|
+
recovery_attempted?: boolean | null;
|
|
34
|
+
recovery_action?: string | null;
|
|
35
|
+
recovery_successful?: boolean | null;
|
|
36
|
+
execution_time_before_error_ms?: number | null;
|
|
37
|
+
}
|
|
38
|
+
export interface EnhancedErrorEventData extends ErrorEventData {
|
|
39
|
+
execution_start_time?: number | null;
|
|
40
|
+
}
|
|
41
|
+
export interface ApplicationLifecycleEventData {
|
|
42
|
+
lifecycle_event_type: "startup" | "exit" | "signal_termination";
|
|
43
|
+
exit_code?: number | null;
|
|
44
|
+
signal_name?: string | null;
|
|
45
|
+
uptime_ms?: number | null;
|
|
46
|
+
is_graceful_shutdown?: boolean | null;
|
|
47
|
+
shutdown_duration_ms?: number | null;
|
|
48
|
+
memory_usage_bytes?: number | null;
|
|
49
|
+
peak_memory_usage_bytes?: number | null;
|
|
50
|
+
cpu_time_ms?: number | null;
|
|
51
|
+
active_requests_count?: number | null;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAA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,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple utility functions for event emission
|
|
3
|
+
* These are pure functions that can be used to populate common event fields
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate a unique event ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateEventId(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Get current timestamp in milliseconds since epoch
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCurrentTimestamp(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Get release ID (git SHA) - in production this would come from build process
|
|
15
|
+
*/
|
|
16
|
+
export declare function getReleaseId(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get operating system information
|
|
19
|
+
*/
|
|
20
|
+
export declare function getOsInfo(): {
|
|
21
|
+
platform: string | null;
|
|
22
|
+
release: string | null;
|
|
23
|
+
architecture: string | null;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Get platform versions (Node.js, npm, etc.)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getPlatformVersions(): Record<string, string | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if running in CI environment
|
|
31
|
+
*/
|
|
32
|
+
export declare function isCi(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get CI platform name if running in CI
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCiPlatform(): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Get memory usage in bytes
|
|
39
|
+
*/
|
|
40
|
+
export declare function getMemoryUsage(): number | null;
|
|
41
|
+
/**
|
|
42
|
+
* Get CPU time in milliseconds
|
|
43
|
+
*/
|
|
44
|
+
export declare function getCpuTime(): number | null;
|
|
45
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAeA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAQnE;AAED;;GAEG;AACH,wBAAgB,IAAI,IAAI,OAAO,CAa9B;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAY7C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAM9C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAM1C"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple utility functions for event emission
|
|
3
|
+
* These are pure functions that can be used to populate common event fields
|
|
4
|
+
*/
|
|
5
|
+
import * as os from "os";
|
|
6
|
+
/**
|
|
7
|
+
* Generate a unique event ID
|
|
8
|
+
*/
|
|
9
|
+
export function generateEventId() {
|
|
10
|
+
return crypto.randomUUID();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get current timestamp in milliseconds since epoch
|
|
14
|
+
*/
|
|
15
|
+
export function getCurrentTimestamp() {
|
|
16
|
+
return Date.now();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get release ID (git SHA) - in production this would come from build process
|
|
20
|
+
*/
|
|
21
|
+
export function getReleaseId() {
|
|
22
|
+
return process?.env?.SDK_RELEASE_ID || "development";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get operating system information
|
|
26
|
+
*/
|
|
27
|
+
export function getOsInfo() {
|
|
28
|
+
try {
|
|
29
|
+
return {
|
|
30
|
+
platform: os.platform() || null,
|
|
31
|
+
release: os.release() || null,
|
|
32
|
+
architecture: os.arch() || null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Browser environment - os module not available
|
|
37
|
+
return {
|
|
38
|
+
platform: null,
|
|
39
|
+
release: null,
|
|
40
|
+
architecture: null,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get platform versions (Node.js, npm, etc.)
|
|
46
|
+
*/
|
|
47
|
+
export function getPlatformVersions() {
|
|
48
|
+
const versions = {};
|
|
49
|
+
if (typeof process?.versions === "object") {
|
|
50
|
+
for (const [key, value] of Object.entries(process.versions)) {
|
|
51
|
+
versions[key] = value || null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return versions;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if running in CI environment
|
|
58
|
+
*/
|
|
59
|
+
export function isCi() {
|
|
60
|
+
return !!(process?.env?.CI ||
|
|
61
|
+
process?.env?.CONTINUOUS_INTEGRATION ||
|
|
62
|
+
process?.env?.GITHUB_ACTIONS ||
|
|
63
|
+
process?.env?.JENKINS_URL ||
|
|
64
|
+
process?.env?.GITLAB_CI ||
|
|
65
|
+
process?.env?.CIRCLECI ||
|
|
66
|
+
process?.env?.TRAVIS ||
|
|
67
|
+
process?.env?.BUILDKITE ||
|
|
68
|
+
process?.env?.DRONE ||
|
|
69
|
+
process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get CI platform name if running in CI
|
|
73
|
+
*/
|
|
74
|
+
export function getCiPlatform() {
|
|
75
|
+
if (process?.env?.GITHUB_ACTIONS)
|
|
76
|
+
return "github-actions";
|
|
77
|
+
if (process?.env?.JENKINS_URL)
|
|
78
|
+
return "jenkins";
|
|
79
|
+
if (process?.env?.GITLAB_CI)
|
|
80
|
+
return "gitlab-ci";
|
|
81
|
+
if (process?.env?.CIRCLECI)
|
|
82
|
+
return "circleci";
|
|
83
|
+
if (process?.env?.TRAVIS)
|
|
84
|
+
return "travis";
|
|
85
|
+
if (process?.env?.BUILDKITE)
|
|
86
|
+
return "buildkite";
|
|
87
|
+
if (process?.env?.DRONE)
|
|
88
|
+
return "drone";
|
|
89
|
+
if (process?.env?.BITBUCKET_PIPELINES_UUID)
|
|
90
|
+
return "bitbucket-pipelines";
|
|
91
|
+
if (process?.env?.CI || process?.env?.CONTINUOUS_INTEGRATION)
|
|
92
|
+
return "unknown-ci";
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get memory usage in bytes
|
|
97
|
+
*/
|
|
98
|
+
export function getMemoryUsage() {
|
|
99
|
+
if (process?.memoryUsage) {
|
|
100
|
+
const usage = process.memoryUsage();
|
|
101
|
+
return usage.rss || null; // Resident Set Size
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get CPU time in milliseconds
|
|
107
|
+
*/
|
|
108
|
+
export function getCpuTime() {
|
|
109
|
+
if (process?.cpuUsage) {
|
|
110
|
+
const usage = process.cpuUsage();
|
|
111
|
+
return Math.round((usage.user + usage.system) / 1000); // Convert to milliseconds
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
@@ -8,16 +8,16 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
|
|
|
8
8
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
9
9
|
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
method?: "
|
|
11
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
12
12
|
authenticationId?: number | undefined;
|
|
13
|
-
body?: string |
|
|
13
|
+
body?: string | FormData | URLSearchParams | undefined;
|
|
14
14
|
callbackUrl?: string | undefined;
|
|
15
15
|
authenticationTemplate?: string | undefined;
|
|
16
16
|
headers?: Record<string, string> | undefined;
|
|
17
17
|
}, {
|
|
18
|
-
method?: "
|
|
18
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
19
19
|
authenticationId?: number | undefined;
|
|
20
|
-
body?: string |
|
|
20
|
+
body?: string | FormData | URLSearchParams | undefined;
|
|
21
21
|
callbackUrl?: string | undefined;
|
|
22
22
|
authenticationTemplate?: string | undefined;
|
|
23
23
|
headers?: Record<string, string> | undefined;
|
|
@@ -9,11 +9,11 @@ export declare const GetActionSchema: z.ZodObject<{
|
|
|
9
9
|
actionKey: z.ZodString;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
appKey: string;
|
|
12
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
12
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
13
13
|
actionKey: string;
|
|
14
14
|
}, {
|
|
15
15
|
appKey: string;
|
|
16
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
16
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
17
17
|
actionKey: string;
|
|
18
18
|
}>;
|
|
19
19
|
export type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
@@ -70,7 +70,9 @@ describe("listActions plugin", () => {
|
|
|
70
70
|
manifest: null,
|
|
71
71
|
getVersionedImplementationId: mockGetVersionedImplementationId,
|
|
72
72
|
resolveAppKeys: mockResolveAppKeys,
|
|
73
|
-
updateManifestEntry: vi
|
|
73
|
+
updateManifestEntry: vi
|
|
74
|
+
.fn()
|
|
75
|
+
.mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
74
76
|
},
|
|
75
77
|
}))
|
|
76
78
|
.addPlugin(listAppsPlugin)
|
|
@@ -12,13 +12,13 @@ export declare const ListActionsSchema: z.ZodObject<{
|
|
|
12
12
|
cursor: z.ZodOptional<z.ZodString>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
appKey: string;
|
|
15
|
-
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
15
|
+
actionType?: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write" | undefined;
|
|
16
16
|
pageSize?: number | undefined;
|
|
17
17
|
maxItems?: number | undefined;
|
|
18
18
|
cursor?: string | undefined;
|
|
19
19
|
}, {
|
|
20
20
|
appKey: string;
|
|
21
|
-
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
21
|
+
actionType?: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write" | undefined;
|
|
22
22
|
pageSize?: number | undefined;
|
|
23
23
|
maxItems?: number | undefined;
|
|
24
24
|
cursor?: string | undefined;
|
|
@@ -58,7 +58,9 @@ describe("listAuthentications plugin", () => {
|
|
|
58
58
|
manifest: null,
|
|
59
59
|
getVersionedImplementationId: mockGetVersionedImplementationId,
|
|
60
60
|
resolveAppKeys: mockResolveAppKeys,
|
|
61
|
-
updateManifestEntry: vi
|
|
61
|
+
updateManifestEntry: vi
|
|
62
|
+
.fn()
|
|
63
|
+
.mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
62
64
|
},
|
|
63
65
|
});
|
|
64
66
|
function createTestSdk() {
|
|
@@ -7,13 +7,13 @@ export declare const InputFieldChoiceItemSchema: z.ZodObject<{
|
|
|
7
7
|
sample: z.ZodOptional<z.ZodString>;
|
|
8
8
|
value: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
value?: string | undefined;
|
|
11
10
|
key?: string | undefined;
|
|
11
|
+
value?: string | undefined;
|
|
12
12
|
label?: string | undefined;
|
|
13
13
|
sample?: string | undefined;
|
|
14
14
|
}, {
|
|
15
|
-
value?: string | undefined;
|
|
16
15
|
key?: string | undefined;
|
|
16
|
+
value?: string | undefined;
|
|
17
17
|
label?: string | undefined;
|
|
18
18
|
sample?: string | undefined;
|
|
19
19
|
}>;
|
|
@@ -33,7 +33,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
33
33
|
cursor: z.ZodOptional<z.ZodString>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
appKey: string;
|
|
36
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
36
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
37
37
|
actionKey: string;
|
|
38
38
|
inputFieldKey: string;
|
|
39
39
|
page?: number | undefined;
|
|
@@ -44,7 +44,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
44
44
|
cursor?: string | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
appKey: string;
|
|
47
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
47
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
48
48
|
actionKey: string;
|
|
49
49
|
inputFieldKey: string;
|
|
50
50
|
page?: number | undefined;
|
|
@@ -15,7 +15,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
15
15
|
cursor: z.ZodOptional<z.ZodString>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
appKey: string;
|
|
18
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
18
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
19
19
|
actionKey: string;
|
|
20
20
|
authenticationId?: number | null | undefined;
|
|
21
21
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -24,7 +24,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
24
24
|
cursor?: string | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
appKey: string;
|
|
27
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
27
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
28
28
|
actionKey: string;
|
|
29
29
|
authenticationId?: number | null | undefined;
|
|
30
30
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -3,11 +3,18 @@ import type { Plugin } from "../../types/plugin";
|
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { ApiClient } from "../../api";
|
|
5
5
|
export type ManifestPluginOptions = z.infer<typeof ManifestPluginOptionsSchema>;
|
|
6
|
+
export interface UpdateManifestEntryOptions {
|
|
7
|
+
appKey: string;
|
|
8
|
+
entry: ManifestEntry;
|
|
9
|
+
configPath?: string;
|
|
10
|
+
skipWrite?: boolean;
|
|
11
|
+
manifest?: Manifest;
|
|
12
|
+
}
|
|
6
13
|
export interface ManifestPluginProvides {
|
|
7
14
|
context: {
|
|
8
15
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
9
16
|
resolveAppKeys: ResolveAppKeys;
|
|
10
|
-
updateManifestEntry: (
|
|
17
|
+
updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<[string, ManifestEntry, Manifest]>;
|
|
11
18
|
};
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
@@ -31,6 +38,7 @@ export declare function findManifestEntry({ appKey, manifest, }: {
|
|
|
31
38
|
manifest: Manifest;
|
|
32
39
|
}): [string, ManifestEntry] | null;
|
|
33
40
|
export { DEFAULT_CONFIG_PATH } from "./schemas";
|
|
41
|
+
export type { ManifestEntry, Manifest } from "./schemas";
|
|
34
42
|
export declare const manifestPlugin: Plugin<{}, // no SDK dependencies
|
|
35
43
|
{
|
|
36
44
|
api: ApiClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,QAAQ,EACR,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAgB3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE;QACP,4BAA4B,EAAE,4BAA4B,CAAC;QAC3D,cAAc,EAAE,cAAc,CAAC;QAC/B,mBAAmB,EAAE,CACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,QAAQ,EACR,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAA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AS,CAAA;CAAE,EAClB,sBAAsB,CAgIvB,CAAC"}
|
|
@@ -237,8 +237,11 @@ export const manifestPlugin = (params) => {
|
|
|
237
237
|
return null;
|
|
238
238
|
return `${resolvedApp.implementationName}@${resolvedApp.version || "latest"}`;
|
|
239
239
|
};
|
|
240
|
-
const updateManifestEntry = async (
|
|
241
|
-
const
|
|
240
|
+
const updateManifestEntry = async (options) => {
|
|
241
|
+
const { appKey, entry, configPath = DEFAULT_CONFIG_PATH, skipWrite = false, manifest: inputManifest, } = options;
|
|
242
|
+
// Use provided manifest or read from file
|
|
243
|
+
const manifest = inputManifest ||
|
|
244
|
+
(await readManifestFromFile(configPath)) || { apps: {} };
|
|
242
245
|
// Try to find existing entry by direct key first
|
|
243
246
|
let existingEntry = findManifestEntry({
|
|
244
247
|
appKey,
|
|
@@ -277,11 +280,20 @@ export const manifestPlugin = (params) => {
|
|
|
277
280
|
api,
|
|
278
281
|
});
|
|
279
282
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
const updatedManifest = {
|
|
284
|
+
...manifest,
|
|
285
|
+
apps: {
|
|
286
|
+
...manifest.apps,
|
|
287
|
+
[manifestKey]: entry,
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
// Conditionally write to file
|
|
291
|
+
if (!skipWrite) {
|
|
292
|
+
await writeManifestToFile(updatedManifest, configPath);
|
|
293
|
+
// Clear the cached manifest so it gets reloaded with the new data
|
|
294
|
+
resolvedManifest = undefined;
|
|
295
|
+
}
|
|
296
|
+
return [manifestKey, entry, updatedManifest];
|
|
285
297
|
};
|
|
286
298
|
return {
|
|
287
299
|
context: {
|
|
@@ -379,8 +379,10 @@ describe("manifestPlugin", () => {
|
|
|
379
379
|
const sdk = createTestSdk();
|
|
380
380
|
const context = sdk.getContext();
|
|
381
381
|
// This should now find the existing "SlackCLIAPI" entry
|
|
382
|
-
const [manifestKey] = await context.updateManifestEntry(
|
|
383
|
-
|
|
382
|
+
const [manifestKey] = await context.updateManifestEntry({
|
|
383
|
+
appKey: "slack", // Input is slug
|
|
384
|
+
entry: { implementationName: "SlackCLIAPI", version: "1.30.0" },
|
|
385
|
+
});
|
|
384
386
|
// Should return the existing key, not create a new one
|
|
385
387
|
expect(manifestKey).toBe("SlackCLIAPI");
|
|
386
388
|
});
|
|
@@ -12,7 +12,7 @@ export declare const RelayRequestSchema: z.ZodObject<{
|
|
|
12
12
|
relayBaseUrl: z.ZodOptional<z.ZodString>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
url: string;
|
|
15
|
-
method?: "
|
|
15
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
16
16
|
authenticationId?: number | undefined;
|
|
17
17
|
body?: any;
|
|
18
18
|
callbackUrl?: string | undefined;
|
|
@@ -21,7 +21,7 @@ export declare const RelayRequestSchema: z.ZodObject<{
|
|
|
21
21
|
relayBaseUrl?: string | undefined;
|
|
22
22
|
}, {
|
|
23
23
|
url: string;
|
|
24
|
-
method?: "
|
|
24
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
25
25
|
authenticationId?: number | undefined;
|
|
26
26
|
body?: any;
|
|
27
27
|
callbackUrl?: string | undefined;
|
|
@@ -46,7 +46,7 @@ export declare const RelayFetchSchema: z.ZodObject<{
|
|
|
46
46
|
relayBaseUrl: z.ZodOptional<z.ZodString>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
url: string;
|
|
49
|
-
method?: "
|
|
49
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
50
50
|
authenticationId?: number | undefined;
|
|
51
51
|
body?: any;
|
|
52
52
|
callbackUrl?: string | undefined;
|
|
@@ -55,7 +55,7 @@ export declare const RelayFetchSchema: z.ZodObject<{
|
|
|
55
55
|
relayBaseUrl?: string | undefined;
|
|
56
56
|
}, {
|
|
57
57
|
url: string;
|
|
58
|
-
method?: "
|
|
58
|
+
method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
59
59
|
authenticationId?: number | undefined;
|
|
60
60
|
body?: any;
|
|
61
61
|
callbackUrl?: string | undefined;
|
|
@@ -14,7 +14,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
14
14
|
cursor: z.ZodOptional<z.ZodString>;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
16
|
appKey: string;
|
|
17
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
17
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
18
18
|
actionKey: string;
|
|
19
19
|
authenticationId?: number | null | undefined;
|
|
20
20
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -23,7 +23,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
23
23
|
cursor?: string | undefined;
|
|
24
24
|
}, {
|
|
25
25
|
appKey: string;
|
|
26
|
-
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
26
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
27
27
|
actionKey: string;
|
|
28
28
|
authenticationId?: number | null | undefined;
|
|
29
29
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAwBnB,CAAC"}
|
|
@@ -5,9 +5,8 @@ export const actionTypeResolver = {
|
|
|
5
5
|
const actionsResponse = await sdk.listActions({
|
|
6
6
|
appKey: resolvedParams.appKey,
|
|
7
7
|
});
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
];
|
|
8
|
+
const actionTypes = actionsResponse.data.map((action) => action.action_type);
|
|
9
|
+
const types = [...new Set(actionTypes)];
|
|
11
10
|
return types.map((type) => ({ key: type, name: type }));
|
|
12
11
|
},
|
|
13
12
|
prompt: (types) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,wBA0CtC,CAAC;AAGF,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC"}
|
package/dist/schemas/Action.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const ActionItemSchema: z.ZodObject<Omit<{
|
|
|
20
20
|
description: string;
|
|
21
21
|
title: string;
|
|
22
22
|
app_key: string;
|
|
23
|
-
action_type: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
23
|
+
action_type: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
24
24
|
id?: string | undefined;
|
|
25
25
|
is_important?: boolean | undefined;
|
|
26
26
|
is_hidden?: boolean | undefined;
|
|
@@ -31,7 +31,7 @@ export declare const ActionItemSchema: z.ZodObject<Omit<{
|
|
|
31
31
|
description: string;
|
|
32
32
|
title: string;
|
|
33
33
|
app_key: string;
|
|
34
|
-
action_type: "filter" | "read" | "read_bulk" | "write" | "run" | "
|
|
34
|
+
action_type: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
|
|
35
35
|
id?: string | undefined;
|
|
36
36
|
is_important?: boolean | undefined;
|
|
37
37
|
is_hidden?: boolean | undefined;
|