@awsless/awsless 0.0.202 → 0.0.203
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 +11 -1
- package/dist/server.js +8 -16
- package/package.json +7 -7
package/dist/bin.js
CHANGED
|
@@ -3629,6 +3629,15 @@ var httpFeature = defineFeature({
|
|
|
3629
3629
|
// src/feature/search/index.ts
|
|
3630
3630
|
import { Node as Node16, aws as aws16 } from "@awsless/formation";
|
|
3631
3631
|
import { constantCase as constantCase5 } from "change-case";
|
|
3632
|
+
var typeGenCode6 = `
|
|
3633
|
+
import { AnyStruct, Table } from '@awsless/open-search'
|
|
3634
|
+
|
|
3635
|
+
type Search<Name extends string> = {
|
|
3636
|
+
readonly name: Name
|
|
3637
|
+
readonly domain: string
|
|
3638
|
+
readonly defineTable: <S extends AnyStruct>(schema: S) => Table<Name, S>
|
|
3639
|
+
}
|
|
3640
|
+
`;
|
|
3632
3641
|
var searchFeature = defineFeature({
|
|
3633
3642
|
name: "search",
|
|
3634
3643
|
async onTypeGen(ctx) {
|
|
@@ -3638,10 +3647,11 @@ var searchFeature = defineFeature({
|
|
|
3638
3647
|
const list4 = new TypeObject(2);
|
|
3639
3648
|
for (const id of Object.keys(stack.searchs ?? {})) {
|
|
3640
3649
|
const name = formatLocalResourceName(ctx.appConfig.name, stack.name, this.name, id);
|
|
3641
|
-
list4.addType(name, `
|
|
3650
|
+
list4.addType(name, `Search<'${name}'>`);
|
|
3642
3651
|
}
|
|
3643
3652
|
resources.addType(stack.name, list4);
|
|
3644
3653
|
}
|
|
3654
|
+
gen.addCode(typeGenCode6);
|
|
3645
3655
|
gen.addInterface("SearchResources", resources);
|
|
3646
3656
|
await ctx.write("search.d.ts", gen, true);
|
|
3647
3657
|
},
|
package/dist/server.js
CHANGED
|
@@ -263,7 +263,7 @@ var Config = /* @__PURE__ */ new Proxy(
|
|
|
263
263
|
|
|
264
264
|
// src/lib/resource/search.ts
|
|
265
265
|
import { constantCase as constantCase4 } from "change-case";
|
|
266
|
-
import { searchClient,
|
|
266
|
+
import { searchClient, define } from "@awsless/open-search";
|
|
267
267
|
var getSearchName = bindLocalResourceName("search");
|
|
268
268
|
var getSearchProps = (name, stack = STACK) => {
|
|
269
269
|
return {
|
|
@@ -273,24 +273,16 @@ var getSearchProps = (name, stack = STACK) => {
|
|
|
273
273
|
var Search = /* @__PURE__ */ createProxy((stack) => {
|
|
274
274
|
return createProxy((name) => {
|
|
275
275
|
const { domain } = getSearchProps(name, stack);
|
|
276
|
-
|
|
276
|
+
let client;
|
|
277
277
|
return {
|
|
278
278
|
name: getSearchName(name, stack),
|
|
279
279
|
domain,
|
|
280
|
-
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
indexItem(...args) {
|
|
287
|
-
return indexItem(args[0], args[1], args[2], { client, ...args[3] });
|
|
288
|
-
},
|
|
289
|
-
updateItem(...args) {
|
|
290
|
-
return updateItem(args[0], args[1], args[2], { client, ...args[3] });
|
|
291
|
-
},
|
|
292
|
-
deleteItem(...args) {
|
|
293
|
-
return deleteItem(args[0], args[1], { client, ...args[2] });
|
|
280
|
+
defineTable(schema) {
|
|
281
|
+
return define(name, schema, () => {
|
|
282
|
+
if (!client)
|
|
283
|
+
client = searchClient({ node: domain }, "es");
|
|
284
|
+
return client;
|
|
285
|
+
});
|
|
294
286
|
}
|
|
295
287
|
};
|
|
296
288
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.203",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@awsless/open-search": "^0.0.12",
|
|
31
32
|
"@awsless/lambda": "^0.0.18",
|
|
32
33
|
"@awsless/redis": "^0.0.12",
|
|
33
34
|
"@awsless/s3": "^0.0.10",
|
|
34
|
-
"@awsless/open-search": "^0.0.11",
|
|
35
35
|
"@awsless/sns": "^0.0.7",
|
|
36
|
-
"@awsless/ssm": "^0.0.7",
|
|
37
36
|
"@awsless/sqs": "^0.0.7",
|
|
38
37
|
"@awsless/validate": "^0.0.13",
|
|
39
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
38
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
39
|
+
"@awsless/ssm": "^0.0.7"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@aws-appsync/utils": "^1.5.0",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"wrap-ansi": "^8.1.0",
|
|
98
98
|
"zod": "^3.21.4",
|
|
99
99
|
"zod-to-json-schema": "^3.22.3",
|
|
100
|
+
"@awsless/code": "^0.0.10",
|
|
100
101
|
"@awsless/duration": "^0.0.1",
|
|
101
102
|
"@awsless/formation": "^0.0.17",
|
|
102
|
-
"@awsless/size": "^0.0.1",
|
|
103
103
|
"@awsless/graphql": "^0.0.9",
|
|
104
|
-
"@awsless/
|
|
105
|
-
"@awsless/
|
|
104
|
+
"@awsless/size": "^0.0.1",
|
|
105
|
+
"@awsless/validate": "^0.0.13"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"test": "pnpm code test",
|