sst 3.0.1-8 → 3.0.1-9

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.
@@ -1,7 +1,4 @@
1
1
  export interface Resource {
2
2
  [key: string]: any;
3
3
  }
4
- declare global {
5
- export const $SST_LINKS: Resource;
6
- }
7
4
  export declare const Resource: Resource;
package/dist/resource.js CHANGED
@@ -1,8 +1,14 @@
1
- export const Resource = new Proxy($SST_LINKS, {
1
+ const $SST_LINKS = {};
2
+ export const Resource = new Proxy({}, {
2
3
  get(target, prop) {
3
- if (!(prop in target)) {
4
- throw new Error(`"${prop}" is not linked`);
4
+ // Read from environment first
5
+ const envName = `SST_RESOURCE_${prop}`;
6
+ if (process.env[envName]) {
7
+ return JSON.parse(process.env[envName]);
5
8
  }
6
- return target[prop];
9
+ if (prop in $SST_LINKS) {
10
+ return $SST_LINKS[prop];
11
+ }
12
+ throw new Error(`"${prop}" is not linked`);
7
13
  },
8
14
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "sst",
4
4
  "type": "module",
5
- "version": "3.0.1-8",
5
+ "version": "3.0.1-9",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {
8
8
  ".": "./dist/index.js",