sst 3.0.3 → 3.0.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.
@@ -2,4 +2,5 @@ export interface Resource {
2
2
  [key: string]: any;
3
3
  }
4
4
  export declare function fromCloudflareEnv(input: any): void;
5
+ export declare function wrapCloudflareHandler(handler: any): any;
5
6
  export declare const Resource: Resource;
package/dist/resource.js CHANGED
@@ -13,6 +13,19 @@ export function fromCloudflareEnv(input) {
13
13
  raw[key] = value;
14
14
  }
15
15
  }
16
+ export function wrapCloudflareHandler(handler) {
17
+ function wrap(fn) {
18
+ return function (req, env, ...rest) {
19
+ fromCloudflareEnv(env);
20
+ return fn(req, env, ...rest);
21
+ };
22
+ }
23
+ const result = {};
24
+ for (const [key, value] of Object.entries(handler)) {
25
+ result[key] = wrap(value);
26
+ }
27
+ return result;
28
+ }
16
29
  export const Resource = new Proxy(raw, {
17
30
  get(_target, prop) {
18
31
  if (prop in raw) {
package/package.json CHANGED
@@ -3,11 +3,14 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.0.3",
6
+ "version": "3.0.5",
7
7
  "main": "./dist/index.js",
8
8
  "exports": {
9
9
  ".": "./dist/index.js",
10
- "./*": "./dist/*.js"
10
+ "./*": [
11
+ "./dist/*/index.js",
12
+ "./dist/*.js"
13
+ ]
11
14
  },
12
15
  "devDependencies": {
13
16
  "@tsconfig/node18": "^18.2.2",