@awsless/awsless 0.0.66 → 0.0.68
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.js +7 -2
- package/dist/index.js +28 -21
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -97,6 +97,12 @@ var formatName = (name) => {
|
|
|
97
97
|
return paramCase2(name);
|
|
98
98
|
};
|
|
99
99
|
var formatArn = (props) => {
|
|
100
|
+
if (!props.resource) {
|
|
101
|
+
return sub("arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}", props);
|
|
102
|
+
}
|
|
103
|
+
if (!props.resourceName) {
|
|
104
|
+
return sub("arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}:${resource}", props);
|
|
105
|
+
}
|
|
100
106
|
return sub("arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}:${resource}${seperator}${resourceName}", {
|
|
101
107
|
seperator: "/",
|
|
102
108
|
...props
|
|
@@ -1635,8 +1641,7 @@ var Queue = class extends Resource {
|
|
|
1635
1641
|
resources: [
|
|
1636
1642
|
formatArn({
|
|
1637
1643
|
service: "sqs",
|
|
1638
|
-
resource:
|
|
1639
|
-
resourceName: this.name
|
|
1644
|
+
resource: this.name
|
|
1640
1645
|
})
|
|
1641
1646
|
]
|
|
1642
1647
|
};
|
package/dist/index.js
CHANGED
|
@@ -37,14 +37,16 @@ var getFunctionName = (stack, name) => {
|
|
|
37
37
|
var Function = /* @__PURE__ */ createProxy((stackName) => {
|
|
38
38
|
return createProxy((funcName) => {
|
|
39
39
|
const name = getFunctionName(stackName, funcName);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const ctx = {
|
|
41
|
+
[name]: (payload, options = {}) => {
|
|
42
|
+
return invoke({
|
|
43
|
+
...options,
|
|
44
|
+
name,
|
|
45
|
+
payload
|
|
46
|
+
});
|
|
47
|
+
}
|
|
46
48
|
};
|
|
47
|
-
call
|
|
49
|
+
const call = ctx[name];
|
|
48
50
|
call.async = (payload, options = {}) => {
|
|
49
51
|
return invoke({
|
|
50
52
|
...options,
|
|
@@ -72,14 +74,16 @@ import { publish } from "@awsless/sns";
|
|
|
72
74
|
var getTopicName = getGlobalResourceName;
|
|
73
75
|
var Topic = /* @__PURE__ */ createProxy((topic) => {
|
|
74
76
|
const name = getTopicName(topic);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const ctx = {
|
|
78
|
+
[name]: (payload, options = {}) => {
|
|
79
|
+
return publish({
|
|
80
|
+
...options,
|
|
81
|
+
topic: name,
|
|
82
|
+
payload
|
|
83
|
+
});
|
|
84
|
+
}
|
|
81
85
|
};
|
|
82
|
-
call
|
|
86
|
+
const call = ctx[name];
|
|
83
87
|
return call;
|
|
84
88
|
});
|
|
85
89
|
|
|
@@ -93,15 +97,18 @@ var getQueueUrl = (name, stack = STACK) => {
|
|
|
93
97
|
var Queue = /* @__PURE__ */ createProxy((stack) => {
|
|
94
98
|
return createProxy((queue) => {
|
|
95
99
|
const url = getQueueUrl(queue, stack);
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const name = getQueueName(queue, stack);
|
|
101
|
+
const ctx = {
|
|
102
|
+
[name]: (payload, options = {}) => {
|
|
103
|
+
return sendMessage({
|
|
104
|
+
...options,
|
|
105
|
+
queue: url,
|
|
106
|
+
payload
|
|
107
|
+
});
|
|
108
|
+
}
|
|
102
109
|
};
|
|
110
|
+
const send = ctx[name];
|
|
103
111
|
send.url = url;
|
|
104
|
-
send.name = getQueueName(queue, stack);
|
|
105
112
|
send.batch = (items, options = {}) => {
|
|
106
113
|
return sendMessageBatch({
|
|
107
114
|
...options,
|