@zapier/zapier-sdk-cli 0.13.5 → 0.13.7

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +39 -0
  3. package/dist/cli.cjs +360 -82
  4. package/dist/cli.mjs +356 -78
  5. package/dist/index.cjs +359 -81
  6. package/dist/index.d.mts +155 -3
  7. package/dist/index.d.ts +155 -3
  8. package/dist/index.mjs +355 -77
  9. package/dist/package.json +1 -1
  10. package/dist/src/plugins/add/index.d.ts +4 -2
  11. package/dist/src/plugins/add/index.js +89 -98
  12. package/dist/src/plugins/buildManifest/index.d.ts +13 -0
  13. package/dist/src/plugins/buildManifest/index.js +81 -0
  14. package/dist/src/plugins/buildManifest/schemas.d.ts +56 -0
  15. package/dist/src/plugins/buildManifest/schemas.js +17 -0
  16. package/dist/src/plugins/generateAppTypes/index.d.ts +13 -0
  17. package/dist/src/plugins/generateAppTypes/index.js +169 -0
  18. package/dist/src/plugins/generateAppTypes/schemas.d.ts +72 -0
  19. package/dist/src/plugins/generateAppTypes/schemas.js +21 -0
  20. package/dist/src/plugins/index.d.ts +2 -0
  21. package/dist/src/plugins/index.js +2 -0
  22. package/dist/src/sdk.d.ts +4 -3
  23. package/dist/src/sdk.js +16 -14
  24. package/dist/src/types/sdk.d.ts +5 -0
  25. package/dist/src/types/sdk.js +1 -0
  26. package/dist/src/utils/constants.d.ts +1 -3
  27. package/dist/src/utils/constants.js +3 -4
  28. package/dist/src/utils/directory-detection.d.ts +5 -0
  29. package/dist/src/utils/directory-detection.js +21 -0
  30. package/dist/src/utils/manifest-helpers.d.ts +10 -0
  31. package/dist/src/utils/manifest-helpers.js +19 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +4 -4
  34. package/src/plugins/add/index.ts +123 -125
  35. package/src/plugins/buildManifest/index.test.ts +612 -0
  36. package/src/plugins/buildManifest/index.ts +128 -0
  37. package/src/plugins/buildManifest/schemas.ts +59 -0
  38. package/src/plugins/generateAppTypes/index.ts +235 -0
  39. package/src/plugins/generateAppTypes/schemas.ts +65 -0
  40. package/src/plugins/index.ts +2 -0
  41. package/src/sdk.ts +25 -21
  42. package/src/types/sdk.ts +8 -0
  43. package/src/utils/constants.ts +7 -6
  44. package/src/utils/directory-detection.ts +23 -0
  45. package/src/utils/manifest-helpers.ts +25 -0
  46. /package/dist/src/{plugins/add → generators}/ast-generator.d.ts +0 -0
  47. /package/dist/src/{plugins/add → generators}/ast-generator.js +0 -0
  48. /package/src/{plugins/add → generators}/ast-generator.ts +0 -0
package/dist/index.d.mts CHANGED
@@ -1,6 +1,158 @@
1
- import { ZapierSdk, BaseEvent } from '@zapier/zapier-sdk';
1
+ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
+ import { z } from 'zod';
2
3
 
3
- interface ZapierCliSdkOptions {
4
+ declare const BuildManifestSchema: z.ZodObject<{
5
+ appKeys: z.ZodArray<z.ZodString, "many">;
6
+ skipWrite: z.ZodOptional<z.ZodBoolean>;
7
+ configPath: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ appKeys: string[];
10
+ configPath?: string | undefined;
11
+ skipWrite?: boolean | undefined;
12
+ }, {
13
+ appKeys: string[];
14
+ configPath?: string | undefined;
15
+ skipWrite?: boolean | undefined;
16
+ }>;
17
+ type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
18
+ onProgress?: (event: ManifestBuildProgressEvent) => void;
19
+ };
20
+ type ManifestBuildProgressEvent = {
21
+ type: "apps_lookup_start";
22
+ count: number;
23
+ } | {
24
+ type: "app_found";
25
+ app: AppItem;
26
+ } | {
27
+ type: "apps_lookup_complete";
28
+ count: number;
29
+ } | {
30
+ type: "app_processing_start";
31
+ appKey: string;
32
+ slug?: string;
33
+ } | {
34
+ type: "manifest_entry_built";
35
+ appKey: string;
36
+ manifestKey: string;
37
+ version: string;
38
+ } | {
39
+ type: "manifest_updated";
40
+ appKey: string;
41
+ manifestKey: string;
42
+ version: string;
43
+ } | {
44
+ type: "app_processing_complete";
45
+ appKey: string;
46
+ } | {
47
+ type: "app_processing_error";
48
+ appKey: string;
49
+ error: string;
50
+ };
51
+ interface BuildManifestResult {
52
+ manifest?: Manifest;
53
+ errors: Array<{
54
+ appKey: string;
55
+ error: string;
56
+ }>;
57
+ }
58
+
59
+ interface BuildManifestPluginProvides {
60
+ buildManifest: (options: BuildManifestOptions) => Promise<BuildManifestResult>;
61
+ context: {
62
+ meta: {
63
+ buildManifest: {
64
+ inputSchema: typeof BuildManifestSchema;
65
+ };
66
+ };
67
+ };
68
+ }
69
+
70
+ declare const GenerateAppTypesSchema: z.ZodObject<{
71
+ appKeys: z.ZodArray<z.ZodString, "many">;
72
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
73
+ skipWrite: z.ZodOptional<z.ZodBoolean>;
74
+ typesOutputDirectory: z.ZodOptional<z.ZodString>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ appKeys: string[];
77
+ authenticationIds?: string[] | undefined;
78
+ skipWrite?: boolean | undefined;
79
+ typesOutputDirectory?: string | undefined;
80
+ }, {
81
+ appKeys: string[];
82
+ authenticationIds?: string[] | undefined;
83
+ skipWrite?: boolean | undefined;
84
+ typesOutputDirectory?: string | undefined;
85
+ }>;
86
+ type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
87
+ onProgress?: (event: AppTypesProgressEvent) => void;
88
+ };
89
+ type AppTypesProgressEvent = {
90
+ type: "apps_lookup_start";
91
+ count: number;
92
+ } | {
93
+ type: "app_found";
94
+ app: AppItem;
95
+ } | {
96
+ type: "apps_lookup_complete";
97
+ count: number;
98
+ } | {
99
+ type: "authentications_lookup_start";
100
+ count: number;
101
+ } | {
102
+ type: "authentications_lookup_complete";
103
+ count: number;
104
+ } | {
105
+ type: "app_processing_start";
106
+ appKey: string;
107
+ slug?: string;
108
+ } | {
109
+ type: "authentication_matched";
110
+ appKey: string;
111
+ authenticationId: number;
112
+ authenticationTitle: string;
113
+ } | {
114
+ type: "authentication_not_matched";
115
+ appKey: string;
116
+ } | {
117
+ type: "type_generated";
118
+ manifestKey: string;
119
+ sizeBytes: number;
120
+ } | {
121
+ type: "file_written";
122
+ manifestKey: string;
123
+ filePath: string;
124
+ } | {
125
+ type: "app_processing_complete";
126
+ appKey: string;
127
+ } | {
128
+ type: "app_processing_error";
129
+ appKey: string;
130
+ error: string;
131
+ };
132
+ interface GenerateAppTypesResult {
133
+ typeDefinitions: Record<string, string>;
134
+ writtenFiles?: Record<string, string>;
135
+ errors: Array<{
136
+ appKey: string;
137
+ error: string;
138
+ }>;
139
+ }
140
+
141
+ interface GenerateAppTypesPluginProvides {
142
+ generateAppTypes: (options: GenerateAppTypesOptions) => Promise<GenerateAppTypesResult>;
143
+ context: {
144
+ meta: {
145
+ generateAppTypes: {
146
+ inputSchema: typeof GenerateAppTypesSchema;
147
+ };
148
+ };
149
+ };
150
+ }
151
+
152
+ interface ZapierSdkCli extends GetSdkType<ZapierSdk & BuildManifestPluginProvides & GenerateAppTypesPluginProvides> {
153
+ }
154
+
155
+ interface ZapierCliSdkOptions extends ZapierSdkOptions {
4
156
  debug?: boolean;
5
157
  eventEmission?: {
6
158
  enabled?: boolean;
@@ -15,7 +167,7 @@ interface ZapierCliSdkOptions {
15
167
  * Create a Zapier SDK instance configured specifically for the CLI
16
168
  * Includes all CLI-specific plugins in addition to the standard SDK functionality
17
169
  */
18
- declare function createZapierCliSdk(options?: ZapierCliSdkOptions): ZapierSdk;
170
+ declare function createZapierCliSdk(options?: ZapierCliSdkOptions): ZapierSdkCli;
19
171
 
20
172
  /**
21
173
  * CLI-specific telemetry event definitions
package/dist/index.d.ts CHANGED
@@ -1,6 +1,158 @@
1
- import { ZapierSdk, BaseEvent } from '@zapier/zapier-sdk';
1
+ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
+ import { z } from 'zod';
2
3
 
3
- interface ZapierCliSdkOptions {
4
+ declare const BuildManifestSchema: z.ZodObject<{
5
+ appKeys: z.ZodArray<z.ZodString, "many">;
6
+ skipWrite: z.ZodOptional<z.ZodBoolean>;
7
+ configPath: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ appKeys: string[];
10
+ configPath?: string | undefined;
11
+ skipWrite?: boolean | undefined;
12
+ }, {
13
+ appKeys: string[];
14
+ configPath?: string | undefined;
15
+ skipWrite?: boolean | undefined;
16
+ }>;
17
+ type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
18
+ onProgress?: (event: ManifestBuildProgressEvent) => void;
19
+ };
20
+ type ManifestBuildProgressEvent = {
21
+ type: "apps_lookup_start";
22
+ count: number;
23
+ } | {
24
+ type: "app_found";
25
+ app: AppItem;
26
+ } | {
27
+ type: "apps_lookup_complete";
28
+ count: number;
29
+ } | {
30
+ type: "app_processing_start";
31
+ appKey: string;
32
+ slug?: string;
33
+ } | {
34
+ type: "manifest_entry_built";
35
+ appKey: string;
36
+ manifestKey: string;
37
+ version: string;
38
+ } | {
39
+ type: "manifest_updated";
40
+ appKey: string;
41
+ manifestKey: string;
42
+ version: string;
43
+ } | {
44
+ type: "app_processing_complete";
45
+ appKey: string;
46
+ } | {
47
+ type: "app_processing_error";
48
+ appKey: string;
49
+ error: string;
50
+ };
51
+ interface BuildManifestResult {
52
+ manifest?: Manifest;
53
+ errors: Array<{
54
+ appKey: string;
55
+ error: string;
56
+ }>;
57
+ }
58
+
59
+ interface BuildManifestPluginProvides {
60
+ buildManifest: (options: BuildManifestOptions) => Promise<BuildManifestResult>;
61
+ context: {
62
+ meta: {
63
+ buildManifest: {
64
+ inputSchema: typeof BuildManifestSchema;
65
+ };
66
+ };
67
+ };
68
+ }
69
+
70
+ declare const GenerateAppTypesSchema: z.ZodObject<{
71
+ appKeys: z.ZodArray<z.ZodString, "many">;
72
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
73
+ skipWrite: z.ZodOptional<z.ZodBoolean>;
74
+ typesOutputDirectory: z.ZodOptional<z.ZodString>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ appKeys: string[];
77
+ authenticationIds?: string[] | undefined;
78
+ skipWrite?: boolean | undefined;
79
+ typesOutputDirectory?: string | undefined;
80
+ }, {
81
+ appKeys: string[];
82
+ authenticationIds?: string[] | undefined;
83
+ skipWrite?: boolean | undefined;
84
+ typesOutputDirectory?: string | undefined;
85
+ }>;
86
+ type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
87
+ onProgress?: (event: AppTypesProgressEvent) => void;
88
+ };
89
+ type AppTypesProgressEvent = {
90
+ type: "apps_lookup_start";
91
+ count: number;
92
+ } | {
93
+ type: "app_found";
94
+ app: AppItem;
95
+ } | {
96
+ type: "apps_lookup_complete";
97
+ count: number;
98
+ } | {
99
+ type: "authentications_lookup_start";
100
+ count: number;
101
+ } | {
102
+ type: "authentications_lookup_complete";
103
+ count: number;
104
+ } | {
105
+ type: "app_processing_start";
106
+ appKey: string;
107
+ slug?: string;
108
+ } | {
109
+ type: "authentication_matched";
110
+ appKey: string;
111
+ authenticationId: number;
112
+ authenticationTitle: string;
113
+ } | {
114
+ type: "authentication_not_matched";
115
+ appKey: string;
116
+ } | {
117
+ type: "type_generated";
118
+ manifestKey: string;
119
+ sizeBytes: number;
120
+ } | {
121
+ type: "file_written";
122
+ manifestKey: string;
123
+ filePath: string;
124
+ } | {
125
+ type: "app_processing_complete";
126
+ appKey: string;
127
+ } | {
128
+ type: "app_processing_error";
129
+ appKey: string;
130
+ error: string;
131
+ };
132
+ interface GenerateAppTypesResult {
133
+ typeDefinitions: Record<string, string>;
134
+ writtenFiles?: Record<string, string>;
135
+ errors: Array<{
136
+ appKey: string;
137
+ error: string;
138
+ }>;
139
+ }
140
+
141
+ interface GenerateAppTypesPluginProvides {
142
+ generateAppTypes: (options: GenerateAppTypesOptions) => Promise<GenerateAppTypesResult>;
143
+ context: {
144
+ meta: {
145
+ generateAppTypes: {
146
+ inputSchema: typeof GenerateAppTypesSchema;
147
+ };
148
+ };
149
+ };
150
+ }
151
+
152
+ interface ZapierSdkCli extends GetSdkType<ZapierSdk & BuildManifestPluginProvides & GenerateAppTypesPluginProvides> {
153
+ }
154
+
155
+ interface ZapierCliSdkOptions extends ZapierSdkOptions {
4
156
  debug?: boolean;
5
157
  eventEmission?: {
6
158
  enabled?: boolean;
@@ -15,7 +167,7 @@ interface ZapierCliSdkOptions {
15
167
  * Create a Zapier SDK instance configured specifically for the CLI
16
168
  * Includes all CLI-specific plugins in addition to the standard SDK functionality
17
169
  */
18
- declare function createZapierCliSdk(options?: ZapierCliSdkOptions): ZapierSdk;
170
+ declare function createZapierCliSdk(options?: ZapierCliSdkOptions): ZapierSdkCli;
19
171
 
20
172
  /**
21
173
  * CLI-specific telemetry event definitions