@aws-amplify/data-schema 0.16.0 → 0.16.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/data-schema",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,6 +34,7 @@
34
34
  },
35
35
  "./runtime": {
36
36
  "types": "./dist/esm/runtime/index.d.ts",
37
+ "types@<5": "./dist/esm/runtime/index.v3.d.ts",
37
38
  "import": "./dist/esm/runtime/index.mjs",
38
39
  "require": "./dist/cjs/runtime/index.js",
39
40
  "node": "./dist/esm/index.mjs"
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "name": "@aws-amplify/data-schema/runtime",
3
3
  "main": "../dist/cjs/runtime/index.js",
4
+ "typings": "./defer-to-types-versions",
4
5
  "module": "../dist/esm/runtime/index.mjs",
5
- "types": "../dist/esm/runtime/index.d.ts",
6
6
  "react-native": "../src/runtime/index.ts",
7
- "sideEffects": false
7
+ "sideEffects": false,
8
+ "typesVersions": {
9
+ "<5": {
10
+ "defer-to-types-versions": [
11
+ "../dist/esm/runtime/index.v3.d.ts"
12
+ ]
13
+ },
14
+ ">=5": {
15
+ "defer-to-types-versions": [
16
+ "../dist/esm/runtime/index.d.ts"
17
+ ]
18
+ }
19
+ }
8
20
  }
@@ -355,7 +355,7 @@ export type ClientInternals = {
355
355
  headers: CustomHeaders | undefined;
356
356
  };
357
357
 
358
- export type ClientInternalsGetter = (client: any) => ClientInternals;
358
+ export type ClientInternalsGetter = (client: BaseClient) => ClientInternals;
359
359
 
360
360
  export type BaseClient = BaseBrowserClient | BaseSSRClient;
361
361
 
@@ -31,6 +31,17 @@ export type CustomHeaders =
31
31
  | Record<string, string>
32
32
  | (() => Promise<Record<string, string>>);
33
33
 
34
+ /**
35
+ * Request options that are passed to custom header functions.
36
+ * `method` and `headers` are not included in custom header functions passed to
37
+ * subscriptions.
38
+ */
39
+ export type RequestOptions = {
40
+ url: string;
41
+ queryString: string;
42
+ method?: string;
43
+ };
44
+
34
45
  export type CustomQueries<
35
46
  Schema extends Record<any, any>,
36
47
  _Context extends string = 'CLIENT',
@@ -50,3 +61,38 @@ export type CustomSubscriptions<
50
61
  > = any;
51
62
 
52
63
  export type ModelSortDirection = 'ASC' | 'DESC';
64
+
65
+ export type ClientExtensions<T extends Record<any, any> = never> = {
66
+ models: ModelTypes<T>;
67
+ enums: EnumTypes<T>;
68
+ queries: CustomQueries<T, 'CLIENT'>;
69
+ mutations: CustomMutations<T, 'CLIENT'>;
70
+ subscriptions: CustomSubscriptions<T, 'CLIENT'>;
71
+ };
72
+
73
+ export type ClientExtensionsSSRRequest<T extends Record<any, any> = never> = {
74
+ models: ModelTypes<T, 'REQUEST'>;
75
+ enums: EnumTypes<T>;
76
+ queries: CustomQueries<T, 'REQUEST'>;
77
+ mutations: CustomMutations<T, 'REQUEST'>;
78
+ };
79
+
80
+ export type ClientExtensionsSSRCookies<T extends Record<any, any> = never> = {
81
+ models: ModelTypes<T, 'COOKIES'>;
82
+ enums: EnumTypes<T>;
83
+ queries: CustomQueries<T, 'COOKIES'>;
84
+ mutations: CustomMutations<T, 'COOKIES'>;
85
+ };
86
+
87
+ export type ClientInternals = {
88
+ amplify: any;
89
+ authMode: any;
90
+ authToken: string | undefined;
91
+ headers: CustomHeaders | undefined;
92
+ };
93
+
94
+ export type BaseClient = {
95
+ graphql(...args: any): Promise<Record<string, any>>;
96
+ cancel(promise: Promise<any>, message?: string): boolean;
97
+ isCancelError(error: any): boolean;
98
+ };
@@ -2,6 +2,11 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export * from './client/index.v3';
5
- export { addSchemaToClient } from './addSchemaToClient';
6
- export { addSchemaToClientWithInstance } from './addSchemaToClientWithInstance';
7
- export { BaseClient, ClientInternals } from './bridge-types';
5
+ export declare function addSchemaToClient<_T extends Record<any, any> = never>(
6
+ client: any,
7
+ apiGraphqlConfig: any,
8
+ getInternals: any,
9
+ ): any;
10
+ export declare function addSchemaToClientWithInstance<
11
+ _T extends Record<any, any>,
12
+ >(client: any, params: any, getInternals: any): any;