@awsless/awsless 0.0.34 → 0.0.36

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/index.d.ts CHANGED
@@ -2470,28 +2470,36 @@ type Plugin<S extends AnyZodObject | undefined = undefined> = {
2470
2470
  };
2471
2471
  declare const definePlugin: <S extends AnyZodObject | undefined = undefined>(plugin: Plugin<S>) => Plugin<S>;
2472
2472
 
2473
- declare const getLocalResourceName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--${N}`;
2474
- declare const getGlobalResourceName: <N extends string>(name: N) => `app--${N}`;
2475
- declare const getSearchName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--${N}`;
2476
- declare const getStoreName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--${N}`;
2477
- declare const getQueueName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--${N}`;
2478
- declare const getTopicName: <N extends string>(name: N) => `app--${N}`;
2473
+ declare const getLocalResourceName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
2474
+ declare const getGlobalResourceName: <N extends string>(name: N) => `app-${N}`;
2475
+ declare const getSearchName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
2476
+ declare const getStoreName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
2479
2477
  declare const getSecretName: (name: string) => string;
2480
2478
  declare const getCacheProps: (name: string, stack?: "stack") => {
2481
2479
  readonly host: string;
2482
2480
  readonly port: number;
2483
2481
  };
2484
2482
 
2485
- declare const getFunctionName: <S extends string, N extends string>(stack: S, name: N) => `app--${S}--${N}`;
2483
+ declare const getFunctionName: <S extends string, N extends string>(stack: S, name: N) => `app-${S}-${N}`;
2486
2484
  interface FunctionResources {
2487
2485
  }
2488
2486
  declare const Function: FunctionResources;
2489
2487
 
2490
- declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--${N}`;
2488
+ declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
2491
2489
  interface TableResources {
2492
2490
  }
2493
2491
  declare const Table: TableResources;
2494
2492
 
2493
+ declare const getTopicName: <N extends string>(name: N) => `app-${N}`;
2494
+ interface TopicResources {
2495
+ }
2496
+ declare const Topic: {};
2497
+
2498
+ declare const getQueueName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
2499
+ interface QueueResources {
2500
+ }
2501
+ declare const Queue: {};
2502
+
2495
2503
  type AppConfig = CombinedDefaultPluginsConfigInput;
2496
2504
  type StackConfig = CombinedDefaultPluginsConfigInput['stacks'][number];
2497
2505
  declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (StackConfig$1 & {
@@ -2710,4 +2718,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
2710
2718
  });
2711
2719
  declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
2712
2720
 
2713
- export { AppConfig, Function, FunctionResources, Plugin, StackConfig, Table, defineAppConfig, definePlugin, defineStackConfig, getCacheProps, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getSecretName, getStoreName, getTableName, getTopicName };
2721
+ export { AppConfig, Function, FunctionResources, Plugin, Queue, QueueResources, StackConfig, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getCacheProps, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getSecretName, getStoreName, getTableName, getTopicName };
package/dist/index.js CHANGED
@@ -7,15 +7,13 @@ import { paramCase } from "change-case";
7
7
  var APP = process.env.APP || "app";
8
8
  var STACK = process.env.STACK || "stack";
9
9
  var getLocalResourceName = (name, stack = STACK) => {
10
- return `${APP}--${paramCase(stack)}--${paramCase(name)}`;
10
+ return `${APP}-${paramCase(stack)}-${paramCase(name)}`;
11
11
  };
12
12
  var getGlobalResourceName = (name) => {
13
- return `${APP}--${paramCase(name)}`;
13
+ return `${APP}-${paramCase(name)}`;
14
14
  };
15
15
  var getSearchName = getLocalResourceName;
16
16
  var getStoreName = getLocalResourceName;
17
- var getQueueName = getLocalResourceName;
18
- var getTopicName = getGlobalResourceName;
19
17
  var getSecretName = (name) => {
20
18
  return `/.awsless/${APP}/${name}`;
21
19
  };
@@ -47,14 +45,26 @@ var createProxy = (cb) => {
47
45
  var getFunctionName = (stack, name) => {
48
46
  return getLocalResourceName(name, stack);
49
47
  };
50
- var Function = createProxy((stack) => {
51
- return createProxy((name) => {
52
- return (event, options = {}) => {
53
- return invoke({
54
- ...options,
55
- name: getFunctionName(stack, name),
56
- payload: event
57
- });
48
+ var Function = createProxy((stackName) => {
49
+ return createProxy((funcName) => {
50
+ const name = getFunctionName(stackName, funcName);
51
+ return {
52
+ name,
53
+ invoke(payload, options = {}) {
54
+ return invoke({
55
+ ...options,
56
+ name,
57
+ payload
58
+ });
59
+ },
60
+ async(payload, options = {}) {
61
+ return invoke({
62
+ ...options,
63
+ name,
64
+ payload,
65
+ type: "Event"
66
+ });
67
+ }
58
68
  };
59
69
  });
60
70
  });
@@ -63,7 +73,33 @@ var Function = createProxy((stack) => {
63
73
  var getTableName = getLocalResourceName;
64
74
  var Table = createProxy((stack) => {
65
75
  return createProxy((name) => {
66
- return getTableName(name, stack);
76
+ return {
77
+ name: getTableName(name, stack)
78
+ };
79
+ });
80
+ });
81
+
82
+ // src/node/topic.ts
83
+ var getTopicName = getGlobalResourceName;
84
+ var Topic = createProxy((topic) => {
85
+ const name = getTopicName(topic);
86
+ return {
87
+ name
88
+ // publish(payload:unknown) {
89
+ // }
90
+ };
91
+ });
92
+
93
+ // src/node/queue.ts
94
+ var getQueueName = getLocalResourceName;
95
+ var Queue = createProxy((stack) => {
96
+ return createProxy((queue) => {
97
+ const name = getQueueName(queue, stack);
98
+ return {
99
+ name
100
+ // sendMessage(payload:unknown) {
101
+ // }
102
+ };
67
103
  });
68
104
  });
69
105
 
@@ -76,7 +112,9 @@ var defineAppConfig = (config) => {
76
112
  };
77
113
  export {
78
114
  Function,
115
+ Queue,
79
116
  Table,
117
+ Topic,
80
118
  defineAppConfig,
81
119
  definePlugin,
82
120
  defineStackConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -45,6 +45,7 @@
45
45
  "chalk": "^5.3.0",
46
46
  "change-case": "^4.1.2",
47
47
  "commander": "^9.4.1",
48
+ "event-iterator": "^2.0.0",
48
49
  "filesize": "^10.0.7",
49
50
  "graphql": "^16.7.1",
50
51
  "jszip": "^3.10.1",