sst 3.12.3 → 3.12.6

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.
@@ -20,28 +20,16 @@ import { z } from "zod";
20
20
  * });
21
21
  * ```
22
22
  */
23
- export declare const tools: (import("opencontrol/tool").Tool<z.ZodObject<{
24
- client: z.ZodString;
25
- command: z.ZodString;
26
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
+ export declare const tools: import("opencontrol/tool").Tool<z.ZodObject<{
24
+ service: z.ZodString;
25
+ method: z.ZodString;
26
+ params: z.ZodString;
27
27
  }, "strip", z.ZodTypeAny, {
28
- client: string;
29
- command: string;
30
- args?: Record<string, any> | undefined;
28
+ method: string;
29
+ params: string;
30
+ service: string;
31
31
  }, {
32
- client: string;
33
- command: string;
34
- args?: Record<string, any> | undefined;
35
- }>> | import("opencontrol/tool").Tool<z.ZodObject<{
36
- client: z.ZodString;
37
- command: z.ZodString;
38
- args: z.ZodArray<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, "many">;
39
- }, "strip", z.ZodTypeAny, {
40
- client: string;
41
- command: string;
42
- args: (Record<string, any> | undefined)[];
43
- }, {
44
- client: string;
45
- command: string;
46
- args: (Record<string, any> | undefined)[];
47
- }>>)[];
32
+ method: string;
33
+ params: string;
34
+ service: string;
35
+ }>>[];
@@ -1,6 +1,5 @@
1
1
  import { tool } from "opencontrol/tool";
2
2
  import { z } from "zod";
3
- import AWS from "aws-sdk";
4
3
  /**
5
4
  * A list of OpenControl tools provided by SST. Currently, it includes tools that
6
5
  * can:
@@ -91,38 +90,62 @@ export const tools = [
91
90
  */
92
91
  tool({
93
92
  name: "aws",
94
- description: "Make a call to the AWS SDK for JavaScript v2",
93
+ description: `This uses aws sdk v2 in javascript to execute aws commands
94
+ this is roughly how it works
95
+ \`\`\`js
96
+ import aws from "aws-sdk";
97
+ aws[service][method](params)
98
+ \`\`\`
99
+ `,
95
100
  args: z.object({
96
- client: z.string().describe("Class name of the client to use"),
97
- command: z.string().describe("Command to call on the client"),
98
- args: z
99
- .record(z.string(), z.any())
100
- .optional()
101
- .describe("Arguments to pass to the command"),
101
+ service: z
102
+ .string()
103
+ .describe("name of the aws service in the format aws sdk v2 uses, like S3 or EC2"),
104
+ method: z
105
+ .string()
106
+ .describe("name of the aws method in the format aws sdk v2 uses"),
107
+ params: z.string().describe("params for the aws method in json format"),
102
108
  }),
103
109
  async run(input) {
104
- // @ts-ignore
105
- const client = new AWS[input.client]();
106
- return await client[input.command](input.args).promise();
110
+ const aws = await import("aws-sdk");
111
+ /* @ts-expect-error */
112
+ const service = aws.default[input.service];
113
+ if (!service) {
114
+ throw new Error(`service aws[${input.service}] not found`);
115
+ }
116
+ const instance = new service();
117
+ if (!instance[input.method]) {
118
+ throw new Error(`method aws.${input.service}.${input.method} not found`);
119
+ }
120
+ return await instance[input.method](JSON.parse(input.params)).promise();
107
121
  },
108
122
  }),
123
+ /*
109
124
  tool({
110
- name: "aws_batch",
111
- description: "Make multiple calls to the AWS SDK for JavaScript v2 with the same command but different arguments. This tools takes an array of arguments, and will call the command with each argument in the array in parallel. Use this over the aws tool when you need to call the same command multiple times with different arguments.",
112
- args: z.object({
113
- client: z.string().describe("Class name of the client to use"),
114
- command: z.string().describe("Command to call on the client"),
115
- args: z
116
- .array(z
117
- .record(z.string(), z.any())
118
- .optional()
119
- .describe("Arguments to pass to the command"))
120
- .describe("An array of arguments. Each argument will be passed to the command in parallel."),
121
- }),
122
- async run(input) {
123
- // @ts-ignore
124
- const client = new AWS[input.client]();
125
- return await Promise.all(input.args.map((arg) => client[input.command](arg).promise()));
126
- },
125
+ name: "aws_batch",
126
+ description:
127
+ "Make multiple calls to the AWS SDK for JavaScript v2 with the same command but different arguments. This tools takes an array of arguments, and will call the command with each argument in the array in parallel. Use this over the aws tool when you need to call the same command multiple times with different arguments.",
128
+ args: z.object({
129
+ client: z.string().describe("Class name of the client to use"),
130
+ command: z.string().describe("Command to call on the client"),
131
+ args: z
132
+ .array(
133
+ z
134
+ .record(z.string(), z.any())
135
+ .optional()
136
+ .describe("Arguments to pass to the command"),
137
+ )
138
+ .describe(
139
+ "An array of arguments. Each argument will be passed to the command in parallel.",
140
+ ),
141
+ }),
142
+ async run(input) {
143
+ // @ts-ignore
144
+ const client = new AWS[input.client]();
145
+ return await Promise.all(
146
+ input.args.map((arg: any) => client[input.command](arg).promise()),
147
+ );
148
+ },
127
149
  }),
150
+ */
128
151
  ];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.12.3",
6
+ "version": "3.12.6",
7
7
  "main": "./dist/index.js",
8
8
  "repository": {
9
9
  "type": "git",
@@ -41,11 +41,11 @@
41
41
  "sst": "./bin/sst.mjs"
42
42
  },
43
43
  "optionalDependencies": {
44
- "sst-linux-x64": "3.12.3",
45
- "sst-linux-x86": "3.12.3",
46
- "sst-linux-arm64": "3.12.3",
47
- "sst-darwin-x64": "3.12.3",
48
- "sst-darwin-arm64": "3.12.3"
44
+ "sst-linux-x64": "3.12.6",
45
+ "sst-linux-x86": "3.12.6",
46
+ "sst-linux-arm64": "3.12.6",
47
+ "sst-darwin-x64": "3.12.6",
48
+ "sst-darwin-arm64": "3.12.6"
49
49
  },
50
50
  "dependencies": {
51
51
  "aws-sdk": "2.1692.0",