@lifeready/core 8.0.16 → 9.0.1
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 +64 -44
- 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/_common/utils.js +6 -9
- package/esm2015/lib/api/types/lr-graphql.types.js +7 -1
- package/esm2015/lib/item/item.gql.js +3 -1
- package/esm2015/lib/item/item.service.js +24 -18
- package/esm2015/lib/item/item.types.js +1 -1
- package/esm2015/lib/scenario/scenario.service.js +6 -6
- package/esm2015/lib/trusted-party/trusted-party.service.js +20 -12
- package/esm2015/lib/trusted-party/trusted-party.types.js +1 -1
- package/fesm2015/lifeready-core.js +57 -38
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/_common/utils.d.ts +1 -1
- package/lib/api/types/lr-graphql.types.d.ts +2 -0
- package/lib/item/item.gql.d.ts +6 -18
- package/lib/item/item.types.d.ts +7 -4
- package/lib/trusted-party/trusted-party.types.d.ts +4 -1
- package/lifeready-core.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -665,16 +665,13 @@
|
|
|
665
665
|
});
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function assertExactlyOne(options) {
|
|
669
669
|
var keys = Object.keys(options);
|
|
670
|
-
if (keys.length
|
|
671
|
-
throw new KcBadLogicException('You must provide
|
|
670
|
+
if (keys.length < 2) {
|
|
671
|
+
throw new KcBadLogicException('You must provide 2 or more fields in the argument.');
|
|
672
672
|
}
|
|
673
|
-
if (
|
|
674
|
-
throw new KcBadLogicException("You
|
|
675
|
-
}
|
|
676
|
-
if (options[keys[0]] == null && options[keys[1]] == null) {
|
|
677
|
-
throw new KcBadLogicException("You must specify either " + keys[0] + " and " + keys[1]);
|
|
673
|
+
if (keys.filter(function (key) { return options[key] != null; }).length != 1) {
|
|
674
|
+
throw new KcBadLogicException("You must provide exactly one argument that != null.");
|
|
678
675
|
}
|
|
679
676
|
}
|
|
680
677
|
|
|
@@ -3831,6 +3828,12 @@
|
|
|
3831
3828
|
function mapEdges(connection) {
|
|
3832
3829
|
return connection.edges.map(function (edge) { return edge.node; });
|
|
3833
3830
|
}
|
|
3831
|
+
function toIdKeyPair(t) {
|
|
3832
|
+
return {
|
|
3833
|
+
id: t.id,
|
|
3834
|
+
keyId: t.keyId,
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3834
3837
|
(function (UserDeleteState) {
|
|
3835
3838
|
UserDeleteState["REQUESTED"] = "REQUESTED";
|
|
3836
3839
|
})(exports.UserDeleteState || (exports.UserDeleteState = {}));
|
|
@@ -7233,8 +7236,8 @@
|
|
|
7233
7236
|
var ArchiveFileMutation = gqlTyped(templateObject_9$2 || (templateObject_9$2 = __makeTemplateObject(["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
7234
7237
|
var UnarchiveDirectoryMutation = gqlTyped(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
7235
7238
|
var UnarchiveFileMutation = gqlTyped(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
7236
|
-
var ChangeDirectoryParentsMutation = gqlTyped(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
7237
|
-
var ChangeFileParentsMutation = gqlTyped(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
7239
|
+
var ChangeDirectoryParentsMutation = gqlTyped(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"], ["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"])));
|
|
7240
|
+
var ChangeFileParentsMutation = gqlTyped(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"], ["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"])));
|
|
7238
7241
|
var BeginDeleteChildItemLinksWindowMutation = gqlTyped(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"], ["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"])));
|
|
7239
7242
|
var TempDirectoryQuery = gqlTyped(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: \"created\") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n"], ["\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: \"created\") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n"])));
|
|
7240
7243
|
var SetFileConfidentialMutation = gqlTyped(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
@@ -7789,8 +7792,7 @@
|
|
|
7789
7792
|
cipherMetaClearJson: options.cipherMetaClearJson,
|
|
7790
7793
|
parentDirectories: [
|
|
7791
7794
|
{
|
|
7792
|
-
|
|
7793
|
-
wrappingKeyId: tempDir.keyId,
|
|
7795
|
+
directory: tempDir,
|
|
7794
7796
|
},
|
|
7795
7797
|
],
|
|
7796
7798
|
plainMetaJson: options.plainMetaJson,
|
|
@@ -7851,8 +7853,7 @@
|
|
|
7851
7853
|
_d.sent();
|
|
7852
7854
|
return [4 /*yield*/, this.createFile(Object.assign(Object.assign({}, options), { parentDirectories: [
|
|
7853
7855
|
{
|
|
7854
|
-
|
|
7855
|
-
wrappingKeyId: tempDir.keyId,
|
|
7856
|
+
directory: tempDir,
|
|
7856
7857
|
},
|
|
7857
7858
|
] }))];
|
|
7858
7859
|
case 3:
|
|
@@ -7869,8 +7870,7 @@
|
|
|
7869
7870
|
// TODO return the server time where delete is scheduled. Expirable mutation
|
|
7870
7871
|
// Return the mutation that moves the directory into the dst directories
|
|
7871
7872
|
return [2 /*return*/, this.changeFileParentsMutation({
|
|
7872
|
-
|
|
7873
|
-
fileKeyId: file.keyId,
|
|
7873
|
+
file: file,
|
|
7874
7874
|
parentsToRemove: [tempDir.id],
|
|
7875
7875
|
parentsToAdd: options.parentDirectories,
|
|
7876
7876
|
})];
|
|
@@ -7929,24 +7929,25 @@
|
|
|
7929
7929
|
// ------------------------------------------------------------------------------
|
|
7930
7930
|
ItemService.prototype.prepareParentDirectory = function (options, newKey) {
|
|
7931
7931
|
return __awaiter(this, void 0, void 0, function () {
|
|
7932
|
-
var
|
|
7932
|
+
var _directoryId, _wrappingKeyId, linkType, directory, wrappingKey, _d;
|
|
7933
7933
|
return __generator(this, function (_e) {
|
|
7934
7934
|
switch (_e.label) {
|
|
7935
7935
|
case 0:
|
|
7936
|
-
|
|
7936
|
+
_directoryId = options.directoryId, _wrappingKeyId = options.wrappingKeyId, linkType = options.linkType;
|
|
7937
|
+
directory = options.directory || {
|
|
7938
|
+
id: _directoryId,
|
|
7939
|
+
keyId: _wrappingKeyId,
|
|
7940
|
+
};
|
|
7937
7941
|
if (!(linkType == exports.LinkTypeField.REFERENCE)) return [3 /*break*/, 1];
|
|
7938
|
-
if (wrappingKeyId) {
|
|
7939
|
-
throw new KcBadArgumentException('Do not specify wrappingKeyId when link type is REFERENCE.');
|
|
7940
|
-
}
|
|
7941
7942
|
return [2 /*return*/, {
|
|
7942
|
-
directoryId:
|
|
7943
|
+
directoryId: directory.id,
|
|
7943
7944
|
linkType: linkType,
|
|
7944
7945
|
}];
|
|
7945
|
-
case 1: return [4 /*yield*/, this.getDirectoryKey(
|
|
7946
|
+
case 1: return [4 /*yield*/, this.getDirectoryKey(directory.id, directory.keyId)];
|
|
7946
7947
|
case 2:
|
|
7947
7948
|
wrappingKey = _e.sent();
|
|
7948
7949
|
_d = {
|
|
7949
|
-
directoryId:
|
|
7950
|
+
directoryId: directory.id,
|
|
7950
7951
|
wrappingKeyId: wrappingKey.id
|
|
7951
7952
|
};
|
|
7952
7953
|
return [4 /*yield*/, this.keyGraph.wrapKey(wrappingKey, newKey)];
|
|
@@ -8157,32 +8158,42 @@
|
|
|
8157
8158
|
};
|
|
8158
8159
|
ItemService.prototype.prepareChangeDirectoryParents = function (options) {
|
|
8159
8160
|
return __awaiter(this, void 0, void 0, function () {
|
|
8160
|
-
var directoryKey, input;
|
|
8161
|
+
var directory, directoryKey, input;
|
|
8161
8162
|
return __generator(this, function (_d) {
|
|
8162
8163
|
switch (_d.label) {
|
|
8163
|
-
case 0:
|
|
8164
|
+
case 0:
|
|
8165
|
+
directory = options.directory || {
|
|
8166
|
+
id: options.directoryId,
|
|
8167
|
+
keyId: options.directoryKeyId,
|
|
8168
|
+
};
|
|
8169
|
+
return [4 /*yield*/, this.getDirectoryKey(directory.id, directory.keyId)];
|
|
8164
8170
|
case 1:
|
|
8165
8171
|
directoryKey = _d.sent();
|
|
8166
8172
|
return [4 /*yield*/, this.prepareChangeItemParents(options, directoryKey.jwk)];
|
|
8167
8173
|
case 2:
|
|
8168
8174
|
input = _d.sent();
|
|
8169
|
-
return [2 /*return*/, Object.assign(Object.assign({}, input), { directoryId:
|
|
8175
|
+
return [2 /*return*/, Object.assign(Object.assign({}, input), { directoryId: directory.id })];
|
|
8170
8176
|
}
|
|
8171
8177
|
});
|
|
8172
8178
|
});
|
|
8173
8179
|
};
|
|
8174
8180
|
ItemService.prototype.prepareChangeFileParents = function (options) {
|
|
8175
8181
|
return __awaiter(this, void 0, void 0, function () {
|
|
8176
|
-
var fileKey, input;
|
|
8182
|
+
var file, fileKey, input;
|
|
8177
8183
|
return __generator(this, function (_d) {
|
|
8178
8184
|
switch (_d.label) {
|
|
8179
|
-
case 0:
|
|
8185
|
+
case 0:
|
|
8186
|
+
file = options.file || {
|
|
8187
|
+
id: options.fileId,
|
|
8188
|
+
keyId: options.fileKeyId,
|
|
8189
|
+
};
|
|
8190
|
+
return [4 /*yield*/, this.getFileKey(file.id, file.keyId)];
|
|
8180
8191
|
case 1:
|
|
8181
8192
|
fileKey = _d.sent();
|
|
8182
8193
|
return [4 /*yield*/, this.prepareChangeItemParents(options, fileKey.jwk)];
|
|
8183
8194
|
case 2:
|
|
8184
8195
|
input = _d.sent();
|
|
8185
|
-
return [2 /*return*/, Object.assign(Object.assign({}, input), { fileId:
|
|
8196
|
+
return [2 /*return*/, Object.assign(Object.assign({}, input), { fileId: file.id })];
|
|
8186
8197
|
}
|
|
8187
8198
|
});
|
|
8188
8199
|
});
|
|
@@ -10929,7 +10940,7 @@
|
|
|
10929
10940
|
switch (_a.label) {
|
|
10930
10941
|
case 0:
|
|
10931
10942
|
receiverItemOptions = options.receiverItemOptions, receiverSharedKey = options.receiverSharedKey, assemblyKey = options.assemblyKey, directory = options.directory, file = options.file;
|
|
10932
|
-
|
|
10943
|
+
assertExactlyOne({ directory: directory, file: file });
|
|
10933
10944
|
accessRole = receiverItemOptions.accessRole;
|
|
10934
10945
|
if (!(accessRole == exports.AccessRoleChoice.DENY)) return [3 /*break*/, 1];
|
|
10935
10946
|
ret = {
|
|
@@ -12221,20 +12232,24 @@
|
|
|
12221
12232
|
};
|
|
12222
12233
|
TrustedPartyService.prototype.prepareCreateItemShareMutation = function (options) {
|
|
12223
12234
|
return __awaiter(this, void 0, void 0, function () {
|
|
12224
|
-
var
|
|
12235
|
+
var _itemId, _itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, plainMetaJson, item, plainMeta, itemKey, wrappingKey, wrappedItemKey;
|
|
12225
12236
|
var _this = this;
|
|
12226
12237
|
return __generator(this, function (_a) {
|
|
12227
12238
|
switch (_a.label) {
|
|
12228
12239
|
case 0:
|
|
12229
|
-
|
|
12240
|
+
_itemId = options.itemId, _itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType, plainMetaJson = options.plainMetaJson;
|
|
12241
|
+
item = options.item || {
|
|
12242
|
+
id: _itemId,
|
|
12243
|
+
keyId: _itemKeyId,
|
|
12244
|
+
};
|
|
12230
12245
|
plainMeta = plainMetaJson && JSON.stringify(plainMetaJson);
|
|
12231
12246
|
if (accessRole == exports.AccessRoleChoice.DENY) {
|
|
12232
|
-
if (
|
|
12247
|
+
if (item.keyId || tpSharedKeyId) {
|
|
12233
12248
|
throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, or tpSharedKeyId parameters');
|
|
12234
12249
|
}
|
|
12235
12250
|
return [2 /*return*/, {
|
|
12236
12251
|
input: {
|
|
12237
|
-
itemId:
|
|
12252
|
+
itemId: item.id,
|
|
12238
12253
|
tpId: tpId,
|
|
12239
12254
|
accessRole: accessRole,
|
|
12240
12255
|
itemKeyId: null,
|
|
@@ -12245,9 +12260,9 @@
|
|
|
12245
12260
|
},
|
|
12246
12261
|
}];
|
|
12247
12262
|
}
|
|
12248
|
-
return [4 /*yield*/, this.keyGraph.getKey(
|
|
12249
|
-
? _this.itemService.getDirectoryKeyId(
|
|
12250
|
-
: _this.itemService.getFileKeyId(
|
|
12263
|
+
return [4 /*yield*/, this.keyGraph.getKey(item.keyId, function () { return isDirectory
|
|
12264
|
+
? _this.itemService.getDirectoryKeyId(item.id)
|
|
12265
|
+
: _this.itemService.getFileKeyId(item.id); })];
|
|
12251
12266
|
case 1:
|
|
12252
12267
|
itemKey = _a.sent();
|
|
12253
12268
|
return [4 /*yield*/, this.keyGraph.getKey(tpSharedKeyId, function () { return _this.getTpCurrentUserSharedKey(tpId).then(function (res) { return res.sharedKey.id; }); })];
|
|
@@ -12258,7 +12273,7 @@
|
|
|
12258
12273
|
wrappedItemKey = _a.sent();
|
|
12259
12274
|
return [2 /*return*/, {
|
|
12260
12275
|
input: {
|
|
12261
|
-
itemId:
|
|
12276
|
+
itemId: item.id,
|
|
12262
12277
|
tpId: tpId,
|
|
12263
12278
|
accessRole: accessRole,
|
|
12264
12279
|
itemKeyId: itemKey.id,
|
|
@@ -12386,16 +12401,20 @@
|
|
|
12386
12401
|
};
|
|
12387
12402
|
TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
|
|
12388
12403
|
return __awaiter(this, void 0, void 0, function () {
|
|
12389
|
-
var itemShareId, accessRole, isDirectory,
|
|
12404
|
+
var itemShareId, accessRole, isDirectory, _itemId, _itemKeyId, tpId, tpSharedKeyId, plainMetaJson, item, plainMeta, itemShare, getItemShare, itemKey, wrappingKey, wrappedItemKey;
|
|
12390
12405
|
var _this = this;
|
|
12391
12406
|
return __generator(this, function (_a) {
|
|
12392
12407
|
switch (_a.label) {
|
|
12393
12408
|
case 0:
|
|
12394
|
-
itemShareId = options.itemShareId, accessRole = options.accessRole, isDirectory = options.isDirectory,
|
|
12409
|
+
itemShareId = options.itemShareId, accessRole = options.accessRole, isDirectory = options.isDirectory, _itemId = options.itemId, _itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, plainMetaJson = options.plainMetaJson;
|
|
12410
|
+
item = options.item || {
|
|
12411
|
+
id: _itemId,
|
|
12412
|
+
keyId: _itemKeyId,
|
|
12413
|
+
};
|
|
12395
12414
|
plainMeta = plainMetaJson && JSON.stringify(plainMetaJson);
|
|
12396
12415
|
// If not updating access role or updating to DENY role, then we don't need any key material.
|
|
12397
12416
|
if (accessRole == null || accessRole == exports.AccessRoleChoice.DENY) {
|
|
12398
|
-
if (
|
|
12417
|
+
if (item.id || item.keyId || tpId || tpSharedKeyId) {
|
|
12399
12418
|
throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, tpId, or tpSharedKeyId parameters');
|
|
12400
12419
|
}
|
|
12401
12420
|
return [2 /*return*/, {
|
|
@@ -12430,12 +12449,12 @@
|
|
|
12430
12449
|
}
|
|
12431
12450
|
});
|
|
12432
12451
|
}); };
|
|
12433
|
-
return [4 /*yield*/, this.keyGraph.getKey(
|
|
12452
|
+
return [4 /*yield*/, this.keyGraph.getKey(item.keyId, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
12434
12453
|
var itemId_, _a;
|
|
12435
12454
|
return __generator(this, function (_b) {
|
|
12436
12455
|
switch (_b.label) {
|
|
12437
12456
|
case 0:
|
|
12438
|
-
_a =
|
|
12457
|
+
_a = item.id;
|
|
12439
12458
|
if (_a) return [3 /*break*/, 2];
|
|
12440
12459
|
return [4 /*yield*/, getItemShare()];
|
|
12441
12460
|
case 1:
|
|
@@ -13162,6 +13181,7 @@
|
|
|
13162
13181
|
exports.processConnection = processConnection;
|
|
13163
13182
|
exports.throwClaimIdMismatch = throwClaimIdMismatch;
|
|
13164
13183
|
exports.throwClaimNotApproved = throwClaimNotApproved;
|
|
13184
|
+
exports.toIdKeyPair = toIdKeyPair;
|
|
13165
13185
|
exports.ɵa = KeyGraphService;
|
|
13166
13186
|
exports.ɵb = EncryptionService;
|
|
13167
13187
|
exports.ɵc = KeyService;
|