@awsless/awsless 0.0.185 → 0.0.187
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 +33 -4
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -2476,7 +2476,7 @@ var functionFeature = defineFeature({
|
|
|
2476
2476
|
import { paramCase as paramCase5 } from "change-case";
|
|
2477
2477
|
import { mergeTypeDefs } from "@graphql-tools/merge";
|
|
2478
2478
|
import { generate } from "@awsless/graphql";
|
|
2479
|
-
import { buildSchema, print } from "graphql";
|
|
2479
|
+
import { buildSchema, isObjectType, print } from "graphql";
|
|
2480
2480
|
import { readFile as readFile5 } from "fs/promises";
|
|
2481
2481
|
import { Asset as Asset2, Node as Node6, aws as aws6 } from "@awsless/formation";
|
|
2482
2482
|
|
|
@@ -2627,6 +2627,7 @@ var buildTypeScriptResolver = async (input, { minify = true } = {}) => {
|
|
|
2627
2627
|
};
|
|
2628
2628
|
|
|
2629
2629
|
// src/feature/graphql/index.ts
|
|
2630
|
+
import { createHash as createHash4 } from "crypto";
|
|
2630
2631
|
var defaultResolver = `
|
|
2631
2632
|
export function request(ctx) {
|
|
2632
2633
|
return {
|
|
@@ -2793,9 +2794,37 @@ var graphqlFeature = defineFeature({
|
|
|
2793
2794
|
}
|
|
2794
2795
|
}
|
|
2795
2796
|
});
|
|
2797
|
+
ctx.registerBuild("graphql-schema", id, async (build3) => {
|
|
2798
|
+
const source = await readFile5(props.schema, "utf8");
|
|
2799
|
+
const finger = createHash4("sha1").update(source).digest("hex");
|
|
2800
|
+
return build3(finger, async (write) => {
|
|
2801
|
+
const defs = mergeTypeDefs([scalarSchema, source]);
|
|
2802
|
+
const output = print(defs);
|
|
2803
|
+
const schema2 = buildSchema(output);
|
|
2804
|
+
for (const [typeName, fields] of Object.entries(props.resolvers ?? {})) {
|
|
2805
|
+
const type = schema2.getType(typeName);
|
|
2806
|
+
if (!type || !isObjectType(type)) {
|
|
2807
|
+
throw new FileError(props.schema, `GraphQL schema type doesn't exist: ${typeName}`);
|
|
2808
|
+
}
|
|
2809
|
+
const typeFields = type.getFields();
|
|
2810
|
+
for (const fieldName of Object.keys(fields ?? {})) {
|
|
2811
|
+
if (!(fieldName in typeFields)) {
|
|
2812
|
+
throw new FileError(
|
|
2813
|
+
props.schema,
|
|
2814
|
+
`GraphQL schema field doesn't exist: ${typeName}.${fieldName}`
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
await write("schema.gql", output);
|
|
2820
|
+
return {
|
|
2821
|
+
size: formatByteSize(Buffer.from(source).byteLength)
|
|
2822
|
+
};
|
|
2823
|
+
});
|
|
2824
|
+
});
|
|
2796
2825
|
const schema = new aws6.appsync.GraphQLSchema(group, "schema", {
|
|
2797
2826
|
apiId: api.id,
|
|
2798
|
-
definition: Asset2.fromFile(
|
|
2827
|
+
definition: Asset2.fromFile(getBuildPath("graphql-schema", id, "schema.gql"))
|
|
2799
2828
|
});
|
|
2800
2829
|
const association = new aws6.appsync.SourceApiAssociation(group, "association", {
|
|
2801
2830
|
mergedApiId: ctx.shared.get(`graphql-${id}-id`),
|
|
@@ -3390,9 +3419,9 @@ import { camelCase as camelCase5 } from "change-case";
|
|
|
3390
3419
|
import { relative as relative3 } from "path";
|
|
3391
3420
|
|
|
3392
3421
|
// src/util/id.ts
|
|
3393
|
-
import { createHash as
|
|
3422
|
+
import { createHash as createHash5 } from "crypto";
|
|
3394
3423
|
var shortId = (ns) => {
|
|
3395
|
-
return
|
|
3424
|
+
return createHash5("md5").update(ns).digest("hex").substring(0, 10);
|
|
3396
3425
|
};
|
|
3397
3426
|
|
|
3398
3427
|
// src/feature/http/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.187",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@awsless/lambda": "^0.0.18",
|
|
32
32
|
"@awsless/redis": "^0.0.12",
|
|
33
33
|
"@awsless/sns": "^0.0.7",
|
|
34
|
+
"@awsless/sqs": "^0.0.7",
|
|
34
35
|
"@awsless/s3": "^0.0.10",
|
|
35
36
|
"@awsless/validate": "^0.0.13",
|
|
36
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
37
37
|
"@awsless/ssm": "^0.0.7",
|
|
38
|
-
"@awsless/
|
|
38
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@aws-appsync/utils": "^1.5.0",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"zod": "^3.21.4",
|
|
98
98
|
"zod-to-json-schema": "^3.22.3",
|
|
99
99
|
"@awsless/duration": "^0.0.1",
|
|
100
|
-
"@awsless/graphql": "^0.0.9",
|
|
101
|
-
"@awsless/formation": "^0.0.12",
|
|
102
100
|
"@awsless/size": "^0.0.1",
|
|
101
|
+
"@awsless/graphql": "^0.0.9",
|
|
103
102
|
"@awsless/validate": "^0.0.13",
|
|
103
|
+
"@awsless/formation": "^0.0.12",
|
|
104
104
|
"@awsless/code": "^0.0.10"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|