@lifeready/core 1.0.10 → 1.0.12

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 (84) hide show
  1. package/bundles/lifeready-core.umd.js +7390 -8456
  2. package/bundles/lifeready-core.umd.js.map +1 -1
  3. package/bundles/lifeready-core.umd.min.js +2 -2
  4. package/bundles/lifeready-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/_common/utils.js +9 -1
  6. package/esm2015/lib/api/lock.service.js +10 -10
  7. package/esm2015/lib/api/lr-graphql/lr-merged-mutation.js +1 -1
  8. package/esm2015/lib/api/query-processor/query-processor.service.js +71 -1
  9. package/esm2015/lib/api/types/lr-graphql.types.js +31 -1
  10. package/esm2015/lib/auth/life-ready-auth.service.js +12 -24
  11. package/esm2015/lib/cryptography/encryption.service.js +3 -3
  12. package/esm2015/lib/cryptography/key-graph.service.js +24 -5
  13. package/esm2015/lib/items2/item2.gql.js +139 -0
  14. package/esm2015/lib/items2/item2.service.js +498 -0
  15. package/esm2015/lib/items2/item2.types.js +1 -0
  16. package/esm2015/lib/scenario/scenario.constants.js +2 -0
  17. package/esm2015/lib/scenario/scenario.controller.js +34 -0
  18. package/esm2015/lib/scenario/scenario.gql.js +35 -331
  19. package/esm2015/lib/scenario/scenario.gql.private.js +198 -0
  20. package/esm2015/lib/scenario/scenario.service.js +420 -493
  21. package/esm2015/lib/scenario/scenario.types.js +1 -64
  22. package/esm2015/lib/trusted-parties/tp-assembly.gql.private.js +22 -0
  23. package/esm2015/lib/trusted-parties/tp-assembly.js +362 -0
  24. package/esm2015/lib/trusted-parties/tp-assembly.types.js +1 -0
  25. package/esm2015/lib/trusted-parties/tp-password-reset-request.service.js +4 -3
  26. package/esm2015/lib/trusted-parties/tp-password-reset.controller.js +34 -0
  27. package/esm2015/lib/trusted-parties/tp-password-reset.gql.js +5 -1
  28. package/esm2015/lib/trusted-parties/tp-password-reset.service.js +36 -240
  29. package/esm2015/lib/trusted-parties/trusted-party2.service.js +3 -3
  30. package/esm2015/lifeready-core.js +6 -3
  31. package/esm2015/public-api.js +6 -15
  32. package/fesm2015/lifeready-core.js +6127 -6909
  33. package/fesm2015/lifeready-core.js.map +1 -1
  34. package/lib/_common/utils.d.ts +6 -0
  35. package/lib/api/lock.service.d.ts +12 -3
  36. package/lib/api/lr-graphql/lr-merged-mutation.d.ts +1 -0
  37. package/lib/api/query-processor/query-processor.service.d.ts +1 -1
  38. package/lib/api/types/lr-graphql.types.d.ts +107 -2
  39. package/lib/auth/life-ready-auth.service.d.ts +3 -1
  40. package/lib/cryptography/key-graph.service.d.ts +9 -1
  41. package/lib/{api → items2}/item2.gql.d.ts +28 -1
  42. package/lib/items2/item2.service.d.ts +203 -0
  43. package/lib/items2/item2.types.d.ts +70 -0
  44. package/lib/scenario/scenario.constants.d.ts +1 -0
  45. package/lib/scenario/scenario.controller.d.ts +10 -0
  46. package/lib/scenario/scenario.gql.d.ts +52 -24
  47. package/lib/scenario/scenario.gql.private.d.ts +16 -0
  48. package/lib/scenario/scenario.service.d.ts +229 -54
  49. package/lib/scenario/scenario.types.d.ts +47 -214
  50. package/lib/trusted-parties/tp-assembly.d.ts +177 -0
  51. package/lib/trusted-parties/tp-assembly.gql.private.d.ts +5 -0
  52. package/lib/trusted-parties/tp-assembly.types.d.ts +38 -0
  53. package/lib/trusted-parties/tp-password-reset-request.service.d.ts +3 -3
  54. package/lib/trusted-parties/tp-password-reset.controller.d.ts +10 -0
  55. package/lib/trusted-parties/tp-password-reset.gql.d.ts +5 -0
  56. package/lib/trusted-parties/tp-password-reset.service.d.ts +99 -41
  57. package/lib/trusted-parties/trusted-party2.service.d.ts +1 -1
  58. package/lifeready-core.d.ts +5 -2
  59. package/lifeready-core.metadata.json +1 -1
  60. package/package.json +1 -1
  61. package/public-api.d.ts +5 -14
  62. package/esm2015/lib/api/item2.gql.js +0 -110
  63. package/esm2015/lib/api/item2.service.js +0 -311
  64. package/esm2015/lib/scenario/approvals/scenario-approval.gql.js +0 -105
  65. package/esm2015/lib/scenario/approvals/scenario-approval.types.js +0 -1
  66. package/esm2015/lib/scenario/approvals/scenario-approver.service.js +0 -300
  67. package/esm2015/lib/scenario/claimants/scenario-claimant.gql.js +0 -52
  68. package/esm2015/lib/scenario/claimants/scenario-claimant.service.js +0 -97
  69. package/esm2015/lib/scenario/claimants/scenario-claimant.types.js +0 -1
  70. package/esm2015/lib/scenario/receivers/scenario-receiver.gql.js +0 -150
  71. package/esm2015/lib/scenario/receivers/scenario-receiver.service.js +0 -229
  72. package/esm2015/lib/scenario/receivers/scenario-receiver.types.js +0 -1
  73. package/esm2015/lib/scenario/scenario-setup.service.js +0 -269
  74. package/lib/api/item2.service.d.ts +0 -177
  75. package/lib/scenario/approvals/scenario-approval.gql.d.ts +0 -7
  76. package/lib/scenario/approvals/scenario-approval.types.d.ts +0 -63
  77. package/lib/scenario/approvals/scenario-approver.service.d.ts +0 -32
  78. package/lib/scenario/claimants/scenario-claimant.gql.d.ts +0 -5
  79. package/lib/scenario/claimants/scenario-claimant.service.d.ts +0 -17
  80. package/lib/scenario/claimants/scenario-claimant.types.d.ts +0 -18
  81. package/lib/scenario/receivers/scenario-receiver.gql.d.ts +0 -8
  82. package/lib/scenario/receivers/scenario-receiver.service.d.ts +0 -30
  83. package/lib/scenario/receivers/scenario-receiver.types.d.ts +0 -54
  84. package/lib/scenario/scenario-setup.service.d.ts +0 -22
@@ -1,3 +1,9 @@
1
1
  export declare function promiseAllMayAsync(values: any[]): Promise<any> | any;
2
2
  export declare function mapValuesMayAsync(obj: object, callback: (value: any, key: string, obj: object) => any | Promise<any>): Promise<any> | any;
3
3
  export declare function mapValuesAsync(obj: object, callback?: (value: any, key: string, obj: object) => any | Promise<any>): Promise<any>;
4
+ /**
5
+ * Returns the defaultValue when value is undefined
6
+ * @param value The value to check
7
+ * @param defaultValue The value to return if value is undefined.
8
+ */
9
+ export declare function undefinedDefault(value: any, defaultValue: any): any;
@@ -4,19 +4,28 @@ export declare class LockService extends LrService {
4
4
  private ngZone;
5
5
  private injector;
6
6
  constructor(ngZone: NgZone, injector: Injector);
7
- updateLockMutation(resourceId: string, version: string): LrMutation<import("./lock.gql").UpdateLockMutationResult, {
7
+ updateLockMutation(options: {
8
+ resourceId?: string;
9
+ version: string;
10
+ }): LrMutation<import("./lock.gql").UpdateLockMutationResult, {
8
11
  input: {
9
12
  resourceId: string;
10
13
  version: string;
11
14
  };
12
15
  }>;
13
- acquireLockMutation(resourceId: string, timeoutMs: number): LrMutation<import("./lock.gql").AcquireLockMutationResult, {
16
+ acquireLockMutation(options: {
17
+ resourceId?: string;
18
+ timeoutMs: number;
19
+ }): LrMutation<import("./lock.gql").AcquireLockMutationResult, {
14
20
  input: {
15
21
  resourceId: string;
16
22
  timeoutMs: number;
17
23
  };
18
24
  }>;
19
- releaseLockMutation(resourceId: string, version: string): LrMutation<import("./lock.gql").ReleaseLockMutationResult, {
25
+ releaseLockMutation(options: {
26
+ resourceId: string;
27
+ version: string;
28
+ }): LrMutation<import("./lock.gql").ReleaseLockMutationResult, {
20
29
  input: {
21
30
  resourceId: string;
22
31
  version: string;
@@ -8,6 +8,7 @@ export declare class LrMergedMutation<T> extends LrMutationBase<T> {
8
8
  static create<T1, T2, T3>(lrMutations: [LrMutationBase<T1> | LrMergedMutation<T1>, LrMutationBase<T2> | LrMergedMutation<T2>, LrMutationBase<T3> | LrMergedMutation<T3>]): LrMergedMutation<[T1, T2, T3]>;
9
9
  static create<T1, T2, T3, T4>(lrMutations: [LrMutationBase<T1> | LrMergedMutation<T1>, LrMutationBase<T2> | LrMergedMutation<T2>, LrMutationBase<T3> | LrMergedMutation<T3>, LrMutationBase<T4> | LrMergedMutation<T4>]): LrMergedMutation<[T1, T2, T3, T4]>;
10
10
  static create<T1, T2, T3, T4, T5>(lrMutations: [LrMutationBase<T1> | LrMergedMutation<T1>, LrMutationBase<T2> | LrMergedMutation<T2>, LrMutationBase<T3> | LrMergedMutation<T3>, LrMutationBase<T4> | LrMergedMutation<T4>, LrMutationBase<T5> | LrMergedMutation<T5>]): LrMergedMutation<[T1, T2, T3, T4, T5]>;
11
+ static create<T>(lrMutations: LrMutationBase<T>[]): LrMergedMutation<T[]>;
11
12
  static create(lrMutations: LrMutationBase<any>[]): LrMergedMutation<any[]>;
12
13
  private getDescendants;
13
14
  resolve(value: any): void;
@@ -9,10 +9,10 @@ export declare class QueryProcessorService {
9
9
  private tpprProcessor;
10
10
  readonly TYPENAME = "__typename";
11
11
  private processors;
12
- constructor(ngZone: NgZone, keyService: KeyService, common: CommonProcessorsService, tpprProcessor: TpPasswordResetProcessorService);
13
12
  processQuery(fields: {
14
13
  [key: string]: any;
15
14
  }, options: ProcessorOptions): Promise<any>;
16
15
  private processField;
17
16
  private registerProcessor;
17
+ constructor(ngZone: NgZone, keyService: KeyService, common: CommonProcessorsService, tpprProcessor: TpPasswordResetProcessorService);
18
18
  }
@@ -1,10 +1,9 @@
1
1
  import { Connection, DateTime, GenericScalar, ID, JSONString, LrEmail, Node, TimeStamped } from './graphql.types';
2
+ export declare function mapEdges<T>(connection: Connection<T>): T[];
2
3
  export declare type UserStripeNode = any;
3
4
  export declare type UserPlanNode = any;
4
5
  export declare type UserDeleteNode = any;
5
6
  export declare type FeaturesNode = any;
6
- export declare type ScenarioNode = any;
7
- export declare type SharedScenarioNode = any;
8
7
  export declare type TpPasswordResetRequestNode = any;
9
8
  export interface PassKeyNode extends Node, TimeStamped {
10
9
  passKeyParams?: GenericScalar;
@@ -82,10 +81,12 @@ export interface FileNode extends Node, TimeStamped {
82
81
  export interface DirectoryLinkNode extends Node, TimeStamped {
83
82
  parentDirectory?: DirectoryNode;
84
83
  childDirectory?: DirectoryNode;
84
+ linkType?: LinkTypeField;
85
85
  }
86
86
  export interface FileLinkNode extends Node, TimeStamped {
87
87
  parentDirectory?: DirectoryNode;
88
88
  childFile?: FileNode;
89
+ linkType?: LinkTypeField;
89
90
  }
90
91
  export interface DirectoryLinkNodeLrNList {
91
92
  list?: DirectoryLinkNode[];
@@ -350,7 +351,9 @@ export interface TpSubAssemblyNode extends Node, TimeStamped {
350
351
  export interface TpAssemblyApproverNode extends Node, TimeStamped {
351
352
  sharedKey?: KeyNode;
352
353
  sharedCipherData?: string;
354
+ sharedCipherDataClearJson?: any;
353
355
  sharedCipherApprovalData?: string;
356
+ sharedCipherApprovalDataClearJson?: any;
354
357
  tp?: TpNode;
355
358
  }
356
359
  export interface SharedTpPasswordResetNode extends Node, TimeStamped {
@@ -377,7 +380,9 @@ export interface SharedTpClaimApproverNode extends Node, TimeStamped {
377
380
  state?: TpClaimApproverState;
378
381
  sharedKey?: KeyNode;
379
382
  sharedCipherApprovalData?: string;
383
+ sharedCipherApprovalDataClearJson?: any;
380
384
  sharedCipherPartialAssemblyKey?: string;
385
+ sharedCipherPartialAssemblyKeyClearJson?: any;
381
386
  receiverApprovals?: Connection<SharedTpClaimReceiverApprovalNode>;
382
387
  }
383
388
  export interface SharedTpClaimReceiverApprovalNode extends Node, TimeStamped {
@@ -387,6 +392,102 @@ export declare enum LockState {
387
392
  UNLOCKED = "UNLOCKED",
388
393
  MUTEX_LOCKED = "MUTEX_LOCKED"
389
394
  }
395
+ export declare enum ScenarioState {
396
+ DISABLED = "DISABLED",
397
+ ENABLED = "ENABLED",
398
+ CLAIMED = "CLAIMED",
399
+ APPROVED = "APPROVED"
400
+ }
401
+ export declare enum ClaimState {
402
+ CLAIMED = "CLAIMED",
403
+ EXPIRED = "EXPIRED",
404
+ APPROVED = "APPROVED",
405
+ REJECTED = "REJECTED",
406
+ CANCELLED = "CANCELLED",
407
+ RESET = "RESET"
408
+ }
409
+ export declare enum ClaimApproverState {
410
+ CLAIMED = "CLAIMED",
411
+ APPROVED = "APPROVED",
412
+ REJECTED = "REJECTED"
413
+ }
414
+ export declare type ScenarioClaimNode = any;
415
+ export interface ScenarioNode extends Node, TimeStamped {
416
+ subject?: UserNode;
417
+ subjectKey?: KeyNode;
418
+ subjectCipherData?: string;
419
+ subjectCipherDataClearJson?: any;
420
+ assembly?: TpAssemblyNode;
421
+ state?: ScenarioState;
422
+ claimants?: Connection<ScenarioClaimantNode>;
423
+ receivers?: Connection<ScenarioReceiverNode>;
424
+ claims?: Connection<ScenarioClaimNode>;
425
+ claim?: ScenarioClaimNode;
426
+ }
427
+ export interface ScenarioReceiverNode extends Node, TimeStamped {
428
+ sharedKey?: KeyNode;
429
+ sharedCipherData?: string;
430
+ sharedCipherDataClearJson?: any;
431
+ pbk?: KeyNode;
432
+ receiverDirectories?: Connection<ScenarioReceiverDirectoryNode>;
433
+ receiverFiles?: Connection<ScenarioReceiverFileNode>;
434
+ tp?: TpNode;
435
+ }
436
+ export interface SharedScenarioReceiverNode extends Node, TimeStamped {
437
+ pbk?: KeyNode;
438
+ }
439
+ export declare type ReceiverDirectoryAccessRole = AccessRoleChoice;
440
+ export interface ScenarioReceiverItemNode extends Node, TimeStamped {
441
+ receiver?: SharedScenarioReceiverNode;
442
+ sharedKey?: KeyNode;
443
+ sharedCipherData?: string;
444
+ sharedCipherDataClearJson?: any;
445
+ accessRole?: ReceiverDirectoryAccessRole;
446
+ wrappedItemKey?: string;
447
+ itemKey?: KeyNode;
448
+ }
449
+ export interface ScenarioReceiverDirectoryNode extends ScenarioReceiverItemNode {
450
+ directory?: DirectoryNode;
451
+ }
452
+ export interface ScenarioReceiverFileNode extends ScenarioReceiverItemNode {
453
+ file?: FileNode;
454
+ }
455
+ export interface ScenarioClaimantNode extends Node, TimeStamped {
456
+ tp?: TpNode;
457
+ sharedKey?: KeyNode;
458
+ sharedCipherData?: string;
459
+ sharedCipherDataClearJson?: any;
460
+ }
461
+ export interface SharedScenarioNode extends Node, TimeStamped {
462
+ subject?: UserNode;
463
+ state?: ScenarioState;
464
+ tp?: TpNode;
465
+ asClaimant?: ScenarioClaimantNode;
466
+ asReceiver?: ScenarioReceiverNode;
467
+ assembly?: SharedTpAssemblyNode;
468
+ sharedClaim?: SharedScenarioClaimNode;
469
+ }
470
+ export interface SharedScenarioClaimNode extends Node, TimeStamped {
471
+ state?: ClaimState;
472
+ sharedScenario?: SharedScenarioNode;
473
+ isClaimant?: boolean;
474
+ asClaimReceiver?: SharedScenarioClaimReceiverNode;
475
+ claim: SharedTpClaimNode;
476
+ }
477
+ export interface SharedScenarioClaimApproverNode extends Node, TimeStamped {
478
+ receivers?: Connection<SharedScenarioReceiverNode>;
479
+ state?: ClaimApproverState;
480
+ approver?: TpAssemblyApproverNode;
481
+ }
482
+ export interface SharedScenarioClaimReceiverNode extends Node, TimeStamped {
483
+ received?: DateTime;
484
+ approvals?: Connection<SharedScenarioClaimReceivedApprovalNode>;
485
+ }
486
+ export interface SharedScenarioClaimReceivedApprovalNode extends Node, TimeStamped {
487
+ receiverCipher?: string;
488
+ receiverCipherPartialAssemblyKey?: string;
489
+ pxk?: KeyNode;
490
+ }
390
491
  export interface NotificationNode extends Node, TimeStamped {
391
492
  plainData?: JSONString;
392
493
  plainMeta?: JSONString;
@@ -395,3 +496,7 @@ export interface NotificationNode extends Node, TimeStamped {
395
496
  export interface NotificationManagementState extends Node, TimeStamped {
396
497
  lastViewed?: DateTime;
397
498
  }
499
+ export declare enum LinkTypeField {
500
+ HARD = "HARD",
501
+ SOFT = "SOFT"
502
+ }
@@ -13,6 +13,7 @@ import { PersistService } from '../api/persist.service';
13
13
  import { LifeReadyConfig } from '../life-ready.config';
14
14
  import { EncryptionService } from '../cryptography/encryption.service';
15
15
  import { Slip39Service } from '../cryptography/slip39.service';
16
+ import { TpPasswordResetAssemblyController } from '../trusted-parties/tp-password-reset.controller';
16
17
  export declare const initialiseAuth: (authService: LifeReadyAuthService) => () => Promise<void>;
17
18
  export interface LoginOptions {
18
19
  tpPasswordResetAutoComplete?: boolean;
@@ -31,10 +32,11 @@ export declare class LifeReadyAuthService {
31
32
  private persistService;
32
33
  private encryptionService;
33
34
  private slip39Service;
35
+ private assemblyController;
34
36
  private hubSubject;
35
37
  private currentUser;
36
38
  private currentResetUser;
37
- constructor(config: LifeReadyConfig, auth: AuthClass, keyFactory: KeyFactoryService, keyService: KeyService, profileService: ProfileService, keyGraphService: KeyGraphService, passwordService: PasswordService, idleService: IdleService, lrGraphQL: LrGraphQLService, tpPasswordResetProcessorService: TpPasswordResetProcessorService, persistService: PersistService, encryptionService: EncryptionService, slip39Service: Slip39Service);
39
+ constructor(config: LifeReadyConfig, auth: AuthClass, keyFactory: KeyFactoryService, keyService: KeyService, profileService: ProfileService, keyGraphService: KeyGraphService, passwordService: PasswordService, idleService: IdleService, lrGraphQL: LrGraphQLService, tpPasswordResetProcessorService: TpPasswordResetProcessorService, persistService: PersistService, encryptionService: EncryptionService, slip39Service: Slip39Service, assemblyController: TpPasswordResetAssemblyController);
38
40
  initialise(): Promise<void>;
39
41
  private loginIdpImpl;
40
42
  private loginIdp;
@@ -2,6 +2,7 @@ import { JWK } from 'node-jose';
2
2
  import { CurrentUserKey } from '../users/profile.types';
3
3
  import { Edge, Key, KeyGraphResponse, PassKey } from './cryptography.types';
4
4
  import { DecryptOptions, EncryptionService } from './encryption.service';
5
+ import { KeyFactoryService } from './key-factory.service';
5
6
  import { KeyService } from './key.service';
6
7
  export interface GraphKey extends Key {
7
8
  task?: Promise<any>;
@@ -9,8 +10,9 @@ export interface GraphKey extends Key {
9
10
  export declare class KeyGraphService {
10
11
  private encryptionService;
11
12
  private keyService;
13
+ private keyFactory;
12
14
  private graph;
13
- constructor(encryptionService: EncryptionService, keyService: KeyService);
15
+ constructor(encryptionService: EncryptionService, keyService: KeyService, keyFactory: KeyFactoryService);
14
16
  purgeKeys(): void;
15
17
  populateKeys(userKey: CurrentUserKey): Promise<void>;
16
18
  hasKey(keyId: string): boolean;
@@ -30,4 +32,10 @@ export declare class KeyGraphService {
30
32
  decryptFile(keyId: string, file: any): Promise<any>;
31
33
  encryptToString(key: string | Key | JWK.Key, content: any): Promise<string>;
32
34
  wrapKey<T>(wrappingKey: string | Key | JWK.Key, key: JWK.Key): Promise<string>;
35
+ encryptWithNewKey(wrappingKeyId: string, cipherClearJson: any): Promise<{
36
+ key: JWK.Key;
37
+ wrappingKeyId: string;
38
+ wrappedKey: string;
39
+ cipher: string;
40
+ }>;
33
41
  }
@@ -1,4 +1,4 @@
1
- import { DateTime, ID } from './types';
1
+ import { DateTime, ID } from '../api/types';
2
2
  export interface DirectoryKeyQuery {
3
3
  directory: {
4
4
  keyId: ID;
@@ -21,6 +21,7 @@ export interface CreateDirectoryMutation {
21
21
  createDirectory: {
22
22
  directory: {
23
23
  id: ID;
24
+ keyId: ID;
24
25
  };
25
26
  };
26
27
  }
@@ -94,3 +95,29 @@ export interface ChangeFileParentsMutationResult {
94
95
  };
95
96
  }
96
97
  export declare const ChangeFileParentsMutation: import("../_common/ast").TypedDocumentNode<ChangeFileParentsMutationResult>;
98
+ export interface BeginDeleteChildItemLinksWindowMutationResult {
99
+ beginDeleteChildItemLinksWindow: {
100
+ begin: DateTime;
101
+ end: DateTime;
102
+ scheduled: DateTime;
103
+ windowMs: number;
104
+ directory: {
105
+ id: ID;
106
+ };
107
+ };
108
+ }
109
+ export declare const BeginDeleteChildItemLinksWindowMutation: import("../_common/ast").TypedDocumentNode<BeginDeleteChildItemLinksWindowMutationResult>;
110
+ export interface TempDirectoryQueryResult {
111
+ rootDirectories: {
112
+ edges: {
113
+ node: {
114
+ id: ID;
115
+ keyId: ID;
116
+ };
117
+ }[];
118
+ };
119
+ lock: {
120
+ version: string;
121
+ };
122
+ }
123
+ export declare const TempDirectoryQuery: import("../_common/ast").TypedDocumentNode<TempDirectoryQueryResult>;
@@ -0,0 +1,203 @@
1
+ import { Injector, NgZone } from '@angular/core';
2
+ import { KeyFactoryService } from '../cryptography/key-factory.service';
3
+ import { KeyGraphService } from '../cryptography/key-graph.service';
4
+ import { KeyService } from '../cryptography/key.service';
5
+ import { FileService } from '../api/file.service';
6
+ import { CreateDirectoryMutation, DeleteDirectoryMutation, CreateFileMutation, DeleteFileMutation, UpdateFileMutation, UpdateDirectoryMutation, ArchiveDirectoryMutation, UnarchiveDirectoryMutation } from './item2.gql';
7
+ import { ChangeFileParentsOptions, ChangeDirectoryParentsOptions, CreateDirectoryOptions, CreateFileOptions, DownloadFileContentOptions, FileParentDirectoryInput, ParentDirectoryInput, ParentRootDirectoryInput, UpdateDirectoryOptions, UpdateFileOptions, BeginDeleteChildItemLinksWindowOptions, CreateDirectoryTreeOptions } from './item2.types';
8
+ import { LrMutation, LrService } from '../api/lr-graphql';
9
+ import { DirectoryNode, ID, LrRelayIdInput } from '../api/types';
10
+ import { LockService } from '../api/lock.service';
11
+ export declare class Item2Service extends LrService {
12
+ private ngZone;
13
+ private injector;
14
+ private fileService;
15
+ private keyService;
16
+ private keyFactory;
17
+ private keyGraph;
18
+ private lockService;
19
+ constructor(ngZone: NgZone, injector: Injector, fileService: FileService, keyService: KeyService, keyFactory: KeyFactoryService, keyGraph: KeyGraphService, lockService: LockService);
20
+ static TEMP_DIRECTORY_PLAIN_META: {
21
+ kcType: string;
22
+ };
23
+ static TEMP_DIRECTORY_PLAIN_META_FILTER: string;
24
+ downloadFileContent(options: DownloadFileContentOptions): Promise<ArrayBuffer>;
25
+ getDirectoryKeyId(directoryId: LrRelayIdInput): Promise<string>;
26
+ getFileKeyId(fileId: LrRelayIdInput): Promise<string>;
27
+ getDirectoryKey(directoryId: LrRelayIdInput, directoryKeyId?: LrRelayIdInput): Promise<import("../cryptography/cryptography.types").Key>;
28
+ getFileKey(fileId: LrRelayIdInput, fileKeyId?: LrRelayIdInput): Promise<import("../cryptography/cryptography.types").Key>;
29
+ createDirectoryExec(options: CreateDirectoryOptions): Promise<CreateDirectoryMutation>;
30
+ createDirectory(options: CreateDirectoryOptions): Promise<LrMutation<CreateDirectoryMutation, {
31
+ input: {
32
+ parentDirectories: ParentDirectoryInput[];
33
+ parentRootDirectory: ParentRootDirectoryInput;
34
+ plainMeta: string;
35
+ cipherMeta: string;
36
+ };
37
+ }>>;
38
+ createDirectoryMutation(options: CreateDirectoryOptions): Promise<LrMutation<CreateDirectoryMutation, {
39
+ input: {
40
+ parentDirectories: ParentDirectoryInput[];
41
+ parentRootDirectory: ParentRootDirectoryInput;
42
+ plainMeta: string;
43
+ cipherMeta: string;
44
+ };
45
+ }>>;
46
+ updateDirectoryExec(options: UpdateDirectoryOptions): Promise<UpdateDirectoryMutation>;
47
+ updateDirectory(options: UpdateDirectoryOptions): Promise<LrMutation<UpdateDirectoryMutation, {
48
+ input: {
49
+ directoryId: string;
50
+ plainMeta: string;
51
+ cipherMeta: string;
52
+ };
53
+ }>>;
54
+ updateDirectoryMutation(options: UpdateDirectoryOptions): Promise<LrMutation<UpdateDirectoryMutation, {
55
+ input: {
56
+ directoryId: string;
57
+ plainMeta: string;
58
+ cipherMeta: string;
59
+ };
60
+ }>>;
61
+ deleteDirectoryExec(id: ID): Promise<DeleteDirectoryMutation>;
62
+ deleteDirectory(id: ID): LrMutation<DeleteDirectoryMutation, {
63
+ input: {
64
+ directoryId: string;
65
+ };
66
+ }>;
67
+ deleteDirectoryMutation(id: ID): LrMutation<DeleteDirectoryMutation, {
68
+ input: {
69
+ directoryId: string;
70
+ };
71
+ }>;
72
+ createFileExec(options: CreateFileOptions): Promise<CreateFileMutation>;
73
+ createFile(options: CreateFileOptions): Promise<LrMutation<CreateFileMutation, {
74
+ input: {
75
+ parentDirectories: FileParentDirectoryInput[];
76
+ wrappedStateKey: string;
77
+ contentResource: string;
78
+ plainMeta: string;
79
+ cipherMeta: string;
80
+ };
81
+ }>>;
82
+ createFileMutation(options: CreateFileOptions): Promise<LrMutation<CreateFileMutation, {
83
+ input: {
84
+ parentDirectories: FileParentDirectoryInput[];
85
+ wrappedStateKey: string;
86
+ contentResource: string;
87
+ plainMeta: string;
88
+ cipherMeta: string;
89
+ };
90
+ }>>;
91
+ updateFileExec(options: UpdateFileOptions): Promise<UpdateFileMutation>;
92
+ updateFile(options: UpdateFileOptions): Promise<LrMutation<UpdateFileMutation, {
93
+ input: {
94
+ fileId: string;
95
+ wrappedStateKey: string;
96
+ contentResource: string;
97
+ plainMeta: string;
98
+ cipherMeta: string;
99
+ };
100
+ }>>;
101
+ updateFileMutation(options: UpdateFileOptions): Promise<LrMutation<UpdateFileMutation, {
102
+ input: {
103
+ fileId: string;
104
+ wrappedStateKey: string;
105
+ contentResource: string;
106
+ plainMeta: string;
107
+ cipherMeta: string;
108
+ };
109
+ }>>;
110
+ deleteFileExec(id: ID): Promise<DeleteFileMutation>;
111
+ deleteFile(id: ID): LrMutation<DeleteFileMutation, {
112
+ input: {
113
+ fileId: string;
114
+ };
115
+ }>;
116
+ deleteFileMutation(id: ID): LrMutation<DeleteFileMutation, {
117
+ input: {
118
+ fileId: string;
119
+ };
120
+ }>;
121
+ archiveDirectoryExec(directoryId: string, recursive: boolean): Promise<ArchiveDirectoryMutation>;
122
+ archiveDirectory(directoryId: string, recursive: boolean): LrMutation<ArchiveDirectoryMutation, {
123
+ input: {
124
+ directoryId: string;
125
+ recursive: boolean;
126
+ };
127
+ }>;
128
+ archiveDirectoryMutation(directoryId: string, recursive: boolean): LrMutation<ArchiveDirectoryMutation, {
129
+ input: {
130
+ directoryId: string;
131
+ recursive: boolean;
132
+ };
133
+ }>;
134
+ unarchiveDirectoryExec(directoryId: string, recursive: boolean): Promise<UnarchiveDirectoryMutation>;
135
+ unarchiveDirectory(directoryId: string, recursive: boolean): LrMutation<UnarchiveDirectoryMutation, {
136
+ input: {
137
+ directoryId: string;
138
+ recursive: boolean;
139
+ };
140
+ }>;
141
+ unarchiveDirectoryMutation(directoryId: string, recursive: boolean): LrMutation<UnarchiveDirectoryMutation, {
142
+ input: {
143
+ directoryId: string;
144
+ recursive: boolean;
145
+ };
146
+ }>;
147
+ changeDirectoryParents(options: ChangeDirectoryParentsOptions): Promise<import("./item2.gql").ChangeDirectoryParentsMutationResult>;
148
+ changeDirectoryParentsMutation(options: ChangeDirectoryParentsOptions): Promise<LrMutation<import("./item2.gql").ChangeDirectoryParentsMutationResult, {
149
+ input: {
150
+ directoryId: string;
151
+ directoriesToRemove: string[];
152
+ directoriesToAdd: ParentDirectoryInput[];
153
+ };
154
+ }>>;
155
+ changeFileParents(options: ChangeFileParentsOptions): Promise<import("./item2.gql").ChangeFileParentsMutationResult>;
156
+ changeFileParentsMutation(options: ChangeFileParentsOptions): Promise<LrMutation<import("./item2.gql").ChangeFileParentsMutationResult, {
157
+ input: {
158
+ fileId: string;
159
+ directoriesToRemove: string[];
160
+ directoriesToAdd: ParentDirectoryInput[];
161
+ };
162
+ }>>;
163
+ beginDeleteChildItemLinksWindow(options: BeginDeleteChildItemLinksWindowOptions): Promise<import("./item2.gql").BeginDeleteChildItemLinksWindowMutationResult>;
164
+ beginDeleteChildItemLinksWindowMutation(options: BeginDeleteChildItemLinksWindowOptions): Promise<LrMutation<import("./item2.gql").BeginDeleteChildItemLinksWindowMutationResult, {
165
+ input: BeginDeleteChildItemLinksWindowOptions;
166
+ }>>;
167
+ /**
168
+ *
169
+ * This method may raise VERSION_MISMATCH exception if there is a race condition
170
+ * when multiple clients try to create the temp directory.
171
+ *
172
+ * TODO There is a retry mechanism in graphql with exponential back off but that's internal.
173
+ * But need to use an exponential back off lib if we want to retry here.
174
+ *
175
+ * @returns The ID of the temp directory
176
+ *
177
+ */
178
+ ensureTempDirectory(): Promise<Pick<DirectoryNode, 'id' | 'keyId'>>;
179
+ createDirectoryTree(options: CreateDirectoryTreeOptions): Promise<import("./item2.gql").ChangeDirectoryParentsMutationResult>;
180
+ /**
181
+ * You must run this mutation within the temp directory cleanup window on the
182
+ * server, otherwise the temp directory will get cleaned up.
183
+ *
184
+ */
185
+ createDirectoryTreeMutation(options: CreateDirectoryTreeOptions): Promise<LrMutation<import("./item2.gql").ChangeDirectoryParentsMutationResult, {
186
+ input: {
187
+ directoryId: string;
188
+ directoriesToRemove: string[];
189
+ directoriesToAdd: ParentDirectoryInput[];
190
+ };
191
+ }>>;
192
+ private prepareParentDirectory;
193
+ private getFileStateKeyId;
194
+ private prepareCreateFileState;
195
+ private prepareChangeItemParents;
196
+ private prepareItem;
197
+ private prepareCreateDirectory;
198
+ private prepareUpdateDirectory;
199
+ private prepareCreateFile;
200
+ private prepareUpdateFile;
201
+ private prepareChangeDirectoryParents;
202
+ private prepareChangeFileParents;
203
+ }
@@ -0,0 +1,70 @@
1
+ import { LinkTypeField, LrRelayIdInput } from '../api/types';
2
+ export interface ParentDirectoryOptions {
3
+ directoryId: LrRelayIdInput;
4
+ wrappingKeyId?: LrRelayIdInput;
5
+ linkType?: LinkTypeField;
6
+ }
7
+ export interface ParentRootDirectoryInput {
8
+ wrappedKey: string;
9
+ wrappingKeyId: LrRelayIdInput;
10
+ }
11
+ export interface ParentDirectoryInputBase {
12
+ directoryId: LrRelayIdInput;
13
+ wrappingKeyId: LrRelayIdInput;
14
+ linkType?: LinkTypeField;
15
+ }
16
+ export interface ParentDirectoryInput extends ParentDirectoryInputBase {
17
+ wrappedKey: string;
18
+ }
19
+ export interface FileParentDirectoryInput extends ParentDirectoryInputBase {
20
+ wrappedFileKey: string;
21
+ }
22
+ export interface DownloadFileContentOptions {
23
+ fileStateNodeId: LrRelayIdInput;
24
+ fileStateKeyId?: LrRelayIdInput;
25
+ }
26
+ export interface CommonDirectoryOptions {
27
+ plainMetaJson?: any;
28
+ cipherMetaClearJson?: any;
29
+ }
30
+ export interface CreateDirectoryOptions extends CommonDirectoryOptions {
31
+ asRootDirectory?: boolean;
32
+ parentDirectories?: ParentDirectoryOptions[];
33
+ }
34
+ export interface UpdateDirectoryOptions extends CommonDirectoryOptions {
35
+ directoryId: LrRelayIdInput;
36
+ directoryKeyId?: LrRelayIdInput;
37
+ }
38
+ export interface CommonFileOptions {
39
+ plainMetaJson?: any;
40
+ cipherMetaClearJson?: any;
41
+ file?: File;
42
+ upload?: (cipherFileContent: string) => Promise<string>;
43
+ }
44
+ export interface CreateFileOptions extends CommonFileOptions {
45
+ parentDirectories: ParentDirectoryOptions[];
46
+ }
47
+ export interface UpdateFileOptions extends CommonFileOptions {
48
+ fileId: LrRelayIdInput;
49
+ fileKeyId?: LrRelayIdInput;
50
+ }
51
+ export interface ChangeItemParentsOptions {
52
+ parentsToRemove: LrRelayIdInput[];
53
+ parentsToAdd: ParentDirectoryOptions[];
54
+ }
55
+ export interface ChangeDirectoryParentsOptions extends ChangeItemParentsOptions {
56
+ directoryId: LrRelayIdInput;
57
+ directoryKeyId?: LrRelayIdInput;
58
+ }
59
+ export interface ChangeFileParentsOptions extends ChangeItemParentsOptions {
60
+ fileId: LrRelayIdInput;
61
+ fileKeyId?: LrRelayIdInput;
62
+ }
63
+ export interface BeginDeleteChildItemLinksWindowOptions {
64
+ directoryId: LrRelayIdInput;
65
+ requestWindowMs: number;
66
+ }
67
+ export interface CreateDirectoryTreeOptions extends Omit<CreateDirectoryOptions, 'asRootDirectory'> {
68
+ requestWindowMs: number;
69
+ createContent: (directoryId: string) => void | Promise<void>;
70
+ }
@@ -0,0 +1 @@
1
+ export declare const SCENARIO_SLIP39_PASSPHRASE = "lifeready";
@@ -0,0 +1,10 @@
1
+ import { Injector, NgZone } from '@angular/core';
2
+ import { TpNode } from '../api/types';
3
+ import { TpAssemblyController } from '../trusted-parties/tp-assembly';
4
+ export declare class ScenarioAssemblyController extends TpAssemblyController {
5
+ private ngZone;
6
+ private injector;
7
+ slip39Passphrase: string;
8
+ constructor(ngZone: NgZone, injector: Injector);
9
+ getTpWrappingKeyId(tp: TpNode): string;
10
+ }