@rocketmakers/orbit-storage-typeorm 1.0.1 → 1.0.5
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/package.json +10 -7
- package/lib/src/entities/bucketRegistration.d.ts +0 -16
- package/lib/src/entities/bucketRegistration.js +0 -58
- package/lib/src/entities/bucketRegistration.js.map +0 -1
- package/lib/src/entities/folder.d.ts +0 -12
- package/lib/src/entities/folder.js +0 -41
- package/lib/src/entities/folder.js.map +0 -1
- package/lib/src/entities/index.d.ts +0 -3
- package/lib/src/entities/index.js +0 -7
- package/lib/src/entities/index.js.map +0 -1
- package/lib/src/entities/upload.d.ts +0 -19
- package/lib/src/entities/upload.js +0 -65
- package/lib/src/entities/upload.js.map +0 -1
- package/lib/src/index.d.ts +0 -2
- package/lib/src/index.js +0 -6
- package/lib/src/index.js.map +0 -1
- package/lib/src/repositories/bucketRegistrationRepository.d.ts +0 -20
- package/lib/src/repositories/bucketRegistrationRepository.js +0 -117
- package/lib/src/repositories/bucketRegistrationRepository.js.map +0 -1
- package/lib/src/repositories/folderRepository.d.ts +0 -19
- package/lib/src/repositories/folderRepository.js +0 -120
- package/lib/src/repositories/folderRepository.js.map +0 -1
- package/lib/src/repositories/index.d.ts +0 -3
- package/lib/src/repositories/index.js +0 -7
- package/lib/src/repositories/index.js.map +0 -1
- package/lib/src/repositories/uploadRepository.d.ts +0 -21
- package/lib/src/repositories/uploadRepository.js +0 -105
- package/lib/src/repositories/uploadRepository.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -6371
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocketmakers/orbit-storage-typeorm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Product team <product-team@rocketmakers.com>",
|
|
6
6
|
"homepage": "https://gitlab.com/rocketmakers/microservices/orbit-packages#readme",
|
|
@@ -23,19 +23,22 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"tsc": "tsc",
|
|
26
|
-
"build-watch": "tsc --watch"
|
|
26
|
+
"build-watch": "tsc --watch",
|
|
27
|
+
"local-publish": "npm publish --registry=http://127.0.0.1:4873 --force",
|
|
28
|
+
"local-unpublish": "npm unpublish @rocketmakers/orbit-storage-typeorm --registry=http://127.0.0.1:4873 --force",
|
|
29
|
+
"local-update": "npm run local-unpublish && npm run local-publish"
|
|
27
30
|
},
|
|
28
31
|
"bugs": {
|
|
29
32
|
"url": "https://gitlab.com/rocketmakers/microservices/orbit-packages/issues"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
32
|
-
"@rocketmakers/orbit-core": "^1.0.
|
|
33
|
-
"@rocketmakers/orbit-db-core": "^1.0.
|
|
34
|
-
"@rocketmakers/orbit-db-typeorm": "^1.0.
|
|
35
|
-
"@rocketmakers/orbit-storage-core": "^1.0.
|
|
35
|
+
"@rocketmakers/orbit-core": "^1.0.5",
|
|
36
|
+
"@rocketmakers/orbit-db-core": "^1.0.5",
|
|
37
|
+
"@rocketmakers/orbit-db-typeorm": "^1.0.5",
|
|
38
|
+
"@rocketmakers/orbit-storage-core": "^1.0.5",
|
|
36
39
|
"@rocketmakers/storage": "0.2.0",
|
|
37
40
|
"tslib": "2.1.0",
|
|
38
41
|
"typeorm": "0.2.30"
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "72dbabd7896b586847a63634be3e6a3f5400e533"
|
|
41
44
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { UserType } from '@rocketmakers/orbit-core';
|
|
2
|
-
import { BucketDeleteAccess, BucketName, BucketReadAccess, BucketRegistrationId, DeleteMode, StorageConvention } from '@rocketmakers/orbit-storage-core';
|
|
3
|
-
import { UpdatableCreatableEntity } from '@rocketmakers/orbit-db-typeorm';
|
|
4
|
-
export declare class BucketRegistrationEntity extends UpdatableCreatableEntity {
|
|
5
|
-
id: BucketRegistrationId;
|
|
6
|
-
bucketName: BucketName;
|
|
7
|
-
pathPrefix?: string;
|
|
8
|
-
readAccess: BucketReadAccess;
|
|
9
|
-
writeAccess: UserType;
|
|
10
|
-
deleteAccess: BucketDeleteAccess;
|
|
11
|
-
deleteMode: DeleteMode;
|
|
12
|
-
convention: StorageConvention;
|
|
13
|
-
callbackUrl?: string;
|
|
14
|
-
config?: string;
|
|
15
|
-
maxFileSizeBytes?: number;
|
|
16
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BucketRegistrationEntity = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
7
|
-
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
8
|
-
let BucketRegistrationEntity = class BucketRegistrationEntity extends orbit_db_typeorm_1.UpdatableCreatableEntity {
|
|
9
|
-
};
|
|
10
|
-
tslib_1.__decorate([
|
|
11
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
12
|
-
tslib_1.__metadata("design:type", String)
|
|
13
|
-
], BucketRegistrationEntity.prototype, "id", void 0);
|
|
14
|
-
tslib_1.__decorate([
|
|
15
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
16
|
-
tslib_1.__metadata("design:type", String)
|
|
17
|
-
], BucketRegistrationEntity.prototype, "bucketName", void 0);
|
|
18
|
-
tslib_1.__decorate([
|
|
19
|
-
typeorm_1.Column({ name: 'path_prefix', type: 'text' }),
|
|
20
|
-
tslib_1.__metadata("design:type", String)
|
|
21
|
-
], BucketRegistrationEntity.prototype, "pathPrefix", void 0);
|
|
22
|
-
tslib_1.__decorate([
|
|
23
|
-
typeorm_1.Column({ name: 'read_access', type: 'text' }),
|
|
24
|
-
tslib_1.__metadata("design:type", String)
|
|
25
|
-
], BucketRegistrationEntity.prototype, "readAccess", void 0);
|
|
26
|
-
tslib_1.__decorate([
|
|
27
|
-
typeorm_1.Column({ name: 'write_access', type: 'text' }),
|
|
28
|
-
tslib_1.__metadata("design:type", String)
|
|
29
|
-
], BucketRegistrationEntity.prototype, "writeAccess", void 0);
|
|
30
|
-
tslib_1.__decorate([
|
|
31
|
-
typeorm_1.Column({ name: 'delete_access', type: 'text' }),
|
|
32
|
-
tslib_1.__metadata("design:type", String)
|
|
33
|
-
], BucketRegistrationEntity.prototype, "deleteAccess", void 0);
|
|
34
|
-
tslib_1.__decorate([
|
|
35
|
-
typeorm_1.Column({ name: 'delete_mode', type: 'text' }),
|
|
36
|
-
tslib_1.__metadata("design:type", String)
|
|
37
|
-
], BucketRegistrationEntity.prototype, "deleteMode", void 0);
|
|
38
|
-
tslib_1.__decorate([
|
|
39
|
-
typeorm_1.Column({ name: 'storage_convention', type: 'text' }),
|
|
40
|
-
tslib_1.__metadata("design:type", String)
|
|
41
|
-
], BucketRegistrationEntity.prototype, "convention", void 0);
|
|
42
|
-
tslib_1.__decorate([
|
|
43
|
-
typeorm_1.Column({ name: 'callback_url', type: 'text', nullable: true }),
|
|
44
|
-
tslib_1.__metadata("design:type", String)
|
|
45
|
-
], BucketRegistrationEntity.prototype, "callbackUrl", void 0);
|
|
46
|
-
tslib_1.__decorate([
|
|
47
|
-
typeorm_1.Column({ type: 'text', nullable: true }),
|
|
48
|
-
tslib_1.__metadata("design:type", String)
|
|
49
|
-
], BucketRegistrationEntity.prototype, "config", void 0);
|
|
50
|
-
tslib_1.__decorate([
|
|
51
|
-
typeorm_1.Column({ name: 'max_file_size_bytes', type: 'int', nullable: true }),
|
|
52
|
-
tslib_1.__metadata("design:type", Number)
|
|
53
|
-
], BucketRegistrationEntity.prototype, "maxFileSizeBytes", void 0);
|
|
54
|
-
BucketRegistrationEntity = tslib_1.__decorate([
|
|
55
|
-
typeorm_1.Entity({ name: 'bucket_registration' })
|
|
56
|
-
], BucketRegistrationEntity);
|
|
57
|
-
exports.BucketRegistrationEntity = BucketRegistrationEntity;
|
|
58
|
-
//# sourceMappingURL=bucketRegistration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bucketRegistration.js","sourceRoot":"","sources":["../../../src/entities/bucketRegistration.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AACxD,yDAAoD;AASpD,qEAA0E;AAG1E,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,2CAAwB;CAiCrE,CAAA;AA/BC;IADC,uBAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACN;AAG1B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACtB;AAGxB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAC1B;AAGpB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAChB;AAG9B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DACxB;AAGvB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DACd;AAGlC;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACtB;AAGxB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACtB;AAG/B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6DAC1C;AAGrB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACzB;AAGhB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kEAC3C;AAhCf,wBAAwB;IADpC,gBAAM,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;GAC3B,wBAAwB,CAiCpC;AAjCY,4DAAwB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DateTimeString } from '@rocketmakers/orbit-core';
|
|
2
|
-
import { UpdatableCreatableEntity } from '@rocketmakers/orbit-db-typeorm';
|
|
3
|
-
import { FolderId, BucketName, FolderType } from '@rocketmakers/orbit-storage-core';
|
|
4
|
-
export declare class Folder extends UpdatableCreatableEntity {
|
|
5
|
-
id: FolderId;
|
|
6
|
-
bucketName: BucketName;
|
|
7
|
-
parentId?: FolderId;
|
|
8
|
-
folderName: string;
|
|
9
|
-
folderType: FolderType;
|
|
10
|
-
deletedBy: string;
|
|
11
|
-
deletedOn: DateTimeString;
|
|
12
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Folder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
7
|
-
let Folder = class Folder extends orbit_db_typeorm_1.UpdatableCreatableEntity {
|
|
8
|
-
};
|
|
9
|
-
tslib_1.__decorate([
|
|
10
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
11
|
-
tslib_1.__metadata("design:type", String)
|
|
12
|
-
], Folder.prototype, "id", void 0);
|
|
13
|
-
tslib_1.__decorate([
|
|
14
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
15
|
-
tslib_1.__metadata("design:type", String)
|
|
16
|
-
], Folder.prototype, "bucketName", void 0);
|
|
17
|
-
tslib_1.__decorate([
|
|
18
|
-
typeorm_1.Column({ name: 'parent_id', type: 'uuid' }),
|
|
19
|
-
tslib_1.__metadata("design:type", String)
|
|
20
|
-
], Folder.prototype, "parentId", void 0);
|
|
21
|
-
tslib_1.__decorate([
|
|
22
|
-
typeorm_1.Column({ name: 'folder_name', type: 'text' }),
|
|
23
|
-
tslib_1.__metadata("design:type", String)
|
|
24
|
-
], Folder.prototype, "folderName", void 0);
|
|
25
|
-
tslib_1.__decorate([
|
|
26
|
-
typeorm_1.Column({ name: 'folder_type', type: 'text' }),
|
|
27
|
-
tslib_1.__metadata("design:type", String)
|
|
28
|
-
], Folder.prototype, "folderType", void 0);
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
typeorm_1.Column({ name: 'deleted_by', type: 'text' }),
|
|
31
|
-
tslib_1.__metadata("design:type", String)
|
|
32
|
-
], Folder.prototype, "deletedBy", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
typeorm_1.Column({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
35
|
-
tslib_1.__metadata("design:type", String)
|
|
36
|
-
], Folder.prototype, "deletedOn", void 0);
|
|
37
|
-
Folder = tslib_1.__decorate([
|
|
38
|
-
typeorm_1.Entity({ name: 'folder' })
|
|
39
|
-
], Folder);
|
|
40
|
-
exports.Folder = Folder;
|
|
41
|
-
//# sourceMappingURL=folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../src/entities/folder.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AAExD,qEAAwF;AAIxF,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,2CAAwB;CAqBnD,CAAA;AAnBC;IADC,uBAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kCAClB;AAGd;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACtB;AAGxB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACxB;AAGpB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAC1B;AAGpB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACtB;AAGxB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAC1B;AAGnB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,+BAAY,CAAC,QAAQ,EAAE,CAAC;;yCAC3D;AApBhB,MAAM;IADlB,gBAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;GACd,MAAM,CAqBlB;AArBY,wBAAM"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./bucketRegistration"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./folder"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./upload"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mDAAyB;AACzB,mDAAyB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { MetadataMap } from '@rocketmakers/storage';
|
|
2
|
-
import { DateTimeString, UserId, IByWho } from '@rocketmakers/orbit-core';
|
|
3
|
-
import { UploadId, FolderId, BucketName, UploadTicket } from '@rocketmakers/orbit-storage-core';
|
|
4
|
-
import { CreatableEntity } from '@rocketmakers/orbit-db-typeorm';
|
|
5
|
-
export declare class Upload extends CreatableEntity {
|
|
6
|
-
id: UploadId;
|
|
7
|
-
folderId?: FolderId;
|
|
8
|
-
bucketName: BucketName;
|
|
9
|
-
ticket: UploadTicket;
|
|
10
|
-
filePath: string;
|
|
11
|
-
fileName: string;
|
|
12
|
-
fileSize: number;
|
|
13
|
-
contentType: string;
|
|
14
|
-
userId: UserId;
|
|
15
|
-
additionalMetadata?: MetadataMap;
|
|
16
|
-
completedOn: DateTimeString;
|
|
17
|
-
deletedBy: IByWho;
|
|
18
|
-
deletedOn: DateTimeString;
|
|
19
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Upload = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
7
|
-
let Upload = class Upload extends orbit_db_typeorm_1.CreatableEntity {
|
|
8
|
-
};
|
|
9
|
-
tslib_1.__decorate([
|
|
10
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
11
|
-
tslib_1.__metadata("design:type", String)
|
|
12
|
-
], Upload.prototype, "id", void 0);
|
|
13
|
-
tslib_1.__decorate([
|
|
14
|
-
typeorm_1.Column({ name: 'folder_id', type: 'uuid' }),
|
|
15
|
-
tslib_1.__metadata("design:type", String)
|
|
16
|
-
], Upload.prototype, "folderId", void 0);
|
|
17
|
-
tslib_1.__decorate([
|
|
18
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
19
|
-
tslib_1.__metadata("design:type", String)
|
|
20
|
-
], Upload.prototype, "bucketName", void 0);
|
|
21
|
-
tslib_1.__decorate([
|
|
22
|
-
typeorm_1.Column({ type: 'text' }),
|
|
23
|
-
tslib_1.__metadata("design:type", String)
|
|
24
|
-
], Upload.prototype, "ticket", void 0);
|
|
25
|
-
tslib_1.__decorate([
|
|
26
|
-
typeorm_1.Column({ name: 'file_path', type: 'text' }),
|
|
27
|
-
tslib_1.__metadata("design:type", String)
|
|
28
|
-
], Upload.prototype, "filePath", void 0);
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
typeorm_1.Column({ name: 'file_name', type: 'text' }),
|
|
31
|
-
tslib_1.__metadata("design:type", String)
|
|
32
|
-
], Upload.prototype, "fileName", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
typeorm_1.Column({ name: 'file_size', type: 'int' }),
|
|
35
|
-
tslib_1.__metadata("design:type", Number)
|
|
36
|
-
], Upload.prototype, "fileSize", void 0);
|
|
37
|
-
tslib_1.__decorate([
|
|
38
|
-
typeorm_1.Column({ name: 'content_type', type: 'text' }),
|
|
39
|
-
tslib_1.__metadata("design:type", String)
|
|
40
|
-
], Upload.prototype, "contentType", void 0);
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
typeorm_1.Column({ name: 'user_id', type: 'text' }),
|
|
43
|
-
tslib_1.__metadata("design:type", String)
|
|
44
|
-
], Upload.prototype, "userId", void 0);
|
|
45
|
-
tslib_1.__decorate([
|
|
46
|
-
typeorm_1.Column({ name: 'additional_metadata', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
47
|
-
tslib_1.__metadata("design:type", Object)
|
|
48
|
-
], Upload.prototype, "additionalMetadata", void 0);
|
|
49
|
-
tslib_1.__decorate([
|
|
50
|
-
typeorm_1.Column({ name: 'completed_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
51
|
-
tslib_1.__metadata("design:type", String)
|
|
52
|
-
], Upload.prototype, "completedOn", void 0);
|
|
53
|
-
tslib_1.__decorate([
|
|
54
|
-
typeorm_1.Column({ name: 'deleted_by', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
55
|
-
tslib_1.__metadata("design:type", Object)
|
|
56
|
-
], Upload.prototype, "deletedBy", void 0);
|
|
57
|
-
tslib_1.__decorate([
|
|
58
|
-
typeorm_1.Column({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
59
|
-
tslib_1.__metadata("design:type", String)
|
|
60
|
-
], Upload.prototype, "deletedOn", void 0);
|
|
61
|
-
Upload = tslib_1.__decorate([
|
|
62
|
-
typeorm_1.Entity({ name: 'upload' })
|
|
63
|
-
], Upload);
|
|
64
|
-
exports.Upload = Upload;
|
|
65
|
-
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/entities/upload.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AAIxD,qEAA+E;AAG/E,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,kCAAe;CAuC1C,CAAA;AArCC;IADC,uBAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kCAClB;AAGd;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACxB;AAGpB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACtB;AAGxB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACH;AAGtB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAC1B;AAGlB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAC1B;AAGlB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;wCACzB;AAGlB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAC1B;AAGrB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAC1B;AAGhB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,+BAAY,CAAC,IAAI,EAAE,CAAC;;kDACrD;AAGjC;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,+BAAY,CAAC,QAAQ,EAAE,CAAC;;2CAC3D;AAG7B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,+BAAY,CAAC,IAAI,EAAE,CAAC;;yCAC1D;AAGnB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,+BAAY,CAAC,QAAQ,EAAE,CAAC;;yCAC3D;AAtChB,MAAM;IADlB,gBAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;GACd,MAAM,CAuClB;AAvCY,wBAAM"}
|
package/lib/src/index.d.ts
DELETED
package/lib/src/index.js
DELETED
package/lib/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,yDAA+B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DateTimeString, ITimeService, IUuidGeneratorService } from '@rocketmakers/orbit-core';
|
|
2
|
-
import { IBucketRegistrationUpdateRaw, BucketRegistrationRaw, BucketRegistrationId, BucketName, IBucketRegistrationRepository } from '@rocketmakers/orbit-storage-core';
|
|
3
|
-
import { IDataContext } from '@rocketmakers/orbit-db-core';
|
|
4
|
-
import { CustomRepositoryBase } from '@rocketmakers/orbit-db-typeorm';
|
|
5
|
-
import { BucketRegistrationEntity } from '../entities';
|
|
6
|
-
export declare class BucketRegistrationRepository extends CustomRepositoryBase<BucketRegistrationEntity> implements IBucketRegistrationRepository {
|
|
7
|
-
private timeService;
|
|
8
|
-
private uuidGenerator;
|
|
9
|
-
constructor(timeService: ITimeService, uuidGenerator: IUuidGeneratorService);
|
|
10
|
-
exists(context: IDataContext, bucketName: BucketName): Promise<boolean>;
|
|
11
|
-
getRawByName(context: IDataContext, bucketName: BucketName): Promise<BucketRegistrationRaw | undefined>;
|
|
12
|
-
getUpdatedOn(context: IDataContext, bucketName: BucketName): Promise<DateTimeString | undefined>;
|
|
13
|
-
deleteByName(context: IDataContext, bucketName: BucketName): Promise<boolean>;
|
|
14
|
-
getAll(context: IDataContext): Promise<BucketRegistrationRaw[]>;
|
|
15
|
-
getById(context: IDataContext, id: BucketRegistrationId): Promise<BucketRegistrationRaw | undefined>;
|
|
16
|
-
private findById;
|
|
17
|
-
create(context: IDataContext, reg: BucketRegistrationRaw): Promise<BucketRegistrationRaw>;
|
|
18
|
-
update(context: IDataContext, reg: IBucketRegistrationUpdateRaw): Promise<import("@rocketmakers/orbit-core").UpdateStatus>;
|
|
19
|
-
private map;
|
|
20
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BucketRegistrationRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
6
|
-
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
7
|
-
const entities_1 = require("../entities");
|
|
8
|
-
class BucketRegistrationRepository extends orbit_db_typeorm_1.CustomRepositoryBase {
|
|
9
|
-
constructor(timeService, uuidGenerator) {
|
|
10
|
-
super(entities_1.BucketRegistrationEntity);
|
|
11
|
-
this.timeService = timeService;
|
|
12
|
-
this.uuidGenerator = uuidGenerator;
|
|
13
|
-
}
|
|
14
|
-
exists(context, bucketName) {
|
|
15
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const value = yield this.getRepository(context).count({ bucketName });
|
|
17
|
-
return value > 0;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
getRawByName(context, bucketName) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const row = yield this.getRepository(context).findOne({ bucketName });
|
|
23
|
-
if (!row) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
return this.map(row);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
getUpdatedOn(context, bucketName) {
|
|
30
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const bucket = yield this.getRepository(context).findOne({ bucketName }, { select: ['updatedOn'] });
|
|
32
|
-
if (!bucket) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
return bucket.updatedOn;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
deleteByName(context, bucketName) {
|
|
39
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
return orbit_db_typeorm_1.RepositoryExtensions.deleteEntity(this.getRepository(context), { bucketName });
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
getAll(context) {
|
|
44
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const registrations = yield this.getRepository(context).find();
|
|
46
|
-
return registrations.map(this.map);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getById(context, id) {
|
|
50
|
-
const repo = this.getRepository(context);
|
|
51
|
-
return this.findById(repo, id);
|
|
52
|
-
}
|
|
53
|
-
findById(repo, id) {
|
|
54
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const registration = yield repo.findOne({ id });
|
|
56
|
-
if (!registration) {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
return this.map(registration);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
create(context, reg) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
try {
|
|
65
|
-
const repo = this.getRepository(context);
|
|
66
|
-
const id = yield orbit_db_typeorm_1.RepositoryExtensions.insertIdentifiableCreatableUpdatable(context, this.getRepository(context), reg, this.timeService, this.uuidGenerator);
|
|
67
|
-
const bucket = yield this.findById(repo, id);
|
|
68
|
-
if (!bucket) {
|
|
69
|
-
throw new Error('Created bucket registration not found!');
|
|
70
|
-
}
|
|
71
|
-
return bucket;
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
if (error.message && error.message.indexOf('uq_idx_bucket_registration') > -1) {
|
|
75
|
-
throw new orbit_core_1.ValidationError([
|
|
76
|
-
{
|
|
77
|
-
attribute: 'bucketName',
|
|
78
|
-
path: 'bucketName',
|
|
79
|
-
messages: {
|
|
80
|
-
friendly: 'Bucket name already used',
|
|
81
|
-
developer: 'Bucket name exists in the database',
|
|
82
|
-
},
|
|
83
|
-
value: reg.bucketName,
|
|
84
|
-
},
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
update(context, reg) {
|
|
92
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const { id, updatedOn } = reg, rest = tslib_1.__rest(reg, ["id", "updatedOn"]);
|
|
94
|
-
return orbit_db_typeorm_1.RepositoryExtensions.updateIdentifiableCreatableUpdatable(context, this.getRepository(context), updatedOn, id, rest, this.timeService);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
map(registration) {
|
|
98
|
-
return {
|
|
99
|
-
id: registration.id,
|
|
100
|
-
readAccess: registration.readAccess,
|
|
101
|
-
writeAccess: registration.writeAccess,
|
|
102
|
-
deleteAccess: registration.deleteAccess,
|
|
103
|
-
deleteMode: registration.deleteMode,
|
|
104
|
-
convention: registration.convention,
|
|
105
|
-
createdBy: registration.createdBy,
|
|
106
|
-
createdOn: registration.createdOn,
|
|
107
|
-
updatedBy: registration.updatedBy,
|
|
108
|
-
updatedOn: registration.updatedOn,
|
|
109
|
-
bucketName: registration.bucketName,
|
|
110
|
-
pathPrefix: registration.pathPrefix,
|
|
111
|
-
maxFileSizeBytes: registration.maxFileSizeBytes,
|
|
112
|
-
config: registration.config,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.BucketRegistrationRepository = BucketRegistrationRepository;
|
|
117
|
-
//# sourceMappingURL=bucketRegistrationRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bucketRegistrationRepository.js","sourceRoot":"","sources":["../../../src/repositories/bucketRegistrationRepository.ts"],"names":[],"mappings":";;;;AACA,yDAAgH;AAShH,qEAA4F;AAC5F,0CAAuD;AAEvD,MAAa,4BAA6B,SAAQ,uCAA8C;IAE9F,YAAoB,WAAyB,EAAU,aAAoC;QACzF,KAAK,CAAC,mCAAwB,CAAC,CAAC;QADd,gBAAW,GAAX,WAAW,CAAc;QAAU,kBAAa,GAAb,aAAa,CAAuB;IAE3F,CAAC;IAEK,MAAM,CAAC,OAAqB,EAAE,UAAsB;;YACxD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YACtE,OAAO,KAAK,GAAG,CAAC,CAAC;QACnB,CAAC;KAAA;IAEK,YAAY,CAAC,OAAqB,EAAE,UAAsB;;YAC9D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAA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C,aAAa,CAAC,OAAO,CAAC,EAC3B,SAAS,EACT,EAAE,EACF,IAAI,EACJ,IAAI,CAAC,WAAW,CACjB,CAAC;QACJ,CAAC;KAAA;IAEO,GAAG,CAAC,YAAsC;QAChD,OAAO;YACL,EAAE,EAAE,YAAY,CAAC,EAAE;YACnB,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,MAAM,EAAE,YAAY,CAAC,MAAM;SAC5B,CAAC;IACJ,CAAC;CACF;AAxHD,oEAwHC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ITimeService, IUuidGeneratorService } from '@rocketmakers/orbit-core';
|
|
2
|
-
import { IDataContext } from '@rocketmakers/orbit-db-core';
|
|
3
|
-
import { CustomRepositoryBase } from '@rocketmakers/orbit-db-typeorm';
|
|
4
|
-
import { IFolder, FolderId, BucketName, IFolderRename, IFolderMove, IFolderCreate, FolderType, IFolderRepository } from '@rocketmakers/orbit-storage-core';
|
|
5
|
-
import { Folder } from '../entities';
|
|
6
|
-
export declare class FolderRepository extends CustomRepositoryBase<Folder> implements IFolderRepository {
|
|
7
|
-
private timeService;
|
|
8
|
-
private uuidGenerator;
|
|
9
|
-
constructor(timeService: ITimeService, uuidGenerator: IUuidGeneratorService);
|
|
10
|
-
private getFolderIdsByParent;
|
|
11
|
-
private getChildFolderIdsRecursive;
|
|
12
|
-
getFolders(context: IDataContext, bucketName: BucketName): Promise<IFolder[]>;
|
|
13
|
-
createFolder(context: IDataContext, creation: IFolderCreate, type: FolderType): Promise<import("@rocketmakers/orbit-core").OpaqueString<"FolderId">>;
|
|
14
|
-
deleteFolder(context: IDataContext, id: FolderId): Promise<boolean>;
|
|
15
|
-
renameFolder(context: IDataContext, update: IFolderRename): Promise<import("@rocketmakers/orbit-core").UpdateStatus>;
|
|
16
|
-
moveFolder(context: IDataContext, update: IFolderMove): Promise<import("@rocketmakers/orbit-core").UpdateStatus>;
|
|
17
|
-
private ensureParentIdInBucket;
|
|
18
|
-
private ensureNotMovingToChild;
|
|
19
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FolderRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
7
|
-
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
8
|
-
const entities_1 = require("../entities");
|
|
9
|
-
class FolderRepository extends orbit_db_typeorm_1.CustomRepositoryBase {
|
|
10
|
-
constructor(timeService, uuidGenerator) {
|
|
11
|
-
super(entities_1.Folder);
|
|
12
|
-
this.timeService = timeService;
|
|
13
|
-
this.uuidGenerator = uuidGenerator;
|
|
14
|
-
}
|
|
15
|
-
getFolderIdsByParent(context, parentIds) {
|
|
16
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const f = yield this.getRepository(context).find({ where: { parentId: typeorm_1.In(parentIds) }, select: ['id'] });
|
|
18
|
-
return f ? f.map(g => g.id) : [];
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
getChildFolderIdsRecursive(context, id) {
|
|
22
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
let parentIds = [id];
|
|
24
|
-
const folders = [];
|
|
25
|
-
while (parentIds.length) {
|
|
26
|
-
parentIds = yield this.getFolderIdsByParent(context, parentIds);
|
|
27
|
-
folders.push(...parentIds);
|
|
28
|
-
}
|
|
29
|
-
return folders;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
getFolders(context, bucketName) {
|
|
33
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const folders = yield this.getRepository(context).find({ where: { bucketName }, order: { parentId: 'ASC' } });
|
|
35
|
-
const folderDict = folders.reduce((m, f) => {
|
|
36
|
-
const folder = {
|
|
37
|
-
name: f.folderName,
|
|
38
|
-
id: f.id,
|
|
39
|
-
updatedOn: f.updatedOn,
|
|
40
|
-
updatedBy: f.updatedBy,
|
|
41
|
-
children: [],
|
|
42
|
-
};
|
|
43
|
-
m[f.id] = folder;
|
|
44
|
-
return m;
|
|
45
|
-
}, {});
|
|
46
|
-
const returns = [];
|
|
47
|
-
folders.forEach(f => {
|
|
48
|
-
const current = folderDict[f.id];
|
|
49
|
-
if (f.parentId) {
|
|
50
|
-
folderDict[f.parentId].children.push(current);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
returns.push(current);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return returns;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
createFolder(context, creation, type) {
|
|
60
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const repo = this.getRepository(context);
|
|
62
|
-
if (creation.parentId) {
|
|
63
|
-
yield this.ensureParentIdInBucket(repo, creation.parentId, creation.bucketName);
|
|
64
|
-
}
|
|
65
|
-
return orbit_db_typeorm_1.RepositoryExtensions.insertIdentifiableCreatableUpdatable(context, repo, {
|
|
66
|
-
bucketName: creation.bucketName,
|
|
67
|
-
folderName: creation.name,
|
|
68
|
-
parentId: creation.parentId,
|
|
69
|
-
folderType: type,
|
|
70
|
-
}, this.timeService, this.uuidGenerator);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
deleteFolder(context, id) {
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const childIds = yield this.getChildFolderIdsRecursive(context, id);
|
|
76
|
-
if (childIds.length) {
|
|
77
|
-
}
|
|
78
|
-
return orbit_db_typeorm_1.RepositoryExtensions.deleteById(this.getRepository(context), id);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
renameFolder(context, update) {
|
|
82
|
-
return orbit_db_typeorm_1.RepositoryExtensions.updateIdentifiableCreatableUpdatable(context, this.getRepository(context), update.updatedOn, update.id, { folderName: update.name }, this.timeService);
|
|
83
|
-
}
|
|
84
|
-
moveFolder(context, update) {
|
|
85
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
const repo = this.getRepository(context);
|
|
87
|
-
const existing = yield orbit_db_typeorm_1.RepositoryExtensions.findById(repo, update.id, { select: ['bucketName'] });
|
|
88
|
-
if (!existing) {
|
|
89
|
-
throw new orbit_core_1.BadRequestError('Id is not a valid folder');
|
|
90
|
-
}
|
|
91
|
-
yield this.ensureParentIdInBucket(repo, update.parentId, existing.bucketName);
|
|
92
|
-
yield this.ensureNotMovingToChild(repo, update.id, update.parentId);
|
|
93
|
-
return orbit_db_typeorm_1.RepositoryExtensions.updateIdentifiableCreatableUpdatable(context, repo, update.updatedOn, update.id, { parentId: update.parentId }, this.timeService);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
ensureParentIdInBucket(repo, parentId, bucketName) {
|
|
97
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const parent = yield orbit_db_typeorm_1.RepositoryExtensions.findById(repo, parentId, { select: ['bucketName'] });
|
|
99
|
-
if (!parent) {
|
|
100
|
-
throw new orbit_core_1.BadRequestError('ParentId is not a valid folder');
|
|
101
|
-
}
|
|
102
|
-
if (parent.bucketName !== bucketName) {
|
|
103
|
-
throw new orbit_core_1.BadRequestError('Parent Folder is from a different bucket');
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
ensureNotMovingToChild(repo, folder, find) {
|
|
108
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const childrenOfFolder = yield repo.find({ where: { parentId: folder }, select: ['id'] });
|
|
110
|
-
if (childrenOfFolder.some(f => f.id === find)) {
|
|
111
|
-
throw new orbit_core_1.BadRequestError('You cannot move a folder into it own children');
|
|
112
|
-
}
|
|
113
|
-
for (const childFolder of childrenOfFolder) {
|
|
114
|
-
yield this.ensureNotMovingToChild(repo, childFolder.id, find);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.FolderRepository = FolderRepository;
|
|
120
|
-
//# sourceMappingURL=folderRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"folderRepository.js","sourceRoot":"","sources":["../../../src/repositories/folderRepository.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,yDAAgG;AAEhG,qEAA4F;AAW5F,0CAAqC;AAMrC,MAAa,gBAAiB,SAAQ,uCAA4B;IAChE,YAAoB,WAAyB,EAAU,aAAoC;QACzF,KAAK,CAAC,iBAAM,CAAC,CAAC;QADI,gBAAW,GAAX,WAAW,CAAc;QAAU,kBAAa,GAAb,aAAa,CAAuB;IAE3F,CAAC;IAEa,oBAAoB,CAAC,OAAqB,EAAE,SAAqB;;YAC7E,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAE,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACzG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CA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,EAAE;gBACpC,MAAM,IAAI,4BAAe,CAAC,0CAA0C,CAAC,CAAC;aACvE;QACH,CAAC;KAAA;IAEa,sBAAsB,CAAC,IAAwB,EAAE,MAAgB,EAAE,IAAc;;YAC7F,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1F,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;gBAC7C,MAAM,IAAI,4BAAe,CAAC,+CAA+C,CAAC,CAAC;aAC5E;YACD,KAAK,MAAM,WAAW,IAAI,gBAAgB,EAAE;gBAC1C,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;aAC/D;QACH,CAAC;KAAA;CACF;AA/HD,4CA+HC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./bucketRegistrationRepository"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./folderRepository"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./uploadRepository"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+C;AAC/C,6DAAmC;AACnC,6DAAmC"}
|