@devramps/sdk-typescript 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @devramps/step-sdk
1
+ # @devramps/@devramps/sdk-typescript
2
2
 
3
3
  SDK for building custom deployment steps for DevRamps. Create simple one-shot steps or polling steps for long-running operations, with optional approval workflows.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @devramps/step-sdk
8
+ npm install @devramps/sdk-typescript
9
9
  ```
10
10
 
11
11
  ## Requirements
@@ -20,7 +20,7 @@ npm install @devramps/step-sdk
20
20
  A simple step runs once and returns a result.
21
21
 
22
22
  ```typescript
23
- import { SimpleStep, Step, StepOutputs, StepRegistry } from "@devramps/step-sdk";
23
+ import { SimpleStep, Step, StepOutputs, StepRegistry } from "@devramps/@devramps/sdk-typescript";
24
24
  import { z } from "zod";
25
25
 
26
26
  // Define your input schema
@@ -54,7 +54,7 @@ StepRegistry.run([DeployStep]);
54
54
  A polling step is used for long-running operations that need status checks.
55
55
 
56
56
  ```typescript
57
- import { PollingStep, Step, StepOutputs, StepRegistry } from "@devramps/step-sdk";
57
+ import { PollingStep, Step, StepOutputs, StepRegistry } from "@devramps/@devramps/sdk-typescript";
58
58
  import { z } from "zod";
59
59
 
60
60
  const BuildSchema = z.object({
@@ -109,7 +109,7 @@ Steps can require approval before execution by overriding the `prepare` method.
109
109
  ### Simple Step with Approval
110
110
 
111
111
  ```typescript
112
- import { SimpleStep, Step, StepOutputs, ApprovalContext } from "@devramps/step-sdk";
112
+ import { SimpleStep, Step, StepOutputs, ApprovalContext } from "@devramps/@devramps/sdk-typescript";
113
113
  import { z } from "zod";
114
114
 
115
115
  const DeleteUserSchema = z.object({
@@ -146,7 +146,7 @@ class DeleteUserStep extends SimpleStep<DeleteUserParams> {
146
146
  ### Polling Step with Approval
147
147
 
148
148
  ```typescript
149
- import { PollingStep, Step, StepOutputs, ApprovalContext } from "@devramps/step-sdk";
149
+ import { PollingStep, Step, StepOutputs, ApprovalContext } from "@devramps/@devramps/sdk-typescript";
150
150
  import { z } from "zod";
151
151
 
152
152
  const ProductionDeploySchema = z.object({
@@ -202,7 +202,7 @@ class ProductionDeployStep extends PollingStep<ProductionDeployParams, DeploySta
202
202
  The SDK provides helper functions for creating step outputs:
203
203
 
204
204
  ```typescript
205
- import { StepOutputs } from "@devramps/step-sdk";
205
+ import { StepOutputs } from "@devramps/@devramps/sdk-typescript";
206
206
 
207
207
  // Success with optional data
208
208
  StepOutputs.success();
@@ -247,7 +247,7 @@ The `@Step` decorator adds metadata to your step class:
247
247
  The registry handles CLI argument parsing and step execution:
248
248
 
249
249
  ```typescript
250
- import { StepRegistry } from "@devramps/step-sdk";
250
+ import { StepRegistry } from "@devramps/@devramps/sdk-typescript";
251
251
 
252
252
  // Register all your steps
253
253
  StepRegistry.run([
@@ -372,7 +372,7 @@ import {
372
372
  StepOutputs,
373
373
  StepRegistry,
374
374
  ApprovalContext,
375
- } from "@devramps/step-sdk";
375
+ } from "@devramps/@devramps/sdk-typescript";
376
376
  import { z } from "zod";
377
377
 
378
378
  // Schema definitions
@@ -2,275 +2,103 @@ import z from "zod";
2
2
  export declare const ApprovalContextSchema: z.ZodObject<{
3
3
  approved: z.ZodLiteral<true>;
4
4
  approverId: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- approved: true;
7
- approverId: string;
8
- }, {
9
- approved: true;
10
- approverId: string;
11
- }>;
5
+ }, z.core.$strip>;
12
6
  export type ApprovalContext = z.infer<typeof ApprovalContextSchema>;
13
7
  declare const FailedOutputSchema: z.ZodObject<{
14
8
  status: z.ZodLiteral<"FAILED">;
15
9
  error: z.ZodString;
16
10
  errorCode: z.ZodOptional<z.ZodString>;
17
- }, "strip", z.ZodTypeAny, {
18
- error: string;
19
- status: "FAILED";
20
- errorCode?: string | undefined;
21
- }, {
22
- error: string;
23
- status: "FAILED";
24
- errorCode?: string | undefined;
25
- }>;
11
+ }, z.core.$strip>;
26
12
  declare const SuccessOutputSchema: z.ZodObject<{
27
13
  status: z.ZodLiteral<"SUCCESS">;
28
14
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
29
- }, "strip", z.ZodTypeAny, {
30
- status: "SUCCESS";
31
- data?: Record<string, any> | undefined;
32
- }, {
33
- status: "SUCCESS";
34
- data?: Record<string, any> | undefined;
35
- }>;
15
+ }, z.core.$strip>;
36
16
  export type FailedOutput = z.infer<typeof FailedOutputSchema>;
37
17
  export type SuccessOutput = z.infer<typeof SuccessOutputSchema>;
38
18
  declare const ApprovalRequiredOutputSchema: z.ZodObject<{
39
19
  status: z.ZodLiteral<"APPROVAL_REQUIRED">;
40
20
  approvalRequest: z.ZodObject<{
41
21
  message: z.ZodString;
42
- approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
+ approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
23
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
44
- }, "strip", z.ZodTypeAny, {
45
- message: string;
46
- approvers?: string[] | undefined;
47
- metadata?: Record<string, any> | undefined;
48
- }, {
49
- message: string;
50
- approvers?: string[] | undefined;
51
- metadata?: Record<string, any> | undefined;
52
- }>;
53
- }, "strip", z.ZodTypeAny, {
54
- status: "APPROVAL_REQUIRED";
55
- approvalRequest: {
56
- message: string;
57
- approvers?: string[] | undefined;
58
- metadata?: Record<string, any> | undefined;
59
- };
60
- }, {
61
- status: "APPROVAL_REQUIRED";
62
- approvalRequest: {
63
- message: string;
64
- approvers?: string[] | undefined;
65
- metadata?: Record<string, any> | undefined;
66
- };
67
- }>;
68
- export declare const PrepareOutputSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>;
26
+ export declare const PrepareOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
27
  status: z.ZodLiteral<"APPROVAL_REQUIRED">;
70
28
  approvalRequest: z.ZodObject<{
71
29
  message: z.ZodString;
72
- approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
+ approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
31
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
74
- }, "strip", z.ZodTypeAny, {
75
- message: string;
76
- approvers?: string[] | undefined;
77
- metadata?: Record<string, any> | undefined;
78
- }, {
79
- message: string;
80
- approvers?: string[] | undefined;
81
- metadata?: Record<string, any> | undefined;
82
- }>;
83
- }, "strip", z.ZodTypeAny, {
84
- status: "APPROVAL_REQUIRED";
85
- approvalRequest: {
86
- message: string;
87
- approvers?: string[] | undefined;
88
- metadata?: Record<string, any> | undefined;
89
- };
90
- }, {
91
- status: "APPROVAL_REQUIRED";
92
- approvalRequest: {
93
- message: string;
94
- approvers?: string[] | undefined;
95
- metadata?: Record<string, any> | undefined;
96
- };
97
- }>, z.ZodObject<{
32
+ }, z.core.$strip>;
33
+ }, z.core.$strip>, z.ZodObject<{
98
34
  status: z.ZodLiteral<"FAILED">;
99
35
  error: z.ZodString;
100
36
  errorCode: z.ZodOptional<z.ZodString>;
101
- }, "strip", z.ZodTypeAny, {
102
- error: string;
103
- status: "FAILED";
104
- errorCode?: string | undefined;
105
- }, {
106
- error: string;
107
- status: "FAILED";
108
- errorCode?: string | undefined;
109
- }>]>;
37
+ }, z.core.$strip>], "status">;
110
38
  export type ApprovalRequiredOutput = z.infer<typeof ApprovalRequiredOutputSchema>;
111
39
  export type PrepareOutput = z.infer<typeof PrepareOutputSchema>;
112
- export declare const RunOutputSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
40
+ export declare const RunOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
41
  status: z.ZodLiteral<"SUCCESS">;
114
42
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
115
- }, "strip", z.ZodTypeAny, {
116
- status: "SUCCESS";
117
- data?: Record<string, any> | undefined;
118
- }, {
119
- status: "SUCCESS";
120
- data?: Record<string, any> | undefined;
121
- }>, z.ZodObject<{
43
+ }, z.core.$strip>, z.ZodObject<{
122
44
  status: z.ZodLiteral<"FAILED">;
123
45
  error: z.ZodString;
124
46
  errorCode: z.ZodOptional<z.ZodString>;
125
- }, "strip", z.ZodTypeAny, {
126
- error: string;
127
- status: "FAILED";
128
- errorCode?: string | undefined;
129
- }, {
130
- error: string;
131
- status: "FAILED";
132
- errorCode?: string | undefined;
133
- }>]>;
47
+ }, z.core.$strip>], "status">;
134
48
  export type RunOutput = z.infer<typeof RunOutputSchema>;
135
- export declare const TriggerOutputSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
49
+ export declare const TriggerOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
50
  status: z.ZodLiteral<"TRIGGERED">;
137
51
  pollingState: z.ZodRecord<z.ZodString, z.ZodAny>;
138
- }, "strip", z.ZodTypeAny, {
139
- status: "TRIGGERED";
140
- pollingState: Record<string, any>;
141
- }, {
142
- status: "TRIGGERED";
143
- pollingState: Record<string, any>;
144
- }>, z.ZodObject<{
52
+ }, z.core.$strip>, z.ZodObject<{
145
53
  status: z.ZodLiteral<"FAILED">;
146
54
  error: z.ZodString;
147
55
  errorCode: z.ZodOptional<z.ZodString>;
148
- }, "strip", z.ZodTypeAny, {
149
- error: string;
150
- status: "FAILED";
151
- errorCode?: string | undefined;
152
- }, {
153
- error: string;
154
- status: "FAILED";
155
- errorCode?: string | undefined;
156
- }>]>;
56
+ }, z.core.$strip>], "status">;
157
57
  export type TriggeredOutput<TPollingState = Record<string, unknown>> = {
158
58
  status: "TRIGGERED";
159
59
  pollingState: TPollingState;
160
60
  };
161
61
  export type TriggerOutput<TPollingState = Record<string, unknown>> = TriggeredOutput<TPollingState> | FailedOutput;
162
- export declare const PollOutputSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
62
+ export declare const PollOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
163
63
  status: z.ZodLiteral<"POLL_AGAIN">;
164
64
  pollingState: z.ZodRecord<z.ZodString, z.ZodAny>;
165
65
  retryAfterMs: z.ZodOptional<z.ZodNumber>;
166
- }, "strip", z.ZodTypeAny, {
167
- status: "POLL_AGAIN";
168
- pollingState: Record<string, any>;
169
- retryAfterMs?: number | undefined;
170
- }, {
171
- status: "POLL_AGAIN";
172
- pollingState: Record<string, any>;
173
- retryAfterMs?: number | undefined;
174
- }>, z.ZodObject<{
66
+ }, z.core.$strip>, z.ZodObject<{
175
67
  status: z.ZodLiteral<"SUCCESS">;
176
68
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
177
- }, "strip", z.ZodTypeAny, {
178
- status: "SUCCESS";
179
- data?: Record<string, any> | undefined;
180
- }, {
181
- status: "SUCCESS";
182
- data?: Record<string, any> | undefined;
183
- }>, z.ZodObject<{
69
+ }, z.core.$strip>, z.ZodObject<{
184
70
  status: z.ZodLiteral<"FAILED">;
185
71
  error: z.ZodString;
186
72
  errorCode: z.ZodOptional<z.ZodString>;
187
- }, "strip", z.ZodTypeAny, {
188
- error: string;
189
- status: "FAILED";
190
- errorCode?: string | undefined;
191
- }, {
192
- error: string;
193
- status: "FAILED";
194
- errorCode?: string | undefined;
195
- }>]>;
73
+ }, z.core.$strip>], "status">;
196
74
  export type PollAgainOutput<TPollingState = Record<string, unknown>> = {
197
75
  status: "POLL_AGAIN";
198
76
  pollingState: TPollingState;
199
77
  retryAfterMs?: number;
200
78
  };
201
79
  export type PollOutput<TPollingState = Record<string, unknown>> = PollAgainOutput<TPollingState> | SuccessOutput | FailedOutput;
202
- export declare const StepOutputSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
80
+ export declare const StepOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
203
81
  status: z.ZodLiteral<"SUCCESS">;
204
82
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
205
- }, "strip", z.ZodTypeAny, {
206
- status: "SUCCESS";
207
- data?: Record<string, any> | undefined;
208
- }, {
209
- status: "SUCCESS";
210
- data?: Record<string, any> | undefined;
211
- }>, z.ZodObject<{
83
+ }, z.core.$strip>, z.ZodObject<{
212
84
  status: z.ZodLiteral<"FAILED">;
213
85
  error: z.ZodString;
214
86
  errorCode: z.ZodOptional<z.ZodString>;
215
- }, "strip", z.ZodTypeAny, {
216
- error: string;
217
- status: "FAILED";
218
- errorCode?: string | undefined;
219
- }, {
220
- error: string;
221
- status: "FAILED";
222
- errorCode?: string | undefined;
223
- }>, z.ZodObject<{
87
+ }, z.core.$strip>, z.ZodObject<{
224
88
  status: z.ZodLiteral<"APPROVAL_REQUIRED">;
225
89
  approvalRequest: z.ZodObject<{
226
90
  message: z.ZodString;
227
- approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
91
+ approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
228
92
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
229
- }, "strip", z.ZodTypeAny, {
230
- message: string;
231
- approvers?: string[] | undefined;
232
- metadata?: Record<string, any> | undefined;
233
- }, {
234
- message: string;
235
- approvers?: string[] | undefined;
236
- metadata?: Record<string, any> | undefined;
237
- }>;
238
- }, "strip", z.ZodTypeAny, {
239
- status: "APPROVAL_REQUIRED";
240
- approvalRequest: {
241
- message: string;
242
- approvers?: string[] | undefined;
243
- metadata?: Record<string, any> | undefined;
244
- };
245
- }, {
246
- status: "APPROVAL_REQUIRED";
247
- approvalRequest: {
248
- message: string;
249
- approvers?: string[] | undefined;
250
- metadata?: Record<string, any> | undefined;
251
- };
252
- }>, z.ZodObject<{
93
+ }, z.core.$strip>;
94
+ }, z.core.$strip>, z.ZodObject<{
253
95
  status: z.ZodLiteral<"TRIGGERED">;
254
96
  pollingState: z.ZodRecord<z.ZodString, z.ZodAny>;
255
- }, "strip", z.ZodTypeAny, {
256
- status: "TRIGGERED";
257
- pollingState: Record<string, any>;
258
- }, {
259
- status: "TRIGGERED";
260
- pollingState: Record<string, any>;
261
- }>, z.ZodObject<{
97
+ }, z.core.$strip>, z.ZodObject<{
262
98
  status: z.ZodLiteral<"POLL_AGAIN">;
263
99
  pollingState: z.ZodRecord<z.ZodString, z.ZodAny>;
264
100
  retryAfterMs: z.ZodOptional<z.ZodNumber>;
265
- }, "strip", z.ZodTypeAny, {
266
- status: "POLL_AGAIN";
267
- pollingState: Record<string, any>;
268
- retryAfterMs?: number | undefined;
269
- }, {
270
- status: "POLL_AGAIN";
271
- pollingState: Record<string, any>;
272
- retryAfterMs?: number | undefined;
273
- }>]>;
101
+ }, z.core.$strip>], "status">;
274
102
  export type StepOutput = z.infer<typeof StepOutputSchema>;
275
103
  export declare const StepOutputs: {
276
104
  success(data?: Record<string, unknown>): SuccessOutput;
@@ -1,45 +1,17 @@
1
1
  import z from "zod";
2
2
  import type { StepClass } from "../base/base-step";
3
- export declare const StepRegistryInputSchema: z.ZodDiscriminatedUnion<"job", [z.ZodObject<{
3
+ export declare const StepRegistryInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
4
  job: z.ZodLiteral<"EXECUTE">;
5
5
  type: z.ZodString;
6
6
  params: z.ZodRecord<z.ZodString, z.ZodAny>;
7
7
  approvalContext: z.ZodOptional<z.ZodObject<{
8
8
  approved: z.ZodLiteral<true>;
9
9
  approverId: z.ZodString;
10
- }, "strip", z.ZodTypeAny, {
11
- approved: true;
12
- approverId: string;
13
- }, {
14
- approved: true;
15
- approverId: string;
16
- }>>;
10
+ }, z.core.$strip>>;
17
11
  pollingState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
18
- }, "strip", z.ZodTypeAny, {
19
- params: Record<string, any>;
20
- type: string;
21
- job: "EXECUTE";
22
- pollingState?: Record<string, any> | undefined;
23
- approvalContext?: {
24
- approved: true;
25
- approverId: string;
26
- } | undefined;
27
- }, {
28
- params: Record<string, any>;
29
- type: string;
30
- job: "EXECUTE";
31
- pollingState?: Record<string, any> | undefined;
32
- approvalContext?: {
33
- approved: true;
34
- approverId: string;
35
- } | undefined;
36
- }>, z.ZodObject<{
12
+ }, z.core.$strip>, z.ZodObject<{
37
13
  job: z.ZodLiteral<"SYNTHESIZE-METADATA">;
38
- }, "strip", z.ZodTypeAny, {
39
- job: "SYNTHESIZE-METADATA";
40
- }, {
41
- job: "SYNTHESIZE-METADATA";
42
- }>]>;
14
+ }, z.core.$strip>], "job">;
43
15
  export type StepRegistryInput = z.infer<typeof StepRegistryInputSchema>;
44
16
  export declare class StepRegistry {
45
17
  private steps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devramps/sdk-typescript",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "SDK for building custom deployment steps for DevRamps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -51,20 +51,21 @@
51
51
  "node": ">=18.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "minimist": "^1.2.8",
55
- "zod": "^3.23.8"
54
+ "minimist": "^1.2.8"
56
55
  },
57
56
  "peerDependencies": {
58
- "typescript": ">=5.0.0"
57
+ "typescript": ">=5.0.0",
58
+ "zod": "^4.3.4"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@eslint/js": "^9.17.0",
62
62
  "@types/minimist": "^1.2.5",
63
63
  "@types/node": "^22.10.0",
64
- "@vitest/coverage-v8": "^2.1.0",
64
+ "@vitest/coverage-v8": "^4.0.16",
65
65
  "eslint": "^9.17.0",
66
66
  "typescript": "^5.7.0",
67
67
  "typescript-eslint": "^8.18.0",
68
- "vitest": "^2.1.0"
68
+ "vitest": "^4.0.16",
69
+ "zod": "^4.3.4"
69
70
  }
70
71
  }