@lifeready/core 8.0.9 → 8.0.11
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 +86 -71
- package/bundles/lifeready-core.umd.js.map +1 -1
- package/bundles/lifeready-core.umd.min.js +1 -1
- package/bundles/lifeready-core.umd.min.js.map +1 -1
- package/esm2015/lib/api/query-processor/query-processor.service.js +13 -1
- package/esm2015/lib/api/types/lr-graphql.types.js +1 -1
- package/esm2015/lib/item/item.service.js +23 -19
- package/esm2015/lib/item/item.types.js +1 -1
- package/esm2015/lib/scenario/scenario.private.gql.js +1 -14
- package/esm2015/lib/scenario/scenario.service.js +35 -28
- package/fesm2015/lifeready-core.js +68 -58
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/api/types/lr-graphql.types.d.ts +19 -5
- package/lib/item/item.service.d.ts +11 -13
- package/lib/item/item.types.d.ts +4 -3
- package/lib/scenario/scenario.service.d.ts +0 -7
- package/lifeready-core.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -2971,6 +2971,15 @@
|
|
|
2971
2971
|
},
|
|
2972
2972
|
}),
|
|
2973
2973
|
]));
|
|
2974
|
+
this.registerProcessor('SharedScenarioReceiverDirectoryNode', common.series([
|
|
2975
|
+
common.makeDecryptionProcessor({
|
|
2976
|
+
cipherFieldName: 'sharedCipherData',
|
|
2977
|
+
getKeyId: function (_a) {
|
|
2978
|
+
var field = _a.field;
|
|
2979
|
+
return field.sharedKey.id;
|
|
2980
|
+
},
|
|
2981
|
+
}),
|
|
2982
|
+
]));
|
|
2974
2983
|
this.registerProcessor('ScenarioReceiverFileNode', common.series([
|
|
2975
2984
|
common.makeDecryptionProcessor({
|
|
2976
2985
|
cipherFieldName: 'sharedCipherData',
|
|
@@ -2980,6 +2989,15 @@
|
|
|
2980
2989
|
},
|
|
2981
2990
|
}),
|
|
2982
2991
|
]));
|
|
2992
|
+
this.registerProcessor('SharedScenarioReceiverFileNode', common.series([
|
|
2993
|
+
common.makeDecryptionProcessor({
|
|
2994
|
+
cipherFieldName: 'sharedCipherData',
|
|
2995
|
+
getKeyId: function (_a) {
|
|
2996
|
+
var field = _a.field;
|
|
2997
|
+
return field.sharedKey.id;
|
|
2998
|
+
},
|
|
2999
|
+
}),
|
|
3000
|
+
]));
|
|
2983
3001
|
this.registerProcessor('SharedScenarioReceiverNode', common.series([
|
|
2984
3002
|
common.makeDecryptionProcessor({
|
|
2985
3003
|
cipherFieldName: 'sharedCipherData',
|
|
@@ -7687,10 +7705,10 @@
|
|
|
7687
7705
|
});
|
|
7688
7706
|
});
|
|
7689
7707
|
};
|
|
7690
|
-
ItemService.prototype.
|
|
7708
|
+
ItemService.prototype.createDirectoryWithStaging = function (options) {
|
|
7691
7709
|
return __awaiter(this, void 0, void 0, function () {
|
|
7692
7710
|
return __generator(this, function (_d) {
|
|
7693
|
-
return [2 /*return*/, this.mutate(this.
|
|
7711
|
+
return [2 /*return*/, this.mutate(this.createDirectoryWithStagingMutation(options))];
|
|
7694
7712
|
});
|
|
7695
7713
|
});
|
|
7696
7714
|
};
|
|
@@ -7699,7 +7717,7 @@
|
|
|
7699
7717
|
* server, otherwise the temp directory will get cleaned up.
|
|
7700
7718
|
*
|
|
7701
7719
|
*/
|
|
7702
|
-
ItemService.prototype.
|
|
7720
|
+
ItemService.prototype.createDirectoryWithStagingMutation = function (options) {
|
|
7703
7721
|
return __awaiter(this, void 0, void 0, function () {
|
|
7704
7722
|
var tempDir, directory;
|
|
7705
7723
|
return __generator(this, function (_d) {
|
|
@@ -7735,13 +7753,13 @@
|
|
|
7735
7753
|
})];
|
|
7736
7754
|
case 3:
|
|
7737
7755
|
directory = (_d.sent()).createDirectory.directory;
|
|
7738
|
-
//
|
|
7739
|
-
return [4 /*yield*/, options.
|
|
7756
|
+
// Call back with item that's currently in staging.
|
|
7757
|
+
return [4 /*yield*/, options.onCreatedInStaging({
|
|
7740
7758
|
id: directory.id,
|
|
7741
7759
|
keyId: directory.keyId,
|
|
7742
7760
|
})];
|
|
7743
7761
|
case 4:
|
|
7744
|
-
//
|
|
7762
|
+
// Call back with item that's currently in staging.
|
|
7745
7763
|
_d.sent();
|
|
7746
7764
|
// TODO client-side check for timeout on requestWindowMs
|
|
7747
7765
|
// TODO return the server time where delete is scheduled. Expirable mutation
|
|
@@ -7756,14 +7774,21 @@
|
|
|
7756
7774
|
});
|
|
7757
7775
|
});
|
|
7758
7776
|
};
|
|
7759
|
-
ItemService.prototype.
|
|
7777
|
+
ItemService.prototype.createFileWithStaging = function (options) {
|
|
7760
7778
|
return __awaiter(this, void 0, void 0, function () {
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7779
|
+
return __generator(this, function (_d) {
|
|
7780
|
+
return [2 /*return*/, this.mutate(this.createFileWithStagingMutation(options))];
|
|
7781
|
+
});
|
|
7782
|
+
});
|
|
7783
|
+
};
|
|
7784
|
+
ItemService.prototype.createFileWithStagingMutation = function (options) {
|
|
7785
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7786
|
+
var tempDir, file;
|
|
7787
|
+
return __generator(this, function (_d) {
|
|
7788
|
+
switch (_d.label) {
|
|
7764
7789
|
case 0: return [4 /*yield*/, this.ensureTempDirectory()];
|
|
7765
7790
|
case 1:
|
|
7766
|
-
tempDir =
|
|
7791
|
+
tempDir = _d.sent();
|
|
7767
7792
|
// Clear the temp directory of the ones we are about to create.
|
|
7768
7793
|
// NOTE: this mutation can not be merged into a single mutation with the
|
|
7769
7794
|
// the createDirectory mutation because it uses the current server time to
|
|
@@ -7779,7 +7804,7 @@
|
|
|
7779
7804
|
// the createDirectory mutation because it uses the current server time to
|
|
7780
7805
|
// clean up. So it must successfully complete before the creation of the
|
|
7781
7806
|
// directories.
|
|
7782
|
-
|
|
7807
|
+
_d.sent();
|
|
7783
7808
|
return [4 /*yield*/, this.createFile(Object.assign(Object.assign({}, options), { parentDirectories: [
|
|
7784
7809
|
{
|
|
7785
7810
|
directoryId: tempDir.id,
|
|
@@ -7787,24 +7812,24 @@
|
|
|
7787
7812
|
},
|
|
7788
7813
|
] }))];
|
|
7789
7814
|
case 3:
|
|
7790
|
-
file = (
|
|
7791
|
-
|
|
7792
|
-
return [4 /*yield*/,
|
|
7815
|
+
file = (_d.sent()).createFile.file;
|
|
7816
|
+
// Call back with item that's currently in staging.
|
|
7817
|
+
return [4 /*yield*/, options.onCreatedInStaging({
|
|
7818
|
+
id: file.id,
|
|
7819
|
+
keyId: file.keyId,
|
|
7820
|
+
})];
|
|
7821
|
+
case 4:
|
|
7822
|
+
// Call back with item that's currently in staging.
|
|
7823
|
+
_d.sent();
|
|
7824
|
+
// TODO client-side check for timeout on requestWindowMs
|
|
7825
|
+
// TODO return the server time where delete is scheduled. Expirable mutation
|
|
7826
|
+
// Return the mutation that moves the directory into the dst directories
|
|
7827
|
+
return [2 /*return*/, this.changeFileParentsMutation({
|
|
7793
7828
|
fileId: file.id,
|
|
7794
7829
|
fileKeyId: file.keyId,
|
|
7795
7830
|
parentsToRemove: [tempDir.id],
|
|
7796
7831
|
parentsToAdd: options.parentDirectories,
|
|
7797
7832
|
})];
|
|
7798
|
-
case 4:
|
|
7799
|
-
// TODO client-side check for timeout on requestWindowMs
|
|
7800
|
-
// TODO return the server time where delete is scheduled. Expirable mutation
|
|
7801
|
-
// Return the mutation that moves the directory into the dst directories
|
|
7802
|
-
return [2 /*return*/, (_d.mutation = _e.sent(),
|
|
7803
|
-
_d.file = {
|
|
7804
|
-
id: file.id,
|
|
7805
|
-
keyId: file.keyId,
|
|
7806
|
-
},
|
|
7807
|
-
_d)];
|
|
7808
7833
|
}
|
|
7809
7834
|
});
|
|
7810
7835
|
});
|
|
@@ -10376,8 +10401,8 @@
|
|
|
10376
10401
|
})
|
|
10377
10402
|
], exports.ɵm);
|
|
10378
10403
|
|
|
10379
|
-
var ScenarioQuery = gqlTyped(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n
|
|
10380
|
-
var SharedScenarioQuery = gqlTyped(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n
|
|
10404
|
+
var ScenarioQuery = gqlTyped(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"], ["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"])));
|
|
10405
|
+
var SharedScenarioQuery = gqlTyped(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"], ["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));
|
|
10381
10406
|
var templateObject_1$m, templateObject_2$h;
|
|
10382
10407
|
|
|
10383
10408
|
function throwClaimIdMismatch() {
|
|
@@ -11188,50 +11213,40 @@
|
|
|
11188
11213
|
});
|
|
11189
11214
|
});
|
|
11190
11215
|
};
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
case 3:
|
|
11226
|
-
receiverDirectories = _a.sent();
|
|
11227
|
-
return [2 /*return*/, {
|
|
11228
|
-
scenarioClaimId: sharedClaimId,
|
|
11229
|
-
receiverDirectories: receiverDirectories,
|
|
11230
|
-
}];
|
|
11231
|
-
}
|
|
11232
|
-
});
|
|
11233
|
-
});
|
|
11234
|
-
};
|
|
11216
|
+
// async prepareReceiveClaim(scenarioId: string, sharedClaimId: string) {
|
|
11217
|
+
// // Get all the shared items
|
|
11218
|
+
// const sharedScenario = (
|
|
11219
|
+
// await this.getSharedScenario(scenarioId, sharedClaimId)
|
|
11220
|
+
// ).sharedScenario;
|
|
11221
|
+
// if (sharedScenario.state !== ScenarioState.APPROVED) {
|
|
11222
|
+
// throwClaimNotApproved();
|
|
11223
|
+
// }
|
|
11224
|
+
// const approvals = mapEdges(
|
|
11225
|
+
// sharedScenario.sharedClaim.asClaimReceiver.approvals
|
|
11226
|
+
// );
|
|
11227
|
+
// const assemblyKey = await this.recoverAssemblyKey(approvals);
|
|
11228
|
+
// // Decrypt all items
|
|
11229
|
+
// const receiverDirectories = await Promise.all(
|
|
11230
|
+
// sharedScenario.asReceiver.receiverItems.receiverDirectories.edges
|
|
11231
|
+
// .map((edge) => edge.node)
|
|
11232
|
+
// .map(async (receiverDirectory) => {
|
|
11233
|
+
// const wrappedItemKey = await this.encryptionService.decrypt(
|
|
11234
|
+
// assemblyKey,
|
|
11235
|
+
// receiverDirectory.wrappedItemKey
|
|
11236
|
+
// );
|
|
11237
|
+
// return {
|
|
11238
|
+
// receiverDirectoryId: receiverDirectory.id,
|
|
11239
|
+
// // Looks like receiverDirectory.wrappedItemKey has no other content in side it except a wrapped key.
|
|
11240
|
+
// // So we can turn this in to a doubly wrapped key and just release the assembly key.
|
|
11241
|
+
// receiverSharedKeyWrappedItemKey: wrappedItemKey, // the wrappedItemKey is already wrapped by receiverSharedKey
|
|
11242
|
+
// };
|
|
11243
|
+
// })
|
|
11244
|
+
// );
|
|
11245
|
+
// return {
|
|
11246
|
+
// scenarioClaimId: sharedClaimId,
|
|
11247
|
+
// receiverDirectories,
|
|
11248
|
+
// };
|
|
11249
|
+
// }
|
|
11235
11250
|
ScenarioService.prototype.recoverAssemblyKey = function (approvals) {
|
|
11236
11251
|
return __awaiter(this, void 0, void 0, function () {
|
|
11237
11252
|
var partials;
|