@awsless/awsless 0.0.118 → 0.0.119

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.
@@ -0,0 +1,18 @@
1
+ // src/node/resource.ts
2
+ import { paramCase } from "change-case";
3
+ var APP = process.env.APP || "app";
4
+ var STACK = process.env.STACK || "stack";
5
+ var STAGE = process.env.STAGE || "stage";
6
+ var getLocalResourceName = (name, stack = STACK) => {
7
+ return `${APP}-${paramCase(stack)}-${paramCase(name)}`;
8
+ };
9
+ var getGlobalResourceName = (name) => {
10
+ return `${APP}-${paramCase(name)}`;
11
+ };
12
+
13
+ export {
14
+ APP,
15
+ STACK,
16
+ getLocalResourceName,
17
+ getGlobalResourceName
18
+ };
package/dist/index.d.ts CHANGED
@@ -11254,11 +11254,6 @@ interface StoreResources {
11254
11254
  }
11255
11255
  declare const Store: StoreResources;
11256
11256
 
11257
- declare const getConfigName: (name: string) => string;
11258
- interface ConfigResources {
11259
- }
11260
- declare const Config: ConfigResources;
11261
-
11262
11257
  declare const getSearchName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
11263
11258
  interface SearchResources {
11264
11259
  }
@@ -12163,4 +12158,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
12163
12158
  });
12164
12159
  declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
12165
12160
 
12166
- export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, GraphQL, HTTP, HttpFetcher, Plugin, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, createHttpClient, createHttpFetcher, cron, defineAppConfig, definePlugin, defineStackConfig, func, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName, mockFunction, mockQueue, mockTopic, queue, topic };
12161
+ export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, GraphQL, HTTP, HttpFetcher, Plugin, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, createHttpClient, createHttpFetcher, cron, defineAppConfig, definePlugin, defineStackConfig, func, getAuthName, getAuthProps, getCacheProps, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName, mockFunction, mockQueue, mockTopic, queue, topic };
package/dist/index.js CHANGED
@@ -1,18 +1,12 @@
1
1
  import {
2
2
  definePlugin
3
3
  } from "./chunk-PFTL6L4F.js";
4
-
5
- // src/node/resource.ts
6
- import { paramCase } from "change-case";
7
- var APP = process.env.APP || "app";
8
- var STACK = process.env.STACK || "stack";
9
- var STAGE = process.env.STAGE || "stage";
10
- var getLocalResourceName = (name, stack = STACK) => {
11
- return `${APP}-${paramCase(stack)}-${paramCase(name)}`;
12
- };
13
- var getGlobalResourceName = (name) => {
14
- return `${APP}-${paramCase(name)}`;
15
- };
4
+ import {
5
+ APP,
6
+ STACK,
7
+ getGlobalResourceName,
8
+ getLocalResourceName
9
+ } from "./chunk-UB7WT657.js";
16
10
 
17
11
  // src/node/function.ts
18
12
  import { invoke } from "@awsless/lambda";
@@ -197,49 +191,6 @@ var Store = /* @__PURE__ */ createProxy((stack) => {
197
191
  });
198
192
  });
199
193
 
200
- // src/node/config.ts
201
- import { ssm } from "@awsless/ssm";
202
- import { paramCase as paramCase2 } from "change-case";
203
- var getConfigName = (name) => {
204
- return `/.awsless/${APP}/${name}`;
205
- };
206
- var TEST = process.env.NODE_ENV === "test";
207
- var CONFIGS = process.env.CONFIG;
208
- var loadConfigData = /* @__NO_SIDE_EFFECTS__ */ async () => {
209
- if (!TEST && CONFIGS) {
210
- const keys = CONFIGS.split(",");
211
- if (keys.length > 0) {
212
- const paths = {};
213
- for (const key of keys) {
214
- paths[key] = getConfigName(key);
215
- }
216
- return ssm(paths);
217
- }
218
- }
219
- return {};
220
- };
221
- var data = await /* @__PURE__ */ loadConfigData();
222
- var Config = /* @__PURE__ */ new Proxy(
223
- {},
224
- {
225
- get(_, name) {
226
- const key = paramCase2(name);
227
- const value = data[key];
228
- if (typeof value === "undefined") {
229
- throw new Error(
230
- `The "${name}" config value hasn't been set yet. ${TEST ? `Use "Config.${name} = 'VAlUE'" to define your mock value.` : `Define access to the desired config value inside your awsless stack file.`}`
231
- );
232
- }
233
- return value;
234
- },
235
- set(_, name, value) {
236
- const key = paramCase2(name);
237
- data[key] = value;
238
- return true;
239
- }
240
- }
241
- );
242
-
243
194
  // src/node/search.ts
244
195
  var getSearchName = getLocalResourceName;
245
196
  var Search = /* @__PURE__ */ createProxy((stack) => {
@@ -398,7 +349,6 @@ export {
398
349
  APP,
399
350
  Auth,
400
351
  Cache,
401
- Config,
402
352
  Fn,
403
353
  Function,
404
354
  Queue,
@@ -417,7 +367,6 @@ export {
417
367
  getAuthName,
418
368
  getAuthProps,
419
369
  getCacheProps,
420
- getConfigName,
421
370
  getFunctionName,
422
371
  getGlobalResourceName,
423
372
  getLocalResourceName,
@@ -0,0 +1,6 @@
1
+ declare const getConfigName: (name: string) => string;
2
+ interface ConfigResources {
3
+ }
4
+ declare const Config: ConfigResources;
5
+
6
+ export { Config, ConfigResources, getConfigName };
@@ -0,0 +1,50 @@
1
+ import {
2
+ APP
3
+ } from "../chunk-UB7WT657.js";
4
+
5
+ // src/node/config.ts
6
+ import { ssm } from "@awsless/ssm";
7
+ import { paramCase } from "change-case";
8
+ var getConfigName = (name) => {
9
+ return `/.awsless/${APP}/${name}`;
10
+ };
11
+ var TEST = process.env.NODE_ENV === "test";
12
+ var CONFIGS = process.env.CONFIG;
13
+ var loadConfigData = /* @__NO_SIDE_EFFECTS__ */ async () => {
14
+ if (!TEST && CONFIGS) {
15
+ const keys = CONFIGS.split(",");
16
+ if (keys.length > 0) {
17
+ const paths = {};
18
+ for (const key of keys) {
19
+ paths[key] = getConfigName(key);
20
+ }
21
+ return ssm(paths);
22
+ }
23
+ }
24
+ return {};
25
+ };
26
+ var data = await /* @__PURE__ */ loadConfigData();
27
+ var Config = /* @__PURE__ */ new Proxy(
28
+ {},
29
+ {
30
+ get(_, name) {
31
+ const key = paramCase(name);
32
+ const value = data[key];
33
+ if (typeof value === "undefined") {
34
+ throw new Error(
35
+ `The "${name}" config value hasn't been set yet. ${TEST ? `Use "Config.${name} = 'VAlUE'" to define your mock value.` : `Define access to the desired config value inside your awsless stack file.`}`
36
+ );
37
+ }
38
+ return value;
39
+ },
40
+ set(_, name, value) {
41
+ const key = paramCase(name);
42
+ data[key] = value;
43
+ return true;
44
+ }
45
+ }
46
+ );
47
+ export {
48
+ Config,
49
+ getConfigName
50
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.118",
3
+ "version": "0.0.119",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -21,6 +21,10 @@
21
21
  ".": {
22
22
  "import": "./dist/index.js",
23
23
  "types": "./dist/index.d.ts"
24
+ },
25
+ "./config": {
26
+ "import": "./dist/node/config.js",
27
+ "types": "./dist/node/config.d.ts"
24
28
  }
25
29
  },
26
30
  "peerDependencies": {
@@ -85,7 +89,7 @@
85
89
  "test": "pnpm code test",
86
90
  "term": "zsh -c 'node dist/bin.js ${*} --config-file=./test/_data/config.ts' --",
87
91
  "berm": "zsh -c 'pnpm build; pnpm build-features; node dist/bin.js ${*} --config-file=./test/_data/config.ts' --",
88
- "build": "pnpm tsup src/index.ts src/bin.ts --format esm --dts --clean",
92
+ "build": "pnpm tsup src/index.ts src/bin.ts src/node/config.ts --format esm --dts --clean",
89
93
  "build-features": "node ./features/build.js",
90
94
  "prepublish": "if pnpm test schema; then pnpm build; pnpm build-features; else exit; fi"
91
95
  }