@lifeready/core 1.0.1 → 1.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.
- package/bundles/lifeready-core.umd.js +15939 -0
- package/bundles/lifeready-core.umd.js.map +1 -0
- package/bundles/lifeready-core.umd.min.js +16 -0
- package/bundles/lifeready-core.umd.min.js.map +1 -0
- package/esm2015/lib/_common/ast.js +40 -0
- package/esm2015/lib/_common/deferred-promise.js +24 -0
- package/esm2015/lib/_common/exceptions.js +157 -0
- package/esm2015/lib/_common/queries.gql.js +190 -0
- package/esm2015/lib/_common/run-outside-angular.js +79 -0
- package/esm2015/lib/_common/types.js +1 -0
- package/esm2015/lib/_common/utils.js +44 -0
- package/esm2015/lib/api/contact-card.gql.js +79 -0
- package/esm2015/lib/api/contact-card.service.js +154 -0
- package/esm2015/lib/api/contact-card2.gql.js +60 -0
- package/esm2015/lib/api/contact-card2.service.js +103 -0
- package/esm2015/lib/api/file.service.js +74 -0
- package/esm2015/lib/api/item2.gql.js +110 -0
- package/esm2015/lib/api/item2.service.js +311 -0
- package/esm2015/lib/api/key-exchange.gql.js +188 -0
- package/esm2015/lib/api/key-exchange.service.js +442 -0
- package/esm2015/lib/api/key-exchange.types.js +18 -0
- package/esm2015/lib/api/key-exchange2.gql.js +171 -0
- package/esm2015/lib/api/key-exchange2.service.js +479 -0
- package/esm2015/lib/api/lock.gql.js +40 -0
- package/esm2015/lib/api/lock.service.js +64 -0
- package/esm2015/lib/api/lr-apollo.service.js +46 -0
- package/esm2015/lib/api/lr-graphql/index.js +6 -0
- package/esm2015/lib/api/lr-graphql/lr-graphql.service.js +155 -0
- package/esm2015/lib/api/lr-graphql/lr-merged-mutation.js +213 -0
- package/esm2015/lib/api/lr-graphql/lr-mutation-base.js +51 -0
- package/esm2015/lib/api/lr-graphql/lr-mutation.js +48 -0
- package/esm2015/lib/api/lr-graphql/lr.service.js +18 -0
- package/esm2015/lib/api/message.service.js +138 -0
- package/esm2015/lib/api/persist.service.js +181 -0
- package/esm2015/lib/api/query-processor/common-processors.service.js +93 -0
- package/esm2015/lib/api/query-processor/index.js +3 -0
- package/esm2015/lib/api/query-processor/query-processor.service.js +192 -0
- package/esm2015/lib/api/query-processor/tp-password-reset-processor.service.js +109 -0
- package/esm2015/lib/api/shared-contact-card.service.js +119 -0
- package/esm2015/lib/api/shared-contact-card2.gql.js +41 -0
- package/esm2015/lib/api/shared-contact-card2.service.js +117 -0
- package/esm2015/lib/api/time.service.js +146 -0
- package/esm2015/lib/api/types/graphql.types.js +7 -0
- package/esm2015/lib/api/types/index.js +3 -0
- package/esm2015/lib/api/types/lr-graphql.types.js +71 -0
- package/esm2015/lib/auth/auth.config.js +57 -0
- package/esm2015/lib/auth/auth.gql.js +48 -0
- package/esm2015/lib/auth/auth.types.js +27 -0
- package/esm2015/lib/auth/idle.service.js +168 -0
- package/esm2015/lib/auth/idle.types.js +7 -0
- package/esm2015/lib/auth/lbop.service.js +355 -0
- package/esm2015/lib/auth/life-ready-auth.service.js +500 -0
- package/esm2015/lib/auth/password.service.js +320 -0
- package/esm2015/lib/auth/register.service.js +172 -0
- package/esm2015/lib/auth/two-factor.service.js +74 -0
- package/esm2015/lib/category/category-meta.service.js +99 -0
- package/esm2015/lib/category/category.gql.js +406 -0
- package/esm2015/lib/category/category.service.js +390 -0
- package/esm2015/lib/category/category.types.js +29 -0
- package/esm2015/lib/cryptography/cryptography.types.js +11 -0
- package/esm2015/lib/cryptography/encryption.service.js +189 -0
- package/esm2015/lib/cryptography/key-factory.service.js +237 -0
- package/esm2015/lib/cryptography/key-graph.service.js +280 -0
- package/esm2015/lib/cryptography/key-meta.service.js +200 -0
- package/esm2015/lib/cryptography/key.service.js +124 -0
- package/esm2015/lib/cryptography/slip39.service.js +169 -0
- package/esm2015/lib/cryptography/web-crypto.service.js +29 -0
- package/esm2015/lib/life-ready.config.js +84 -0
- package/esm2015/lib/life-ready.module.js +74 -0
- package/esm2015/lib/plan/plan.gql.js +123 -0
- package/esm2015/lib/plan/plan.service.js +149 -0
- package/esm2015/lib/plan/plan.types.js +11 -0
- package/esm2015/lib/record/record-attachment.service.js +101 -0
- package/esm2015/lib/record/record.gql.js +179 -0
- package/esm2015/lib/record/record.service.js +206 -0
- package/esm2015/lib/record/record.types.js +15 -0
- package/esm2015/lib/record-type/record-type.service.js +75 -0
- package/esm2015/lib/record-type/record-type.types.js +28 -0
- package/esm2015/lib/scenario/approvals/scenario-approval.gql.js +105 -0
- package/esm2015/lib/scenario/approvals/scenario-approval.types.js +1 -0
- package/esm2015/lib/scenario/approvals/scenario-approver.service.js +300 -0
- package/esm2015/lib/scenario/claimants/scenario-claimant.gql.js +52 -0
- package/esm2015/lib/scenario/claimants/scenario-claimant.service.js +97 -0
- package/esm2015/lib/scenario/claimants/scenario-claimant.types.js +1 -0
- package/esm2015/lib/scenario/receivers/scenario-receiver.gql.js +150 -0
- package/esm2015/lib/scenario/receivers/scenario-receiver.service.js +229 -0
- package/esm2015/lib/scenario/receivers/scenario-receiver.types.js +1 -0
- package/esm2015/lib/scenario/scenario-setup.service.js +269 -0
- package/esm2015/lib/scenario/scenario.gql.js +368 -0
- package/esm2015/lib/scenario/scenario.service.js +611 -0
- package/esm2015/lib/scenario/scenario.types.js +64 -0
- package/esm2015/lib/search/search.gql.js +62 -0
- package/esm2015/lib/search/search.service.js +156 -0
- package/esm2015/lib/search/search.types.js +6 -0
- package/esm2015/lib/trusted-parties/tp-password-reset-request.service.js +112 -0
- package/esm2015/lib/trusted-parties/tp-password-reset-user.service.js +129 -0
- package/esm2015/lib/trusted-parties/tp-password-reset.constants.js +4 -0
- package/esm2015/lib/trusted-parties/tp-password-reset.gql.js +232 -0
- package/esm2015/lib/trusted-parties/tp-password-reset.service.js +299 -0
- package/esm2015/lib/trusted-parties/trusted-party.gql.js +148 -0
- package/esm2015/lib/trusted-parties/trusted-party.service.js +326 -0
- package/esm2015/lib/trusted-parties/trusted-party.types.js +41 -0
- package/esm2015/lib/trusted-parties/trusted-party2.gql.js +87 -0
- package/esm2015/lib/trusted-parties/trusted-party2.service.js +215 -0
- package/esm2015/lib/users/profile-details.service.js +214 -0
- package/esm2015/lib/users/profile.gql.js +97 -0
- package/esm2015/lib/users/profile.service.js +169 -0
- package/esm2015/lib/users/profile.types.js +34 -0
- package/esm2015/lib/users/user.gql.js +60 -0
- package/esm2015/lib/users/user.service.js +79 -0
- package/esm2015/lib/users/user.types.js +5 -0
- package/esm2015/lifeready-core.js +10 -0
- package/esm2015/public-api.js +81 -0
- package/fesm2015/lifeready-core.js +13314 -0
- package/fesm2015/lifeready-core.js.map +1 -0
- package/lib/_common/ast.d.ts +11 -0
- package/lib/_common/deferred-promise.d.ts +12 -0
- package/lib/_common/exceptions.d.ts +109 -0
- package/lib/_common/queries.gql.d.ts +10 -0
- package/lib/_common/run-outside-angular.d.ts +14 -0
- package/{src/lib/_common/types.ts → lib/_common/types.d.ts} +3 -6
- package/lib/_common/utils.d.ts +3 -0
- package/lib/api/contact-card.gql.d.ts +7 -0
- package/lib/api/contact-card.service.d.ts +52 -0
- package/lib/api/contact-card2.gql.d.ts +34 -0
- package/lib/api/contact-card2.service.d.ts +49 -0
- package/lib/api/file.service.d.ts +18 -0
- package/lib/api/item2.gql.d.ts +96 -0
- package/lib/api/item2.service.d.ts +177 -0
- package/lib/api/key-exchange.gql.d.ts +9 -0
- package/lib/api/key-exchange.service.d.ts +39 -0
- package/lib/api/key-exchange.types.d.ts +196 -0
- package/lib/api/key-exchange2.gql.d.ts +125 -0
- package/lib/api/key-exchange2.service.d.ts +187 -0
- package/lib/api/lock.gql.d.ts +27 -0
- package/lib/api/lock.service.d.ts +25 -0
- package/lib/api/lr-apollo.service.d.ts +15 -0
- package/lib/api/lr-graphql/lr-graphql.service.d.ts +60 -0
- package/lib/api/lr-graphql/lr-merged-mutation.d.ts +27 -0
- package/lib/api/lr-graphql/lr-mutation-base.d.ts +28 -0
- package/lib/api/lr-graphql/lr-mutation.d.ts +8 -0
- package/lib/api/lr-graphql/lr.service.d.ts +9 -0
- package/lib/api/message.service.d.ts +58 -0
- package/lib/api/persist.service.d.ts +31 -0
- package/lib/api/query-processor/common-processors.service.d.ts +36 -0
- package/lib/api/query-processor/query-processor.service.d.ts +18 -0
- package/lib/api/query-processor/tp-password-reset-processor.service.d.ts +15 -0
- package/lib/api/shared-contact-card.service.d.ts +33 -0
- package/lib/api/shared-contact-card2.gql.d.ts +36 -0
- package/lib/api/shared-contact-card2.service.d.ts +45 -0
- package/lib/api/time.service.d.ts +16 -0
- package/lib/api/types/graphql.types.d.ts +29 -0
- package/lib/api/types/lr-graphql.types.d.ts +385 -0
- package/lib/auth/auth.config.d.ts +5 -0
- package/lib/auth/auth.gql.d.ts +15 -0
- package/lib/auth/auth.types.d.ts +66 -0
- package/lib/auth/idle.service.d.ts +40 -0
- package/lib/auth/idle.types.d.ts +10 -0
- package/lib/auth/lbop.service.d.ts +91 -0
- package/lib/auth/life-ready-auth.service.d.ts +59 -0
- package/lib/auth/password.service.d.ts +78 -0
- package/lib/auth/register.service.d.ts +25 -0
- package/lib/auth/two-factor.service.d.ts +15 -0
- package/lib/category/category-meta.service.d.ts +23 -0
- package/lib/category/category.gql.d.ts +45 -0
- package/lib/category/category.service.d.ts +67 -0
- package/lib/category/category.types.d.ts +79 -0
- package/lib/cryptography/cryptography.types.d.ts +83 -0
- package/lib/cryptography/encryption.service.d.ts +41 -0
- package/lib/cryptography/key-factory.service.d.ts +38 -0
- package/lib/cryptography/key-graph.service.d.ts +33 -0
- package/lib/cryptography/key-meta.service.d.ts +44 -0
- package/lib/cryptography/key.service.d.ts +36 -0
- package/lib/cryptography/slip39.service.d.ts +43 -0
- package/lib/cryptography/web-crypto.service.d.ts +5 -0
- package/lib/life-ready.config.d.ts +14 -0
- package/lib/life-ready.module.d.ts +5 -0
- package/lib/plan/plan.gql.d.ts +11 -0
- package/lib/plan/plan.service.d.ts +33 -0
- package/lib/plan/plan.types.d.ts +31 -0
- package/lib/record/record-attachment.service.d.ts +16 -0
- package/lib/record/record.gql.d.ts +14 -0
- package/lib/record/record.service.d.ts +25 -0
- package/lib/record/record.types.d.ts +57 -0
- package/lib/record-type/record-type.service.d.ts +11 -0
- package/lib/record-type/record-type.types.d.ts +50 -0
- package/lib/scenario/approvals/scenario-approval.gql.d.ts +7 -0
- package/lib/scenario/approvals/scenario-approval.types.d.ts +63 -0
- package/lib/scenario/approvals/scenario-approver.service.d.ts +32 -0
- package/lib/scenario/claimants/scenario-claimant.gql.d.ts +5 -0
- package/lib/scenario/claimants/scenario-claimant.service.d.ts +17 -0
- package/lib/scenario/claimants/scenario-claimant.types.d.ts +18 -0
- package/lib/scenario/receivers/scenario-receiver.gql.d.ts +8 -0
- package/lib/scenario/receivers/scenario-receiver.service.d.ts +30 -0
- package/lib/scenario/receivers/scenario-receiver.types.d.ts +54 -0
- package/lib/scenario/scenario-setup.service.d.ts +22 -0
- package/lib/scenario/scenario.gql.d.ts +34 -0
- package/lib/scenario/scenario.service.d.ts +58 -0
- package/lib/scenario/scenario.types.d.ts +217 -0
- package/lib/search/search.gql.d.ts +1 -0
- package/lib/search/search.service.d.ts +25 -0
- package/lib/search/search.types.d.ts +20 -0
- package/lib/trusted-parties/tp-password-reset-request.service.d.ts +20 -0
- package/lib/trusted-parties/tp-password-reset-user.service.d.ts +35 -0
- package/lib/trusted-parties/tp-password-reset.constants.d.ts +3 -0
- package/lib/trusted-parties/tp-password-reset.gql.d.ts +218 -0
- package/lib/trusted-parties/tp-password-reset.service.d.ts +130 -0
- package/lib/trusted-parties/trusted-party.gql.d.ts +9 -0
- package/lib/trusted-parties/trusted-party.service.d.ts +44 -0
- package/lib/trusted-parties/trusted-party.types.d.ts +102 -0
- package/lib/trusted-parties/trusted-party2.gql.d.ts +79 -0
- package/lib/trusted-parties/trusted-party2.service.d.ts +114 -0
- package/lib/users/profile-details.service.d.ts +21 -0
- package/lib/users/profile.gql.d.ts +11 -0
- package/lib/users/profile.service.d.ts +35 -0
- package/lib/users/profile.types.d.ts +96 -0
- package/lib/users/user.gql.d.ts +9 -0
- package/lib/users/user.service.d.ts +12 -0
- package/lib/users/user.types.d.ts +23 -0
- package/lifeready-core.d.ts +9 -0
- package/lifeready-core.metadata.json +1 -0
- package/package.json +29 -21
- package/{src/public-api.ts → public-api.d.ts} +0 -19
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -26
- package/src/lib/_common/ast.ts +0 -75
- package/src/lib/_common/deferred-promise.ts +0 -35
- package/src/lib/_common/exceptions.ts +0 -189
- package/src/lib/_common/queries.gql.ts +0 -200
- package/src/lib/_common/run-outside-angular.ts +0 -125
- package/src/lib/_common/tests.ts +0 -82
- package/src/lib/_common/utils.ts +0 -57
- package/src/lib/api/api-mutation.spec.ts +0 -547
- package/src/lib/api/api-query.spec.ts +0 -40
- package/src/lib/api/contact-card.gql.ts +0 -85
- package/src/lib/api/contact-card.service.spec.ts +0 -249
- package/src/lib/api/contact-card.service.ts +0 -228
- package/src/lib/api/contact-card2.gql.ts +0 -93
- package/src/lib/api/contact-card2.service.spec.ts +0 -297
- package/src/lib/api/contact-card2.service.ts +0 -139
- package/src/lib/api/file.service.spec.ts +0 -14
- package/src/lib/api/file.service.ts +0 -81
- package/src/lib/api/item2.gql.ts +0 -211
- package/src/lib/api/item2.service.spec.ts +0 -1043
- package/src/lib/api/item2.service.ts +0 -481
- package/src/lib/api/key-exchange.gql.ts +0 -196
- package/src/lib/api/key-exchange.service.spec.ts +0 -470
- package/src/lib/api/key-exchange.service.ts +0 -731
- package/src/lib/api/key-exchange.types.ts +0 -235
- package/src/lib/api/key-exchange2.gql.ts +0 -310
- package/src/lib/api/key-exchange2.service.spec.ts +0 -892
- package/src/lib/api/key-exchange2.service.ts +0 -875
- package/src/lib/api/lock.gql.ts +0 -67
- package/src/lib/api/lock.service.spec.ts +0 -549
- package/src/lib/api/lock.service.ts +0 -57
- package/src/lib/api/lr-apollo.service.spec.ts +0 -27
- package/src/lib/api/lr-apollo.service.ts +0 -43
- package/src/lib/api/lr-graphql/lr-graphql.service.ts +0 -313
- package/src/lib/api/lr-graphql/lr-merged-mutation.ts +0 -377
- package/src/lib/api/lr-graphql/lr-mutation-base.ts +0 -67
- package/src/lib/api/lr-graphql/lr-mutation.ts +0 -74
- package/src/lib/api/lr-graphql/lr.service.ts +0 -28
- package/src/lib/api/message.service.spec.ts +0 -20
- package/src/lib/api/message.service.ts +0 -210
- package/src/lib/api/persist.service.spec.ts +0 -209
- package/src/lib/api/persist.service.ts +0 -220
- package/src/lib/api/query-processor/common-processors.service.ts +0 -148
- package/src/lib/api/query-processor/query-processor.service.ts +0 -240
- package/src/lib/api/query-processor/tp-password-reset-processor.service.ts +0 -177
- package/src/lib/api/shared-contact-card.service.ts +0 -156
- package/src/lib/api/shared-contact-card2.gql.ts +0 -76
- package/src/lib/api/shared-contact-card2.service.ts +0 -154
- package/src/lib/api/time.service.spec.ts +0 -48
- package/src/lib/api/time.service.ts +0 -155
- package/src/lib/api/types/graphql.types.ts +0 -48
- package/src/lib/api/types/lr-graphql.types.ts +0 -467
- package/src/lib/auth/auth.config.ts +0 -83
- package/src/lib/auth/auth.gql.ts +0 -62
- package/src/lib/auth/auth.types.ts +0 -79
- package/src/lib/auth/idle.service.spec.ts +0 -119
- package/src/lib/auth/idle.service.ts +0 -208
- package/src/lib/auth/idle.types.ts +0 -11
- package/src/lib/auth/lbop.service.spec.ts +0 -56
- package/src/lib/auth/lbop.service.ts +0 -539
- package/src/lib/auth/life-ready-auth.service.spec.ts +0 -70
- package/src/lib/auth/life-ready-auth.service.ts +0 -454
- package/src/lib/auth/password.service.spec.ts +0 -51
- package/src/lib/auth/password.service.ts +0 -438
- package/src/lib/auth/register.service.spec.ts +0 -31
- package/src/lib/auth/register.service.ts +0 -181
- package/src/lib/auth/two-factor.service.spec.ts +0 -21
- package/src/lib/auth/two-factor.service.ts +0 -69
- package/src/lib/category/category-meta.service.spec.ts +0 -28
- package/src/lib/category/category-meta.service.ts +0 -125
- package/src/lib/category/category.gql.ts +0 -449
- package/src/lib/category/category.service.spec.ts +0 -26
- package/src/lib/category/category.service.ts +0 -498
- package/src/lib/category/category.types.ts +0 -89
- package/src/lib/cryptography/cryptography.types.ts +0 -108
- package/src/lib/cryptography/encryption.service.spec.ts +0 -125
- package/src/lib/cryptography/encryption.service.ts +0 -243
- package/src/lib/cryptography/key-factory.service.spec.ts +0 -15
- package/src/lib/cryptography/key-factory.service.ts +0 -303
- package/src/lib/cryptography/key-graph.service.spec.ts +0 -16
- package/src/lib/cryptography/key-graph.service.ts +0 -354
- package/src/lib/cryptography/key-meta.service.spec.ts +0 -40
- package/src/lib/cryptography/key-meta.service.ts +0 -254
- package/src/lib/cryptography/key.service.spec.ts +0 -16
- package/src/lib/cryptography/key.service.ts +0 -154
- package/src/lib/cryptography/slip39.service.spec.ts +0 -44
- package/src/lib/cryptography/slip39.service.ts +0 -204
- package/src/lib/cryptography/web-crypto.service.ts +0 -22
- package/src/lib/life-ready.config.ts +0 -127
- package/src/lib/life-ready.module.ts +0 -81
- package/src/lib/plan/plan.gql.ts +0 -133
- package/src/lib/plan/plan.service.spec.ts +0 -294
- package/src/lib/plan/plan.service.ts +0 -198
- package/src/lib/plan/plan.types.ts +0 -37
- package/src/lib/record/record-attachment.service.spec.ts +0 -31
- package/src/lib/record/record-attachment.service.ts +0 -101
- package/src/lib/record/record.gql.ts +0 -192
- package/src/lib/record/record.service.spec.ts +0 -598
- package/src/lib/record/record.service.ts +0 -236
- package/src/lib/record/record.types.ts +0 -86
- package/src/lib/record-type/record-type.service.spec.ts +0 -16
- package/src/lib/record-type/record-type.service.ts +0 -71
- package/src/lib/record-type/record-type.types.ts +0 -58
- package/src/lib/scenario/approvals/scenario-approval.gql.ts +0 -112
- package/src/lib/scenario/approvals/scenario-approval.types.ts +0 -85
- package/src/lib/scenario/approvals/scenario-approver.service.spec.ts +0 -16
- package/src/lib/scenario/approvals/scenario-approver.service.ts +0 -422
- package/src/lib/scenario/claimants/scenario-claimant.gql.ts +0 -56
- package/src/lib/scenario/claimants/scenario-claimant.service.spec.ts +0 -16
- package/src/lib/scenario/claimants/scenario-claimant.service.ts +0 -100
- package/src/lib/scenario/claimants/scenario-claimant.types.ts +0 -21
- package/src/lib/scenario/receivers/scenario-receiver.gql.ts +0 -157
- package/src/lib/scenario/receivers/scenario-receiver.service.spec.ts +0 -16
- package/src/lib/scenario/receivers/scenario-receiver.service.ts +0 -278
- package/src/lib/scenario/receivers/scenario-receiver.types.ts +0 -66
- package/src/lib/scenario/scenario-setup.service.spec.ts +0 -22
- package/src/lib/scenario/scenario-setup.service.ts +0 -369
- package/src/lib/scenario/scenario.gql.ts +0 -404
- package/src/lib/scenario/scenario.service.spec.ts +0 -1586
- package/src/lib/scenario/scenario.service.ts +0 -811
- package/src/lib/scenario/scenario.types.ts +0 -258
- package/src/lib/search/search.gql.ts +0 -62
- package/src/lib/search/search.service.spec.ts +0 -57
- package/src/lib/search/search.service.ts +0 -174
- package/src/lib/search/search.types.ts +0 -24
- package/src/lib/trusted-parties/tp-password-reset-request.service.ts +0 -140
- package/src/lib/trusted-parties/tp-password-reset-user.service.ts +0 -359
- package/src/lib/trusted-parties/tp-password-reset.gql.ts +0 -453
- package/src/lib/trusted-parties/tp-password-reset.service.spec.ts +0 -602
- package/src/lib/trusted-parties/tp-password-reset.service.ts +0 -482
- package/src/lib/trusted-parties/trusted-party.gql.ts +0 -159
- package/src/lib/trusted-parties/trusted-party.service.spec.ts +0 -1008
- package/src/lib/trusted-parties/trusted-party.service.ts +0 -394
- package/src/lib/trusted-parties/trusted-party.types.ts +0 -119
- package/src/lib/trusted-parties/trusted-party2.gql.ts +0 -165
- package/src/lib/trusted-parties/trusted-party2.service.spec.ts +0 -1782
- package/src/lib/trusted-parties/trusted-party2.service.ts +0 -272
- package/src/lib/users/profile-details.service.spec.ts +0 -45
- package/src/lib/users/profile-details.service.ts +0 -278
- package/src/lib/users/profile.gql.ts +0 -108
- package/src/lib/users/profile.service.spec.ts +0 -97
- package/src/lib/users/profile.service.ts +0 -224
- package/src/lib/users/profile.types.ts +0 -101
- package/src/lib/users/user.gql.ts +0 -69
- package/src/lib/users/user.service.spec.ts +0 -161
- package/src/lib/users/user.service.ts +0 -72
- package/src/lib/users/user.types.ts +0 -27
- package/src/test.ts +0 -21
- package/tsconfig.lib.json +0 -21
- package/tsconfig.lib.prod.json +0 -6
- package/tsconfig.spec.json +0 -10
- package/tslint.json +0 -17
- /package/{src/lib/api/lr-graphql/index.ts → lib/api/lr-graphql/index.d.ts} +0 -0
- /package/{src/lib/api/query-processor/index.ts → lib/api/query-processor/index.d.ts} +0 -0
- /package/{src/lib/api/types/index.ts → lib/api/types/index.d.ts} +0 -0
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { RecordService } from './record.service';
|
|
3
|
-
import { loginTestUser } from '../auth/life-ready-auth.service.spec';
|
|
4
|
-
import { CategoryService } from '../category/category.service';
|
|
5
|
-
import { RecordAttachmentService } from '../record/record-attachment.service';
|
|
6
|
-
import { VaultCategory, Category } from '../category/category.types';
|
|
7
|
-
import { LrRecord } from './record.types';
|
|
8
|
-
import { environment } from 'projects/lr-auth-app/src/environments/environment';
|
|
9
|
-
import {
|
|
10
|
-
lrConfigureTestingModule,
|
|
11
|
-
lrExpectAsyncThrow,
|
|
12
|
-
lrit,
|
|
13
|
-
} from '../_common/tests';
|
|
14
|
-
import { CurrentUser } from '../auth/auth.types';
|
|
15
|
-
|
|
16
|
-
const TIMEOUT = 1000 * 60 * 10;
|
|
17
|
-
|
|
18
|
-
describe('RecordService', () => {
|
|
19
|
-
let recordService: RecordService;
|
|
20
|
-
let recordAttachmentService: RecordAttachmentService;
|
|
21
|
-
let categoryService: CategoryService;
|
|
22
|
-
let user: CurrentUser;
|
|
23
|
-
|
|
24
|
-
beforeEach(async () => {
|
|
25
|
-
lrConfigureTestingModule();
|
|
26
|
-
recordService = TestBed.inject(RecordService);
|
|
27
|
-
categoryService = TestBed.inject(CategoryService);
|
|
28
|
-
recordAttachmentService = TestBed.inject(RecordAttachmentService);
|
|
29
|
-
user = await loginTestUser();
|
|
30
|
-
}, TIMEOUT);
|
|
31
|
-
|
|
32
|
-
function categoryContent(name) {
|
|
33
|
-
return {
|
|
34
|
-
name,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function createCategory(name: string, parentIds?: string[]) {
|
|
39
|
-
const id = await categoryService.createCategory({
|
|
40
|
-
name,
|
|
41
|
-
isCustom: false,
|
|
42
|
-
allowRecords: true,
|
|
43
|
-
allowCustomCategories: true,
|
|
44
|
-
categoryIds: parentIds,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const C = await categoryService.getCategory(id);
|
|
48
|
-
|
|
49
|
-
expect(C.category.id).toEqual(id);
|
|
50
|
-
expect(C.category.name).toEqual(name);
|
|
51
|
-
return C;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function createRecord(name: string, categoryIds: string[]) {
|
|
55
|
-
const content = 'first text file';
|
|
56
|
-
const file = new File([content], 'attachment.txt', {
|
|
57
|
-
type: 'text/plain',
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const { recordId, attachmentError } = await recordService.createRecord({
|
|
61
|
-
name,
|
|
62
|
-
recordType: {
|
|
63
|
-
id: '123',
|
|
64
|
-
name,
|
|
65
|
-
version: 123,
|
|
66
|
-
},
|
|
67
|
-
categoryIds,
|
|
68
|
-
attachments: [
|
|
69
|
-
{
|
|
70
|
-
name: 'first attachment',
|
|
71
|
-
file,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const R = await recordService.getRecord(recordId);
|
|
77
|
-
|
|
78
|
-
expect(R.id).toEqual(recordId);
|
|
79
|
-
expect(R.name).toEqual(name);
|
|
80
|
-
matchParentCategoryIds(R, categoryIds);
|
|
81
|
-
|
|
82
|
-
const attachment = await recordAttachmentService.downloadAttachment(
|
|
83
|
-
R.attachments[0].contentId,
|
|
84
|
-
R.attachments[0].keyId
|
|
85
|
-
);
|
|
86
|
-
expect(new TextDecoder('utf-8').decode(attachment)).toEqual(content);
|
|
87
|
-
|
|
88
|
-
return R;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function matchParentCategoryIds(
|
|
92
|
-
record: LrRecord,
|
|
93
|
-
parentCategoryIds: string[]
|
|
94
|
-
) {
|
|
95
|
-
expect(record.categories.length).toBe(
|
|
96
|
-
parentCategoryIds.length,
|
|
97
|
-
'Different number of ParentCategories'
|
|
98
|
-
);
|
|
99
|
-
expect(
|
|
100
|
-
record.categories.every((c) =>
|
|
101
|
-
parentCategoryIds.includes(c[c.length - 1].id)
|
|
102
|
-
)
|
|
103
|
-
).toBeTrue();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function matchSubCategories(
|
|
107
|
-
category: VaultCategory,
|
|
108
|
-
children: VaultCategory[]
|
|
109
|
-
) {
|
|
110
|
-
const childrenId = children.map((c) => c.category.id);
|
|
111
|
-
|
|
112
|
-
expect(category.subCategories.length).toBe(
|
|
113
|
-
children.length,
|
|
114
|
-
'Different number of SubCategories'
|
|
115
|
-
);
|
|
116
|
-
expect(
|
|
117
|
-
category.subCategories.every((c) => childrenId.includes(c.id))
|
|
118
|
-
).toBeTrue();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// async function updateRecord(recordId: string, recordProps: RecordProps) {
|
|
122
|
-
// await recordService.updateRecord(recordId, updateId: string, keyId: string, updatedRecord: UpdatedRecord);
|
|
123
|
-
|
|
124
|
-
// const R = await recordService.getRecord({
|
|
125
|
-
// recordId
|
|
126
|
-
// });
|
|
127
|
-
|
|
128
|
-
// expect(R.plainMetaJson.recordProps).toEqual(recordProps);
|
|
129
|
-
|
|
130
|
-
// return R;
|
|
131
|
-
// }
|
|
132
|
-
|
|
133
|
-
// async function updateContent(recordId, plainCipherMetaJson) {
|
|
134
|
-
// let R = await recordService.getRecord({
|
|
135
|
-
// recordId
|
|
136
|
-
// });
|
|
137
|
-
|
|
138
|
-
// const oldVersionId = R.content.edges[0].node.childFile.currentVersion.id;
|
|
139
|
-
// const oldVersionsCount = R.content.edges[0].node.childFile.versions.edges.length;
|
|
140
|
-
// const oldContent = R.content.edges[0].node.childFile.currentVersion.state.plainCipherMetaJson;
|
|
141
|
-
|
|
142
|
-
// await recordService.updateContent({
|
|
143
|
-
// recordId,
|
|
144
|
-
// plainCipherMetaJson
|
|
145
|
-
// });
|
|
146
|
-
|
|
147
|
-
// R = await recordService.getRecord({
|
|
148
|
-
// recordId
|
|
149
|
-
// });
|
|
150
|
-
|
|
151
|
-
// expect(R.content.edges[0].node.childFile.currentVersion.state.plainCipherMetaJson).toEqual(plainCipherMetaJson);
|
|
152
|
-
// const newVersionId = R.content.edges[0].node.childFile.currentVersion.id;
|
|
153
|
-
// const newVersionsCount = R.content.edges[0].node.childFile.versions.edges.length;
|
|
154
|
-
// const newContent = R.content.edges[0].node.childFile.currentVersion.state.plainCipherMetaJson;
|
|
155
|
-
|
|
156
|
-
// expect(newVersionId !== oldVersionId);
|
|
157
|
-
// expect(newVersionsCount > oldVersionsCount);
|
|
158
|
-
// }
|
|
159
|
-
|
|
160
|
-
// async function addAttachment(recordId: string, name: string, text: string) {
|
|
161
|
-
// const fileInput = new File([text], "attachment.txt", {
|
|
162
|
-
// type: "text/plain",
|
|
163
|
-
// });
|
|
164
|
-
|
|
165
|
-
// const A = await recordService.addAttachment({
|
|
166
|
-
// recordId,
|
|
167
|
-
// fileInput,
|
|
168
|
-
// plainCipherMetaJson: {
|
|
169
|
-
// name,
|
|
170
|
-
// }
|
|
171
|
-
// });
|
|
172
|
-
|
|
173
|
-
// const R = await recordService.getRecord({
|
|
174
|
-
// recordId
|
|
175
|
-
// });
|
|
176
|
-
|
|
177
|
-
// const hasAttachment = R.attachments.edges.some(edge => {
|
|
178
|
-
// return edge.node.childFile.currentVersion.state.plainCipherMetaJson.name == name
|
|
179
|
-
// });
|
|
180
|
-
|
|
181
|
-
// expect(hasAttachment).toBeTrue();
|
|
182
|
-
|
|
183
|
-
// return A;
|
|
184
|
-
// }
|
|
185
|
-
|
|
186
|
-
async function deleteAllCategories() {
|
|
187
|
-
// First unarchive everything
|
|
188
|
-
let ids = await categoryService.getRootDirectoryIds({ archived: true });
|
|
189
|
-
await Promise.all(
|
|
190
|
-
ids.map(async (id) => categoryService.unarchiveCategory(id, true))
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
// Delete everything
|
|
194
|
-
ids = await categoryService.getRootDirectoryIds({ archived: false });
|
|
195
|
-
await Promise.all(
|
|
196
|
-
ids.map(async (id) => categoryService.deleteCategory(id))
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
lrit(
|
|
201
|
-
'should create vault',
|
|
202
|
-
async () => {
|
|
203
|
-
await deleteAllCategories();
|
|
204
|
-
|
|
205
|
-
let vault = await categoryService.getDefaultVault();
|
|
206
|
-
expect(vault).toEqual(null);
|
|
207
|
-
|
|
208
|
-
const vaultId = await categoryService.createDefaultVault();
|
|
209
|
-
vault = await categoryService.getDefaultVault();
|
|
210
|
-
expect(vault).toBeTruthy();
|
|
211
|
-
|
|
212
|
-
const C1 = await createCategory('C1', [vault.id]);
|
|
213
|
-
const categories = await categoryService.getCategories();
|
|
214
|
-
console.log('categories', categories);
|
|
215
|
-
},
|
|
216
|
-
TIMEOUT
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
// it('should create a simple category and record', async () => {
|
|
220
|
-
// // First clear existing records.
|
|
221
|
-
// await deleteAllCategories();
|
|
222
|
-
// const C1 = await createCategory('C1')
|
|
223
|
-
// let R1 = await createRecord('R1', [C1.category.id]);
|
|
224
|
-
|
|
225
|
-
// R1 = await recordService.getRecord(R1.id);
|
|
226
|
-
|
|
227
|
-
// }, TIMEOUT);
|
|
228
|
-
|
|
229
|
-
lrit(
|
|
230
|
-
'should create categories and records',
|
|
231
|
-
async () => {
|
|
232
|
-
if (!user) return;
|
|
233
|
-
|
|
234
|
-
// First clear existing records.
|
|
235
|
-
await deleteAllCategories();
|
|
236
|
-
|
|
237
|
-
// C1 C2
|
|
238
|
-
// | / |
|
|
239
|
-
// | / |
|
|
240
|
-
// C3 |
|
|
241
|
-
// | \ |
|
|
242
|
-
// | \ |
|
|
243
|
-
// C4 C5
|
|
244
|
-
// / | / |
|
|
245
|
-
// / | / |
|
|
246
|
-
// R3 C6 |
|
|
247
|
-
// | \ |
|
|
248
|
-
// | \ |
|
|
249
|
-
// R1 R2
|
|
250
|
-
|
|
251
|
-
// 'C' for category, 'R' for record, 'C3__C1_C2' C3 with C1,C2 as parents.
|
|
252
|
-
let C1 = await createCategory('C1试用'); // Test unicode
|
|
253
|
-
let C2 = await createCategory('C2');
|
|
254
|
-
let C3__C1_C2 = await createCategory('C3__C1_c2', [
|
|
255
|
-
C1.category.id,
|
|
256
|
-
C2.category.id,
|
|
257
|
-
]);
|
|
258
|
-
let C4__C3 = await createCategory('C4__C3', [C3__C1_C2.category.id]);
|
|
259
|
-
let C5__C2_C3 = await createCategory('C5__C2_C3', [
|
|
260
|
-
C3__C1_C2.category.id,
|
|
261
|
-
C2.category.id,
|
|
262
|
-
]);
|
|
263
|
-
let C6__C4_C5 = await createCategory('C6__C4_C5', [
|
|
264
|
-
C4__C3.category.id,
|
|
265
|
-
C5__C2_C3.category.id,
|
|
266
|
-
]);
|
|
267
|
-
|
|
268
|
-
// --------------------------------------------------
|
|
269
|
-
// Categories
|
|
270
|
-
// --------------------------------------------------
|
|
271
|
-
C1 = await categoryService.getCategory(C1.category.id);
|
|
272
|
-
C2 = await categoryService.getCategory(C2.category.id);
|
|
273
|
-
C3__C1_C2 = await categoryService.getCategory(C3__C1_C2.category.id);
|
|
274
|
-
C4__C3 = await categoryService.getCategory(C4__C3.category.id);
|
|
275
|
-
C5__C2_C3 = await categoryService.getCategory(C5__C2_C3.category.id);
|
|
276
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
277
|
-
|
|
278
|
-
matchSubCategories(C1, [C3__C1_C2]);
|
|
279
|
-
matchSubCategories(C2, [C3__C1_C2, C5__C2_C3]);
|
|
280
|
-
matchSubCategories(C3__C1_C2, [C4__C3, C5__C2_C3]);
|
|
281
|
-
matchSubCategories(C4__C3, [C6__C4_C5]);
|
|
282
|
-
matchSubCategories(C5__C2_C3, [C6__C4_C5]);
|
|
283
|
-
|
|
284
|
-
// --------------------------------------------------
|
|
285
|
-
// Records
|
|
286
|
-
// --------------------------------------------------
|
|
287
|
-
|
|
288
|
-
// --------------------------------------------------
|
|
289
|
-
// R1
|
|
290
|
-
// --------------------------------------------------
|
|
291
|
-
let R1 = await createRecord('R1', [C6__C4_C5.category.id]);
|
|
292
|
-
|
|
293
|
-
// Delete test
|
|
294
|
-
await recordService.deleteRecord(R1.id);
|
|
295
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
296
|
-
expect(C6__C4_C5.records.length).toBe(0);
|
|
297
|
-
expect(C6__C4_C5.category.allRecordsCount).toBe(0);
|
|
298
|
-
|
|
299
|
-
C5__C2_C3 = await categoryService.getCategory(C5__C2_C3.category.id);
|
|
300
|
-
expect(C5__C2_C3.category.allRecordsCount).toBe(0);
|
|
301
|
-
|
|
302
|
-
// Delete archived record test
|
|
303
|
-
R1 = await createRecord('R1', [C6__C4_C5.category.id]);
|
|
304
|
-
await recordService.archiveRecord(R1.id);
|
|
305
|
-
await recordService.deleteRecord(R1.id);
|
|
306
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
307
|
-
expect(C6__C4_C5.records.length).toBe(0);
|
|
308
|
-
|
|
309
|
-
// Create record
|
|
310
|
-
R1 = await createRecord('R1', [C6__C4_C5.category.id]);
|
|
311
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
312
|
-
expect(C6__C4_C5.records.length).toBe(1);
|
|
313
|
-
|
|
314
|
-
// todo complete the rest of the tests.
|
|
315
|
-
|
|
316
|
-
// R1 = await updateRecord(R1.id, {
|
|
317
|
-
// archived: false,
|
|
318
|
-
// hidden: false
|
|
319
|
-
// });
|
|
320
|
-
|
|
321
|
-
// await updateContent(R1.id, recordContent("R1 update1"));
|
|
322
|
-
|
|
323
|
-
// let A1 = await addAttachment(R1.id, "R1 A1", "R1 A1 content");
|
|
324
|
-
// let A2 = await addAttachment(R1.id, "R1 A2", "R1 A2 content");
|
|
325
|
-
// await recordService.deleteAttachment({
|
|
326
|
-
// attachmentId: A1.id
|
|
327
|
-
// })
|
|
328
|
-
// R1 = await recordService.getRecord({
|
|
329
|
-
// recordId: R1.id
|
|
330
|
-
// });
|
|
331
|
-
// expect(R1.attachments.edges.length).toBe(1);
|
|
332
|
-
|
|
333
|
-
// --------------------------------------------------
|
|
334
|
-
// R2
|
|
335
|
-
// --------------------------------------------------
|
|
336
|
-
const R2 = await createRecord('R2', [
|
|
337
|
-
C5__C2_C3.category.id,
|
|
338
|
-
C6__C4_C5.category.id,
|
|
339
|
-
]);
|
|
340
|
-
|
|
341
|
-
// PlainMeta filter should filter to only categories
|
|
342
|
-
const res = await categoryService.getCategory(C5__C2_C3.category.id);
|
|
343
|
-
expect(res.records.length).toBe(1);
|
|
344
|
-
expect(res.records[0].name).toEqual('R2');
|
|
345
|
-
expect(res.subCategories.length).toBe(1);
|
|
346
|
-
expect(res.subCategories[0].name).toEqual('C6__C4_C5');
|
|
347
|
-
|
|
348
|
-
// let parentC6 = R2.parentCategories.edges.find(edge => edge.node.parentDirectory.id == C6__C4_C5.id).node.parentDirectory;
|
|
349
|
-
// matchParentCategories(parentC6, [C4__C3, C5__C2_C3])
|
|
350
|
-
|
|
351
|
-
// --------------------------------------------------
|
|
352
|
-
// R3
|
|
353
|
-
// --------------------------------------------------
|
|
354
|
-
const R3 = await createRecord('R3', [C4__C3.category.id]);
|
|
355
|
-
|
|
356
|
-
// // --------------------------------------------------
|
|
357
|
-
// // C1
|
|
358
|
-
// // --------------------------------------------------
|
|
359
|
-
// C1 = await recordService.getCategory({
|
|
360
|
-
// categoryId: C1.id,
|
|
361
|
-
// });
|
|
362
|
-
// expect(C1.allRecordsCount).toBe(3);
|
|
363
|
-
// expect(C1.records.edges.length).toBe(0);
|
|
364
|
-
// expect(C1.subCategories.edges.length).toBe(1);
|
|
365
|
-
|
|
366
|
-
// --------------------------------------------------
|
|
367
|
-
// C2
|
|
368
|
-
// --------------------------------------------------
|
|
369
|
-
C2 = await categoryService.getCategory(C2.category.id);
|
|
370
|
-
expect(C2.category.allRecordsCount).toBe(3);
|
|
371
|
-
|
|
372
|
-
// // --------------------------------------------------
|
|
373
|
-
// // C3
|
|
374
|
-
// // --------------------------------------------------
|
|
375
|
-
// C3__C1_c2 = await recordService.getCategory({
|
|
376
|
-
// categoryId: C3__C1_c2.id,
|
|
377
|
-
// });
|
|
378
|
-
// expect(C3__C1_c2.allRecordsCount).toBe(3);
|
|
379
|
-
// expect(C3__C1_c2.records.edges.length).toBe(0);
|
|
380
|
-
// expect(C3__C1_c2.subCategories.edges.length).toBe(2);
|
|
381
|
-
|
|
382
|
-
// // --------------------------------------------------
|
|
383
|
-
// // C4
|
|
384
|
-
// // --------------------------------------------------
|
|
385
|
-
// C4__C3 = await recordService.getCategory({
|
|
386
|
-
// categoryId: C4__C3.id,
|
|
387
|
-
// });
|
|
388
|
-
// expect(C4__C3.allRecordsCount).toBe(3);
|
|
389
|
-
// expect(C4__C3.records.edges.length).toBe(1);
|
|
390
|
-
// expect(C4__C3.subCategories.edges.length).toBe(1);
|
|
391
|
-
|
|
392
|
-
// // --------------------------------------------------
|
|
393
|
-
// // C5
|
|
394
|
-
// // --------------------------------------------------
|
|
395
|
-
C5__C2_C3 = await categoryService.getCategory(C5__C2_C3.category.id);
|
|
396
|
-
expect(C5__C2_C3.records.length).toBe(1);
|
|
397
|
-
expect(C5__C2_C3.subCategories.length).toBe(1);
|
|
398
|
-
expect(C5__C2_C3.category.allRecordsCount).toBe(2);
|
|
399
|
-
|
|
400
|
-
// --------------------------------------------------
|
|
401
|
-
// C6
|
|
402
|
-
// --------------------------------------------------
|
|
403
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
404
|
-
expect(C6__C4_C5.records.length).toBe(2);
|
|
405
|
-
expect(C6__C4_C5.category.allRecordsCount).toBe(2);
|
|
406
|
-
console.log(res);
|
|
407
|
-
|
|
408
|
-
// --------------------------------------------------
|
|
409
|
-
// Archived R2
|
|
410
|
-
// --------------------------------------------------
|
|
411
|
-
await recordService.archiveRecord(R2.id);
|
|
412
|
-
|
|
413
|
-
// --------------------------------------------------
|
|
414
|
-
// C5
|
|
415
|
-
// --------------------------------------------------
|
|
416
|
-
C5__C2_C3 = await categoryService.getCategory(C5__C2_C3.category.id);
|
|
417
|
-
expect(C5__C2_C3.category.allRecordsCount).toBe(1);
|
|
418
|
-
|
|
419
|
-
// --------------------------------------------------
|
|
420
|
-
// C6
|
|
421
|
-
// --------------------------------------------------
|
|
422
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
423
|
-
expect(C6__C4_C5.category.allRecordsCount).toBe(1);
|
|
424
|
-
},
|
|
425
|
-
TIMEOUT
|
|
426
|
-
);
|
|
427
|
-
|
|
428
|
-
lrit(
|
|
429
|
-
'should access control categories and records',
|
|
430
|
-
async () => {
|
|
431
|
-
if (!environment.test) {
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// First clear existing records.
|
|
436
|
-
await deleteAllCategories();
|
|
437
|
-
|
|
438
|
-
const {
|
|
439
|
-
username: username1,
|
|
440
|
-
password: password1,
|
|
441
|
-
email: email1,
|
|
442
|
-
} = environment.test.users[0];
|
|
443
|
-
const {
|
|
444
|
-
username: username2,
|
|
445
|
-
password: password2,
|
|
446
|
-
email: email2,
|
|
447
|
-
} = environment.test.users[1];
|
|
448
|
-
const {
|
|
449
|
-
username: username3,
|
|
450
|
-
password: password3,
|
|
451
|
-
email: email3,
|
|
452
|
-
} = environment.test.users[2];
|
|
453
|
-
|
|
454
|
-
// ------------------------------------------------------------------------------
|
|
455
|
-
// User 1
|
|
456
|
-
// ------------------------------------------------------------------------------
|
|
457
|
-
await loginTestUser(username1, password1);
|
|
458
|
-
|
|
459
|
-
const C1 = await createCategory('C1');
|
|
460
|
-
const R1 = await createRecord('R1', [C1.category.id]);
|
|
461
|
-
|
|
462
|
-
// ------------------------------------------------------------------------------
|
|
463
|
-
// User 2
|
|
464
|
-
// ------------------------------------------------------------------------------
|
|
465
|
-
await loginTestUser(username2, password2);
|
|
466
|
-
const C2 = await createCategory('C2');
|
|
467
|
-
const R2 = await createRecord('R2', [C2.category.id]);
|
|
468
|
-
|
|
469
|
-
// Should not have access
|
|
470
|
-
(
|
|
471
|
-
await lrExpectAsyncThrow(categoryService.getCategory(C1.category.id))
|
|
472
|
-
).toBeTruthy();
|
|
473
|
-
(await lrExpectAsyncThrow(recordService.getRecord(R1.id))).toBeTruthy();
|
|
474
|
-
|
|
475
|
-
// ------------------------------------------------------------------------------
|
|
476
|
-
// User 1
|
|
477
|
-
// ------------------------------------------------------------------------------
|
|
478
|
-
await loginTestUser(username1, password1);
|
|
479
|
-
|
|
480
|
-
// Should not have access
|
|
481
|
-
(
|
|
482
|
-
await lrExpectAsyncThrow(categoryService.getCategory(C2.category.id))
|
|
483
|
-
).toBeTruthy();
|
|
484
|
-
(await lrExpectAsyncThrow(recordService.getRecord(R2.id))).toBeTruthy();
|
|
485
|
-
},
|
|
486
|
-
TIMEOUT
|
|
487
|
-
);
|
|
488
|
-
|
|
489
|
-
lrit(
|
|
490
|
-
'should archive categories and records',
|
|
491
|
-
async () => {
|
|
492
|
-
if (!user) return;
|
|
493
|
-
|
|
494
|
-
// First clear existing records.
|
|
495
|
-
await deleteAllCategories();
|
|
496
|
-
// C1 C2
|
|
497
|
-
// | / |
|
|
498
|
-
// | / |
|
|
499
|
-
// C3 |
|
|
500
|
-
// | \ |
|
|
501
|
-
// | \ |
|
|
502
|
-
// C4 C5
|
|
503
|
-
// / | / |
|
|
504
|
-
// / | / |
|
|
505
|
-
// R3 C6 |
|
|
506
|
-
// | \ |
|
|
507
|
-
// | \ |
|
|
508
|
-
// R1 R2
|
|
509
|
-
|
|
510
|
-
const VAULT_ID = await categoryService.createDefaultVault();
|
|
511
|
-
|
|
512
|
-
// 'C' for category, 'R' for record, 'C3__C1_C2' C3 with C1,C2 as parents.
|
|
513
|
-
let C1 = await createCategory('C1试用', [VAULT_ID]);
|
|
514
|
-
const C2 = await createCategory('C2', [VAULT_ID]);
|
|
515
|
-
const C3__C1_C2 = await createCategory('C3__C1_c2', [
|
|
516
|
-
C1.category.id,
|
|
517
|
-
C2.category.id,
|
|
518
|
-
]);
|
|
519
|
-
const C4__C3 = await createCategory('C4__C3', [C3__C1_C2.category.id]);
|
|
520
|
-
const C5__C2_C3 = await createCategory('C5__C2_C3', [
|
|
521
|
-
C3__C1_C2.category.id,
|
|
522
|
-
C2.category.id,
|
|
523
|
-
]);
|
|
524
|
-
let C6__C4_C5 = await createCategory('C6__C4_C5', [
|
|
525
|
-
C4__C3.category.id,
|
|
526
|
-
C5__C2_C3.category.id,
|
|
527
|
-
]);
|
|
528
|
-
let R1 = await createRecord('R1', [C6__C4_C5.category.id]);
|
|
529
|
-
let R2 = await createRecord('R2', [
|
|
530
|
-
C5__C2_C3.category.id,
|
|
531
|
-
C6__C4_C5.category.id,
|
|
532
|
-
]);
|
|
533
|
-
const R3 = await createRecord('R3', [C4__C3.category.id]);
|
|
534
|
-
|
|
535
|
-
let categories: Category[];
|
|
536
|
-
|
|
537
|
-
// Before archiving
|
|
538
|
-
categories = await categoryService.getCategories();
|
|
539
|
-
expect(categories.length).toBe(2);
|
|
540
|
-
categories = await categoryService.getCategories({ archived: false });
|
|
541
|
-
expect(categories.length).toBe(2);
|
|
542
|
-
categories = await categoryService.getCategories({ archived: true });
|
|
543
|
-
expect(categories.length).toBe(0);
|
|
544
|
-
|
|
545
|
-
// Archiving C1 non-recursive
|
|
546
|
-
await categoryService.archiveCategory(C1.category.id, false);
|
|
547
|
-
categories = await categoryService.getCategories();
|
|
548
|
-
expect(categories.length).toBe(2); // Returns all categories the user has access to, either archived or not.
|
|
549
|
-
categories = await categoryService.getCategories({ archived: false });
|
|
550
|
-
expect(categories.length).toBe(1); // Returns only non-archived
|
|
551
|
-
expect(categories[0].isArchived).toBeFalse();
|
|
552
|
-
categories = await categoryService.getCategories({ archived: true });
|
|
553
|
-
expect(categories.length).toBe(1); // Returns only archived
|
|
554
|
-
expect(categories[0].isArchived).toBeTrue();
|
|
555
|
-
|
|
556
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
557
|
-
expect(C6__C4_C5.category.isArchived).toBeFalse();
|
|
558
|
-
|
|
559
|
-
// Archiving R2
|
|
560
|
-
await recordService.archiveRecord(R2.id);
|
|
561
|
-
R2 = await recordService.getRecord(R2.id);
|
|
562
|
-
expect(R2.isArchived).toBeTrue();
|
|
563
|
-
|
|
564
|
-
// Unarchiving R2
|
|
565
|
-
await recordService.unarchiveRecord(R2.id);
|
|
566
|
-
R2 = await recordService.getRecord(R2.id);
|
|
567
|
-
expect(R2.isArchived).toBeFalse();
|
|
568
|
-
|
|
569
|
-
// Archiving C3 recursive
|
|
570
|
-
await categoryService.archiveCategory(C3__C1_C2.category.id, true);
|
|
571
|
-
|
|
572
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
573
|
-
expect(C6__C4_C5.category.isArchived).toBeTrue();
|
|
574
|
-
|
|
575
|
-
R1 = await recordService.getRecord(R1.id);
|
|
576
|
-
expect(R1.isArchived).toBeTrue();
|
|
577
|
-
|
|
578
|
-
// Unarchiving C6
|
|
579
|
-
await categoryService.unarchiveCategory(C6__C4_C5.category.id, false);
|
|
580
|
-
|
|
581
|
-
C6__C4_C5 = await categoryService.getCategory(C6__C4_C5.category.id);
|
|
582
|
-
expect(C6__C4_C5.category.isArchived).toBeFalse();
|
|
583
|
-
|
|
584
|
-
R1 = await recordService.getRecord(R1.id);
|
|
585
|
-
expect(R1.isArchived).toBeTrue(); // Non-recursive unarchive should not affect the child record
|
|
586
|
-
|
|
587
|
-
// Unarchiving C3
|
|
588
|
-
await categoryService.unarchiveCategory(C3__C1_C2.category.id, true);
|
|
589
|
-
|
|
590
|
-
C1 = await categoryService.getCategory(C1.category.id);
|
|
591
|
-
expect(C1.category.isArchived).toBeTrue(); // Unarchive should not affect parents
|
|
592
|
-
|
|
593
|
-
R1 = await recordService.getRecord(R1.id);
|
|
594
|
-
expect(R1.isArchived).toBeFalse();
|
|
595
|
-
},
|
|
596
|
-
TIMEOUT
|
|
597
|
-
);
|
|
598
|
-
});
|