@things-factory/font-base 5.0.7 → 6.0.0-alpha.0
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/dist-server/controllers/google-fonts.js +2 -4
- package/dist-server/controllers/google-fonts.js.map +1 -1
- package/dist-server/index.js +3 -16
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1556862253039-SeedFont.js +5 -6
- package/dist-server/migrations/1556862253039-SeedFont.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/font/font-mutation.js +28 -40
- package/dist-server/service/font/font-mutation.js.map +1 -1
- package/dist-server/service/font/font-query.js +43 -56
- package/dist-server/service/font/font-query.js.map +1 -1
- package/dist-server/service/font/font-type.js +33 -44
- package/dist-server/service/font/font-type.js.map +1 -1
- package/dist-server/service/font/font.js +32 -41
- package/dist-server/service/font/font.js.map +1 -1
- package/dist-server/service/font/index.js.map +1 -1
- package/dist-server/service/index.js +3 -16
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +6 -6
- package/server/migrations/1556862253039-SeedFont.ts +5 -5
- package/server/service/font/font-mutation.ts +6 -7
- package/server/service/font/font-query.ts +10 -11
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getAllGoogleFonts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const env_1 = require("@things-factory/env");
|
|
8
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
9
7
|
const address = 'https://www.googleapis.com/webfonts/v1/webfonts?key=';
|
|
10
8
|
async function getAllGoogleFonts() {
|
|
11
9
|
var key = env_1.config.get('googleFontAPIKey');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-fonts.js","sourceRoot":"","sources":["../../server/controllers/google-fonts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"google-fonts.js","sourceRoot":"","sources":["../../server/controllers/google-fonts.ts"],"names":[],"mappings":";;;;AAAA,6CAA4C;AAC5C,oEAA8B;AAE9B,MAAM,OAAO,GAAG,sDAAsD,CAAA;AAE/D,KAAK,UAAU,iBAAiB;IACrC,IAAI,GAAG,GAAG,YAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IACxC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,CAAC,IAAI,CACV,oHAAoH,CACrH,CAAA;QACD,OAAO,EAAE,CAAA;KACV;IACD,IAAI,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,CAAA;IAC9C,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KAC9D;SAAM;QACL,IAAI,QAAQ,GAAG,EAAE,CAAA;QACjB,QAAQ,IAAI,8BAA8B,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,GAAG,CAAA;QACrF,QAAQ,QAAQ,CAAC,MAAM,EAAE;YACvB,KAAK,GAAG;gBACN,QAAQ,IAAI,6CAA6C,CAAA;gBACzD,MAAK;SACR;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtB,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAtBD,8CAsBC","sourcesContent":["import { config } from '@things-factory/env'\nimport fetch from 'node-fetch'\n\nconst address = 'https://www.googleapis.com/webfonts/v1/webfonts?key='\n\nexport async function getAllGoogleFonts() {\n var key = config.get('googleFontAPIKey')\n if (!key) {\n console.warn(\n \"[things-factory/font-base] Could not read API key. Please check 'googleFontAPIKey' property in your configuration.\"\n )\n return []\n }\n var response = await fetch(`${address}${key}`)\n if (response.ok) {\n return (await response.json()).items.map(font => font.family)\n } else {\n let errorMsg = ''\n errorMsg += `[things-factory/font-base] ${response.status} - ${response.statusText}.`\n switch (response.status) {\n case 400:\n errorMsg += '\\nYour API key may be incorrect or expired.'\n break\n }\n console.warn(errorMsg)\n return []\n }\n}\n"]}
|
package/dist-server/index.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./service"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./migrations"), exports);
|
|
19
6
|
require("./routes");
|
|
20
7
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,uDAA4B;AAE5B,oBAAiB","sourcesContent":["export * from './service'\nexport * from './migrations'\n\nimport './routes'\n"]}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.seedFonts1556862253039 = void 0;
|
|
4
|
-
const typeorm_1 = require("typeorm");
|
|
5
4
|
const shell_1 = require("@things-factory/shell");
|
|
6
5
|
const font_1 = require("../service/font/font");
|
|
7
6
|
const SEED_FONTS = ['Roboto', 'Pangolin', 'Railway', 'Slabo', 'Skranji'];
|
|
8
7
|
class seedFonts1556862253039 {
|
|
9
8
|
async up(queryRunner) {
|
|
10
|
-
const repository = (0,
|
|
11
|
-
const domainRepository = (0,
|
|
12
|
-
const domain = await domainRepository.
|
|
9
|
+
const repository = (0, shell_1.getRepository)(font_1.Font);
|
|
10
|
+
const domainRepository = (0, shell_1.getRepository)(shell_1.Domain);
|
|
11
|
+
const domain = await domainRepository.findOneBy({
|
|
13
12
|
name: 'SYSTEM'
|
|
14
13
|
});
|
|
15
14
|
return await Promise.all(SEED_FONTS.map(async (font) => {
|
|
@@ -24,9 +23,9 @@ class seedFonts1556862253039 {
|
|
|
24
23
|
}));
|
|
25
24
|
}
|
|
26
25
|
async down(queryRunner) {
|
|
27
|
-
const repository = (0,
|
|
26
|
+
const repository = (0, shell_1.getRepository)(font_1.Font);
|
|
28
27
|
SEED_FONTS.reverse().forEach(async (font) => {
|
|
29
|
-
let record = await repository.
|
|
28
|
+
let record = await repository.findOneBy({ name: font });
|
|
30
29
|
await repository.remove(record);
|
|
31
30
|
});
|
|
32
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1556862253039-SeedFont.js","sourceRoot":"","sources":["../../server/migrations/1556862253039-SeedFont.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"1556862253039-SeedFont.js","sourceRoot":"","sources":["../../server/migrations/1556862253039-SeedFont.ts"],"names":[],"mappings":";;;AAEA,iDAA6D;AAE7D,+CAA2C;AAE3C,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;AAExE,MAAa,sBAAsB;IAC1B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,WAAI,CAAC,CAAA;QACtC,MAAM,gBAAgB,GAAG,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC;YAC9C,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YAC1B,MAAM,UAAU,CAAC,IAAI,CAAC;gBACpB,IAAI,EAAE,IAAI;gBACV,MAAM;gBACN,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,EAAE;gBACP,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE,IAAI;aACb,CAAC,CAAA;QACJ,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACxC,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,WAAI,CAAC,CAAA;QAEtC,UAAU,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YACxC,IAAI,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;YACvD,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9BD,wDA8BC","sourcesContent":["import { MigrationInterface, QueryRunner } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { Font } from '../service/font/font'\n\nconst SEED_FONTS = ['Roboto', 'Pangolin', 'Railway', 'Slabo', 'Skranji']\n\nexport class seedFonts1556862253039 implements MigrationInterface {\n public async up(queryRunner: QueryRunner): Promise<any> {\n const repository = getRepository(Font)\n const domainRepository = getRepository(Domain)\n const domain = await domainRepository.findOneBy({\n name: 'SYSTEM'\n })\n\n return await Promise.all(\n SEED_FONTS.map(async font => {\n await repository.save({\n name: font,\n domain,\n provider: 'google',\n uri: '',\n path: '',\n active: true\n })\n })\n )\n }\n\n public async down(queryRunner: QueryRunner): Promise<any> {\n const repository = getRepository(Font)\n\n SEED_FONTS.reverse().forEach(async font => {\n let record = await repository.findOneBy({ name: font })\n await repository.remove(record)\n })\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,6DAA8D;AAE9D,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACxE,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtD,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,gCAAiB,GAAE,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,6DAA8D;AAE9D,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACxE,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtD,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,gCAAiB,GAAE,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { getAllGoogleFonts } from './controllers/google-fonts'\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, routes) => {\n routes.get('/all-google-fonts', async (context, next) => {\n context.type = 'application/json'\n context.body = await getAllGoogleFonts()\n })\n})\n"]}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.FontMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
16
5
|
const type_graphql_1 = require("type-graphql");
|
|
17
|
-
const typeorm_1 = require("typeorm");
|
|
18
6
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
19
7
|
const shell_1 = require("@things-factory/shell");
|
|
20
8
|
const font_1 = require("./font");
|
|
@@ -39,7 +27,7 @@ function notifyChanges(event, domain, font) {
|
|
|
39
27
|
let FontMutation = class FontMutation {
|
|
40
28
|
async createFont(_, font, context) {
|
|
41
29
|
const { domain, user } = context.state;
|
|
42
|
-
const repository = (0,
|
|
30
|
+
const repository = (0, shell_1.getRepository)(font_1.Font);
|
|
43
31
|
const created = await repository.save(Object.assign({ domain, creator: user, updater: user }, font));
|
|
44
32
|
if (font.files) {
|
|
45
33
|
await (0, attachment_base_1.createAttachments)(_, {
|
|
@@ -57,10 +45,10 @@ let FontMutation = class FontMutation {
|
|
|
57
45
|
}
|
|
58
46
|
async updateFont(_, id, patch, context) {
|
|
59
47
|
const { domain, user } = context.state;
|
|
60
|
-
const repository = (0,
|
|
48
|
+
const repository = (0, shell_1.getRepository)(font_1.Font);
|
|
61
49
|
const font = await repository.findOne({
|
|
62
50
|
where: {
|
|
63
|
-
domain,
|
|
51
|
+
domain: { id: domain.id },
|
|
64
52
|
id
|
|
65
53
|
}
|
|
66
54
|
});
|
|
@@ -82,9 +70,9 @@ let FontMutation = class FontMutation {
|
|
|
82
70
|
}
|
|
83
71
|
async deleteFont(id, context) {
|
|
84
72
|
const { domain } = context.state;
|
|
85
|
-
const repository = (0,
|
|
73
|
+
const repository = (0, shell_1.getRepository)(font_1.Font);
|
|
86
74
|
const font = await repository.findOne({
|
|
87
|
-
where: { domain, id }
|
|
75
|
+
where: { domain: { id: domain.id }, id }
|
|
88
76
|
});
|
|
89
77
|
if (font) {
|
|
90
78
|
await repository.remove(font);
|
|
@@ -94,34 +82,34 @@ let FontMutation = class FontMutation {
|
|
|
94
82
|
return true;
|
|
95
83
|
}
|
|
96
84
|
};
|
|
97
|
-
__decorate([
|
|
85
|
+
tslib_1.__decorate([
|
|
98
86
|
(0, type_graphql_1.Mutation)(returns => font_1.Font, { description: 'To create new Font' }),
|
|
99
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
100
|
-
__param(1, (0, type_graphql_1.Arg)('font')),
|
|
101
|
-
__param(2, (0, type_graphql_1.Ctx)()),
|
|
102
|
-
__metadata("design:type", Function),
|
|
103
|
-
__metadata("design:paramtypes", [Object, font_type_1.NewFont, Object]),
|
|
104
|
-
__metadata("design:returntype", Promise)
|
|
87
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
88
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('font')),
|
|
89
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
90
|
+
tslib_1.__metadata("design:type", Function),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [Object, font_type_1.NewFont, Object]),
|
|
92
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
105
93
|
], FontMutation.prototype, "createFont", null);
|
|
106
|
-
__decorate([
|
|
94
|
+
tslib_1.__decorate([
|
|
107
95
|
(0, type_graphql_1.Mutation)(returns => font_1.Font, { description: 'To modify Font information' }),
|
|
108
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
109
|
-
__param(1, (0, type_graphql_1.Arg)('id')),
|
|
110
|
-
__param(2, (0, type_graphql_1.Arg)('patch')),
|
|
111
|
-
__param(3, (0, type_graphql_1.Ctx)()),
|
|
112
|
-
__metadata("design:type", Function),
|
|
113
|
-
__metadata("design:paramtypes", [Object, String, font_type_1.FontPatch, Object]),
|
|
114
|
-
__metadata("design:returntype", Promise)
|
|
96
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
97
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('id')),
|
|
98
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('patch')),
|
|
99
|
+
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
|
100
|
+
tslib_1.__metadata("design:type", Function),
|
|
101
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, font_type_1.FontPatch, Object]),
|
|
102
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
115
103
|
], FontMutation.prototype, "updateFont", null);
|
|
116
|
-
__decorate([
|
|
104
|
+
tslib_1.__decorate([
|
|
117
105
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Font' }),
|
|
118
|
-
__param(0, (0, type_graphql_1.Arg)('id')),
|
|
119
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
120
|
-
__metadata("design:type", Function),
|
|
121
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
122
|
-
__metadata("design:returntype", Promise)
|
|
106
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
107
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
108
|
+
tslib_1.__metadata("design:type", Function),
|
|
109
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
110
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
123
111
|
], FontMutation.prototype, "deleteFont", null);
|
|
124
|
-
FontMutation = __decorate([
|
|
112
|
+
FontMutation = tslib_1.__decorate([
|
|
125
113
|
(0, type_graphql_1.Resolver)(font_1.Font)
|
|
126
114
|
], FontMutation);
|
|
127
115
|
exports.FontMutation = FontMutation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-mutation.js","sourceRoot":"","sources":["../../../server/service/font/font-mutation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-mutation.js","sourceRoot":"","sources":["../../../server/service/font/font-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAiE;AAEjE,qEAA2F;AAC3F,iDAA6D;AAE7D,iCAA6B;AAC7B,2CAAgD;AAEhD,SAAS,aAAa,CAAC,KAAK,EAAE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ql'\n\nimport { createAttachments, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { getRepository, pubsub } from '@things-factory/shell'\n\nimport { Font } from './font'\nimport { FontPatch, NewFont } from './font-type'\n\nfunction notifyChanges(event, domain, font) {\n const { name, provider, uri, path, active } = font\n const { subdomain } = domain\n pubsub.publish('notify-font-changed', {\n event,\n font: {\n domain: {\n subdomain\n },\n name,\n provider,\n uri,\n path,\n active\n }\n })\n}\n@Resolver(Font)\nexport class FontMutation {\n @Mutation(returns => Font, { description: 'To create new Font' })\n async createFont(@Root() _, @Arg('font') font: NewFont, @Ctx() context: ResolverContext): Promise<Font> {\n const { domain, user } = context.state\n\n const repository = getRepository(Font)\n\n const created = await repository.save({\n domain,\n creator: user,\n updater: user,\n ...font\n })\n\n if (font.files) {\n await createAttachments(\n _,\n {\n attachments: font.files.map(file => {\n return {\n file,\n refType: Font.name,\n refBy: created.id\n }\n })\n },\n context\n )\n }\n\n notifyChanges('created', domain, created)\n\n return created\n }\n\n @Mutation(returns => Font, { description: 'To modify Font information' })\n async updateFont(\n @Root() _,\n @Arg('id') id: string,\n @Arg('patch') patch: FontPatch,\n @Ctx() context: ResolverContext\n ): Promise<Font> {\n const { domain, user } = context.state\n\n const repository = getRepository(Font)\n const font = await repository.findOne({\n where: {\n domain: { id: domain.id },\n id\n }\n })\n\n const updated = await repository.save({\n ...font,\n ...patch,\n updater: user\n })\n\n if (patch.files) {\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n await createAttachments(\n _,\n {\n attachments: patch.files.map(file => {\n return {\n file,\n refType: Font.name,\n refBy: updated.id\n }\n })\n },\n context\n )\n }\n\n notifyChanges('updated', domain, updated)\n\n return updated\n }\n\n @Mutation(returns => Boolean, { description: 'To delete Font' })\n async deleteFont(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain } = context.state\n\n const repository = getRepository(Font)\n const font = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (font) {\n await repository.remove(font)\n }\n\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n notifyChanges('removed', domain, font)\n\n return true\n }\n}\n"]}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var _a;
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.FontQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
17
5
|
const type_graphql_1 = require("type-graphql");
|
|
18
|
-
const typeorm_1 = require("typeorm");
|
|
19
6
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
20
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
21
8
|
const shell_1 = require("@things-factory/shell");
|
|
@@ -24,14 +11,14 @@ const font_type_1 = require("./font-type");
|
|
|
24
11
|
let FontQuery = class FontQuery {
|
|
25
12
|
async font(id, context) {
|
|
26
13
|
const { domain } = context.state;
|
|
27
|
-
return await (0,
|
|
28
|
-
where: { domain, id }
|
|
14
|
+
return await (0, shell_1.getRepository)(font_1.Font).findOne({
|
|
15
|
+
where: { domain: { id: domain.id }, id }
|
|
29
16
|
});
|
|
30
17
|
}
|
|
31
18
|
async fonts(params, context) {
|
|
32
19
|
const { domain } = context.state;
|
|
33
20
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
34
|
-
repository: (0,
|
|
21
|
+
repository: (0, shell_1.getRepository)(font_1.Font),
|
|
35
22
|
params,
|
|
36
23
|
domain,
|
|
37
24
|
searchables: ['name', 'description']
|
|
@@ -40,68 +27,68 @@ let FontQuery = class FontQuery {
|
|
|
40
27
|
return { items, total };
|
|
41
28
|
}
|
|
42
29
|
async domain(font) {
|
|
43
|
-
return await (0,
|
|
30
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: font.domainId });
|
|
44
31
|
}
|
|
45
32
|
async files(font, context) {
|
|
46
33
|
const { domain } = context.state;
|
|
47
|
-
return await (0,
|
|
48
|
-
domain,
|
|
34
|
+
return await (0, shell_1.getRepository)(attachment_base_1.Attachment).findBy({
|
|
35
|
+
domain: { id: domain.id },
|
|
49
36
|
refBy: font.id
|
|
50
37
|
});
|
|
51
38
|
}
|
|
52
39
|
async updater(font) {
|
|
53
|
-
return await (0,
|
|
40
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: font.updaterId });
|
|
54
41
|
}
|
|
55
42
|
async creator(font) {
|
|
56
|
-
return await (0,
|
|
43
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: font.creatorId });
|
|
57
44
|
}
|
|
58
45
|
};
|
|
59
|
-
__decorate([
|
|
46
|
+
tslib_1.__decorate([
|
|
60
47
|
(0, type_graphql_1.Query)(returns => font_1.Font, { description: 'To fetch a Font' }),
|
|
61
|
-
__param(0, (0, type_graphql_1.Arg)('id')),
|
|
62
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
63
|
-
__metadata("design:type", Function),
|
|
64
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
65
|
-
__metadata("design:returntype", Promise)
|
|
48
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
49
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
50
|
+
tslib_1.__metadata("design:type", Function),
|
|
51
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
52
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
66
53
|
], FontQuery.prototype, "font", null);
|
|
67
|
-
__decorate([
|
|
54
|
+
tslib_1.__decorate([
|
|
68
55
|
(0, type_graphql_1.Query)(returns => font_type_1.FontList, { description: 'To fetch multiple Fonts' }),
|
|
69
|
-
__param(0, (0, type_graphql_1.Args)()),
|
|
70
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
71
|
-
__metadata("design:type", Function),
|
|
72
|
-
__metadata("design:paramtypes", [
|
|
73
|
-
__metadata("design:returntype", Promise)
|
|
56
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
57
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
58
|
+
tslib_1.__metadata("design:type", Function),
|
|
59
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
60
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
74
61
|
], FontQuery.prototype, "fonts", null);
|
|
75
|
-
__decorate([
|
|
62
|
+
tslib_1.__decorate([
|
|
76
63
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
77
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
78
|
-
__metadata("design:type", Function),
|
|
79
|
-
__metadata("design:paramtypes", [font_1.Font]),
|
|
80
|
-
__metadata("design:returntype", Promise)
|
|
64
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", [font_1.Font]),
|
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
81
68
|
], FontQuery.prototype, "domain", null);
|
|
82
|
-
__decorate([
|
|
69
|
+
tslib_1.__decorate([
|
|
83
70
|
(0, type_graphql_1.FieldResolver)(type => attachment_base_1.Attachment),
|
|
84
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
85
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
86
|
-
__metadata("design:type", Function),
|
|
87
|
-
__metadata("design:paramtypes", [font_1.Font, Object]),
|
|
88
|
-
__metadata("design:returntype", Promise)
|
|
71
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
72
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
73
|
+
tslib_1.__metadata("design:type", Function),
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [font_1.Font, Object]),
|
|
75
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
89
76
|
], FontQuery.prototype, "files", null);
|
|
90
|
-
__decorate([
|
|
77
|
+
tslib_1.__decorate([
|
|
91
78
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
92
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
93
|
-
__metadata("design:type", Function),
|
|
94
|
-
__metadata("design:paramtypes", [font_1.Font]),
|
|
95
|
-
__metadata("design:returntype", Promise)
|
|
79
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
80
|
+
tslib_1.__metadata("design:type", Function),
|
|
81
|
+
tslib_1.__metadata("design:paramtypes", [font_1.Font]),
|
|
82
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
96
83
|
], FontQuery.prototype, "updater", null);
|
|
97
|
-
__decorate([
|
|
84
|
+
tslib_1.__decorate([
|
|
98
85
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
99
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
100
|
-
__metadata("design:type", Function),
|
|
101
|
-
__metadata("design:paramtypes", [font_1.Font]),
|
|
102
|
-
__metadata("design:returntype", Promise)
|
|
86
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
87
|
+
tslib_1.__metadata("design:type", Function),
|
|
88
|
+
tslib_1.__metadata("design:paramtypes", [font_1.Font]),
|
|
89
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
103
90
|
], FontQuery.prototype, "creator", null);
|
|
104
|
-
FontQuery = __decorate([
|
|
91
|
+
FontQuery = tslib_1.__decorate([
|
|
105
92
|
(0, type_graphql_1.Resolver)(font_1.Font)
|
|
106
93
|
], FontQuery);
|
|
107
94
|
exports.FontQuery = FontQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-query.js","sourceRoot":"","sources":["../../../server/service/font/font-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-query.js","sourceRoot":"","sources":["../../../server/service/font/font-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,qEAA4D;AAC5D,yDAAgD;AAChD,iDAAuG;AAEvG,iCAA6B;AAC7B,2CAAsC;AAGtC,IAAa,SAAS,GAAtB,MAAa,SAAS;IAEpB,KAAK,CAAC,IAAI,CAAY,EAAU,EAAS,OAAwB;QAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,WAAI,CAAC,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,KAAK,CAAS,MAAiB,EAAS,OAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,UAAU,EAAE,IAAA,qBAAa,EAAC,WAAI,CAAC;YAC/B,MAAM;YACN,MAAM;YACN,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAA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EAAE,CAAC,oBAAQ,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAC1D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;sCAapC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAO,WAAI;;uCAE9B;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAU,CAAC;IACrB,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAZ,WAAI;;sCAO7B;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAO,WAAI;;wCAE/B;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAO,WAAI;;wCAE/B;AAjDU,SAAS;IADrB,IAAA,uBAAQ,EAAC,WAAI,CAAC;GACF,SAAS,CAkDrB;AAlDY,8BAAS","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Attachment } from '@things-factory/attachment-base'\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Font } from './font'\nimport { FontList } from './font-type'\n\n@Resolver(Font)\nexport class FontQuery {\n @Query(returns => Font, { description: 'To fetch a Font' })\n async font(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Font> {\n const { domain } = context.state\n\n return await getRepository(Font).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => FontList, { description: 'To fetch multiple Fonts' })\n async fonts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<FontList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Font),\n params,\n domain,\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() font: Font) {\n return await getRepository(Domain).findOneBy({ id: font.domainId })\n }\n\n @FieldResolver(type => Attachment)\n async files(@Root() font: Font, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n return await getRepository(Attachment).findBy({\n domain: { id: domain.id },\n refBy: font.id\n })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() font: Font): Promise<User> {\n return await getRepository(User).findOneBy({ id: font.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() font: Font): Promise<User> {\n return await getRepository(User).findOneBy({ id: font.creatorId })\n }\n}\n"]}
|
|
@@ -1,92 +1,81 @@
|
|
|
1
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.FontList = exports.FontPatch = exports.NewFont = void 0;
|
|
16
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
17
6
|
const type_graphql_1 = require("type-graphql");
|
|
18
7
|
const font_1 = require("./font");
|
|
19
8
|
let NewFont = class NewFont {
|
|
20
9
|
};
|
|
21
|
-
__decorate([
|
|
10
|
+
tslib_1.__decorate([
|
|
22
11
|
(0, type_graphql_1.Field)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
12
|
+
tslib_1.__metadata("design:type", String)
|
|
24
13
|
], NewFont.prototype, "name", void 0);
|
|
25
|
-
__decorate([
|
|
14
|
+
tslib_1.__decorate([
|
|
26
15
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
-
__metadata("design:type", String)
|
|
16
|
+
tslib_1.__metadata("design:type", String)
|
|
28
17
|
], NewFont.prototype, "provider", void 0);
|
|
29
|
-
__decorate([
|
|
18
|
+
tslib_1.__decorate([
|
|
30
19
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
31
|
-
__metadata("design:type", String)
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
32
21
|
], NewFont.prototype, "uri", void 0);
|
|
33
|
-
__decorate([
|
|
22
|
+
tslib_1.__decorate([
|
|
34
23
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
35
|
-
__metadata("design:type", String)
|
|
24
|
+
tslib_1.__metadata("design:type", String)
|
|
36
25
|
], NewFont.prototype, "path", void 0);
|
|
37
|
-
__decorate([
|
|
26
|
+
tslib_1.__decorate([
|
|
38
27
|
(0, type_graphql_1.Field)(type => [GraphQLUpload_js_1.default], { nullable: true }),
|
|
39
|
-
__metadata("design:type", Array)
|
|
28
|
+
tslib_1.__metadata("design:type", Array)
|
|
40
29
|
], NewFont.prototype, "files", void 0);
|
|
41
|
-
__decorate([
|
|
30
|
+
tslib_1.__decorate([
|
|
42
31
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
43
|
-
__metadata("design:type", Boolean)
|
|
32
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
44
33
|
], NewFont.prototype, "active", void 0);
|
|
45
|
-
NewFont = __decorate([
|
|
34
|
+
NewFont = tslib_1.__decorate([
|
|
46
35
|
(0, type_graphql_1.InputType)()
|
|
47
36
|
], NewFont);
|
|
48
37
|
exports.NewFont = NewFont;
|
|
49
38
|
let FontPatch = class FontPatch {
|
|
50
39
|
};
|
|
51
|
-
__decorate([
|
|
40
|
+
tslib_1.__decorate([
|
|
52
41
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
__metadata("design:type", String)
|
|
42
|
+
tslib_1.__metadata("design:type", String)
|
|
54
43
|
], FontPatch.prototype, "name", void 0);
|
|
55
|
-
__decorate([
|
|
44
|
+
tslib_1.__decorate([
|
|
56
45
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
__metadata("design:type", String)
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
58
47
|
], FontPatch.prototype, "provider", void 0);
|
|
59
|
-
__decorate([
|
|
48
|
+
tslib_1.__decorate([
|
|
60
49
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
-
__metadata("design:type", String)
|
|
50
|
+
tslib_1.__metadata("design:type", String)
|
|
62
51
|
], FontPatch.prototype, "uri", void 0);
|
|
63
|
-
__decorate([
|
|
52
|
+
tslib_1.__decorate([
|
|
64
53
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
-
__metadata("design:type", String)
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
66
55
|
], FontPatch.prototype, "path", void 0);
|
|
67
|
-
__decorate([
|
|
56
|
+
tslib_1.__decorate([
|
|
68
57
|
(0, type_graphql_1.Field)(type => [GraphQLUpload_js_1.default], { nullable: true }),
|
|
69
|
-
__metadata("design:type", Array)
|
|
58
|
+
tslib_1.__metadata("design:type", Array)
|
|
70
59
|
], FontPatch.prototype, "files", void 0);
|
|
71
|
-
__decorate([
|
|
60
|
+
tslib_1.__decorate([
|
|
72
61
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
73
|
-
__metadata("design:type", Boolean)
|
|
62
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
74
63
|
], FontPatch.prototype, "active", void 0);
|
|
75
|
-
FontPatch = __decorate([
|
|
64
|
+
FontPatch = tslib_1.__decorate([
|
|
76
65
|
(0, type_graphql_1.InputType)()
|
|
77
66
|
], FontPatch);
|
|
78
67
|
exports.FontPatch = FontPatch;
|
|
79
68
|
let FontList = class FontList {
|
|
80
69
|
};
|
|
81
|
-
__decorate([
|
|
70
|
+
tslib_1.__decorate([
|
|
82
71
|
(0, type_graphql_1.Field)(type => [font_1.Font]),
|
|
83
|
-
__metadata("design:type", Array)
|
|
72
|
+
tslib_1.__metadata("design:type", Array)
|
|
84
73
|
], FontList.prototype, "items", void 0);
|
|
85
|
-
__decorate([
|
|
74
|
+
tslib_1.__decorate([
|
|
86
75
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
87
|
-
__metadata("design:type", Number)
|
|
76
|
+
tslib_1.__metadata("design:type", Number)
|
|
88
77
|
], FontList.prototype, "total", void 0);
|
|
89
|
-
FontList = __decorate([
|
|
78
|
+
FontList = tslib_1.__decorate([
|
|
90
79
|
(0, type_graphql_1.ObjectType)()
|
|
91
80
|
], FontList);
|
|
92
81
|
exports.FontList = FontList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-type.js","sourceRoot":"","sources":["../../../server/service/font/font-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-type.js","sourceRoot":"","sources":["../../../server/service/font/font-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAgE;AAEhE,iCAA6B;AAG7B,IAAa,OAAO,GAApB,MAAa,OAAO;CAkBnB,CAAA;AAhBC;IADC,IAAA,oBAAK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IAAI,CAAC,EAAE,CAAC,CAAC,WAAI,CAAC,CAAC;;uCACT;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;uCACN;AALF,QAAQ;IADpB,IAAA,yBAAU,GAAE;GACA,QAAQ,CAMpB;AANY,4BAAQ","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { Field, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { Font } from './font'\n\n@InputType()\nexport class NewFont {\n @Field()\n name: string\n\n @Field({ nullable: true })\n provider?: string\n\n @Field({ nullable: true })\n uri?: string\n\n @Field({ nullable: true })\n path?: string\n\n @Field(type => [GraphQLUpload], { nullable: true })\n files?: FileUpload[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class FontPatch {\n @Field({ nullable: true })\n name: string\n\n @Field({ nullable: true })\n provider?: string\n\n @Field({ nullable: true })\n uri?: string\n\n @Field({ nullable: true })\n path?: string\n\n @Field(type => [GraphQLUpload], { nullable: true })\n files?: FileUpload[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@ObjectType()\nexport class FontList {\n @Field(type => [Font])\n items: Font[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|