@awsless/awsless 0.0.187 → 0.0.189

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.
Files changed (2) hide show
  1. package/dist/bin.js +18 -8
  2. package/package.json +6 -6
package/dist/bin.js CHANGED
@@ -2640,6 +2640,15 @@ export function response(ctx) {
2640
2640
  return ctx.result
2641
2641
  }
2642
2642
  `;
2643
+ var baseSchema = `
2644
+ type Query
2645
+ type Mutation
2646
+
2647
+ schema {
2648
+ query: Query
2649
+ mutation: Mutation
2650
+ }
2651
+ `;
2643
2652
  var scalarSchema = `
2644
2653
  scalar AWSDate
2645
2654
  scalar AWSTime
@@ -2785,8 +2794,9 @@ var graphqlFeature = defineFeature({
2785
2794
  );
2786
2795
  }
2787
2796
  const group = new Node6(ctx.stack, "graphql", id);
2797
+ const name = formatLocalResourceName(ctx.app.name, ctx.stack.name, "graphql", id);
2788
2798
  const api = new aws6.appsync.GraphQLApi(group, "api", {
2789
- name: formatLocalResourceName(ctx.app.name, ctx.stack.name, "graphql", id),
2799
+ name,
2790
2800
  // visibility: false,
2791
2801
  auth: {
2792
2802
  default: {
@@ -2794,11 +2804,11 @@ var graphqlFeature = defineFeature({
2794
2804
  }
2795
2805
  }
2796
2806
  });
2797
- ctx.registerBuild("graphql-schema", id, async (build3) => {
2807
+ ctx.registerBuild("graphql-schema", name, async (build3) => {
2798
2808
  const source = await readFile5(props.schema, "utf8");
2799
2809
  const finger = createHash4("sha1").update(source).digest("hex");
2800
2810
  return build3(finger, async (write) => {
2801
- const defs = mergeTypeDefs([scalarSchema, source]);
2811
+ const defs = mergeTypeDefs([scalarSchema, baseSchema, source]);
2802
2812
  const output = print(defs);
2803
2813
  const schema2 = buildSchema(output);
2804
2814
  for (const [typeName, fields] of Object.entries(props.resolvers ?? {})) {
@@ -2824,7 +2834,7 @@ var graphqlFeature = defineFeature({
2824
2834
  });
2825
2835
  const schema = new aws6.appsync.GraphQLSchema(group, "schema", {
2826
2836
  apiId: api.id,
2827
- definition: Asset2.fromFile(getBuildPath("graphql-schema", id, "schema.gql"))
2837
+ definition: Asset2.fromFile(getBuildPath("graphql-schema", name, "schema.gql"))
2828
2838
  });
2829
2839
  const association = new aws6.appsync.SourceApiAssociation(group, "association", {
2830
2840
  mergedApiId: ctx.shared.get(`graphql-${id}-id`),
@@ -2833,8 +2843,8 @@ var graphqlFeature = defineFeature({
2833
2843
  association.dependsOn(schema);
2834
2844
  for (const [typeName, fields] of Object.entries(props.resolvers ?? {})) {
2835
2845
  for (const [fieldName, props2] of Object.entries(fields ?? {})) {
2836
- const name = `${typeName}__${fieldName}`;
2837
- const resolverGroup = new Node6(group, "resolver", name);
2846
+ const name2 = `${typeName}__${fieldName}`;
2847
+ const resolverGroup = new Node6(group, "resolver", name2);
2838
2848
  const entryId = paramCase5(`${id}-${typeName}-${fieldName}`);
2839
2849
  const { lambda } = createLambdaFunction(resolverGroup, ctx, `graphql`, entryId, {
2840
2850
  ...props2.consumer,
@@ -2857,7 +2867,7 @@ var graphqlFeature = defineFeature({
2857
2867
  const source = new aws6.appsync.DataSource(resolverGroup, "source", {
2858
2868
  apiId: api.id,
2859
2869
  type: "lambda",
2860
- name,
2870
+ name: name2,
2861
2871
  role: role.arn,
2862
2872
  functionArn: lambda.arn
2863
2873
  });
@@ -2869,7 +2879,7 @@ var graphqlFeature = defineFeature({
2869
2879
  }
2870
2880
  const config2 = new aws6.appsync.FunctionConfiguration(resolverGroup, "config", {
2871
2881
  apiId: api.id,
2872
- name,
2882
+ name: name2,
2873
2883
  code,
2874
2884
  dataSourceName: source.name
2875
2885
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.187",
3
+ "version": "0.0.189",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -30,11 +30,11 @@
30
30
  "peerDependencies": {
31
31
  "@awsless/lambda": "^0.0.18",
32
32
  "@awsless/redis": "^0.0.12",
33
- "@awsless/sns": "^0.0.7",
34
- "@awsless/sqs": "^0.0.7",
35
33
  "@awsless/s3": "^0.0.10",
34
+ "@awsless/sqs": "^0.0.7",
36
35
  "@awsless/validate": "^0.0.13",
37
36
  "@awsless/ssm": "^0.0.7",
37
+ "@awsless/sns": "^0.0.7",
38
38
  "@awsless/weak-cache": "^0.0.1"
39
39
  },
40
40
  "dependencies": {
@@ -96,12 +96,12 @@
96
96
  "wrap-ansi": "^8.1.0",
97
97
  "zod": "^3.21.4",
98
98
  "zod-to-json-schema": "^3.22.3",
99
+ "@awsless/code": "^0.0.10",
99
100
  "@awsless/duration": "^0.0.1",
100
- "@awsless/size": "^0.0.1",
101
101
  "@awsless/graphql": "^0.0.9",
102
- "@awsless/validate": "^0.0.13",
103
102
  "@awsless/formation": "^0.0.12",
104
- "@awsless/code": "^0.0.10"
103
+ "@awsless/size": "^0.0.1",
104
+ "@awsless/validate": "^0.0.13"
105
105
  },
106
106
  "scripts": {
107
107
  "test": "pnpm code test",