@awsless/awsless 0.0.201 → 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 CHANGED
@@ -3180,7 +3180,7 @@ var tableFeature = defineFeature({
3180
3180
  });
3181
3181
  if (props.stream) {
3182
3182
  const { lambda, policy } = createLambdaFunction(group, ctx, "table", id, props.stream.consumer);
3183
- new aws11.lambda.EventSourceMapping(group, id, {
3183
+ const source = new aws11.lambda.EventSourceMapping(group, id, {
3184
3184
  functionArn: lambda.arn,
3185
3185
  sourceArn: table2.streamArn,
3186
3186
  batchSize: 100,
@@ -3191,6 +3191,7 @@ var tableFeature = defineFeature({
3191
3191
  onFailure: getGlobalOnFailure(ctx)
3192
3192
  });
3193
3193
  policy.addStatement(table2.streamPermissions);
3194
+ source.dependsOn(policy);
3194
3195
  }
3195
3196
  ctx.onFunction(({ policy }) => {
3196
3197
  policy.addStatement(...table2.permissions);
@@ -3628,6 +3629,15 @@ var httpFeature = defineFeature({
3628
3629
  // src/feature/search/index.ts
3629
3630
  import { Node as Node16, aws as aws16 } from "@awsless/formation";
3630
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
+ `;
3631
3641
  var searchFeature = defineFeature({
3632
3642
  name: "search",
3633
3643
  async onTypeGen(ctx) {
@@ -3637,10 +3647,11 @@ var searchFeature = defineFeature({
3637
3647
  const list4 = new TypeObject(2);
3638
3648
  for (const id of Object.keys(stack.searchs ?? {})) {
3639
3649
  const name = formatLocalResourceName(ctx.appConfig.name, stack.name, this.name, id);
3640
- list4.addType(name, `{ readonly name: '${name}' }`);
3650
+ list4.addType(name, `Search<'${name}'>`);
3641
3651
  }
3642
3652
  resources.addType(stack.name, list4);
3643
3653
  }
3654
+ gen.addCode(typeGenCode6);
3644
3655
  gen.addInterface("SearchResources", resources);
3645
3656
  await ctx.write("search.d.ts", gen, true);
3646
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, migrate, search, indexItem, updateItem, deleteItem } from "@awsless/open-search";
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
- const client = searchClient({ node: domain });
276
+ let client;
277
277
  return {
278
278
  name: getSearchName(name, stack),
279
279
  domain,
280
- migrate(...args) {
281
- return migrate(args[0], { client });
282
- },
283
- search(...args) {
284
- return search(args[0], { client, ...args[1] });
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.201",
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
- "@awsless/s3": "^0.0.10",
33
33
  "@awsless/redis": "^0.0.12",
34
- "@awsless/open-search": "^0.0.11",
34
+ "@awsless/s3": "^0.0.10",
35
35
  "@awsless/sns": "^0.0.7",
36
- "@awsless/validate": "^0.0.13",
37
36
  "@awsless/sqs": "^0.0.7",
38
- "@awsless/ssm": "^0.0.7",
39
- "@awsless/weak-cache": "^0.0.1"
37
+ "@awsless/validate": "^0.0.13",
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",
102
+ "@awsless/formation": "^0.0.17",
101
103
  "@awsless/graphql": "^0.0.9",
102
104
  "@awsless/size": "^0.0.1",
103
- "@awsless/validate": "^0.0.13",
104
- "@awsless/formation": "^0.0.17",
105
- "@awsless/code": "^0.0.10"
105
+ "@awsless/validate": "^0.0.13"
106
106
  },
107
107
  "scripts": {
108
108
  "test": "pnpm code test",