@lifeready/core 5.0.1 → 5.0.3

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.
Files changed (59) hide show
  1. package/bundles/lifeready-core.umd.js +329 -307
  2. package/bundles/lifeready-core.umd.js.map +1 -1
  3. package/bundles/lifeready-core.umd.min.js +1 -1
  4. package/bundles/lifeready-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/_common/ast.js +4 -4
  6. package/esm2015/lib/_common/exceptions.js +129 -103
  7. package/esm2015/lib/_common/run-outside-angular.js +3 -3
  8. package/esm2015/lib/_common/storage.js +3 -3
  9. package/esm2015/lib/_common/types.js +1 -1
  10. package/esm2015/lib/_common/utils.js +1 -12
  11. package/esm2015/lib/api/lr-graphql/lr-graphql.service.js +4 -4
  12. package/esm2015/lib/api/lr-graphql/lr-merged-mutation.js +4 -4
  13. package/esm2015/lib/api/lr-graphql/lr-mutation-base.js +3 -3
  14. package/esm2015/lib/api/query-processor/common-processors.service.js +3 -3
  15. package/esm2015/lib/api/query-processor/query-processor.service.js +4 -4
  16. package/esm2015/lib/api/query-processor/tp-password-reset-processor.service.js +3 -3
  17. package/esm2015/lib/api/types/lr-graphql.types.js +1 -1
  18. package/esm2015/lib/auth/auth.types.js +1 -8
  19. package/esm2015/lib/auth/life-ready-auth.service.js +7 -9
  20. package/esm2015/lib/category/category.gql.js +2 -2
  21. package/esm2015/lib/category/category.service.js +5 -5
  22. package/esm2015/lib/encryption/encryption.service.js +4 -7
  23. package/esm2015/lib/file-upload/file-upload.service.js +2 -3
  24. package/esm2015/lib/idle/idle.service.js +6 -7
  25. package/esm2015/lib/item2/item2.service.js +3 -3
  26. package/esm2015/lib/key/key-factory.service.js +8 -8
  27. package/esm2015/lib/key/key-graph.service.js +7 -9
  28. package/esm2015/lib/key/key.service.js +5 -5
  29. package/esm2015/lib/key/key.types.js +1 -1
  30. package/esm2015/lib/key-exchange/key-exchange.service.js +3 -3
  31. package/esm2015/lib/key-exchange/key-exchange2.service.js +3 -3
  32. package/esm2015/lib/lbop/lbop.service.js +13 -10
  33. package/esm2015/lib/life-ready.config.js +15 -4
  34. package/esm2015/lib/password/password.service.js +4 -5
  35. package/esm2015/lib/persist/persist.service.js +3 -3
  36. package/esm2015/lib/plan/plan.service.js +3 -3
  37. package/esm2015/lib/profile/profile.types.js +8 -1
  38. package/esm2015/lib/scenario/scenario.service.js +4 -4
  39. package/esm2015/lib/time/time.service.js +3 -6
  40. package/esm2015/lib/tp-assembly/tp-assembly.js +7 -7
  41. package/esm2015/lib/tp-password-reset/tp-password-reset-request.service.js +3 -3
  42. package/esm2015/lib/trusted-party/trusted-party.gql.js +3 -3
  43. package/esm2015/lib/trusted-party/trusted-party.service.js +2 -2
  44. package/esm2015/lib/trusted-party/trusted-party2.service.js +4 -4
  45. package/esm2015/lib/two-factor/two-factor.service.js +3 -3
  46. package/fesm2015/lifeready-core.js +219 -200
  47. package/fesm2015/lifeready-core.js.map +1 -1
  48. package/lib/_common/exceptions.d.ts +54 -38
  49. package/lib/_common/types.d.ts +0 -4
  50. package/lib/_common/utils.d.ts +0 -8
  51. package/lib/api/types/lr-graphql.types.d.ts +1 -1
  52. package/lib/auth/auth.types.d.ts +1 -9
  53. package/lib/category/category.gql.d.ts +1 -1
  54. package/lib/key/key.types.d.ts +4 -1
  55. package/lib/lbop/lbop.service.d.ts +4 -0
  56. package/lib/life-ready.config.d.ts +7 -0
  57. package/lib/profile/profile.types.d.ts +8 -1
  58. package/lifeready-core.metadata.json +1 -1
  59. package/package.json +1 -1
@@ -1,6 +1,20 @@
1
1
  import { GraphQLError } from 'graphql';
2
2
  export declare function handleApolloError(errors: ReadonlyArray<GraphQLError>): void;
3
- export declare class LrError {
3
+ export declare class KcError {
4
+ /**
5
+ * The _tag prevents being able to return an object when a class is required:
6
+ * ref: https://medium.com/decathlondevelopers/whats-the-problem-with-typescript-s-classes-2e60aaad3f6
7
+ * Example:
8
+ * // This works because KcError is being treated as a type.
9
+ * function test(): KcError {
10
+ * return {message: "123"};
11
+ * }
12
+ * With the private _tag property, the above will cause a compiler error because _tag property is missing
13
+ * from the returned object.
14
+ *
15
+ * The _type property also provides a type indicator when serialising the class to POJO.
16
+ */
17
+ private _type;
4
18
  code?: string;
5
19
  source?: string;
6
20
  message: string;
@@ -11,13 +25,19 @@ export declare class LrError {
11
25
  }[];
12
26
  path: string[];
13
27
  };
14
- }
15
- export declare class LrException {
16
- errors: LrError[];
17
- constructor(...errors: LrError[]);
28
+ constructor(options: Partial<KcError>);
29
+ }
30
+ export declare class KcException {
31
+ private _type;
32
+ errors: KcError[];
33
+ /**
34
+ *
35
+ * @param errors Each argument is a KcError.
36
+ */
37
+ constructor(...errors: KcError[]);
18
38
  toString(): string[];
19
39
  }
20
- export declare enum LrApiErrorCode {
40
+ export declare enum KcErrorCode {
21
41
  ARCHIVED_RESOURCE = "ARCHIVED_RESOURCE",
22
42
  BAD_ARGUMENT = "BAD_ARGUMENT",
23
43
  BAD_SIGNATURE = "BAD_SIGNATURE",
@@ -47,63 +67,59 @@ export declare enum LrApiErrorCode {
47
67
  UNAUTHENTICATED_USER = "UNAUTHENTICATED_USER",
48
68
  USER_NOT_FOUND = "USER_NOT_FOUND",
49
69
  VERSION_MISMATCH = "VERSION_MISMATCH",
50
- WRONG_PERMISSIONS = "WRONG_PERMISSIONS"
51
- }
52
- export declare enum LrErrorCode {
53
- BadTimeSync = "LrBadTimeSync",
54
- ReceiveClaimMismatch = "LrReceiveClaimMismatch",
55
- BadState = "LrBadState",
56
- BadSignature = "LrBadSignature",
57
- Auth = "LrAuth",
58
- BadArgument = "LrBadArgument",
59
- SuspiciousException = "LrSuspiciousException",
60
- NotFound = "LrNotFound",
61
- BadLogic = "LrBadLogicException",
62
- CodeMismatch = "LrCodeMismatchException",
63
- ConcurrentAccess = "LrConcurrentAccessException",
64
- BadRequest = "LrBadRequestException",
65
- Encryption = "LrEncryptionGoBad",
66
- Locked = "LrLockedException"
67
- }
68
- export declare class LrBadArgumentException extends LrException {
70
+ WRONG_PERMISSIONS = "WRONG_PERMISSIONS",
71
+ AUTH = "AUTH",
72
+ BAD_LOGIC = "BAD_LOGIC",
73
+ BAD_REQUEST = "BAD_REQUEST",
74
+ BAD_TIME_SYNC = "BAD_TIME_SYNC",
75
+ CODE_MISMATCH = "CODE_MISMATCH",
76
+ ENCRYPTION = "ENCRYPTION",
77
+ NOT_FOUND = "NOT_FOUND",
78
+ SUSPICIOUS_OPERATION = "SUSPICIOUS_OPERATION",
79
+ UNSUPPORTED = "UNSUPPORTED"
80
+ }
81
+ export declare class KcAuthException extends KcException {
69
82
  constructor(message: any);
70
83
  }
71
- export declare class LrSuspiciousException extends LrException {
84
+ export declare class KcBadArgumentException extends KcException {
85
+ constructor(message: string);
86
+ }
87
+ export declare class KcBadLogicException extends KcException {
72
88
  constructor(message: any);
73
89
  }
74
- export declare class LrNotFoundException extends LrException {
90
+ export declare class KcBadRequestException extends KcException {
75
91
  constructor(message: any);
76
92
  }
77
- export declare class LrBadLogicException extends LrException {
93
+ export declare class KcBadSignatureException extends KcException {
78
94
  constructor(message: any);
79
95
  }
80
- export declare class LrCodeMismatchException extends LrException {
96
+ export declare class KcBadStateException extends KcException {
81
97
  constructor(message: any);
82
98
  }
83
- export declare class LrConcurrentAccessException extends LrException {
99
+ export declare class KcBadTimeSyncException extends KcException {
84
100
  constructor(message: any);
85
101
  }
86
- export declare class LrLockedException extends LrException {
102
+ export declare class KcCodeMismatchException extends KcException {
87
103
  constructor(message: any);
88
104
  }
89
- export declare class LrBadRequestException extends LrException {
105
+ export declare class KcConcurrentAccessException extends KcException {
90
106
  constructor(message: any);
91
107
  }
92
- export declare class LrAuthException extends LrException {
108
+ export declare class KcEncryptionException extends KcException {
93
109
  constructor(message: any);
94
110
  }
95
- export declare class LrEncryptionException extends LrException {
111
+ export declare class KcInternalErrorException extends KcException {
96
112
  constructor(message: any);
97
113
  }
98
- export declare class LrUnsupportedException extends LrException {
114
+ export declare class KcLockedException extends KcException {
99
115
  constructor(message: any);
100
116
  }
101
- export declare class LrExpiredCodeException extends LrException {
117
+ export declare class KcNotFoundException extends KcException {
102
118
  constructor(message: any);
103
119
  }
104
- export declare class LrExpiredException extends LrException {
120
+ export declare class KcSuspiciousOperationException extends KcException {
105
121
  constructor(message: any);
106
122
  }
107
- export declare class LrBadStateException extends LrException {
123
+ export declare class KcUnsupportedException extends KcException {
108
124
  constructor(message: any);
109
125
  }
@@ -1,4 +1,3 @@
1
- import { HasKeyGraph } from '../key/key.types';
2
1
  export declare type SomePartial<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
3
2
  export declare type SomeRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;
4
3
  export interface Edge<T> {
@@ -7,7 +6,4 @@ export interface Edge<T> {
7
6
  export interface HasEdges<T> {
8
7
  edges: Edge<T>[];
9
8
  }
10
- export interface HasKeyGraphEdges<T> extends HasKeyGraph {
11
- list: HasEdges<T>;
12
- }
13
9
  export declare type MayAsync<T> = T | Promise<T>;
@@ -1,5 +1,4 @@
1
1
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
2
- import { KcConfig } from '../life-ready.config';
3
2
  export declare function promiseAllMayAsync(values: any[]): Promise<any> | any;
4
3
  export declare function mapValuesMayAsync(obj: Record<string, any>, callback: (value: any, key: string, obj: Record<string, any>) => any | Promise<any>): Promise<any> | any;
5
4
  export declare function mapValuesAsync(obj: Record<string, any>, callback?: (value: any, key: string, obj: Record<string, any>) => any | Promise<any>): Promise<any>;
@@ -10,10 +9,3 @@ export declare function mapValuesAsync(obj: Record<string, any>, callback?: (val
10
9
  */
11
10
  export declare function undefinedDefault(value: any, defaultValue: any): any;
12
11
  export declare function getAccessJwtToken(auth: AuthClass): Promise<string>;
13
- export declare function httpOptions(auth: AuthClass, config: KcConfig): Promise<{
14
- withCredentials: boolean;
15
- headers: {
16
- 'x-kc-dev-user': string;
17
- authorization: string;
18
- };
19
- }>;
@@ -317,7 +317,7 @@ export interface TpNode extends Node, TimeStamped {
317
317
  sharedContactCard?: SharedContactCardNode;
318
318
  myContactCard?: SharedContactCardNode;
319
319
  myItems?: SharedItems;
320
- sharedItems?: SharedItems;
320
+ theirItems?: SharedItems;
321
321
  myScenarios?: Connection<ScenarioNode>;
322
322
  sharedScenarios?: Connection<SharedScenarioNode>;
323
323
  }
@@ -3,7 +3,7 @@ import { JWK } from 'node-jose';
3
3
  import { JSONObject, TpPasswordResetUserNode, UserDeleteNode } from '../api/types';
4
4
  import { PassIdpParams, PassKeyParams } from '../key/key.types';
5
5
  import { UserPlan } from '../plan/plan.types';
6
- import { CurrentUserKey, MainContactCard } from '../profile/profile.types';
6
+ import { CurrentUserKey, Features, MainContactCard } from '../profile/profile.types';
7
7
  export interface PassKeyBundle {
8
8
  passKeyParams: PassKeyParams;
9
9
  passKey: JWK.Key;
@@ -18,14 +18,6 @@ export declare class CognitoChallengeUser extends CognitoUser {
18
18
  challengeParam: JSONObject;
19
19
  isTpPasswordResetUser: boolean;
20
20
  }
21
- export declare enum FeatureAction {
22
- ACCESS = "access"
23
- }
24
- export declare class Features {
25
- myVault: FeatureAction[];
26
- tpVault: FeatureAction[];
27
- shareVault: FeatureAction[];
28
- }
29
21
  export declare class CurrentUser {
30
22
  id: string;
31
23
  sub: string;
@@ -17,7 +17,7 @@ export declare const GetCategoriesQuery: import("graphql").DocumentNode;
17
17
  export declare const GetVaultsQuery: import("graphql").DocumentNode;
18
18
  export interface GetTrustedPartyCategoriesQueryType extends HasKeyGraph {
19
19
  tp: {
20
- sharedItems: {
20
+ theirItems: {
21
21
  list: HasEdges<any>;
22
22
  records: HasEdges<any>;
23
23
  };
@@ -1,6 +1,6 @@
1
1
  import { JWK } from 'node-jose';
2
2
  import { JSONObject, PassKeyNode } from '../api/types';
3
- import { SomeRequired } from '../_common/types';
3
+ import { HasEdges, SomeRequired } from '../_common/types';
4
4
  export interface Key {
5
5
  id: string;
6
6
  pbk?: string;
@@ -77,3 +77,6 @@ export interface DerivePassKeyParams extends PassKeyParams {
77
77
  export interface DeriveLbopKeyParams extends PassKeyParams {
78
78
  password: CryptoKey;
79
79
  }
80
+ export interface HasKeyGraphEdges<T> extends HasKeyGraph {
81
+ list: HasEdges<T>;
82
+ }
@@ -10,6 +10,10 @@ import { KeyService } from '../key/key.service';
10
10
  import { PassKeyParams } from '../key/key.types';
11
11
  import { KcConfig } from '../life-ready.config';
12
12
  import { PasswordService } from '../password/password.service';
13
+ export declare const ERROR_SOURCE = "LBOP";
14
+ export declare enum KcLbopErrorCode {
15
+ INVALID_PASSPHRASE = "INVALID_PASSPHRASE"
16
+ }
13
17
  export interface SetPasswordParams {
14
18
  lbopId: string;
15
19
  newPassword: CryptoKey;
@@ -2,6 +2,13 @@ import { InjectionToken } from '@angular/core';
2
2
  import { ApolloClientOptions } from '@apollo/client/core';
3
3
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
4
4
  export declare const KC_CONFIG: InjectionToken<KcConfig>;
5
+ export declare function httpOptions(auth: AuthClass, config: KcConfig): Promise<{
6
+ withCredentials: boolean;
7
+ headers: {
8
+ 'x-kc-dev-user': string;
9
+ authorization: string;
10
+ };
11
+ }>;
5
12
  export interface KcConfig {
6
13
  authUrl: string;
7
14
  apiUrl: string;
@@ -1,6 +1,13 @@
1
1
  import { UserDeleteNode } from '../api/types';
2
- import { Features } from '../auth/auth.types';
3
2
  import { PassIdpParams, PassKey } from '../key/key.types';
3
+ export declare enum FeatureAction {
4
+ ACCESS = "access"
5
+ }
6
+ export declare class Features {
7
+ myVault: FeatureAction[];
8
+ tpVault: FeatureAction[];
9
+ shareVault: FeatureAction[];
10
+ }
4
11
  export declare class CurrentUserKey {
5
12
  passKey?: PassKey;
6
13
  masterKey?: {