@aws-amplify/core 6.0.2-unstable.51ed7b4.0 → 6.0.2-unstable.a5eb335.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.
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.version = void 0;
5
5
  // generated by genversion
6
- exports.version = '6.0.2-unstable.51ed7b4.0+51ed7b4';
6
+ exports.version = '6.0.2-unstable.a5eb335.0+a5eb335';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.2-unstable.51ed7b4.0+51ed7b4';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
1
+ {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.2-unstable.a5eb335.0+a5eb335';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
@@ -2,7 +2,5 @@
2
2
 
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
- // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts
6
- // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../src/singleton/Auth/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts\n// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../../src/singleton/Auth/types.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 });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
@@ -1 +1 @@
1
- export declare const version = "6.0.2-unstable.51ed7b4.0+51ed7b4";
1
+ export declare const version = "6.0.2-unstable.a5eb335.0+a5eb335";
@@ -1,5 +1,5 @@
1
1
  // generated by genversion
2
- const version = '6.0.2-unstable.51ed7b4.0+51ed7b4';
2
+ const version = '6.0.2-unstable.a5eb335.0+a5eb335';
3
3
 
4
4
  export { version };
5
5
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.2-unstable.51ed7b4.0+51ed7b4';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.2-unstable.a5eb335.0+a5eb335';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
@@ -6,7 +6,7 @@ export { amplifyUuid } from './utils/amplifyUuid';
6
6
  export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
7
7
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
8
8
  export { isTokenExpired } from './singleton/Auth';
9
- export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
9
+ export { AssociationBelongsTo, AssociationHasMany, AssociationHasOne, DocumentType, GraphQLAuthMode, ModelFieldType, ModelIntrospectionSchema, SchemaModel, SchemaModels, } from './singleton/API/types';
10
10
  export { Signer } from './Signer';
11
11
  export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials, } from './singleton/Auth/types';
12
12
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
@@ -128,11 +128,12 @@ export type Field = {
128
128
  attributes?: FieldAttribute[];
129
129
  association?: AssociationType;
130
130
  };
131
+ export type ModelFieldType = {
132
+ model: string;
133
+ };
131
134
  export type FieldType = 'ID' | 'String' | 'Int' | 'Float' | 'AWSDate' | 'AWSTime' | 'AWSDateTime' | 'AWSTimestamp' | 'AWSEmail' | 'AWSURL' | 'AWSIPAddress' | 'Boolean' | 'AWSJSON' | 'AWSPhone' | {
132
135
  enum: string;
133
- } | {
134
- model: string;
135
- } | {
136
+ } | ModelFieldType | {
136
137
  nonModel: string;
137
138
  };
138
139
  export type FieldAttribute = ModelAttribute;
@@ -1,3 +1,4 @@
1
+ import { AtLeastOne } from '../types';
1
2
  interface JwtPayloadStandardFields {
2
3
  exp?: number;
3
4
  iss?: string;
@@ -55,7 +56,8 @@ export type AuthVerifiableAttributeKey = 'email' | 'phone_number';
55
56
  export type AuthConfigUserAttributes = Partial<Record<AuthStandardAttributeKey, {
56
57
  required: boolean;
57
58
  }>>;
58
- export type AuthConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
59
+ export type AuthConfig = AtLeastOne<CognitoProviderConfig>;
60
+ export type CognitoProviderConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
59
61
  type UnionKeys<T> = T extends T ? keyof T : never;
60
62
  type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
61
63
  export type StrictUnion<T> = StrictUnionHelper<T, T>;
@@ -1,5 +1,9 @@
1
- import { JWT, CognitoUserPoolWithOAuthConfig, CognitoUserPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoIdentityPoolConfig, StrictUnion } from '../types';
1
+ import { AuthConfig, JWT, CognitoUserPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoIdentityPoolConfig, StrictUnion, OAuthConfig } from '../types';
2
2
  export declare function assertTokenProviderConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoUserPoolAndIdentityPoolConfig | CognitoUserPoolConfig;
3
- export declare function assertOAuthConfig(cognitoConfig?: CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig): asserts cognitoConfig is CognitoUserPoolWithOAuthConfig;
3
+ export declare function assertOAuthConfig(cognitoConfig?: AuthConfig['Cognito']): asserts cognitoConfig is AuthConfig['Cognito'] & {
4
+ loginWith: {
5
+ oauth: OAuthConfig;
6
+ };
7
+ };
4
8
  export declare function assertIdentityPoolIdConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoIdentityPoolConfig;
5
9
  export declare function decodeJWT(token: string): JWT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.0.2-unstable.51ed7b4.0+51ed7b4",
3
+ "version": "6.0.2-unstable.a5eb335.0+a5eb335",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@aws-amplify/react-native": "1.0.2-unstable.51ed7b4.0+51ed7b4",
63
+ "@aws-amplify/react-native": "1.0.2-unstable.a5eb335.0+a5eb335",
64
64
  "@rollup/plugin-typescript": "11.1.5",
65
65
  "@types/js-cookie": "3.0.2",
66
66
  "genversion": "^2.2.0",
@@ -234,5 +234,5 @@
234
234
  "dist"
235
235
  ]
236
236
  },
237
- "gitHead": "51ed7b4ecb1a47b6a17635011169056bec518df9"
237
+ "gitHead": "a5eb33543190fc91fe840eb65e86eaf4c541c3c7"
238
238
  }
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.0.2-unstable.51ed7b4.0+51ed7b4';
2
+ export const version = '6.0.2-unstable.a5eb335.0+a5eb335';
@@ -31,7 +31,17 @@ export {
31
31
  assertOAuthConfig,
32
32
  } from './singleton/Auth/utils';
33
33
  export { isTokenExpired } from './singleton/Auth';
34
- export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
34
+ export {
35
+ AssociationBelongsTo,
36
+ AssociationHasMany,
37
+ AssociationHasOne,
38
+ DocumentType,
39
+ GraphQLAuthMode,
40
+ ModelFieldType,
41
+ ModelIntrospectionSchema,
42
+ SchemaModel,
43
+ SchemaModels,
44
+ } from './singleton/API/types';
35
45
  export { Signer } from './Signer';
36
46
  export {
37
47
  JWT,
@@ -151,6 +151,9 @@ export type Field = {
151
151
  attributes?: FieldAttribute[];
152
152
  association?: AssociationType;
153
153
  };
154
+
155
+ export type ModelFieldType = { model: string };
156
+
154
157
  export type FieldType =
155
158
  | 'ID'
156
159
  | 'String'
@@ -167,7 +170,7 @@ export type FieldType =
167
170
  | 'AWSJSON'
168
171
  | 'AWSPhone'
169
172
  | { enum: string }
170
- | { model: string }
173
+ | ModelFieldType
171
174
  | { nonModel: string };
172
175
  export type FieldAttribute = ModelAttribute;
173
176
 
@@ -1,8 +1,10 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { AtLeastOne } from '../types';
5
+
3
6
  // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts
4
7
  // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts
5
-
6
8
  interface JwtPayloadStandardFields {
7
9
  exp?: number; // expires: https://tools.ietf.org/html/rfc7519#section-4.1.4
8
10
  iss?: string; // issuer: https://tools.ietf.org/html/rfc7519#section-4.1.1
@@ -97,7 +99,9 @@ export type AuthConfigUserAttributes = Partial<
97
99
  Record<AuthStandardAttributeKey, { required: boolean }>
98
100
  >;
99
101
 
100
- export type AuthConfig = StrictUnion<
102
+ export type AuthConfig = AtLeastOne<CognitoProviderConfig>;
103
+
104
+ export type CognitoProviderConfig = StrictUnion<
101
105
  | AuthIdentityPoolConfig
102
106
  | AuthUserPoolConfig
103
107
  | AuthUserPoolAndIdentityPoolConfig
@@ -2,7 +2,6 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { AuthConfigurationErrorCode, assert } from './errorHelpers';
4
4
  import { base64Decoder } from '../../../utils/convert';
5
-
6
5
  import {
7
6
  AuthConfig,
8
7
  JWT,
@@ -12,6 +11,7 @@ import {
12
11
  CognitoUserPoolAndIdentityPoolConfig,
13
12
  CognitoIdentityPoolConfig,
14
13
  StrictUnion,
14
+ OAuthConfig,
15
15
  } from '../types';
16
16
 
17
17
  export function assertTokenProviderConfig(
@@ -38,20 +38,22 @@ export function assertTokenProviderConfig(
38
38
  }
39
39
 
40
40
  export function assertOAuthConfig(
41
- cognitoConfig?: CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig
42
- ): asserts cognitoConfig is CognitoUserPoolWithOAuthConfig {
41
+ cognitoConfig?: AuthConfig['Cognito']
42
+ ): asserts cognitoConfig is AuthConfig['Cognito'] & {
43
+ loginWith: {
44
+ oauth: OAuthConfig;
45
+ };
46
+ } {
43
47
  const validOAuthConfig =
44
48
  !!cognitoConfig?.loginWith?.oauth?.domain &&
45
49
  !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&
46
50
  !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&
47
51
  !!cognitoConfig?.loginWith?.oauth?.responseType;
48
-
49
52
  return assert(
50
53
  validOAuthConfig,
51
54
  AuthConfigurationErrorCode.OAuthNotConfigureException
52
55
  );
53
56
  }
54
-
55
57
  export function assertIdentityPoolIdConfig(
56
58
  cognitoConfig?: StrictUnion<
57
59
  | CognitoUserPoolConfig