@aws-amplify/data-schema 0.16.0 → 0.16.2
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/cjs/runtime/index.v3.js +0 -5
- package/dist/cjs/runtime/index.v3.js.map +1 -1
- package/dist/esm/MappedTypes/CustomOperations.d.ts +4 -4
- package/dist/esm/MappedTypes/ResolveFieldProperties.d.ts +2 -2
- package/dist/esm/runtime/bridge-types.d.ts +1 -1
- package/dist/esm/runtime/client/index.v3.d.ts +40 -0
- package/dist/esm/runtime/index.v3.d.ts +2 -3
- package/dist/esm/runtime/index.v3.mjs +0 -2
- package/dist/esm/runtime/index.v3.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/runtime/package.json +14 -2
- package/src/MappedTypes/CustomOperations.ts +23 -22
- package/src/MappedTypes/ResolveFieldProperties.ts +2 -2
- package/src/runtime/bridge-types.ts +1 -1
- package/src/runtime/client/index.v3.ts +46 -0
- package/src/runtime/index.v3.ts +8 -3
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addSchemaToClientWithInstance = exports.addSchemaToClient = void 0;
|
|
7
6
|
const tslib_1 = require("tslib");
|
|
8
7
|
tslib_1.__exportStar(require("./client/index.v3"), exports);
|
|
9
|
-
var addSchemaToClient_1 = require("./addSchemaToClient");
|
|
10
|
-
Object.defineProperty(exports, "addSchemaToClient", { enumerable: true, get: function () { return addSchemaToClient_1.addSchemaToClient; } });
|
|
11
|
-
var addSchemaToClientWithInstance_1 = require("./addSchemaToClientWithInstance");
|
|
12
|
-
Object.defineProperty(exports, "addSchemaToClientWithInstance", { enumerable: true, get: function () { return addSchemaToClientWithInstance_1.addSchemaToClientWithInstance; } });
|
|
13
8
|
//# sourceMappingURL=index.v3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.v3.js","sources":["../../../src/runtime/index.v3.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\
|
|
1
|
+
{"version":3,"file":"index.v3.js","sources":["../../../src/runtime/index.v3.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./client/index.v3\"), exports);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;;"}
|
|
@@ -3,7 +3,7 @@ import type { NonModelTypesShape } from './ExtractNonModelTypes';
|
|
|
3
3
|
import type { CustomOperation, CustomOperationParamShape } from '../CustomOperation';
|
|
4
4
|
import type { ModelField } from '../ModelField';
|
|
5
5
|
import type { RefType, RefTypeParamShape } from '../RefType';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ResolveFieldRequirements, ResolveRefsOfCustomType, ResolveRefValueArrayTraits } from './ResolveFieldProperties';
|
|
7
7
|
import type { AppSyncResolverHandler } from 'aws-lambda';
|
|
8
8
|
import type { CustomType } from '../CustomType';
|
|
9
9
|
import type { FieldTypesOfCustomType } from './ResolveSchema';
|
|
@@ -30,15 +30,15 @@ export type CustomOpShapes<Schema extends GenericModelSchema<any>> = {
|
|
|
30
30
|
/**
|
|
31
31
|
* Digs out custom operation arguments, mapped to the intended graphql types.
|
|
32
32
|
*/
|
|
33
|
-
export type CustomOpArguments<Shape extends CustomOperationParamShape> = Shape['arguments'] extends null ? never : {
|
|
33
|
+
export type CustomOpArguments<Shape extends CustomOperationParamShape> = Shape['arguments'] extends null ? never : ResolveFieldRequirements<{
|
|
34
34
|
[FieldName in keyof Shape['arguments']]: Shape['arguments'][FieldName] extends ModelField<infer R, any, any> ? R : never;
|
|
35
|
-
}
|
|
35
|
+
}>;
|
|
36
36
|
/**
|
|
37
37
|
* Computes the return type from the `returnType` of a custom operation shape.
|
|
38
38
|
*
|
|
39
39
|
* This entails dereferencing refs and inferring graphql types from field-type defs.
|
|
40
40
|
*/
|
|
41
|
-
export type CustomOpReturnType<Shape extends CustomOperationParamShape, FullyResolvedSchema extends Record<string, unknown>, NonModelTypes extends NonModelTypesShape, CustomOperations extends Record<string, CustomOperationParamShape>> = Shape['returnType'] extends RefType<infer RefShape, any, any> ? RefShape['link'] extends keyof CustomOperations ? CustomOpReturnType<CustomOperations[RefShape['link']], FullyResolvedSchema, NonModelTypes, CustomOperations> : ResolveRef<RefShape, FullyResolvedSchema, NonModelTypes, CustomOperations> : Shape['returnType'] extends ModelField<infer R, any, any> ? R : Shape['returnType'] extends CustomType<infer R> ?
|
|
41
|
+
export type CustomOpReturnType<Shape extends CustomOperationParamShape, FullyResolvedSchema extends Record<string, unknown>, NonModelTypes extends NonModelTypesShape, CustomOperations extends Record<string, CustomOperationParamShape>> = Shape['returnType'] extends RefType<infer RefShape, any, any> ? RefShape['link'] extends keyof CustomOperations ? CustomOpReturnType<CustomOperations[RefShape['link']], FullyResolvedSchema, NonModelTypes, CustomOperations> : ResolveRef<RefShape, FullyResolvedSchema, NonModelTypes, CustomOperations> : Shape['returnType'] extends ModelField<infer R, any, any> ? R : Shape['returnType'] extends CustomType<infer R> ? ResolveFieldRequirements<FieldTypesOfCustomType<{
|
|
42
42
|
thisCustomType: R['fields'];
|
|
43
43
|
}>['thisCustomType']> | null : never;
|
|
44
44
|
/**
|
|
@@ -28,8 +28,8 @@ export type ResolveRef<NonModelTypes extends NonModelTypesShape, Ref extends Ref
|
|
|
28
28
|
export type ResolveRefValueArrayTraits<Ref extends RefTypeParamShape, Value> = Ref['array'] extends false ? Value : Ref['arrayRequired'] extends true ? Array<Value> : Array<Value> | null;
|
|
29
29
|
export type ResolveRefsOfCustomType<NonModelTypes extends NonModelTypesShape, T> = {
|
|
30
30
|
[Prop in keyof T]: T[Prop] extends RefType<infer R extends RefTypeParamShape, any, any> | null ? ResolveRef<NonModelTypes, R> : T[Prop];
|
|
31
|
-
} extends infer Resolved ?
|
|
32
|
-
export type
|
|
31
|
+
} extends infer Resolved ? ResolveFieldRequirements<Resolved> : never;
|
|
32
|
+
export type ResolveFieldRequirements<Resolved> = Intersection<ExtractNullableFieldsToOptionalFields<Resolved>, ExtractNonNullableFieldsToRequiredFields<Resolved>>;
|
|
33
33
|
type ResolveModelsRelationalAndRefFields<Schema, NonModelTypes extends NonModelTypesShape, Flat extends boolean = false> = {
|
|
34
34
|
[ModelProp in keyof Schema]: {
|
|
35
35
|
[FieldProp in keyof Schema[ModelProp]]: Schema[ModelProp][FieldProp] extends RefType<infer R extends RefTypeParamShape, any, any> | null ? ResolveRef<NonModelTypes, R> : Schema[ModelProp][FieldProp] extends ModelRelationalFieldParamShape ? Schema[ModelProp][FieldProp]['relatedModel'] extends keyof Schema ? GetRelationshipRef<Schema, Schema[ModelProp][FieldProp]['relatedModel'], Schema[ModelProp][FieldProp], Flat> : never : Schema[ModelProp][FieldProp];
|
|
@@ -264,7 +264,7 @@ export type ClientInternals = {
|
|
|
264
264
|
authToken: string | undefined;
|
|
265
265
|
headers: CustomHeaders | undefined;
|
|
266
266
|
};
|
|
267
|
-
export type ClientInternalsGetter = (client:
|
|
267
|
+
export type ClientInternalsGetter = (client: BaseClient) => ClientInternals;
|
|
268
268
|
export type BaseClient = BaseBrowserClient | BaseSSRClient;
|
|
269
269
|
export type BaseBrowserClient = {
|
|
270
270
|
graphql: GraphQLMethod;
|
|
@@ -9,7 +9,47 @@ export type SelectionSet<_Model, _Path> = any;
|
|
|
9
9
|
* promise.
|
|
10
10
|
*/
|
|
11
11
|
export type CustomHeaders = Record<string, string> | (() => Promise<Record<string, string>>);
|
|
12
|
+
/**
|
|
13
|
+
* Request options that are passed to custom header functions.
|
|
14
|
+
* `method` and `headers` are not included in custom header functions passed to
|
|
15
|
+
* subscriptions.
|
|
16
|
+
*/
|
|
17
|
+
export type RequestOptions = {
|
|
18
|
+
url: string;
|
|
19
|
+
queryString: string;
|
|
20
|
+
method?: string;
|
|
21
|
+
};
|
|
12
22
|
export type CustomQueries<Schema extends Record<any, any>, _Context extends string = 'CLIENT', _ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = any;
|
|
13
23
|
export type CustomMutations<Schema extends Record<any, any>, _Context extends string = 'CLIENT', _ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = any;
|
|
14
24
|
export type CustomSubscriptions<Schema extends Record<any, any>, _Context extends string = 'CLIENT', _ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = any;
|
|
15
25
|
export type ModelSortDirection = 'ASC' | 'DESC';
|
|
26
|
+
export type ClientExtensions<T extends Record<any, any> = never> = {
|
|
27
|
+
models: ModelTypes<T>;
|
|
28
|
+
enums: EnumTypes<T>;
|
|
29
|
+
queries: CustomQueries<T, 'CLIENT'>;
|
|
30
|
+
mutations: CustomMutations<T, 'CLIENT'>;
|
|
31
|
+
subscriptions: CustomSubscriptions<T, 'CLIENT'>;
|
|
32
|
+
};
|
|
33
|
+
export type ClientExtensionsSSRRequest<T extends Record<any, any> = never> = {
|
|
34
|
+
models: ModelTypes<T, 'REQUEST'>;
|
|
35
|
+
enums: EnumTypes<T>;
|
|
36
|
+
queries: CustomQueries<T, 'REQUEST'>;
|
|
37
|
+
mutations: CustomMutations<T, 'REQUEST'>;
|
|
38
|
+
};
|
|
39
|
+
export type ClientExtensionsSSRCookies<T extends Record<any, any> = never> = {
|
|
40
|
+
models: ModelTypes<T, 'COOKIES'>;
|
|
41
|
+
enums: EnumTypes<T>;
|
|
42
|
+
queries: CustomQueries<T, 'COOKIES'>;
|
|
43
|
+
mutations: CustomMutations<T, 'COOKIES'>;
|
|
44
|
+
};
|
|
45
|
+
export type ClientInternals = {
|
|
46
|
+
amplify: any;
|
|
47
|
+
authMode: any;
|
|
48
|
+
authToken: string | undefined;
|
|
49
|
+
headers: CustomHeaders | undefined;
|
|
50
|
+
};
|
|
51
|
+
export type BaseClient = {
|
|
52
|
+
graphql(...args: any): Promise<Record<string, any>>;
|
|
53
|
+
cancel(promise: Promise<any>, message?: string): boolean;
|
|
54
|
+
isCancelError(error: any): boolean;
|
|
55
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export * from './client/index.v3';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { BaseClient, ClientInternals } from './bridge-types';
|
|
2
|
+
export declare function addSchemaToClient<_T extends Record<any, any> = never>(client: any, apiGraphqlConfig: any, getInternals: any): any;
|
|
3
|
+
export declare function addSchemaToClientWithInstance<_T extends Record<any, any>>(client: any, params: any, getInternals: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.v3.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.v3.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|