@awsless/awsless 0.0.195 → 0.0.199
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 +32 -7
- package/dist/server.js +32 -1
- package/package.json +7 -6
package/dist/bin.js
CHANGED
|
@@ -3000,9 +3000,10 @@ var pubsubFeature = defineFeature({
|
|
|
3000
3000
|
onStack(ctx) {
|
|
3001
3001
|
for (const [id, props] of Object.entries(ctx.stackConfig.pubsub ?? {})) {
|
|
3002
3002
|
const group = new Node8(ctx.stack, "pubsub", id);
|
|
3003
|
-
const { lambda } = createLambdaFunction(group, ctx, `pubsub`,
|
|
3003
|
+
const { lambda } = createLambdaFunction(group, ctx, `pubsub`, id, props.consumer);
|
|
3004
|
+
const name = formatLocalResourceName(ctx.app.name, ctx.stack.name, "pubsub", id);
|
|
3004
3005
|
const topic = new aws8.iot.TopicRule(group, "rule", {
|
|
3005
|
-
name:
|
|
3006
|
+
name: name.replaceAll("-", "_"),
|
|
3006
3007
|
sql: props.sql,
|
|
3007
3008
|
sqlVersion: props.sqlVersion,
|
|
3008
3009
|
actions: [{ lambda: { functionArn: lambda.arn } }]
|
|
@@ -3626,6 +3627,25 @@ var httpFeature = defineFeature({
|
|
|
3626
3627
|
|
|
3627
3628
|
// src/feature/search/index.ts
|
|
3628
3629
|
import { Node as Node16, aws as aws16 } from "@awsless/formation";
|
|
3630
|
+
import { constantCase as constantCase5 } from "change-case";
|
|
3631
|
+
var typeGenCode6 = `
|
|
3632
|
+
import {
|
|
3633
|
+
migrate as sMigrate,
|
|
3634
|
+
search as sSearch,
|
|
3635
|
+
indexItem as sIndexItem,
|
|
3636
|
+
updateItem as sUpdateItem,
|
|
3637
|
+
deleteItem as sDeleteItem,
|
|
3638
|
+
} from '@awsless/open-search'
|
|
3639
|
+
|
|
3640
|
+
type Store<Name extends string> = {
|
|
3641
|
+
readonly name: Name
|
|
3642
|
+
readonly migrate: (...args: Parameters<typeof sMigrate>) => ReturnType<typeof sMigrate>
|
|
3643
|
+
readonly search: (...args: Parameters<typeof sMigrate>) => ReturnType<typeof sSearch>
|
|
3644
|
+
readonly indexItem: (...args: Parameters<typeof sIndexItem>) => ReturnType<typeof sIndexItem>
|
|
3645
|
+
readonly updateItem: (...args: Parameters<typeof sUpdateItem>) => ReturnType<typeof sUpdateItem>
|
|
3646
|
+
readonly deleteItem: (...args: Parameters<typeof sDeleteItem>) => ReturnType<typeof sDeleteItem>
|
|
3647
|
+
}
|
|
3648
|
+
`;
|
|
3629
3649
|
var searchFeature = defineFeature({
|
|
3630
3650
|
name: "search",
|
|
3631
3651
|
async onTypeGen(ctx) {
|
|
@@ -3639,13 +3659,14 @@ var searchFeature = defineFeature({
|
|
|
3639
3659
|
}
|
|
3640
3660
|
resources.addType(stack.name, list4);
|
|
3641
3661
|
}
|
|
3662
|
+
gen.addCode(typeGenCode6);
|
|
3642
3663
|
gen.addInterface("SearchResources", resources);
|
|
3643
3664
|
await ctx.write("search.d.ts", gen, true);
|
|
3644
3665
|
},
|
|
3645
3666
|
onStack(ctx) {
|
|
3646
3667
|
for (const [id, props] of Object.entries(ctx.stackConfig.searchs ?? {})) {
|
|
3647
3668
|
const group = new Node16(ctx.stack, "search", id);
|
|
3648
|
-
const
|
|
3669
|
+
const openSearch = new aws16.openSearch.Domain(group, "domain", {
|
|
3649
3670
|
// name: formatLocalResourceName(ctx.app.name, ctx.stack.name, this.name, id),
|
|
3650
3671
|
version: props.version,
|
|
3651
3672
|
storageSize: props.storage,
|
|
@@ -3657,13 +3678,13 @@ var searchFeature = defineFeature({
|
|
|
3657
3678
|
statements: [
|
|
3658
3679
|
{
|
|
3659
3680
|
principal: "lambda.amazonaws.com",
|
|
3660
|
-
sourceArn: `arn:aws:
|
|
3681
|
+
sourceArn: `arn:aws:lambda:${ctx.appConfig.region}:${ctx.accountId}:function:${ctx.app.name}--${ctx.stack.name}--*`
|
|
3661
3682
|
}
|
|
3662
3683
|
]
|
|
3663
3684
|
}
|
|
3664
3685
|
});
|
|
3665
3686
|
if (props.vpc) {
|
|
3666
|
-
|
|
3687
|
+
openSearch.setVpc({
|
|
3667
3688
|
securityGroupIds: [ctx.shared.get(`vpc-security-group-id`)],
|
|
3668
3689
|
subnetIds: [
|
|
3669
3690
|
ctx.shared.get("vpc-private-subnet-id-1"),
|
|
@@ -3671,10 +3692,14 @@ var searchFeature = defineFeature({
|
|
|
3671
3692
|
]
|
|
3672
3693
|
});
|
|
3673
3694
|
}
|
|
3674
|
-
ctx.onFunction(({ policy }) => {
|
|
3695
|
+
ctx.onFunction(({ lambda, policy }) => {
|
|
3696
|
+
lambda.addEnvironment(
|
|
3697
|
+
`SEARCH_${constantCase5(ctx.stack.name)}_${constantCase5(id)}_DOMAIN`,
|
|
3698
|
+
openSearch.domainEndpoint
|
|
3699
|
+
);
|
|
3675
3700
|
policy.addStatement({
|
|
3676
3701
|
actions: ["es:*"],
|
|
3677
|
-
resources: [
|
|
3702
|
+
resources: [openSearch.arn]
|
|
3678
3703
|
});
|
|
3679
3704
|
});
|
|
3680
3705
|
}
|
package/dist/server.js
CHANGED
|
@@ -262,11 +262,42 @@ var Config = /* @__PURE__ */ new Proxy(
|
|
|
262
262
|
);
|
|
263
263
|
|
|
264
264
|
// src/lib/resource/search.ts
|
|
265
|
+
import { constantCase as constantCase4 } from "change-case";
|
|
266
|
+
import {
|
|
267
|
+
searchClient,
|
|
268
|
+
migrate as sMigrate,
|
|
269
|
+
search as sSearch,
|
|
270
|
+
indexItem as sIndexItem,
|
|
271
|
+
updateItem as sUpdateItem,
|
|
272
|
+
deleteItem as sDeleteItem
|
|
273
|
+
} from "@awsless/open-search";
|
|
265
274
|
var getSearchName = bindLocalResourceName("search");
|
|
275
|
+
var getSearchProps = (name, stack = STACK) => {
|
|
276
|
+
return {
|
|
277
|
+
domain: process.env[`CACHE_${constantCase4(stack)}_${constantCase4(name)}_DOMAIN`]
|
|
278
|
+
};
|
|
279
|
+
};
|
|
266
280
|
var Search = /* @__PURE__ */ createProxy((stack) => {
|
|
267
281
|
return createProxy((name) => {
|
|
282
|
+
const { domain } = getSearchProps(name, stack);
|
|
283
|
+
const client = searchClient({ node: domain });
|
|
268
284
|
return {
|
|
269
|
-
name: getSearchName(name, stack)
|
|
285
|
+
name: getSearchName(name, stack),
|
|
286
|
+
migrate(...args) {
|
|
287
|
+
return sMigrate(args[0], { client });
|
|
288
|
+
},
|
|
289
|
+
search(...args) {
|
|
290
|
+
return sSearch(args[0], { client, ...args[1] });
|
|
291
|
+
},
|
|
292
|
+
indexItem(...args) {
|
|
293
|
+
return sIndexItem(args[0], args[1], args[2], { client, ...args[3] });
|
|
294
|
+
},
|
|
295
|
+
updateItem(...args) {
|
|
296
|
+
return sUpdateItem(args[0], args[1], args[2], { client, ...args[3] });
|
|
297
|
+
},
|
|
298
|
+
deleteItem(...args) {
|
|
299
|
+
return sDeleteItem(args[0], args[1], { client, ...args[2] });
|
|
300
|
+
}
|
|
270
301
|
};
|
|
271
302
|
});
|
|
272
303
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.199",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/lambda": "^0.0.18",
|
|
32
|
+
"@awsless/open-search": "^0.0.11",
|
|
32
33
|
"@awsless/redis": "^0.0.12",
|
|
34
|
+
"@awsless/s3": "^0.0.10",
|
|
33
35
|
"@awsless/sns": "^0.0.7",
|
|
34
36
|
"@awsless/sqs": "^0.0.7",
|
|
35
|
-
"@awsless/s3": "^0.0.10",
|
|
36
37
|
"@awsless/validate": "^0.0.13",
|
|
37
|
-
"@awsless/
|
|
38
|
-
"@awsless/
|
|
38
|
+
"@awsless/ssm": "^0.0.7",
|
|
39
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@aws-appsync/utils": "^1.5.0",
|
|
@@ -97,9 +98,9 @@
|
|
|
97
98
|
"zod": "^3.21.4",
|
|
98
99
|
"zod-to-json-schema": "^3.22.3",
|
|
99
100
|
"@awsless/duration": "^0.0.1",
|
|
100
|
-
"@awsless/size": "^0.0.1",
|
|
101
|
-
"@awsless/formation": "^0.0.15",
|
|
102
101
|
"@awsless/graphql": "^0.0.9",
|
|
102
|
+
"@awsless/formation": "^0.0.15",
|
|
103
|
+
"@awsless/size": "^0.0.1",
|
|
103
104
|
"@awsless/validate": "^0.0.13",
|
|
104
105
|
"@awsless/code": "^0.0.10"
|
|
105
106
|
},
|