@things-factory/attachment-base 4.1.2 → 4.1.13

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.
Files changed (41) hide show
  1. package/package.json +4 -4
  2. package/dist-server/controllers/index.js +0 -1
  3. package/dist-server/controllers/index.js.map +0 -1
  4. package/dist-server/entities/attachment.js +0 -102
  5. package/dist-server/entities/attachment.js.map +0 -1
  6. package/dist-server/entities/index.js +0 -7
  7. package/dist-server/entities/index.js.map +0 -1
  8. package/dist-server/graphql/index.js +0 -30
  9. package/dist-server/graphql/index.js.map +0 -1
  10. package/dist-server/graphql/resolvers/attachment/attachment.js +0 -14
  11. package/dist-server/graphql/resolvers/attachment/attachment.js.map +0 -1
  12. package/dist-server/graphql/resolvers/attachment/attachments.js +0 -16
  13. package/dist-server/graphql/resolvers/attachment/attachments.js.map +0 -1
  14. package/dist-server/graphql/resolvers/attachment/create-attachment.js +0 -28
  15. package/dist-server/graphql/resolvers/attachment/create-attachment.js.map +0 -1
  16. package/dist-server/graphql/resolvers/attachment/create-attachments.js +0 -19
  17. package/dist-server/graphql/resolvers/attachment/create-attachments.js.map +0 -1
  18. package/dist-server/graphql/resolvers/attachment/delete-attachment.js +0 -18
  19. package/dist-server/graphql/resolvers/attachment/delete-attachment.js.map +0 -1
  20. package/dist-server/graphql/resolvers/attachment/delete-attachments-by-ref.js +0 -23
  21. package/dist-server/graphql/resolvers/attachment/delete-attachments-by-ref.js.map +0 -1
  22. package/dist-server/graphql/resolvers/attachment/index.js +0 -24
  23. package/dist-server/graphql/resolvers/attachment/index.js.map +0 -1
  24. package/dist-server/graphql/resolvers/attachment/update-attachment.js +0 -16
  25. package/dist-server/graphql/resolvers/attachment/update-attachment.js.map +0 -1
  26. package/dist-server/graphql/resolvers/attachment/upload.js +0 -14
  27. package/dist-server/graphql/resolvers/attachment/upload.js.map +0 -1
  28. package/dist-server/graphql/resolvers/index.js +0 -14
  29. package/dist-server/graphql/resolvers/index.js.map +0 -1
  30. package/dist-server/graphql/types/attachment/attachment-list.js +0 -14
  31. package/dist-server/graphql/types/attachment/attachment-list.js.map +0 -1
  32. package/dist-server/graphql/types/attachment/attachment-patch.js +0 -19
  33. package/dist-server/graphql/types/attachment/attachment-patch.js.map +0 -1
  34. package/dist-server/graphql/types/attachment/attachment.js +0 -27
  35. package/dist-server/graphql/types/attachment/attachment.js.map +0 -1
  36. package/dist-server/graphql/types/attachment/index.js +0 -38
  37. package/dist-server/graphql/types/attachment/index.js.map +0 -1
  38. package/dist-server/graphql/types/attachment/new-attachment.js +0 -16
  39. package/dist-server/graphql/types/attachment/new-attachment.js.map +0 -1
  40. package/dist-server/graphql/types/index.js +0 -14
  41. package/dist-server/graphql/types/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/attachment-base",
3
- "version": "4.1.2",
3
+ "version": "4.1.13",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -28,11 +28,11 @@
28
28
  "@aws-sdk/lib-storage": "^3.46.0",
29
29
  "@aws-sdk/s3-presigned-post": "^3.46.0",
30
30
  "@koa/multer": "^3.0.0",
31
- "@things-factory/auth-base": "^4.1.2",
32
- "@things-factory/env": "^4.1.2",
31
+ "@things-factory/auth-base": "^4.1.13",
32
+ "@things-factory/env": "^4.1.13",
33
33
  "memfs": "^3.0.1",
34
34
  "mime": "^2.4.4",
35
35
  "multer": "^1.3.0"
36
36
  },
37
- "gitHead": "46164ac6b9b2a15c4ff6af5d83d0435f28fff80a"
37
+ "gitHead": "adbf93d0eddd05d209543ed0d08e3aeaab2968b5"
38
38
  }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":""}
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var _a, _b, _c;
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Attachment = void 0;
14
- const auth_base_1 = require("@things-factory/auth-base");
15
- const shell_1 = require("@things-factory/shell");
16
- const typeorm_1 = require("typeorm");
17
- const { ATTACHMENT_PATH } = require('../attachment-const');
18
- let Attachment = class Attachment {
19
- get fullpath() {
20
- return `/${ATTACHMENT_PATH}/${this.path}`;
21
- }
22
- };
23
- __decorate([
24
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
25
- __metadata("design:type", String)
26
- ], Attachment.prototype, "id", void 0);
27
- __decorate([
28
- (0, typeorm_1.ManyToOne)(type => shell_1.Domain, {
29
- nullable: false
30
- }),
31
- __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
32
- ], Attachment.prototype, "domain", void 0);
33
- __decorate([
34
- (0, typeorm_1.Column)(),
35
- __metadata("design:type", String)
36
- ], Attachment.prototype, "name", void 0);
37
- __decorate([
38
- (0, typeorm_1.Column)({
39
- nullable: true
40
- }),
41
- __metadata("design:type", String)
42
- ], Attachment.prototype, "description", void 0);
43
- __decorate([
44
- (0, typeorm_1.Column)(),
45
- __metadata("design:type", String)
46
- ], Attachment.prototype, "mimetype", void 0);
47
- __decorate([
48
- (0, typeorm_1.Column)(),
49
- __metadata("design:type", String)
50
- ], Attachment.prototype, "encoding", void 0);
51
- __decorate([
52
- (0, typeorm_1.Column)({
53
- nullable: true
54
- }),
55
- __metadata("design:type", String)
56
- ], Attachment.prototype, "category", void 0);
57
- __decorate([
58
- (0, typeorm_1.Column)({
59
- nullable: true
60
- }),
61
- __metadata("design:type", String)
62
- ], Attachment.prototype, "refBy", void 0);
63
- __decorate([
64
- (0, typeorm_1.Column)(),
65
- __metadata("design:type", String)
66
- ], Attachment.prototype, "path", void 0);
67
- __decorate([
68
- (0, typeorm_1.Column)(),
69
- __metadata("design:type", String)
70
- ], Attachment.prototype, "size", void 0);
71
- __decorate([
72
- (0, typeorm_1.CreateDateColumn)(),
73
- __metadata("design:type", Date)
74
- ], Attachment.prototype, "createdAt", void 0);
75
- __decorate([
76
- (0, typeorm_1.UpdateDateColumn)(),
77
- __metadata("design:type", Date)
78
- ], Attachment.prototype, "updatedAt", void 0);
79
- __decorate([
80
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
81
- nullable: true
82
- }),
83
- __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
84
- ], Attachment.prototype, "creator", void 0);
85
- __decorate([
86
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
87
- nullable: true
88
- }),
89
- __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
90
- ], Attachment.prototype, "updater", void 0);
91
- Attachment = __decorate([
92
- (0, typeorm_1.Entity)(),
93
- (0, typeorm_1.Index)('ix_attachment_0', (attachment) => [attachment.domain, attachment.name], { unique: false }),
94
- (0, typeorm_1.Index)('ix_attachment_1', (attachment) => [attachment.domain, attachment.category, attachment.name], {
95
- unique: false
96
- }),
97
- (0, typeorm_1.Index)('ix_attachment_2', (attachment) => [attachment.domain, attachment.refBy], {
98
- unique: false
99
- })
100
- ], Attachment);
101
- exports.Attachment = Attachment;
102
- //# sourceMappingURL=attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../server/entities/attachment.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAgD;AAChD,iDAA8C;AAC9C,qCAAsH;AAEtH,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAU1D,IAAa,UAAU,GAAvB,MAAa,UAAU;IAuDrB,IAAI,QAAQ;QACV,OAAO,IAAI,eAAe,IAAI,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3C,CAAC;CACF,CAAA;AAxDC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACrB;AAKV;IAHC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE;QACzB,QAAQ,EAAE,KAAK;KAChB,CAAC;kDACM,cAAM,oBAAN,cAAM;0CAAA;AAGd;IADC,IAAA,gBAAM,GAAE;;wCACG;AAKZ;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;+CACiB;AAGnB;IADC,IAAA,gBAAM,GAAE;;4CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;4CACO;AAKhB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;4CACc;AAKhB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;8BACK,MAAM;yCAAA;AAGb;IADC,IAAA,gBAAM,GAAE;;wCACG;AAGZ;IADC,IAAA,gBAAM,GAAE;;wCACG;AAGZ;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;6CAAA;AAGf;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;6CAAA;AAKf;IAHC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;2CAAA;AAKb;IAHC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;2CAAA;AArDF,UAAU;IARtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC7G,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/G,MAAM,EAAE,KAAK;KACd,CAAC;IACD,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE;QAC3F,MAAM,EAAE,KAAK;KACd,CAAC;GACW,UAAU,CA0DtB;AA1DY,gCAAU"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Attachment = exports.entities = void 0;
4
- const attachment_1 = require("./attachment");
5
- Object.defineProperty(exports, "Attachment", { enumerable: true, get: function () { return attachment_1.Attachment; } });
6
- exports.entities = [attachment_1.Attachment];
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/entities/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAIhC,2FAJA,uBAAU,OAIA;AAFN,QAAA,QAAQ,GAAG,CAAC,uBAAU,CAAC,CAAA"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.schema = void 0;
23
- const utils_1 = require("@things-factory/utils");
24
- const resolvers = __importStar(require("./resolvers"));
25
- const typeDefs = __importStar(require("./types"));
26
- exports.schema = {
27
- typeDefs,
28
- resolvers: utils_1.deepMerge.apply(null, Object.values(resolvers))
29
- };
30
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/graphql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiD;AAEjD,uDAAwC;AACxC,kDAAmC;AAEtB,QAAA,MAAM,GAAG;IACpB,QAAQ;IACR,SAAS,EAAE,iBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;CAC3D,CAAA"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachmentResolver = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const entities_1 = require("../../../entities");
6
- exports.attachmentResolver = {
7
- async attachment(_, { id }, context) {
8
- return await (0, typeorm_1.getRepository)(entities_1.Attachment).findOne({
9
- where: { domain: context.state.domain, id },
10
- relations: ['domain', 'creator', 'updater']
11
- });
12
- }
13
- };
14
- //# sourceMappingURL=attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/attachment.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,gDAA8C;AAEjC,QAAA,kBAAkB,GAAG;IAChC,KAAK,CAAC,UAAU,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAY;QAC3C,OAAO,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE;YAC3C,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;SAC5C,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachments = exports.attachmentsResolver = void 0;
4
- const shell_1 = require("@things-factory/shell");
5
- const typeorm_1 = require("typeorm");
6
- const entities_1 = require("../../../entities");
7
- exports.attachmentsResolver = {
8
- attachments
9
- };
10
- async function attachments(_, params, context) {
11
- const convertedParams = (0, shell_1.convertListParams)(params, context.state.domain.id);
12
- const [items, total] = await (0, typeorm_1.getRepository)(entities_1.Attachment).findAndCount(Object.assign(Object.assign({}, convertedParams), { relations: ['domain', 'creator', 'updater'] }));
13
- return { items, total };
14
- }
15
- exports.attachments = attachments;
16
- //# sourceMappingURL=attachments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/attachments.ts"],"names":[],"mappings":";;;AAAA,iDAAoE;AACpE,qCAAuC;AACvC,gDAA8C;AAEjC,QAAA,mBAAmB,GAAG;IACjC,WAAW;CACZ,CAAA;AAEM,KAAK,UAAU,WAAW,CAC/B,CAAM,EACN,MAAiB,EACjB,OAAY;IAEZ,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC1E,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,YAAY,iCAC9D,eAAe,KAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,IAC3C,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AACzB,CAAC;AAZD,kCAYC"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAttachment = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const entities_1 = require("../../../entities");
6
- const attachment_const_1 = require("../../../attachment-const");
7
- async function createAttachment(_, { attachment }, context) {
8
- const { file, category, refBy, description } = attachment;
9
- const { createReadStream, filename, mimetype, encoding } = await file;
10
- const stream = createReadStream();
11
- var { id, path, size } = await attachment_const_1.STORAGE.uploadFile({ stream, filename });
12
- return await (0, typeorm_1.getRepository)(entities_1.Attachment).save({
13
- domain: context.state.domain,
14
- creator: context.state.user,
15
- updater: context.state.user,
16
- id,
17
- description,
18
- name: filename,
19
- mimetype,
20
- encoding,
21
- refBy,
22
- category: category || mimetype.split('/').shift(),
23
- size: size,
24
- path
25
- });
26
- }
27
- exports.createAttachment = createAttachment;
28
- //# sourceMappingURL=create-attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-attachment.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/create-attachment.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,gDAA8C;AAC9C,gEAAmD;AAE5C,KAAK,UAAU,gBAAgB,CAAC,CAAM,EAAE,EAAE,UAAU,EAAE,EAAE,OAAY;IACzE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,UAAU,CAAA;IACzD,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAA;IACrE,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;IAEjC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,0BAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEvE,OAAO,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,IAAI,CAAC;QAC1C,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;QAC5B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;QAC3B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;QAC3B,EAAE;QACF,WAAW;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ;QACR,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE;QACjD,IAAI,EAAE,IAAW;QACjB,IAAI;KACL,CAAC,CAAA;AACJ,CAAC;AArBD,4CAqBC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createAttachments = void 0;
7
- const promises_all_1 = __importDefault(require("promises-all"));
8
- const create_attachment_1 = require("./create-attachment");
9
- const env_1 = require("@things-factory/env");
10
- async function createAttachments(_, { attachments }, context) {
11
- const { resolve, reject } = await promises_all_1.default.all(attachments.map(attachment => (0, create_attachment_1.createAttachment)(_, { attachment }, context)));
12
- if (reject.length) {
13
- reject.forEach(({ name, message }) => env_1.logger.error(`${name}: ${message}`));
14
- return reject;
15
- }
16
- return resolve;
17
- }
18
- exports.createAttachments = createAttachments;
19
- //# sourceMappingURL=create-attachments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-attachments.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/create-attachments.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAsC;AACtC,2DAAsD;AACtD,6CAA4C;AAErC,KAAK,UAAU,iBAAiB,CAAC,CAAM,EAAE,EAAE,WAAW,EAAE,EAAE,OAAY;IAC3E,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,sBAAW,CAAC,GAAG,CAC/C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,IAAA,oCAAgB,EAAC,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC,CAC5E,CAAA;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,YAAM,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAA;QAE1E,OAAO,MAAM,CAAA;KACd;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAZD,8CAYC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAttachment = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const entities_1 = require("../../../entities");
6
- const attachment_const_1 = require("../../../attachment-const");
7
- async function deleteAttachment(_, { id }, context) {
8
- const repository = (0, typeorm_1.getRepository)(entities_1.Attachment);
9
- const attachment = await repository.findOne({
10
- where: { domain: context.state.domain, id }
11
- });
12
- if (attachment) {
13
- await repository.delete(attachment.id);
14
- await attachment_const_1.STORAGE.deleteFile(attachment.path);
15
- }
16
- }
17
- exports.deleteAttachment = deleteAttachment;
18
- //# sourceMappingURL=delete-attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-attachment.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/delete-attachment.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,gDAA8C;AAC9C,gEAAmD;AAE5C,KAAK,UAAU,gBAAgB,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAY;IACjE,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE;KAC5C,CAAC,CAAA;IAEF,IAAI,UAAU,EAAE;QACd,MAAM,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;QACtC,MAAM,0BAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;KAC1C;AACH,CAAC;AAVD,4CAUC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAttachmentsByRef = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const entities_1 = require("../../../entities");
6
- const attachment_const_1 = require("../../../attachment-const");
7
- async function deleteAttachmentsByRef(_, { refBys }, context) {
8
- const { domain } = context.state;
9
- const repository = (0, typeorm_1.getRepository)(entities_1.Attachment);
10
- const attachments = await (0, typeorm_1.getRepository)(entities_1.Attachment).find({
11
- where: { domain, refBy: (0, typeorm_1.In)(refBys) }
12
- });
13
- //remove attachment from repo
14
- await repository.delete({
15
- refBy: (0, typeorm_1.In)(refBys)
16
- });
17
- //remove files from attachments folder
18
- await Promise.all(attachments.map(async (attachment) => {
19
- await attachment_const_1.STORAGE.deleteFile(attachment.path);
20
- }));
21
- }
22
- exports.deleteAttachmentsByRef = deleteAttachmentsByRef;
23
- //# sourceMappingURL=delete-attachments-by-ref.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-attachments-by-ref.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/delete-attachments-by-ref.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAC3C,gDAA8C;AAC9C,gEAAmD;AAE5C,KAAK,UAAU,sBAAsB,CAAC,CAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAY;IAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAEhC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAA;IAC5C,MAAM,WAAW,GAAG,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,IAAI,CAAC;QACvD,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAA,YAAE,EAAC,MAAM,CAAC,EAAE;KACrC,CAAC,CAAA;IAEF,6BAA6B;IAC7B,MAAM,UAAU,CAAC,MAAM,CAAC;QACtB,KAAK,EAAE,IAAA,YAAE,EAAC,MAAM,CAAC;KAClB,CAAC,CAAA;IAEF,sCAAsC;IACtC,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,GAAG,CAAC,KAAK,EAAC,UAAU,EAAC,EAAE;QACjC,MAAM,0BAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC,CAAC,CACH,CAAA;AACH,CAAC;AAnBD,wDAmBC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttachmentResolver = void 0;
4
- const attachment_1 = require("./attachment");
5
- const attachments_1 = require("./attachments");
6
- const update_attachment_1 = require("./update-attachment");
7
- const create_attachment_1 = require("./create-attachment");
8
- const create_attachments_1 = require("./create-attachments");
9
- const delete_attachment_1 = require("./delete-attachment");
10
- const delete_attachments_by_ref_1 = require("./delete-attachments-by-ref");
11
- const upload_1 = require("./upload");
12
- exports.AttachmentResolver = {
13
- Query: Object.assign(Object.assign({}, attachments_1.attachmentsResolver), attachment_1.attachmentResolver),
14
- Mutation: {
15
- updateAttachment: update_attachment_1.updateAttachment,
16
- createAttachment: create_attachment_1.createAttachment,
17
- createAttachments: create_attachments_1.createAttachments,
18
- deleteAttachment: delete_attachment_1.deleteAttachment,
19
- deleteAttachmentsByRef: delete_attachments_by_ref_1.deleteAttachmentsByRef,
20
- singleUpload: upload_1.singleUpload,
21
- multipleUpload: upload_1.multipleUpload
22
- }
23
- };
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/index.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AACjD,+CAAmD;AAEnD,2DAAsD;AACtD,2DAAsD;AACtD,6DAAwD;AACxD,2DAAsD;AACtD,2EAAoE;AAEpE,qCAAuD;AAE1C,QAAA,kBAAkB,GAAG;IAChC,KAAK,kCACA,iCAAmB,GACnB,+BAAkB,CACtB;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAhB,oCAAgB;QAChB,gBAAgB,EAAhB,oCAAgB;QAChB,iBAAiB,EAAjB,sCAAiB;QACjB,gBAAgB,EAAhB,oCAAgB;QAChB,sBAAsB,EAAtB,kDAAsB;QACtB,YAAY,EAAZ,qBAAY;QACZ,cAAc,EAAd,uBAAc;KACf;CACF,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAttachment = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const entities_1 = require("../../../entities");
6
- async function updateAttachment(_, { id, patch }, context) {
7
- const attachment = await (0, typeorm_1.getRepository)(entities_1.Attachment).findOne({
8
- where: {
9
- domain: context.state.domain,
10
- id
11
- }
12
- });
13
- return await (0, typeorm_1.getRepository)(entities_1.Attachment).save(Object.assign(Object.assign(Object.assign({}, attachment), patch), { updater: context.state.user }));
14
- }
15
- exports.updateAttachment = updateAttachment;
16
- //# sourceMappingURL=update-attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-attachment.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/update-attachment.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,gDAA8C;AAEvC,KAAK,UAAU,gBAAgB,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,OAAY;IACxE,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,OAAO,CAAC;QACzD,KAAK,EAAE;YACL,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;YAC5B,EAAE;SACH;KACF,CAAC,CAAA;IAEF,OAAO,MAAM,IAAA,uBAAa,EAAC,qBAAU,CAAC,CAAC,IAAI,+CACtC,UAAU,GACV,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;AACJ,CAAC;AAbD,4CAaC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.multipleUpload = exports.singleUpload = void 0;
4
- const create_attachment_1 = require("./create-attachment");
5
- const create_attachments_1 = require("./create-attachments");
6
- async function singleUpload(_, { file }, context) {
7
- return await (0, create_attachment_1.createAttachment)(_, { attachment: { file } }, context);
8
- }
9
- exports.singleUpload = singleUpload;
10
- async function multipleUpload(_, { files }, context) {
11
- return await (0, create_attachments_1.createAttachments)(_, { attachments: { files } }, context);
12
- }
13
- exports.multipleUpload = multipleUpload;
14
- //# sourceMappingURL=upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/attachment/upload.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AACtD,6DAAwD;AAEjD,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,OAAY;IAC1D,OAAO,MAAM,IAAA,oCAAgB,EAAC,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACrE,CAAC;AAFD,oCAEC;AAEM,KAAK,UAAU,cAAc,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAY;IAC7D,OAAO,MAAM,IAAA,sCAAiB,EAAC,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACxE,CAAC;AAFD,wCAEC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./attachment"), exports);
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/resolvers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AttachmentList = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- exports.AttachmentList = (0, graphql_tag_1.default) `
9
- type AttachmentList {
10
- items: [Attachment]
11
- total: Int
12
- }
13
- `;
14
- //# sourceMappingURL=attachment-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/attachment/attachment-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,cAAc,GAAG,IAAA,qBAAG,EAAA;;;;;CAKhC,CAAA"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AttachmentPatch = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- exports.AttachmentPatch = (0, graphql_tag_1.default) `
9
- input AttachmentPatch {
10
- name: String
11
- description: String
12
- mimetype: String
13
- encoding: String
14
- category: String
15
- file: Upload
16
- refBy: String
17
- }
18
- `;
19
- //# sourceMappingURL=attachment-patch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment-patch.js","sourceRoot":"","sources":["../../../../server/graphql/types/attachment/attachment-patch.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,eAAe,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;CAUjC,CAAA"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Attachment = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- exports.Attachment = (0, graphql_tag_1.default) `
9
- type Attachment {
10
- id: String
11
- domain: Domain
12
- name: String
13
- description: String
14
- mimetype: String
15
- encoding: String
16
- category: String
17
- path: String
18
- fullpath: String
19
- refBy: String
20
- size: String
21
- creator: User
22
- updater: User
23
- createdAt: String
24
- updatedAt: String
25
- }
26
- `;
27
- //# sourceMappingURL=attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../../../server/graphql/types/attachment/attachment.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,UAAU,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;CAkB5B,CAAA"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.AttachmentResolver = void 0;
17
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
18
- __exportStar(require("./attachment"), exports);
19
- __exportStar(require("./new-attachment"), exports);
20
- __exportStar(require("./attachment-patch"), exports);
21
- __exportStar(require("./attachment-list"), exports);
22
- exports.AttachmentResolver = (0, graphql_tag_1.default) `
23
- extend type Mutation {
24
- createAttachment(attachment: NewAttachment!): Attachment
25
- createAttachments(attachments: [NewAttachment]!): [Attachment]
26
- updateAttachment(id: String!, patch: AttachmentPatch!): Attachment
27
- deleteAttachment(id: String!): Attachment
28
- deleteAttachmentsByRef(refBys: [String]!): Attachment
29
- singleUpload(file: Upload!): Attachment
30
- multipleUpload(files: [Upload]!): [Attachment]
31
- }
32
-
33
- extend type Query {
34
- attachments(filters: [Filter], pagination: Pagination, sortings: [Sorting]): AttachmentList
35
- attachment(id: String!): Attachment
36
- }
37
- `;
38
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/attachment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA6B;AAE7B,+CAA4B;AAC5B,mDAAgC;AAChC,qDAAkC;AAClC,oDAAiC;AAEpB,QAAA,kBAAkB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;CAepC,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NewAttachment = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- exports.NewAttachment = (0, graphql_tag_1.default) `
9
- input NewAttachment {
10
- category: String
11
- file: Upload!
12
- description: String
13
- refBy: String
14
- }
15
- `;
16
- //# sourceMappingURL=new-attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-attachment.js","sourceRoot":"","sources":["../../../../server/graphql/types/attachment/new-attachment.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,aAAa,GAAG,IAAA,qBAAG,EAAA;;;;;;;CAO/B,CAAA"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./attachment"), exports);
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B"}