@rocketmakers/orbit-storage-typeorm 2.0.0-beta.1 → 2.0.0-beta.10
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/README.md +6 -2
- package/lib/{src/entities → entities}/bucketRegistration.d.ts +1 -2
- package/lib/entities/bucketRegistration.d.ts.map +1 -0
- package/lib/{src/entities → entities}/bucketRegistration.js +8 -12
- package/lib/entities/bucketRegistration.js.map +1 -0
- package/lib/{src/entities → entities}/folder.d.ts +0 -0
- package/lib/entities/folder.d.ts.map +1 -0
- package/lib/{src/entities → entities}/folder.js +8 -8
- package/lib/entities/folder.js.map +1 -0
- package/lib/{src/entities → entities}/index.d.ts +0 -0
- package/lib/entities/index.d.ts.map +1 -0
- package/lib/{src/entities → entities}/index.js +0 -0
- package/lib/entities/index.js.map +1 -0
- package/lib/{src/entities → entities}/upload.d.ts +0 -0
- package/lib/entities/upload.d.ts.map +1 -0
- package/lib/{src/entities → entities}/upload.js +14 -14
- package/lib/entities/upload.js.map +1 -0
- package/lib/{src/index.d.ts → index.d.ts} +0 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/{src/index.js → index.js} +0 -0
- package/lib/index.js.map +1 -0
- package/lib/{src/ioc → ioc}/index.d.ts +0 -0
- package/lib/ioc/index.d.ts.map +1 -0
- package/lib/{src/ioc → ioc}/index.js +0 -0
- package/lib/{src/ioc → ioc}/index.js.map +1 -1
- package/lib/ioc/register.d.ts +5 -0
- package/lib/ioc/register.d.ts.map +1 -0
- package/lib/ioc/register.js +14 -0
- package/lib/ioc/register.js.map +1 -0
- package/lib/{src/repositories → repositories}/bucketRegistrationRepository.d.ts +9 -7
- package/lib/repositories/bucketRegistrationRepository.d.ts.map +1 -0
- package/lib/{src/repositories → repositories}/bucketRegistrationRepository.js +17 -12
- package/lib/repositories/bucketRegistrationRepository.js.map +1 -0
- package/lib/{src/repositories → repositories}/folderRepository.d.ts +6 -4
- package/lib/repositories/folderRepository.d.ts.map +1 -0
- package/lib/{src/repositories → repositories}/folderRepository.js +12 -7
- package/lib/repositories/folderRepository.js.map +1 -0
- package/lib/{src/repositories → repositories}/index.d.ts +0 -0
- package/lib/repositories/index.d.ts.map +1 -0
- package/lib/{src/repositories → repositories}/index.js +0 -0
- package/lib/repositories/index.js.map +1 -0
- package/lib/{src/repositories → repositories}/uploadRepository.d.ts +5 -3
- package/lib/repositories/uploadRepository.d.ts.map +1 -0
- package/lib/{src/repositories → repositories}/uploadRepository.js +15 -10
- package/lib/repositories/uploadRepository.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +15 -15
- package/lib/src/entities/bucketRegistration.d.ts.map +0 -1
- package/lib/src/entities/bucketRegistration.js.map +0 -1
- package/lib/src/entities/folder.d.ts.map +0 -1
- package/lib/src/entities/folder.js.map +0 -1
- package/lib/src/entities/index.d.ts.map +0 -1
- package/lib/src/entities/index.js.map +0 -1
- package/lib/src/entities/upload.d.ts.map +0 -1
- package/lib/src/entities/upload.js.map +0 -1
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js.map +0 -1
- package/lib/src/ioc/container.d.ts +0 -14
- package/lib/src/ioc/container.d.ts.map +0 -1
- package/lib/src/ioc/container.js +0 -7
- package/lib/src/ioc/container.js.map +0 -1
- package/lib/src/ioc/index.d.ts.map +0 -1
- package/lib/src/ioc/register.d.ts +0 -2
- package/lib/src/ioc/register.d.ts.map +0 -1
- package/lib/src/ioc/register.js +0 -21
- package/lib/src/ioc/register.js.map +0 -1
- package/lib/src/repositories/bucketRegistrationRepository.d.ts.map +0 -1
- package/lib/src/repositories/bucketRegistrationRepository.js.map +0 -1
- package/lib/src/repositories/folderRepository.d.ts.map +0 -1
- package/lib/src/repositories/folderRepository.js.map +0 -1
- package/lib/src/repositories/index.d.ts.map +0 -1
- package/lib/src/repositories/index.js.map +0 -1
- package/lib/src/repositories/uploadRepository.d.ts.map +0 -1
- package/lib/src/repositories/uploadRepository.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Set of repository-layer classes required in the orbit storage microservice.
|
|
4
4
|
|
|
5
|
+
### Environment config
|
|
6
|
+
|
|
7
|
+
Once installed as a dependency, any env vars required by this package will be listed as properties of the `@rocketmakers/environment` generated class found at `node_modules/@rocketmakers/orbit-storage-typeorm/lib/config/environment.generated.d.ts`.
|
|
8
|
+
|
|
5
9
|
### Implementation
|
|
6
10
|
|
|
7
11
|
When using `@rocketmakers/orbit-storage-typeorm` there are two options to register service classes with your ioc framework.
|
|
@@ -16,10 +20,10 @@ You can bootstrap storage repository classes using the exposed `registerStorageT
|
|
|
16
20
|
|
|
17
21
|
```typescript
|
|
18
22
|
// Register core types and services from @rocketmakers/orbit-core
|
|
19
|
-
registerCoreIoC();
|
|
23
|
+
const coreContainer = registerCoreIoC(logger);
|
|
20
24
|
|
|
21
25
|
// Register types and repository classes from @rocketmakers/orbit-storage-typeorm
|
|
22
|
-
registerStorageTypeormIoC();
|
|
26
|
+
const repoContainer = registerStorageTypeormIoC(coreContainer);
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
### Docs
|
|
@@ -2,10 +2,9 @@ import { BucketName, BucketRegistrationId, DeleteMode } from '@rocketmakers/orbi
|
|
|
2
2
|
import { UpdatableCreatableEntity } from '@rocketmakers/orbit-db-typeorm';
|
|
3
3
|
export declare class BucketRegistrationEntity extends UpdatableCreatableEntity {
|
|
4
4
|
id: BucketRegistrationId;
|
|
5
|
-
|
|
5
|
+
name: BucketName;
|
|
6
6
|
pathPrefix?: string;
|
|
7
7
|
deleteMode: DeleteMode;
|
|
8
|
-
callbackUrl?: string;
|
|
9
8
|
config: string;
|
|
10
9
|
maxFileSizeBytes?: number;
|
|
11
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketRegistration.d.ts","sourceRoot":"","sources":["../../src/entities/bucketRegistration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,qBACa,wBAAyB,SAAQ,wBAAwB;IAEpE,EAAE,EAAG,oBAAoB,CAAC;IAG1B,IAAI,EAAG,UAAU,CAAC;IAGlB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,UAAU,EAAG,UAAU,CAAC;IAGxB,MAAM,EAAG,MAAM,CAAC;IAGhB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -7,35 +7,31 @@ const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
|
7
7
|
let BucketRegistrationEntity = class BucketRegistrationEntity extends orbit_db_typeorm_1.UpdatableCreatableEntity {
|
|
8
8
|
};
|
|
9
9
|
tslib_1.__decorate([
|
|
10
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
10
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'uuid' }),
|
|
11
11
|
tslib_1.__metadata("design:type", String)
|
|
12
12
|
], BucketRegistrationEntity.prototype, "id", void 0);
|
|
13
13
|
tslib_1.__decorate([
|
|
14
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
14
|
+
(0, typeorm_1.Column)({ name: 'bucket_name', type: 'text' }),
|
|
15
15
|
tslib_1.__metadata("design:type", String)
|
|
16
|
-
], BucketRegistrationEntity.prototype, "
|
|
16
|
+
], BucketRegistrationEntity.prototype, "name", void 0);
|
|
17
17
|
tslib_1.__decorate([
|
|
18
|
-
typeorm_1.Column({ name: 'path_prefix', type: 'text' }),
|
|
18
|
+
(0, typeorm_1.Column)({ name: 'path_prefix', type: 'text' }),
|
|
19
19
|
tslib_1.__metadata("design:type", String)
|
|
20
20
|
], BucketRegistrationEntity.prototype, "pathPrefix", void 0);
|
|
21
21
|
tslib_1.__decorate([
|
|
22
|
-
typeorm_1.Column({ name: 'delete_mode', type: 'text' }),
|
|
22
|
+
(0, typeorm_1.Column)({ name: 'delete_mode', type: 'text' }),
|
|
23
23
|
tslib_1.__metadata("design:type", String)
|
|
24
24
|
], BucketRegistrationEntity.prototype, "deleteMode", void 0);
|
|
25
25
|
tslib_1.__decorate([
|
|
26
|
-
typeorm_1.Column({
|
|
27
|
-
tslib_1.__metadata("design:type", String)
|
|
28
|
-
], BucketRegistrationEntity.prototype, "callbackUrl", void 0);
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
typeorm_1.Column({ type: 'text' }),
|
|
26
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
31
27
|
tslib_1.__metadata("design:type", String)
|
|
32
28
|
], BucketRegistrationEntity.prototype, "config", void 0);
|
|
33
29
|
tslib_1.__decorate([
|
|
34
|
-
typeorm_1.Column({ name: 'max_file_size_bytes', type: 'int', nullable: true }),
|
|
30
|
+
(0, typeorm_1.Column)({ name: 'max_file_size_bytes', type: 'int', nullable: true }),
|
|
35
31
|
tslib_1.__metadata("design:type", Number)
|
|
36
32
|
], BucketRegistrationEntity.prototype, "maxFileSizeBytes", void 0);
|
|
37
33
|
BucketRegistrationEntity = tslib_1.__decorate([
|
|
38
|
-
typeorm_1.Entity('bucket_registration', { schema: '
|
|
34
|
+
(0, typeorm_1.Entity)('bucket_registration', { schema: 'orbit_storage' })
|
|
39
35
|
], BucketRegistrationEntity);
|
|
40
36
|
exports.BucketRegistrationEntity = BucketRegistrationEntity;
|
|
41
37
|
//# sourceMappingURL=bucketRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketRegistration.js","sourceRoot":"","sources":["../../src/entities/bucketRegistration.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AAExD,qEAA0E;AAG1E,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,2CAAwB;CAkBrE,CAAA;AAhBC;IADC,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;o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 const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
|
7
7
|
let Folder = class Folder extends orbit_db_typeorm_1.UpdatableCreatableEntity {
|
|
8
8
|
};
|
|
9
9
|
tslib_1.__decorate([
|
|
10
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
10
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'uuid' }),
|
|
11
11
|
tslib_1.__metadata("design:type", String)
|
|
12
12
|
], Folder.prototype, "id", void 0);
|
|
13
13
|
tslib_1.__decorate([
|
|
14
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
14
|
+
(0, typeorm_1.Column)({ name: 'bucket_name', type: 'text' }),
|
|
15
15
|
tslib_1.__metadata("design:type", String)
|
|
16
16
|
], Folder.prototype, "bucketName", void 0);
|
|
17
17
|
tslib_1.__decorate([
|
|
18
|
-
typeorm_1.Column({ name: 'parent_id', type: 'uuid' }),
|
|
18
|
+
(0, typeorm_1.Column)({ name: 'parent_id', type: 'uuid' }),
|
|
19
19
|
tslib_1.__metadata("design:type", String)
|
|
20
20
|
], Folder.prototype, "parentId", void 0);
|
|
21
21
|
tslib_1.__decorate([
|
|
22
|
-
typeorm_1.Column({ name: 'folder_name', type: 'text' }),
|
|
22
|
+
(0, typeorm_1.Column)({ name: 'folder_name', type: 'text' }),
|
|
23
23
|
tslib_1.__metadata("design:type", String)
|
|
24
24
|
], Folder.prototype, "folderName", void 0);
|
|
25
25
|
tslib_1.__decorate([
|
|
26
|
-
typeorm_1.Column({ name: 'folder_type', type: 'text' }),
|
|
26
|
+
(0, typeorm_1.Column)({ name: 'folder_type', type: 'text' }),
|
|
27
27
|
tslib_1.__metadata("design:type", String)
|
|
28
28
|
], Folder.prototype, "folderType", void 0);
|
|
29
29
|
tslib_1.__decorate([
|
|
30
|
-
typeorm_1.Column({ name: 'deleted_by', type: 'text' }),
|
|
30
|
+
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'text' }),
|
|
31
31
|
tslib_1.__metadata("design:type", String)
|
|
32
32
|
], Folder.prototype, "deletedBy", void 0);
|
|
33
33
|
tslib_1.__decorate([
|
|
34
|
-
typeorm_1.Column({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
34
|
+
(0, typeorm_1.Column)({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
35
35
|
tslib_1.__metadata("design:type", String)
|
|
36
36
|
], Folder.prototype, "deletedOn", void 0);
|
|
37
37
|
Folder = tslib_1.__decorate([
|
|
38
|
-
typeorm_1.Entity('folder', { schema: '
|
|
38
|
+
(0, typeorm_1.Entity)('folder', { schema: 'orbit_storage' })
|
|
39
39
|
], Folder);
|
|
40
40
|
exports.Folder = Folder;
|
|
41
41
|
//# sourceMappingURL=folder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kCAClB;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACtB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACxB;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAC1B;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACtB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAC1B;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,+BAAY,CAAC,QAAQ,EAAE,CAAC;;yCAC3D;AApBhB,MAAM;IADlB,IAAA,gBAAM,EAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;GACjC,MAAM,CAqBlB;AArBY,wBAAM"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mDAAyB;AACzB,mDAAyB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/entities/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,eAAe,EAAgB,MAAM,gCAAgC,CAAC;AAE/E,qBACa,MAAO,SAAQ,eAAe;IAEzC,EAAE,EAAG,QAAQ,CAAC;IAGd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,UAAU,EAAG,UAAU,CAAC;IAGxB,MAAM,EAAG,YAAY,CAAC;IAGtB,QAAQ,EAAG,MAAM,CAAC;IAGlB,QAAQ,EAAG,MAAM,CAAC;IAGlB,QAAQ,EAAG,MAAM,CAAC;IAGlB,WAAW,EAAG,MAAM,CAAC;IAGrB,MAAM,EAAG,MAAM,CAAC;IAGhB,kBAAkB,CAAC,EAAE,WAAW,CAAC;IAGjC,WAAW,EAAG,cAAc,CAAC;IAG7B,SAAS,EAAG,UAAU,CAAC;IAGvB,SAAS,EAAG,cAAc,CAAC;CAC5B"}
|
|
@@ -7,59 +7,59 @@ const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
|
7
7
|
let Upload = class Upload extends orbit_db_typeorm_1.CreatableEntity {
|
|
8
8
|
};
|
|
9
9
|
tslib_1.__decorate([
|
|
10
|
-
typeorm_1.PrimaryColumn({ type: 'uuid' }),
|
|
10
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'uuid' }),
|
|
11
11
|
tslib_1.__metadata("design:type", String)
|
|
12
12
|
], Upload.prototype, "id", void 0);
|
|
13
13
|
tslib_1.__decorate([
|
|
14
|
-
typeorm_1.Column({ name: 'folder_id', type: 'uuid' }),
|
|
14
|
+
(0, typeorm_1.Column)({ name: 'folder_id', type: 'uuid' }),
|
|
15
15
|
tslib_1.__metadata("design:type", String)
|
|
16
16
|
], Upload.prototype, "folderId", void 0);
|
|
17
17
|
tslib_1.__decorate([
|
|
18
|
-
typeorm_1.Column({ name: 'bucket_name', type: 'text' }),
|
|
18
|
+
(0, typeorm_1.Column)({ name: 'bucket_name', type: 'text' }),
|
|
19
19
|
tslib_1.__metadata("design:type", String)
|
|
20
20
|
], Upload.prototype, "bucketName", void 0);
|
|
21
21
|
tslib_1.__decorate([
|
|
22
|
-
typeorm_1.Column({ type: 'text' }),
|
|
22
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
23
23
|
tslib_1.__metadata("design:type", String)
|
|
24
24
|
], Upload.prototype, "ticket", void 0);
|
|
25
25
|
tslib_1.__decorate([
|
|
26
|
-
typeorm_1.Column({ name: 'file_path', type: 'text' }),
|
|
26
|
+
(0, typeorm_1.Column)({ name: 'file_path', type: 'text' }),
|
|
27
27
|
tslib_1.__metadata("design:type", String)
|
|
28
28
|
], Upload.prototype, "filePath", void 0);
|
|
29
29
|
tslib_1.__decorate([
|
|
30
|
-
typeorm_1.Column({ name: 'file_name', type: 'text' }),
|
|
30
|
+
(0, typeorm_1.Column)({ name: 'file_name', type: 'text' }),
|
|
31
31
|
tslib_1.__metadata("design:type", String)
|
|
32
32
|
], Upload.prototype, "fileName", void 0);
|
|
33
33
|
tslib_1.__decorate([
|
|
34
|
-
typeorm_1.Column({ name: 'file_size', type: 'int' }),
|
|
34
|
+
(0, typeorm_1.Column)({ name: 'file_size', type: 'int' }),
|
|
35
35
|
tslib_1.__metadata("design:type", Number)
|
|
36
36
|
], Upload.prototype, "fileSize", void 0);
|
|
37
37
|
tslib_1.__decorate([
|
|
38
|
-
typeorm_1.Column({ name: 'content_type', type: 'text' }),
|
|
38
|
+
(0, typeorm_1.Column)({ name: 'content_type', type: 'text' }),
|
|
39
39
|
tslib_1.__metadata("design:type", String)
|
|
40
40
|
], Upload.prototype, "contentType", void 0);
|
|
41
41
|
tslib_1.__decorate([
|
|
42
|
-
typeorm_1.Column({ name: 'user_id', type: 'text' }),
|
|
42
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'text' }),
|
|
43
43
|
tslib_1.__metadata("design:type", String)
|
|
44
44
|
], Upload.prototype, "userId", void 0);
|
|
45
45
|
tslib_1.__decorate([
|
|
46
|
-
typeorm_1.Column({ name: 'additional_metadata', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
46
|
+
(0, typeorm_1.Column)({ name: 'additional_metadata', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
47
47
|
tslib_1.__metadata("design:type", Object)
|
|
48
48
|
], Upload.prototype, "additionalMetadata", void 0);
|
|
49
49
|
tslib_1.__decorate([
|
|
50
|
-
typeorm_1.Column({ name: 'completed_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
50
|
+
(0, typeorm_1.Column)({ name: 'completed_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
51
51
|
tslib_1.__metadata("design:type", String)
|
|
52
52
|
], Upload.prototype, "completedOn", void 0);
|
|
53
53
|
tslib_1.__decorate([
|
|
54
|
-
typeorm_1.Column({ name: 'deleted_by', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
54
|
+
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'text', transformer: orbit_db_typeorm_1.Transformers.json }),
|
|
55
55
|
tslib_1.__metadata("design:type", Object)
|
|
56
56
|
], Upload.prototype, "deletedBy", void 0);
|
|
57
57
|
tslib_1.__decorate([
|
|
58
|
-
typeorm_1.Column({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
58
|
+
(0, typeorm_1.Column)({ name: 'deleted_on', type: 'timestamp', transformer: orbit_db_typeorm_1.Transformers.dateTime }),
|
|
59
59
|
tslib_1.__metadata("design:type", String)
|
|
60
60
|
], Upload.prototype, "deletedOn", void 0);
|
|
61
61
|
Upload = tslib_1.__decorate([
|
|
62
|
-
typeorm_1.Entity('upload', { schema: '
|
|
62
|
+
(0, typeorm_1.Entity)('upload', { schema: 'orbit_storage' })
|
|
63
63
|
], Upload);
|
|
64
64
|
exports.Upload = Upload;
|
|
65
65
|
//# sourceMappingURL=upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kCAClB;AAGd;IADC,IAAA,gBAAM,E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AI,EAAE,WAAW,EAAE,WAAW,EAAE,+BAAY,CAAC,QAAQ,EAAE,CAAC;;yCAC3D;AAtChB,MAAM;IADlB,IAAA,gBAAM,EAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;GACjC,MAAM,CAuClB;AAvCY,wBAAM"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC"}
|
|
File without changes
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,qDAA2B;AAC3B,gDAAsB;AACtB,yDAA+B"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ioc/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ioc/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IContainer } from '@rocketmakers/ioc';
|
|
2
|
+
import { ICoreContainerTypes } from '@rocketmakers/orbit-core';
|
|
3
|
+
import { IRepositoryContainerTypes } from '@rocketmakers/orbit-storage-core';
|
|
4
|
+
export declare function registerStorageTypeormIoC(container: IContainer<ICoreContainerTypes>): IContainer<ICoreContainerTypes & IRepositoryContainerTypes>;
|
|
5
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/ioc/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAiC7E,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,UAAU,CAAC,mBAAmB,CAAC,GACzC,UAAU,CAAC,mBAAmB,GAAG,yBAAyB,CAAC,CAY7D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerStorageTypeormIoC = void 0;
|
|
4
|
+
const ioc_1 = require("@rocketmakers/ioc");
|
|
5
|
+
const repositories_1 = require("../repositories");
|
|
6
|
+
function registerStorageTypeormIoC(container) {
|
|
7
|
+
return (0, ioc_1.register)({
|
|
8
|
+
bucketRegistrationRepository: builder => builder.class(repositories_1.BucketRegistrationRepository, ['timeService', 'uuidGeneratorService']).inSingletonScope(),
|
|
9
|
+
uploadRepository: builder => builder.class(repositories_1.UploadRepository, ['timeService', 'uuidGeneratorService']).inSingletonScope(),
|
|
10
|
+
folderRepository: builder => builder.class(repositories_1.FolderRepository, ['timeService', 'uuidGeneratorService']).inSingletonScope(),
|
|
11
|
+
}, container);
|
|
12
|
+
}
|
|
13
|
+
exports.registerStorageTypeormIoC = registerStorageTypeormIoC;
|
|
14
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/ioc/register.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAGzD,kDAAmG;AAgCnG,SAAgB,yBAAyB,CACvC,SAA0C;IAE1C,OAAO,IAAA,cAAQ,EACb;QACE,4BAA4B,EAAE,OAAO,CAAC,EAAE,CACtC,OAAO,CAAC,KAAK,CAAC,2CAA4B,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,EAAE;QACzG,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAC1B,OAAO,CAAC,KAAK,CAAC,+BAAgB,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,EAAE;QAC7F,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAC1B,OAAO,CAAC,KAAK,CAAC,+BAAgB,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,EAAE;KAC9F,EACD,SAAS,CACV,CAAC;AACJ,CAAC;AAdD,8DAcC"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
1
2
|
import { DateTimeString, IQuery, IQueryResponse, ITimeService, IUuidGeneratorService } from '@rocketmakers/orbit-core';
|
|
2
3
|
import { IBucketRegistrationUpdateRaw, BucketRegistrationRaw, BucketRegistrationId, BucketName, IBucketRegistrationRepository, BucketRegistration } from '@rocketmakers/orbit-storage-core';
|
|
3
|
-
import { IDataContext } from '@rocketmakers/orbit-db-core';
|
|
4
|
-
import { CustomRepositoryBase } from '@rocketmakers/orbit-db-typeorm';
|
|
4
|
+
import { IDataContext, OrbitTransaction } from '@rocketmakers/orbit-db-core';
|
|
5
5
|
import { BucketRegistrationEntity } from '../entities';
|
|
6
|
-
export declare class BucketRegistrationRepository
|
|
6
|
+
export declare class BucketRegistrationRepository implements IBucketRegistrationRepository {
|
|
7
7
|
private timeService;
|
|
8
8
|
private uuidGenerator;
|
|
9
9
|
constructor(timeService: ITimeService, uuidGenerator: IUuidGeneratorService);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
txCast(tx: OrbitTransaction): EntityManager;
|
|
11
|
+
protected getRepository(context: IDataContext): Repository<BucketRegistrationEntity>;
|
|
12
|
+
exists(context: IDataContext, name: BucketName): Promise<boolean>;
|
|
13
|
+
getRawByName(context: IDataContext, name: BucketName): Promise<BucketRegistrationRaw | undefined>;
|
|
14
|
+
getUpdatedOn(context: IDataContext, name: BucketName): Promise<DateTimeString | undefined>;
|
|
15
|
+
deleteByName(context: IDataContext, name: BucketName): Promise<boolean>;
|
|
14
16
|
getAll(context: IDataContext, query: IQuery<BucketRegistration>): Promise<IQueryResponse<BucketRegistrationRaw>>;
|
|
15
17
|
getById(context: IDataContext, id: BucketRegistrationId): Promise<BucketRegistrationRaw | undefined>;
|
|
16
18
|
private findById;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketRegistrationRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/bucketRegistrationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EACL,cAAc,EACd,MAAM,EACN,cAAc,EACd,YAAY,EACZ,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,6BAA6B,EAC7B,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,4BAA6B,YAAW,6BAA6B;IAEpE,OAAO,CAAC,WAAW;IAAgB,OAAO,CAAC,aAAa;gBAAhD,WAAW,EAAE,YAAY,EAAU,aAAa,EAAE,qBAAqB;IAE3F,MAAM,CAAC,EAAE,EAAE,gBAAgB,GAAG,aAAa;IAI3C,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAI9E,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAKjE,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IASjG,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAS1F,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE,MAAM,CACV,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,CAAC,kBAAkB,CAAC,GAChC,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;IASjD,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;YAKtF,QAAQ;IAWhB,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAoCzF,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,4BAA4B;IAYrE,OAAO,CAAC,GAAG;CAcZ"}
|
|
@@ -5,39 +5,44 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
6
6
|
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
7
7
|
const entities_1 = require("../entities");
|
|
8
|
-
class BucketRegistrationRepository
|
|
8
|
+
class BucketRegistrationRepository {
|
|
9
9
|
constructor(timeService, uuidGenerator) {
|
|
10
|
-
super(entities_1.BucketRegistrationEntity);
|
|
11
10
|
this.timeService = timeService;
|
|
12
11
|
this.uuidGenerator = uuidGenerator;
|
|
13
12
|
}
|
|
14
|
-
|
|
13
|
+
txCast(tx) {
|
|
14
|
+
return tx;
|
|
15
|
+
}
|
|
16
|
+
getRepository(context) {
|
|
17
|
+
return this.txCast(context.tx).getRepository(entities_1.BucketRegistrationEntity);
|
|
18
|
+
}
|
|
19
|
+
exists(context, name) {
|
|
15
20
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const value = yield this.getRepository(context).count({
|
|
21
|
+
const value = yield this.getRepository(context).count({ name });
|
|
17
22
|
return value > 0;
|
|
18
23
|
});
|
|
19
24
|
}
|
|
20
|
-
getRawByName(context,
|
|
25
|
+
getRawByName(context, name) {
|
|
21
26
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const row = yield this.getRepository(context).findOne({
|
|
27
|
+
const row = yield this.getRepository(context).findOne({ name });
|
|
23
28
|
if (!row) {
|
|
24
29
|
return undefined;
|
|
25
30
|
}
|
|
26
31
|
return this.map(row);
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
|
-
getUpdatedOn(context,
|
|
34
|
+
getUpdatedOn(context, name) {
|
|
30
35
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const bucket = yield this.getRepository(context).findOne({
|
|
36
|
+
const bucket = yield this.getRepository(context).findOne({ where: { name }, select: ['updatedOn'] });
|
|
32
37
|
if (!bucket) {
|
|
33
38
|
return undefined;
|
|
34
39
|
}
|
|
35
40
|
return bucket.updatedOn;
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
|
-
deleteByName(context,
|
|
43
|
+
deleteByName(context, name) {
|
|
39
44
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
return orbit_db_typeorm_1.RepositoryExtensions.deleteEntity(this.getRepository(context), {
|
|
45
|
+
return orbit_db_typeorm_1.RepositoryExtensions.deleteEntity(this.getRepository(context), { name });
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
48
|
getAll(context, query) {
|
|
@@ -79,7 +84,7 @@ class BucketRegistrationRepository extends orbit_db_typeorm_1.CustomRepositoryBa
|
|
|
79
84
|
friendly: 'Bucket name already used',
|
|
80
85
|
developer: 'Bucket name exists in the database',
|
|
81
86
|
},
|
|
82
|
-
value: reg.
|
|
87
|
+
value: reg.name,
|
|
83
88
|
},
|
|
84
89
|
]);
|
|
85
90
|
}
|
|
@@ -101,7 +106,7 @@ class BucketRegistrationRepository extends orbit_db_typeorm_1.CustomRepositoryBa
|
|
|
101
106
|
createdOn: registration.createdOn,
|
|
102
107
|
updatedBy: registration.updatedBy,
|
|
103
108
|
updatedOn: registration.updatedOn,
|
|
104
|
-
|
|
109
|
+
name: registration.name,
|
|
105
110
|
pathPrefix: registration.pathPrefix,
|
|
106
111
|
maxFileSizeBytes: registration.maxFileSizeBytes,
|
|
107
112
|
config: registration.config,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketRegistrationRepository.js","sourceRoot":"","sources":["../../src/repositories/bucketRegistrationRepository.ts"],"names":[],"mappings":";;;;AACA,yDAOkC;AAUlC,qEAAsE;AACtE,0CAAuD;AAEvD,MAAa,4BAA4B;IAEvC,YAAoB,WAAyB,EAAU,aAAoC;QAAvE,gBAAW,GAAX,WAAW,CAAc;QAAU,kBAAa,GAAb,aAAa,CAAuB;IAAG,CAAC;IAE/F,MAAM,CAAC,EAAoB;QACzB,OAAO,EAAmB,CAAC;IAC7B,CAAC;IAES,aAAa,CAAC,OAAqB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,mCAAwB,CAAC,CAAC;IACzE,CAAC;IAEK,MAAM,CAAC,OAAqB,EAAE,IAAgB;;YAClD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YAChE,OAAO,KAAK,GAAG,CAAC,CAAC;QACnB,CAAC;KAAA;IAEK,YAAY,CAAC,OAAqB,EAAE,IAAgB;;YACxD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC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AAO,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,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,MAAM,EAAE,YAAY,CAAC,MAAM;SAC5B,CAAC;IACJ,CAAC;CACF;AAjID,oEAiIC"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
1
2
|
import { ITimeService, IUuidGeneratorService, IQueryResponse, IQuery } from '@rocketmakers/orbit-core';
|
|
2
|
-
import { IDataContext } from '@rocketmakers/orbit-db-core';
|
|
3
|
-
import { CustomRepositoryBase } from '@rocketmakers/orbit-db-typeorm';
|
|
3
|
+
import { IDataContext, OrbitTransaction } from '@rocketmakers/orbit-db-core';
|
|
4
4
|
import { IFolder, FolderId, BucketName, IFolderRename, IFolderMove, IFolderCreate, FolderType, IFolderRepository } from '@rocketmakers/orbit-storage-core';
|
|
5
5
|
import { Folder } from '../entities';
|
|
6
|
-
export declare class FolderRepository
|
|
6
|
+
export declare class FolderRepository implements IFolderRepository {
|
|
7
7
|
private timeService;
|
|
8
8
|
private uuidGenerator;
|
|
9
9
|
constructor(timeService: ITimeService, uuidGenerator: IUuidGeneratorService);
|
|
10
|
+
txCast(tx: OrbitTransaction): EntityManager;
|
|
11
|
+
protected getRepository(context: IDataContext): Repository<Folder>;
|
|
10
12
|
private getFolderIdsByParent;
|
|
11
13
|
private getChildFolderIdsRecursive;
|
|
12
14
|
getFolders(context: IDataContext, bucketName: BucketName, query: IQuery<IFolder>): Promise<IQueryResponse<IFolder>>;
|
|
13
|
-
createFolder(context: IDataContext, creation: IFolderCreate, type: FolderType): Promise<
|
|
15
|
+
createFolder(context: IDataContext, creation: IFolderCreate, type: FolderType): Promise<FolderId>;
|
|
14
16
|
deleteFolder(context: IDataContext, id: FolderId): Promise<boolean>;
|
|
15
17
|
renameFolder(context: IDataContext, update: IFolderRename): Promise<import("@rocketmakers/orbit-core").UpdateStatus>;
|
|
16
18
|
moveFolder(context: IDataContext, update: IFolderMove): Promise<import("@rocketmakers/orbit-core").UpdateStatus>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folderRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/folderRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAM,UAAU,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,MAAM,EAEP,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,UAAU,EACV,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMrC,qBAAa,gBAAiB,YAAW,iBAAiB;IAE5C,OAAO,CAAC,WAAW;IAAgB,OAAO,CAAC,aAAa;gBAAhD,WAAW,EAAE,YAAY,EAAU,aAAa,EAAE,qBAAqB;IAE3F,MAAM,CAAC,EAAE,EAAE,gBAAgB,GAAG,aAAa;IAI3C,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC;YAIpD,oBAAoB;YAKpB,0BAA0B;IAWlC,UAAU,CACd,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GACrB,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAoC7B,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU;IAoB7E,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ;IAQtD,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa;IAWnD,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW;YAqB7C,sBAAsB;YAUtB,sBAAsB;CASrC"}
|
|
@@ -6,15 +6,20 @@ const typeorm_1 = require("typeorm");
|
|
|
6
6
|
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
7
7
|
const orbit_db_typeorm_1 = require("@rocketmakers/orbit-db-typeorm");
|
|
8
8
|
const entities_1 = require("../entities");
|
|
9
|
-
class FolderRepository
|
|
9
|
+
class FolderRepository {
|
|
10
10
|
constructor(timeService, uuidGenerator) {
|
|
11
|
-
super(entities_1.Folder);
|
|
12
11
|
this.timeService = timeService;
|
|
13
12
|
this.uuidGenerator = uuidGenerator;
|
|
14
13
|
}
|
|
14
|
+
txCast(tx) {
|
|
15
|
+
return tx;
|
|
16
|
+
}
|
|
17
|
+
getRepository(context) {
|
|
18
|
+
return this.txCast(context.tx).getRepository(entities_1.Folder);
|
|
19
|
+
}
|
|
15
20
|
getFolderIdsByParent(context, parentIds) {
|
|
16
21
|
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'] });
|
|
22
|
+
const f = yield this.getRepository(context).find({ where: { parentId: (0, typeorm_1.In)(parentIds) }, select: ['id'] });
|
|
18
23
|
return f ? f.map(g => g.id) : [];
|
|
19
24
|
});
|
|
20
25
|
}
|
|
@@ -89,7 +94,7 @@ class FolderRepository extends orbit_db_typeorm_1.CustomRepositoryBase {
|
|
|
89
94
|
const repo = this.getRepository(context);
|
|
90
95
|
const existing = yield orbit_db_typeorm_1.RepositoryExtensions.findById(repo, update.id, { select: ['bucketName'] });
|
|
91
96
|
if (!existing) {
|
|
92
|
-
throw new orbit_core_1.
|
|
97
|
+
throw new orbit_core_1.ArgumentValidationError('Id is not a valid folder');
|
|
93
98
|
}
|
|
94
99
|
yield this.ensureParentIdInBucket(repo, update.parentId, existing.bucketName);
|
|
95
100
|
yield this.ensureNotMovingToChild(repo, update.id, update.parentId);
|
|
@@ -100,10 +105,10 @@ class FolderRepository extends orbit_db_typeorm_1.CustomRepositoryBase {
|
|
|
100
105
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
101
106
|
const parent = yield orbit_db_typeorm_1.RepositoryExtensions.findById(repo, parentId, { select: ['bucketName'] });
|
|
102
107
|
if (!parent) {
|
|
103
|
-
throw new orbit_core_1.
|
|
108
|
+
throw new orbit_core_1.ArgumentValidationError('ParentId is not a valid folder');
|
|
104
109
|
}
|
|
105
110
|
if (parent.bucketName !== bucketName) {
|
|
106
|
-
throw new orbit_core_1.
|
|
111
|
+
throw new orbit_core_1.ArgumentValidationError('Parent Folder is from a different bucket');
|
|
107
112
|
}
|
|
108
113
|
});
|
|
109
114
|
}
|
|
@@ -111,7 +116,7 @@ class FolderRepository extends orbit_db_typeorm_1.CustomRepositoryBase {
|
|
|
111
116
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
117
|
const childrenOfFolder = yield repo.find({ where: { parentId: folder }, select: ['id'] });
|
|
113
118
|
if (childrenOfFolder.some(f => f.id === find)) {
|
|
114
|
-
throw new orbit_core_1.
|
|
119
|
+
throw new orbit_core_1.ArgumentValidationError('You cannot move a folder into it own children');
|
|
115
120
|
}
|
|
116
121
|
for (const childFolder of childrenOfFolder) {
|
|
117
122
|
yield this.ensureNotMovingToChild(repo, childFolder.id, find);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folderRepository.js","sourceRoot":"","sources":["../../src/repositories/folderRepository.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AACxD,yDAMkC;AAElC,qEAAsE;AAWtE,0CAAqC;AAMrC,MAAa,gBAAgB;IAE3B,YAAoB,WAAyB,EAAU,aAAoC;QAAvE,gBAAW,GAAX,WAAW,CAAc;QAAU,kBAAa,GAAb,aAAa,CAAuB;IAAG,CAAC;IAE/F,MAAM,CAAC,EAAoB;QACzB,OAAO,EAAmB,CAAC;IAC7B,CAAC;IAES,aAAa,CAAC,OAAqB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAM,CAAC,CAAC;IACvD,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,IAAA,YAAE,EAAC,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,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,CAAC;KAAA;IAEa,0BAA0B,CAAC,OAAqB,EAAE,EAAY;;YAC1E,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC;YACrB,MAAM,OAAO,GAAe,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC,MAAM,EAAE;gBACvB,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,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AAI,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,oCAAuB,CAAC,+CAA+C,CAAC,CAAC;aACpF;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;AAnJD,4CAmJC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+C;AAC/C,6DAAmC;AACnC,6DAAmC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
1
2
|
import { MetadataMap } from '@rocketmakers/storage';
|
|
2
3
|
import { ITimeService, IUuidGeneratorService, IQueryResponse, UserId, Maybe, IQuery } from '@rocketmakers/orbit-core';
|
|
3
4
|
import { IUpload, UploadId, IUploadCreation, IUploadContent, BucketName, FolderId, IUploadRepository } from '@rocketmakers/orbit-storage-core';
|
|
4
|
-
import { IDataContext } from '@rocketmakers/orbit-db-core';
|
|
5
|
-
import { CustomRepositoryBase } from '@rocketmakers/orbit-db-typeorm';
|
|
5
|
+
import { IDataContext, OrbitTransaction } from '@rocketmakers/orbit-db-core';
|
|
6
6
|
import { Upload } from '../entities';
|
|
7
|
-
export declare class UploadRepository
|
|
7
|
+
export declare class UploadRepository implements IUploadRepository {
|
|
8
8
|
private timeService;
|
|
9
9
|
private uuidGenerator;
|
|
10
10
|
constructor(timeService: ITimeService, uuidGenerator: IUuidGeneratorService);
|
|
11
|
+
txCast(tx: OrbitTransaction): EntityManager;
|
|
12
|
+
protected getRepository(context: IDataContext): Repository<Upload>;
|
|
11
13
|
getById(context: IDataContext, id: UploadId): Promise<IUpload | undefined>;
|
|
12
14
|
getForDownload(context: IDataContext, id: UploadId): Promise<Pick<IUpload, 'filePath' | 'fileName' | 'fileSize' | 'contentType' | 'id' | 'userId' | 'bucketName'> | undefined>;
|
|
13
15
|
getForUpload(context: IDataContext, id: UploadId): Promise<Pick<IUpload, 'bucketName' | 'ticket'> | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/uploadRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACtH,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EACf,cAAc,EACd,UAAU,EACV,QAAQ,EACR,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkBrC,qBAAa,gBAAiB,YAAW,iBAAiB;IAE5C,OAAO,CAAC,WAAW;IAAgB,OAAO,CAAC,aAAa;gBAAhD,WAAW,EAAE,YAAY,EAA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