sst 3.12.2 → 3.12.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.
@@ -21,17 +21,17 @@ import { z } from "zod";
21
21
  * ```
22
22
  */
23
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>>;
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;
32
+ method: string;
33
+ params: string;
34
+ service: string;
35
35
  }>> | import("opencontrol/tool").Tool<z.ZodObject<{
36
36
  client: z.ZodString;
37
37
  command: z.ZodString;
@@ -91,19 +91,34 @@ export const tools = [
91
91
  */
92
92
  tool({
93
93
  name: "aws",
94
- description: "Make a call to the AWS SDK for JavaScript v2",
94
+ description: `This uses aws sdk v2 in javascript to execute aws commands
95
+ this is roughly how it works
96
+ \`\`\`js
97
+ import aws from "aws-sdk";
98
+ aws[service][method](params)
99
+ \`\`\`
100
+ `,
95
101
  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"),
102
+ service: z
103
+ .string()
104
+ .describe("name of the aws service in the format aws sdk v2 uses, like S3 or EC2"),
105
+ method: z
106
+ .string()
107
+ .describe("name of the aws method in the format aws sdk v2 uses"),
108
+ params: z.string().describe("params for the aws method in json format"),
102
109
  }),
103
110
  async run(input) {
104
- // @ts-ignore
105
- const client = new AWS[input.client]();
106
- return await client[input.command](input.args).promise();
111
+ const aws = await import("aws-sdk");
112
+ /* @ts-expect-error */
113
+ const service = aws.default[input.service];
114
+ if (!service) {
115
+ throw new Error(`service aws[${input.service}] not found`);
116
+ }
117
+ const instance = new service();
118
+ if (!instance[input.method]) {
119
+ throw new Error(`method aws.${input.service}.${input.method} not found`);
120
+ }
121
+ return await instance[input.method](JSON.parse(input.params)).promise();
107
122
  },
108
123
  }),
109
124
  tool({
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.12.2",
6
+ "version": "3.12.5",
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.2",
45
- "sst-linux-x86": "3.12.2",
46
- "sst-linux-arm64": "3.12.2",
47
- "sst-darwin-x64": "3.12.2",
48
- "sst-darwin-arm64": "3.12.2"
44
+ "sst-linux-x64": "3.12.5",
45
+ "sst-linux-x86": "3.12.5",
46
+ "sst-darwin-x64": "3.12.5",
47
+ "sst-linux-arm64": "3.12.5",
48
+ "sst-darwin-arm64": "3.12.5"
49
49
  },
50
50
  "dependencies": {
51
51
  "aws-sdk": "2.1692.0",