@ttoss/appsync-api 0.22.14 → 0.22.15
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 +20 -8
- package/dist/index.d.mts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +37 -7
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -15,19 +15,19 @@ var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
|
15
15
|
var createApiTemplate = /* @__PURE__ */__name(({
|
|
16
16
|
additionalAuthenticationProviders,
|
|
17
17
|
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
18
|
-
schemaComposer,
|
|
18
|
+
schemaComposer: schemaComposer2,
|
|
19
19
|
dataSource,
|
|
20
20
|
lambdaFunction,
|
|
21
21
|
userPoolConfig,
|
|
22
22
|
customDomain
|
|
23
23
|
}) => {
|
|
24
|
-
const sdlWithoutComments =
|
|
24
|
+
const sdlWithoutComments = schemaComposer2.toSDL({
|
|
25
25
|
commentDescriptions: false,
|
|
26
26
|
omitDescriptions: true,
|
|
27
27
|
omitScalars: true
|
|
28
28
|
});
|
|
29
|
-
graphql.validateSchema(
|
|
30
|
-
const resolveMethods =
|
|
29
|
+
graphql.validateSchema(schemaComposer2.buildSchema());
|
|
30
|
+
const resolveMethods = schemaComposer2.getResolveMethods();
|
|
31
31
|
const resolveMethodsEntries = Object.entries(resolveMethods).flatMap(([typeName, fieldResolvers]) => {
|
|
32
32
|
return Object.entries(fieldResolvers).map(([fieldName, resolver]) => {
|
|
33
33
|
if (typeof resolver !== "function") {
|
|
@@ -285,7 +285,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
285
285
|
}) => {
|
|
286
286
|
return async (event, appSyncHandlerContext) => {
|
|
287
287
|
const {
|
|
288
|
-
schemaComposer
|
|
288
|
+
schemaComposer: schemaComposer2
|
|
289
289
|
} = buildSchemaInput;
|
|
290
290
|
const {
|
|
291
291
|
info,
|
|
@@ -314,7 +314,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
314
314
|
}
|
|
315
315
|
const argsWithEnumValues = (() => {
|
|
316
316
|
const fieldsArgsIsEnumType = field.args.filter(arg => {
|
|
317
|
-
return
|
|
317
|
+
return schemaComposer2.isEnumType(arg.type);
|
|
318
318
|
});
|
|
319
319
|
const enumArgs = fieldsArgsIsEnumType.map(enumArg => {
|
|
320
320
|
if (!args[enumArg.name]) {
|
|
@@ -322,7 +322,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
322
322
|
[enumArg.name]: enumArg.defaultValue
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
|
-
const values =
|
|
325
|
+
const values = schemaComposer2.getETC(enumArg.type).getFields();
|
|
326
326
|
return {
|
|
327
327
|
[enumArg.name]: values[args[enumArg.name]].value
|
|
328
328
|
};
|
|
@@ -344,4 +344,16 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
344
344
|
return response;
|
|
345
345
|
};
|
|
346
346
|
}, "createAppSyncResolverHandler");
|
|
347
|
-
|
|
347
|
+
|
|
348
|
+
// src/scalars.ts
|
|
349
|
+
import { schemaComposer } from "@ttoss/graphql-api";
|
|
350
|
+
var AWSJSONTC = schemaComposer.createScalarTC(`scalar AWSJSON`);
|
|
351
|
+
var AWSDateTimeTC = schemaComposer.createScalarTC(`scalar AWSDateTime`);
|
|
352
|
+
var AWSDateTC = schemaComposer.createScalarTC(`scalar AWSDate`);
|
|
353
|
+
var AWSTimeTC = schemaComposer.createScalarTC(`scalar AWSTime`);
|
|
354
|
+
var AWSTimestampTC = schemaComposer.createScalarTC(`scalar AWSTimestamp`);
|
|
355
|
+
var AWSEmailTC = schemaComposer.createScalarTC(`scalar AWSEmail`);
|
|
356
|
+
var AWSURLTC = schemaComposer.createScalarTC(`scalar AWSURL`);
|
|
357
|
+
var AWSPhoneTC = schemaComposer.createScalarTC(`scalar AWSPhone`);
|
|
358
|
+
var AWSIPAddressTC = schemaComposer.createScalarTC(`scalar AWSIPAddress`);
|
|
359
|
+
export { AWSDateTC, AWSDateTimeTC, AWSEmailTC, AWSIPAddressTC, AWSJSONTC, AWSPhoneTC, AWSTimeTC, AWSTimestampTC, AWSURLTC, createApiTemplate, createAppSyncResolverHandler };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _ttoss_graphql_api from '@ttoss/graphql-api';
|
|
1
2
|
import { SchemaComposer, BuildSchemaInput } from '@ttoss/graphql-api';
|
|
2
3
|
import { AppSyncResolverHandler as AppSyncResolverHandler$1 } from 'aws-lambda';
|
|
3
4
|
export { AppSyncIdentityCognito } from 'aws-lambda';
|
|
@@ -111,4 +112,23 @@ declare const createApiTemplate: ({ additionalAuthenticationProviders, authentic
|
|
|
111
112
|
type AppSyncResolverHandler<TArguments, TResult, TSource = Record<string, any> | null> = AppSyncResolverHandler$1<TArguments, TResult, TSource>;
|
|
112
113
|
declare const createAppSyncResolverHandler: ({ ...buildSchemaInput }: BuildSchemaInput) => AppSyncResolverHandler<any, any, any>;
|
|
113
114
|
|
|
114
|
-
|
|
115
|
+
/** AWS AppSync scalar for JSON data. Represents a JSON object or array. */
|
|
116
|
+
declare const AWSJSONTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
117
|
+
/** AWS AppSync scalar for combined date and time values (ISO 8601, e.g. `2007-04-05T14:30:28Z`). */
|
|
118
|
+
declare const AWSDateTimeTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
119
|
+
/** AWS AppSync scalar for date values (ISO 8601, e.g. `1970-01-01`). */
|
|
120
|
+
declare const AWSDateTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
121
|
+
/** AWS AppSync scalar for time values (ISO 8601, e.g. `12:30:00.000Z`). */
|
|
122
|
+
declare const AWSTimeTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
123
|
+
/** AWS AppSync scalar for Unix epoch timestamps (integer, seconds since 1970-01-01T00:00:00Z). */
|
|
124
|
+
declare const AWSTimestampTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
125
|
+
/** AWS AppSync scalar for email addresses (RFC 822). */
|
|
126
|
+
declare const AWSEmailTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
127
|
+
/** AWS AppSync scalar for URLs (RFC 1738). */
|
|
128
|
+
declare const AWSURLTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
129
|
+
/** AWS AppSync scalar for phone numbers (E.164 format). */
|
|
130
|
+
declare const AWSPhoneTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
131
|
+
/** AWS AppSync scalar for IPv4 and IPv6 addresses. */
|
|
132
|
+
declare const AWSIPAddressTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
133
|
+
|
|
134
|
+
export { AWSDateTC, AWSDateTimeTC, AWSEmailTC, AWSIPAddressTC, AWSJSONTC, AWSPhoneTC, AWSTimeTC, AWSTimestampTC, AWSURLTC, type AppSyncResolverHandler, createApiTemplate, createAppSyncResolverHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _ttoss_graphql_api from '@ttoss/graphql-api';
|
|
1
2
|
import { SchemaComposer, BuildSchemaInput } from '@ttoss/graphql-api';
|
|
2
3
|
import { AppSyncResolverHandler as AppSyncResolverHandler$1 } from 'aws-lambda';
|
|
3
4
|
export { AppSyncIdentityCognito } from 'aws-lambda';
|
|
@@ -111,4 +112,23 @@ declare const createApiTemplate: ({ additionalAuthenticationProviders, authentic
|
|
|
111
112
|
type AppSyncResolverHandler<TArguments, TResult, TSource = Record<string, any> | null> = AppSyncResolverHandler$1<TArguments, TResult, TSource>;
|
|
112
113
|
declare const createAppSyncResolverHandler: ({ ...buildSchemaInput }: BuildSchemaInput) => AppSyncResolverHandler<any, any, any>;
|
|
113
114
|
|
|
114
|
-
|
|
115
|
+
/** AWS AppSync scalar for JSON data. Represents a JSON object or array. */
|
|
116
|
+
declare const AWSJSONTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
117
|
+
/** AWS AppSync scalar for combined date and time values (ISO 8601, e.g. `2007-04-05T14:30:28Z`). */
|
|
118
|
+
declare const AWSDateTimeTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
119
|
+
/** AWS AppSync scalar for date values (ISO 8601, e.g. `1970-01-01`). */
|
|
120
|
+
declare const AWSDateTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
121
|
+
/** AWS AppSync scalar for time values (ISO 8601, e.g. `12:30:00.000Z`). */
|
|
122
|
+
declare const AWSTimeTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
123
|
+
/** AWS AppSync scalar for Unix epoch timestamps (integer, seconds since 1970-01-01T00:00:00Z). */
|
|
124
|
+
declare const AWSTimestampTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
125
|
+
/** AWS AppSync scalar for email addresses (RFC 822). */
|
|
126
|
+
declare const AWSEmailTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
127
|
+
/** AWS AppSync scalar for URLs (RFC 1738). */
|
|
128
|
+
declare const AWSURLTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
129
|
+
/** AWS AppSync scalar for phone numbers (E.164 format). */
|
|
130
|
+
declare const AWSPhoneTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
131
|
+
/** AWS AppSync scalar for IPv4 and IPv6 addresses. */
|
|
132
|
+
declare const AWSIPAddressTC: _ttoss_graphql_api.ScalarTypeComposer<any>;
|
|
133
|
+
|
|
134
|
+
export { AWSDateTC, AWSDateTimeTC, AWSEmailTC, AWSIPAddressTC, AWSJSONTC, AWSPhoneTC, AWSTimeTC, AWSTimestampTC, AWSURLTC, type AppSyncResolverHandler, createApiTemplate, createAppSyncResolverHandler };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,15 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
+
AWSDateTC: () => AWSDateTC,
|
|
35
|
+
AWSDateTimeTC: () => AWSDateTimeTC,
|
|
36
|
+
AWSEmailTC: () => AWSEmailTC,
|
|
37
|
+
AWSIPAddressTC: () => AWSIPAddressTC,
|
|
38
|
+
AWSJSONTC: () => AWSJSONTC,
|
|
39
|
+
AWSPhoneTC: () => AWSPhoneTC,
|
|
40
|
+
AWSTimeTC: () => AWSTimeTC,
|
|
41
|
+
AWSTimestampTC: () => AWSTimestampTC,
|
|
42
|
+
AWSURLTC: () => AWSURLTC,
|
|
34
43
|
createApiTemplate: () => createApiTemplate,
|
|
35
44
|
createAppSyncResolverHandler: () => createAppSyncResolverHandler
|
|
36
45
|
});
|
|
@@ -46,19 +55,19 @@ var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
|
46
55
|
var createApiTemplate = /* @__PURE__ */__name(({
|
|
47
56
|
additionalAuthenticationProviders,
|
|
48
57
|
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
49
|
-
schemaComposer,
|
|
58
|
+
schemaComposer: schemaComposer2,
|
|
50
59
|
dataSource,
|
|
51
60
|
lambdaFunction,
|
|
52
61
|
userPoolConfig,
|
|
53
62
|
customDomain
|
|
54
63
|
}) => {
|
|
55
|
-
const sdlWithoutComments =
|
|
64
|
+
const sdlWithoutComments = schemaComposer2.toSDL({
|
|
56
65
|
commentDescriptions: false,
|
|
57
66
|
omitDescriptions: true,
|
|
58
67
|
omitScalars: true
|
|
59
68
|
});
|
|
60
|
-
import_graphql_api.graphql.validateSchema(
|
|
61
|
-
const resolveMethods =
|
|
69
|
+
import_graphql_api.graphql.validateSchema(schemaComposer2.buildSchema());
|
|
70
|
+
const resolveMethods = schemaComposer2.getResolveMethods();
|
|
62
71
|
const resolveMethodsEntries = Object.entries(resolveMethods).flatMap(([typeName, fieldResolvers]) => {
|
|
63
72
|
return Object.entries(fieldResolvers).map(([fieldName, resolver]) => {
|
|
64
73
|
if (typeof resolver !== "function") {
|
|
@@ -316,7 +325,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
316
325
|
}) => {
|
|
317
326
|
return async (event, appSyncHandlerContext) => {
|
|
318
327
|
const {
|
|
319
|
-
schemaComposer
|
|
328
|
+
schemaComposer: schemaComposer2
|
|
320
329
|
} = buildSchemaInput;
|
|
321
330
|
const {
|
|
322
331
|
info,
|
|
@@ -345,7 +354,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
345
354
|
}
|
|
346
355
|
const argsWithEnumValues = (() => {
|
|
347
356
|
const fieldsArgsIsEnumType = field.args.filter(arg => {
|
|
348
|
-
return
|
|
357
|
+
return schemaComposer2.isEnumType(arg.type);
|
|
349
358
|
});
|
|
350
359
|
const enumArgs = fieldsArgsIsEnumType.map(enumArg => {
|
|
351
360
|
if (!args[enumArg.name]) {
|
|
@@ -353,7 +362,7 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
353
362
|
[enumArg.name]: enumArg.defaultValue
|
|
354
363
|
};
|
|
355
364
|
}
|
|
356
|
-
const values =
|
|
365
|
+
const values = schemaComposer2.getETC(enumArg.type).getFields();
|
|
357
366
|
return {
|
|
358
367
|
[enumArg.name]: values[args[enumArg.name]].value
|
|
359
368
|
};
|
|
@@ -375,8 +384,29 @@ var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
|
375
384
|
return response;
|
|
376
385
|
};
|
|
377
386
|
}, "createAppSyncResolverHandler");
|
|
387
|
+
|
|
388
|
+
// src/scalars.ts
|
|
389
|
+
var import_graphql_api3 = require("@ttoss/graphql-api");
|
|
390
|
+
var AWSJSONTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSJSON`);
|
|
391
|
+
var AWSDateTimeTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSDateTime`);
|
|
392
|
+
var AWSDateTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSDate`);
|
|
393
|
+
var AWSTimeTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSTime`);
|
|
394
|
+
var AWSTimestampTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSTimestamp`);
|
|
395
|
+
var AWSEmailTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSEmail`);
|
|
396
|
+
var AWSURLTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSURL`);
|
|
397
|
+
var AWSPhoneTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSPhone`);
|
|
398
|
+
var AWSIPAddressTC = import_graphql_api3.schemaComposer.createScalarTC(`scalar AWSIPAddress`);
|
|
378
399
|
// Annotate the CommonJS export names for ESM import in node:
|
|
379
400
|
0 && (module.exports = {
|
|
401
|
+
AWSDateTC,
|
|
402
|
+
AWSDateTimeTC,
|
|
403
|
+
AWSEmailTC,
|
|
404
|
+
AWSIPAddressTC,
|
|
405
|
+
AWSJSONTC,
|
|
406
|
+
AWSPhoneTC,
|
|
407
|
+
AWSTimeTC,
|
|
408
|
+
AWSTimestampTC,
|
|
409
|
+
AWSURLTC,
|
|
380
410
|
createApiTemplate,
|
|
381
411
|
createAppSyncResolverHandler
|
|
382
412
|
});
|