@ttoss/appsync-api 0.9.0 → 0.10.0
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/esm/index.js +8 -7
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -7
- package/package.json +6 -6
- package/src/createApiTemplate.ts +9 -1
- package/src/createAppSyncResolverHandler.ts +4 -2
package/dist/esm/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var getPackageLambdaLayerStackName = (packageName) => {
|
|
|
79
79
|
// package.json
|
|
80
80
|
var package_default = {
|
|
81
81
|
name: "@ttoss/appsync-api",
|
|
82
|
-
version: "0.
|
|
82
|
+
version: "0.10.0",
|
|
83
83
|
description: "A library for building GraphQL APIs for AWS AppSync.",
|
|
84
84
|
license: "UNLICENSED",
|
|
85
85
|
author: "ttoss",
|
|
@@ -112,7 +112,7 @@ var package_default = {
|
|
|
112
112
|
sideEffects: false,
|
|
113
113
|
typings: "dist/index.d.ts",
|
|
114
114
|
dependencies: {
|
|
115
|
-
"@ttoss/cloudformation": "^0.6.
|
|
115
|
+
"@ttoss/cloudformation": "^0.6.1",
|
|
116
116
|
express: "^4.18.2",
|
|
117
117
|
"graphql-compose-connection": "^8.2.1",
|
|
118
118
|
"graphql-helix": "^1.13.0",
|
|
@@ -123,10 +123,10 @@ var package_default = {
|
|
|
123
123
|
"graphql-compose": "^9.0.10"
|
|
124
124
|
},
|
|
125
125
|
devDependencies: {
|
|
126
|
-
"@ttoss/config": "^1.28.
|
|
127
|
-
"@ttoss/relay-amplify": "^0.3.
|
|
126
|
+
"@ttoss/config": "^1.28.3",
|
|
127
|
+
"@ttoss/relay-amplify": "^0.3.1",
|
|
128
128
|
"@types/aws-lambda": "^8.10.111",
|
|
129
|
-
carlin: "^1.24.
|
|
129
|
+
carlin: "^1.24.1",
|
|
130
130
|
graphql: "^16.6.0",
|
|
131
131
|
"graphql-compose": "^9.0.10"
|
|
132
132
|
},
|
|
@@ -386,8 +386,9 @@ var createAppSyncResolverHandler = ({
|
|
|
386
386
|
return async (event, context) => {
|
|
387
387
|
const { info, arguments: args, source, request } = event;
|
|
388
388
|
const { parentTypeName, fieldName } = info;
|
|
389
|
+
const headers = request?.headers || {};
|
|
389
390
|
const credentials = (() => {
|
|
390
|
-
const headersCredentials =
|
|
391
|
+
const headersCredentials = headers?.["x-credentials"];
|
|
391
392
|
if (!headersCredentials) {
|
|
392
393
|
return null;
|
|
393
394
|
}
|
|
@@ -398,7 +399,7 @@ var createAppSyncResolverHandler = ({
|
|
|
398
399
|
return resolver(
|
|
399
400
|
source,
|
|
400
401
|
args,
|
|
401
|
-
{ ...context, identity: event.identity, credentials },
|
|
402
|
+
{ ...context, identity: event.identity, credentials, headers },
|
|
402
403
|
info
|
|
403
404
|
);
|
|
404
405
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -84,7 +84,10 @@ type CloudFormationTemplate = {
|
|
|
84
84
|
type StringOrImport = string | {
|
|
85
85
|
'Fn::ImportValue': string;
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html
|
|
89
|
+
*/
|
|
90
|
+
type AuthenticationType = 'API_KEY' | 'AWS_LAMBDA' | 'AWS_IAM' | 'OPENID_CONNECT' | 'AMAZON_COGNITO_USER_POOLS';
|
|
88
91
|
declare const createApiTemplate: ({ additionalAuthenticationProviders, authenticationType, schemaComposer, dataSource, lambdaFunction, userPoolConfig, }: {
|
|
89
92
|
additionalAuthenticationProviders?: AuthenticationType[] | undefined;
|
|
90
93
|
authenticationType?: AuthenticationType | undefined;
|
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ var getPackageLambdaLayerStackName = (packageName) => {
|
|
|
119
119
|
// package.json
|
|
120
120
|
var package_default = {
|
|
121
121
|
name: "@ttoss/appsync-api",
|
|
122
|
-
version: "0.
|
|
122
|
+
version: "0.10.0",
|
|
123
123
|
description: "A library for building GraphQL APIs for AWS AppSync.",
|
|
124
124
|
license: "UNLICENSED",
|
|
125
125
|
author: "ttoss",
|
|
@@ -152,7 +152,7 @@ var package_default = {
|
|
|
152
152
|
sideEffects: false,
|
|
153
153
|
typings: "dist/index.d.ts",
|
|
154
154
|
dependencies: {
|
|
155
|
-
"@ttoss/cloudformation": "^0.6.
|
|
155
|
+
"@ttoss/cloudformation": "^0.6.1",
|
|
156
156
|
express: "^4.18.2",
|
|
157
157
|
"graphql-compose-connection": "^8.2.1",
|
|
158
158
|
"graphql-helix": "^1.13.0",
|
|
@@ -163,10 +163,10 @@ var package_default = {
|
|
|
163
163
|
"graphql-compose": "^9.0.10"
|
|
164
164
|
},
|
|
165
165
|
devDependencies: {
|
|
166
|
-
"@ttoss/config": "^1.28.
|
|
167
|
-
"@ttoss/relay-amplify": "^0.3.
|
|
166
|
+
"@ttoss/config": "^1.28.3",
|
|
167
|
+
"@ttoss/relay-amplify": "^0.3.1",
|
|
168
168
|
"@types/aws-lambda": "^8.10.111",
|
|
169
|
-
carlin: "^1.24.
|
|
169
|
+
carlin: "^1.24.1",
|
|
170
170
|
graphql: "^16.6.0",
|
|
171
171
|
"graphql-compose": "^9.0.10"
|
|
172
172
|
},
|
|
@@ -426,8 +426,9 @@ var createAppSyncResolverHandler = ({
|
|
|
426
426
|
return async (event, context) => {
|
|
427
427
|
const { info, arguments: args, source, request } = event;
|
|
428
428
|
const { parentTypeName, fieldName } = info;
|
|
429
|
+
const headers = request?.headers || {};
|
|
429
430
|
const credentials = (() => {
|
|
430
|
-
const headersCredentials =
|
|
431
|
+
const headersCredentials = headers?.["x-credentials"];
|
|
431
432
|
if (!headersCredentials) {
|
|
432
433
|
return null;
|
|
433
434
|
}
|
|
@@ -438,7 +439,7 @@ var createAppSyncResolverHandler = ({
|
|
|
438
439
|
return resolver(
|
|
439
440
|
source,
|
|
440
441
|
args,
|
|
441
|
-
{ ...context, identity: event.identity, credentials },
|
|
442
|
+
{ ...context, identity: event.identity, credentials, headers },
|
|
442
443
|
info
|
|
443
444
|
);
|
|
444
445
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/appsync-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A library for building GraphQL APIs for AWS AppSync.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"typings": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ttoss/cloudformation": "^0.6.
|
|
36
|
+
"@ttoss/cloudformation": "^0.6.1",
|
|
37
37
|
"express": "^4.18.2",
|
|
38
38
|
"graphql-compose-connection": "^8.2.1",
|
|
39
39
|
"graphql-helix": "^1.13.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"graphql-compose": "^9.0.10"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@ttoss/config": "^1.28.
|
|
48
|
-
"@ttoss/relay-amplify": "^0.3.
|
|
47
|
+
"@ttoss/config": "^1.28.3",
|
|
48
|
+
"@ttoss/relay-amplify": "^0.3.1",
|
|
49
49
|
"@types/aws-lambda": "^8.10.111",
|
|
50
|
-
"carlin": "^1.24.
|
|
50
|
+
"carlin": "^1.24.1",
|
|
51
51
|
"graphql": "^16.6.0",
|
|
52
52
|
"graphql-compose": "^9.0.10"
|
|
53
53
|
},
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
]
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "23bc2fa5ee3a04eb45a235f40bc2ba45b5a477fe"
|
|
74
74
|
}
|
package/src/createApiTemplate.ts
CHANGED
|
@@ -27,7 +27,15 @@ type StringOrImport =
|
|
|
27
27
|
'Fn::ImportValue': string;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html
|
|
32
|
+
*/
|
|
33
|
+
type AuthenticationType =
|
|
34
|
+
| 'API_KEY'
|
|
35
|
+
| 'AWS_LAMBDA'
|
|
36
|
+
| 'AWS_IAM'
|
|
37
|
+
| 'OPENID_CONNECT'
|
|
38
|
+
| 'AMAZON_COGNITO_USER_POOLS';
|
|
31
39
|
|
|
32
40
|
export const createApiTemplate = ({
|
|
33
41
|
additionalAuthenticationProviders,
|
|
@@ -18,8 +18,10 @@ export const createAppSyncResolverHandler = ({
|
|
|
18
18
|
|
|
19
19
|
const { parentTypeName, fieldName } = info;
|
|
20
20
|
|
|
21
|
+
const headers = request?.headers || {};
|
|
22
|
+
|
|
21
23
|
const credentials = (() => {
|
|
22
|
-
const headersCredentials =
|
|
24
|
+
const headersCredentials = headers?.['x-credentials'];
|
|
23
25
|
|
|
24
26
|
if (!headersCredentials) {
|
|
25
27
|
return null;
|
|
@@ -35,7 +37,7 @@ export const createAppSyncResolverHandler = ({
|
|
|
35
37
|
return resolver(
|
|
36
38
|
source,
|
|
37
39
|
args,
|
|
38
|
-
{ ...context, identity: event.identity, credentials },
|
|
40
|
+
{ ...context, identity: event.identity, credentials, headers },
|
|
39
41
|
info
|
|
40
42
|
);
|
|
41
43
|
};
|