@awsless/awsless 0.0.11 → 0.0.12

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/dist/bin.cjs CHANGED
@@ -550,19 +550,22 @@ var rollupBuild = async (input) => {
550
550
  (0, import_plugin_json.default)()
551
551
  ]
552
552
  });
553
- const { output: [output] } = await bundle.generate({
553
+ const result = await bundle.generate({
554
554
  format: "esm",
555
555
  sourcemap: "hidden",
556
556
  exports: "default"
557
557
  });
558
- const hash = (0, import_crypto.createHash)("sha1").update(output.code).digest("hex");
558
+ const output = result.output[0];
559
+ const code = output.code;
560
+ const map = output.map?.toString();
561
+ const hash = (0, import_crypto.createHash)("sha1").update(code).digest("hex");
559
562
  return {
560
563
  handler: "index.default",
561
564
  hash,
562
565
  files: [{
563
566
  name: "index.mjs",
564
- code: output.code,
565
- map: output.map?.toString()
567
+ code,
568
+ map
566
569
  }]
567
570
  };
568
571
  };
package/dist/bin.js CHANGED
@@ -527,19 +527,22 @@ var rollupBuild = async (input) => {
527
527
  json()
528
528
  ]
529
529
  });
530
- const { output: [output] } = await bundle.generate({
530
+ const result = await bundle.generate({
531
531
  format: "esm",
532
532
  sourcemap: "hidden",
533
533
  exports: "default"
534
534
  });
535
- const hash = createHash("sha1").update(output.code).digest("hex");
535
+ const output = result.output[0];
536
+ const code = output.code;
537
+ const map = output.map?.toString();
538
+ const hash = createHash("sha1").update(code).digest("hex");
536
539
  return {
537
540
  handler: "index.default",
538
541
  hash,
539
542
  files: [{
540
543
  name: "index.mjs",
541
- code: output.code,
542
- map: output.map?.toString()
544
+ code,
545
+ map
543
546
  }]
544
547
  };
545
548
  };
package/dist/index.cjs CHANGED
@@ -20,12 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- Queue: () => Queue,
24
- Store: () => Store,
25
- Table: () => Table,
26
23
  definePlugin: () => definePlugin,
24
+ getFunctionName: () => getFunctionName,
25
+ getQueueName: () => getQueueName,
27
26
  getResourceName: () => getResourceName,
28
- getResourceProxy: () => getResourceProxy
27
+ getStoreName: () => getStoreName,
28
+ getTableName: () => getTableName
29
29
  });
30
30
  module.exports = __toCommonJS(src_exports);
31
31
 
@@ -33,30 +33,32 @@ module.exports = __toCommonJS(src_exports);
33
33
  var definePlugin = (plugin) => plugin;
34
34
 
35
35
  // src/node/resource.ts
36
- var getResourceName = (type, id) => {
37
- const key = `RESOURCE_${type.toUpperCase()}_${id}`;
36
+ var getResourceName = (type, id, stack = process.env.STACK || "default") => {
37
+ const key = `RESOURCE_${type.toUpperCase()}_${stack}_${id}`;
38
38
  const value = process.env[key];
39
39
  if (!value) {
40
- throw new TypeError(`Resource type: "${type}" id: "${id}" doesn't exist.`);
40
+ throw new TypeError(`Resource type: "${type}" stack: "${stack}" id: "${id}" doesn't exist.`);
41
41
  }
42
42
  return value;
43
43
  };
44
- var getResourceProxy = (type) => {
45
- return new Proxy({}, {
46
- get(_, id) {
47
- return getResourceName(type, id);
48
- }
49
- });
44
+ var getFunctionName = (id, stack) => {
45
+ return getResourceName("function", id, stack);
46
+ };
47
+ var getTableName = (id, stack) => {
48
+ return getResourceName("table", id, stack);
49
+ };
50
+ var getQueueName = (id, stack) => {
51
+ return getResourceName("queue", id, stack);
52
+ };
53
+ var getStoreName = (id, stack) => {
54
+ return getResourceName("store", id, stack);
50
55
  };
51
- var Table = /* @__PURE__ */ getResourceProxy("TABLE");
52
- var Queue = /* @__PURE__ */ getResourceProxy("QUEUE");
53
- var Store = /* @__PURE__ */ getResourceProxy("STORE");
54
56
  // Annotate the CommonJS export names for ESM import in node:
55
57
  0 && (module.exports = {
56
- Queue,
57
- Store,
58
- Table,
59
58
  definePlugin,
59
+ getFunctionName,
60
+ getQueueName,
60
61
  getResourceName,
61
- getResourceProxy
62
+ getStoreName,
63
+ getTableName
62
64
  });
package/dist/index.d.ts CHANGED
@@ -1361,13 +1361,13 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
1361
1361
  }>>)[];
1362
1362
  type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<typeof defaultPlugins[number]['schema']>;
1363
1363
 
1364
- declare const getResourceName: (type: string, id: string) => string;
1365
- declare const getResourceProxy: (type: string) => {};
1366
- declare const Table: {};
1367
- declare const Queue: {};
1368
- declare const Store: {};
1364
+ declare const getResourceName: (type: string, id: string, stack?: string) => string;
1365
+ declare const getFunctionName: (id: string, stack?: string) => string;
1366
+ declare const getTableName: (id: string, stack?: string) => string;
1367
+ declare const getQueueName: (id: string, stack?: string) => string;
1368
+ declare const getStoreName: (id: string, stack?: string) => string;
1369
1369
 
1370
1370
  type AppConfig = CombinedDefaultPluginsConfigInput;
1371
1371
  type StackConfig = CombinedDefaultPluginsConfigInput['stacks'][number];
1372
1372
 
1373
- export { AppConfig, Plugin, Queue, StackConfig, Store, Table, definePlugin, getResourceName, getResourceProxy };
1373
+ export { AppConfig, Plugin, StackConfig, definePlugin, getFunctionName, getQueueName, getResourceName, getStoreName, getTableName };
package/dist/index.js CHANGED
@@ -3,29 +3,31 @@ import {
3
3
  } from "./chunk-PFTL6L4F.js";
4
4
 
5
5
  // src/node/resource.ts
6
- var getResourceName = (type, id) => {
7
- const key = `RESOURCE_${type.toUpperCase()}_${id}`;
6
+ var getResourceName = (type, id, stack = process.env.STACK || "default") => {
7
+ const key = `RESOURCE_${type.toUpperCase()}_${stack}_${id}`;
8
8
  const value = process.env[key];
9
9
  if (!value) {
10
- throw new TypeError(`Resource type: "${type}" id: "${id}" doesn't exist.`);
10
+ throw new TypeError(`Resource type: "${type}" stack: "${stack}" id: "${id}" doesn't exist.`);
11
11
  }
12
12
  return value;
13
13
  };
14
- var getResourceProxy = (type) => {
15
- return new Proxy({}, {
16
- get(_, id) {
17
- return getResourceName(type, id);
18
- }
19
- });
14
+ var getFunctionName = (id, stack) => {
15
+ return getResourceName("function", id, stack);
16
+ };
17
+ var getTableName = (id, stack) => {
18
+ return getResourceName("table", id, stack);
19
+ };
20
+ var getQueueName = (id, stack) => {
21
+ return getResourceName("queue", id, stack);
22
+ };
23
+ var getStoreName = (id, stack) => {
24
+ return getResourceName("store", id, stack);
20
25
  };
21
- var Table = /* @__PURE__ */ getResourceProxy("TABLE");
22
- var Queue = /* @__PURE__ */ getResourceProxy("QUEUE");
23
- var Store = /* @__PURE__ */ getResourceProxy("STORE");
24
26
  export {
25
- Queue,
26
- Store,
27
- Table,
28
27
  definePlugin,
28
+ getFunctionName,
29
+ getQueueName,
29
30
  getResourceName,
30
- getResourceProxy
31
+ getStoreName,
32
+ getTableName
31
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {