@things-factory/figure-library 10.1.121
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-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/figure-library-page.d.ts +78 -0
- package/dist-client/pages/figure-library-page.js +781 -0
- package/dist-client/pages/figure-library-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +8 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +6 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/routers/figure-library-file-router.d.ts +5 -0
- package/dist-server/routers/figure-library-file-router.js +43 -0
- package/dist-server/routers/figure-library-file-router.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +16 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/figure-library-release/figure-library-release.d.ts +54 -0
- package/dist-server/service/figure-library-release/figure-library-release.js +206 -0
- package/dist-server/service/figure-library-release/figure-library-release.js.map +1 -0
- package/dist-server/service/figure-library-resolver.d.ts +20 -0
- package/dist-server/service/figure-library-resolver.js +196 -0
- package/dist-server/service/figure-library-resolver.js.map +1 -0
- package/dist-server/service/figure-library-types.d.ts +23 -0
- package/dist-server/service/figure-library-types.js +85 -0
- package/dist-server/service/figure-library-types.js.map +1 -0
- package/dist-server/service/figure-type-map/figure-type-map-entry.d.ts +23 -0
- package/dist-server/service/figure-type-map/figure-type-map-entry.js +98 -0
- package/dist-server/service/figure-type-map/figure-type-map-entry.js.map +1 -0
- package/dist-server/service/figure-type-map/figure-type-map.d.ts +34 -0
- package/dist-server/service/figure-type-map/figure-type-map.js +120 -0
- package/dist-server/service/figure-type-map/figure-type-map.js.map +1 -0
- package/dist-server/service/index.d.ts +20 -0
- package/dist-server/service/index.js +28 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/library/blueprints.d.ts +28 -0
- package/dist-server/service/library/blueprints.js +53 -0
- package/dist-server/service/library/blueprints.js.map +1 -0
- package/dist-server/service/library/board-walk.d.ts +1 -0
- package/dist-server/service/library/board-walk.js +31 -0
- package/dist-server/service/library/board-walk.js.map +1 -0
- package/dist-server/service/library/derived.d.ts +16 -0
- package/dist-server/service/library/derived.js +45 -0
- package/dist-server/service/library/derived.js.map +1 -0
- package/dist-server/service/library/import.d.ts +30 -0
- package/dist-server/service/library/import.js +116 -0
- package/dist-server/service/library/import.js.map +1 -0
- package/dist-server/service/library/inspection.d.ts +63 -0
- package/dist-server/service/library/inspection.js +144 -0
- package/dist-server/service/library/inspection.js.map +1 -0
- package/dist-server/service/library/library-files.d.ts +32 -0
- package/dist-server/service/library/library-files.js +58 -0
- package/dist-server/service/library/library-files.js.map +1 -0
- package/dist-server/service/library/type-map.d.ts +35 -0
- package/dist-server/service/library/type-map.js +133 -0
- package/dist-server/service/library/type-map.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +51 -0
- package/things-factory.config.js +13 -0
- package/translations/en.json +98 -0
- package/translations/ko.json +98 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FigureImportResult = exports.FigureImportProblem = exports.FigureImportOutcome = exports.FigureTypeMapLineInput = exports.FigureLibraryReleaseList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const figure_library_release_1 = require("./figure-library-release/figure-library-release");
|
|
7
|
+
let FigureLibraryReleaseList = class FigureLibraryReleaseList {
|
|
8
|
+
};
|
|
9
|
+
exports.FigureLibraryReleaseList = FigureLibraryReleaseList;
|
|
10
|
+
tslib_1.__decorate([
|
|
11
|
+
(0, type_graphql_1.Field)(type => [figure_library_release_1.FigureLibraryRelease], { description: 'The releases on this page.' }),
|
|
12
|
+
tslib_1.__metadata("design:type", Array)
|
|
13
|
+
], FigureLibraryReleaseList.prototype, "items", void 0);
|
|
14
|
+
tslib_1.__decorate([
|
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Total number of releases matching the query.' }),
|
|
16
|
+
tslib_1.__metadata("design:type", Number)
|
|
17
|
+
], FigureLibraryReleaseList.prototype, "total", void 0);
|
|
18
|
+
exports.FigureLibraryReleaseList = FigureLibraryReleaseList = tslib_1.__decorate([
|
|
19
|
+
(0, type_graphql_1.ObjectType)({ description: 'A page of imported releases.' })
|
|
20
|
+
], FigureLibraryReleaseList);
|
|
21
|
+
let FigureTypeMapLineInput = class FigureTypeMapLineInput {
|
|
22
|
+
};
|
|
23
|
+
exports.FigureTypeMapLineInput = FigureTypeMapLineInput;
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, type_graphql_1.Field)({ description: 'Full figure name {namespace}/{type}.' }),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], FigureTypeMapLineInput.prototype, "name", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, type_graphql_1.Field)({ description: 'Id of an imported release of that name.' }),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], FigureTypeMapLineInput.prototype, "releaseId", void 0);
|
|
32
|
+
exports.FigureTypeMapLineInput = FigureTypeMapLineInput = tslib_1.__decorate([
|
|
33
|
+
(0, type_graphql_1.InputType)({ description: 'A line of the candidate type map: a full name and the imported release it draws with.' })
|
|
34
|
+
], FigureTypeMapLineInput);
|
|
35
|
+
let FigureImportOutcome = class FigureImportOutcome {
|
|
36
|
+
};
|
|
37
|
+
exports.FigureImportOutcome = FigureImportOutcome;
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, type_graphql_1.Field)({ description: 'Release reference {namespace}/{type}@{version}.' }),
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
|
+
], FigureImportOutcome.prototype, "ref", void 0);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, type_graphql_1.Field)({ description: 'added, skipped or refused.' }),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], FigureImportOutcome.prototype, "outcome", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why it was refused, or skipped-metadata-differs.' }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], FigureImportOutcome.prototype, "code", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'For a skipped release: the fields the package gave differently.' }),
|
|
52
|
+
tslib_1.__metadata("design:type", Array)
|
|
53
|
+
], FigureImportOutcome.prototype, "differs", void 0);
|
|
54
|
+
exports.FigureImportOutcome = FigureImportOutcome = tslib_1.__decorate([
|
|
55
|
+
(0, type_graphql_1.ObjectType)({ description: 'What became of one release of an imported package.' })
|
|
56
|
+
], FigureImportOutcome);
|
|
57
|
+
let FigureImportProblem = class FigureImportProblem {
|
|
58
|
+
};
|
|
59
|
+
exports.FigureImportProblem = FigureImportProblem;
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.Field)({ description: 'What is wrong with the package.' }),
|
|
62
|
+
tslib_1.__metadata("design:type", String)
|
|
63
|
+
], FigureImportProblem.prototype, "code", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The file inside the package it concerns.' }),
|
|
66
|
+
tslib_1.__metadata("design:type", String)
|
|
67
|
+
], FigureImportProblem.prototype, "path", void 0);
|
|
68
|
+
exports.FigureImportProblem = FigureImportProblem = tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.ObjectType)({ description: 'A fault that refused a whole package.' })
|
|
70
|
+
], FigureImportProblem);
|
|
71
|
+
let FigureImportResult = class FigureImportResult {
|
|
72
|
+
};
|
|
73
|
+
exports.FigureImportResult = FigureImportResult;
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, type_graphql_1.Field)(type => [FigureImportProblem], { description: 'Faults that refused the whole package; nothing was imported when there is one.' }),
|
|
76
|
+
tslib_1.__metadata("design:type", Array)
|
|
77
|
+
], FigureImportResult.prototype, "problems", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, type_graphql_1.Field)(type => [FigureImportOutcome], { description: 'What became of each release.' }),
|
|
80
|
+
tslib_1.__metadata("design:type", Array)
|
|
81
|
+
], FigureImportResult.prototype, "outcomes", void 0);
|
|
82
|
+
exports.FigureImportResult = FigureImportResult = tslib_1.__decorate([
|
|
83
|
+
(0, type_graphql_1.ObjectType)({ description: 'The result of importing a figure package.' })
|
|
84
|
+
], FigureImportResult);
|
|
85
|
+
//# sourceMappingURL=figure-library-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure-library-types.js","sourceRoot":"","sources":["../../server/service/figure-library-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAEhE,4FAAsF;AAG/E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAMpC,CAAA;AANY,4DAAwB;AAEnC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,6CAAoB,CAAC,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;uDACxD;AAG7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;;uDACvE;mCALF,wBAAwB;IADpC,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;GAC/C,wBAAwB,CAMpC;AAGM,IAAM,sBAAsB,GA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AM/B;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAM9B,CAAA;AANY,gDAAkB;AAE7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,gFAAgF,EAAE,CAAC;;oDACzG;AAG/B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;;oDACvD;6BALpB,kBAAkB;IAD9B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;GAC5D,kBAAkB,CAM9B","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { FigureLibraryRelease } from './figure-library-release/figure-library-release'\n\n@ObjectType({ description: 'A page of imported releases.' })\nexport class FigureLibraryReleaseList {\n @Field(type => [FigureLibraryRelease], { description: 'The releases on this page.' })\n items: FigureLibraryRelease[]\n\n @Field(type => Int, { description: 'Total number of releases matching the query.' })\n total: number\n}\n\n@InputType({ description: 'A line of the candidate type map: a full name and the imported release it draws with.' })\nexport class FigureTypeMapLineInput {\n @Field({ description: 'Full figure name {namespace}/{type}.' })\n name: string\n\n @Field({ description: 'Id of an imported release of that name.' })\n releaseId: string\n}\n\n@ObjectType({ description: 'What became of one release of an imported package.' })\nexport class FigureImportOutcome {\n @Field({ description: 'Release reference {namespace}/{type}@{version}.' })\n ref: string\n\n @Field({ description: 'added, skipped or refused.' })\n outcome: string\n\n @Field({ nullable: true, description: 'Why it was refused, or skipped-metadata-differs.' })\n code?: string\n\n @Field(type => [String], { nullable: true, description: 'For a skipped release: the fields the package gave differently.' })\n differs?: string[]\n}\n\n@ObjectType({ description: 'A fault that refused a whole package.' })\nexport class FigureImportProblem {\n @Field({ description: 'What is wrong with the package.' })\n code: string\n\n @Field({ nullable: true, description: 'The file inside the package it concerns.' })\n path?: string\n}\n\n@ObjectType({ description: 'The result of importing a figure package.' })\nexport class FigureImportResult {\n @Field(type => [FigureImportProblem], { description: 'Faults that refused the whole package; nothing was imported when there is one.' })\n problems: FigureImportProblem[]\n\n @Field(type => [FigureImportOutcome], { description: 'What became of each release.' })\n outcomes: FigureImportOutcome[]\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
import { FigureLibraryRelease } from '../figure-library-release/figure-library-release';
|
|
4
|
+
import { FigureTypeMap } from './figure-type-map';
|
|
5
|
+
/** One line of a type map: a full name and the imported release it draws with. */
|
|
6
|
+
export declare class FigureTypeMapEntry {
|
|
7
|
+
readonly id?: string;
|
|
8
|
+
domain?: Domain;
|
|
9
|
+
domainId?: string;
|
|
10
|
+
typeMap?: FigureTypeMap;
|
|
11
|
+
typeMapId?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
release?: FigureLibraryRelease;
|
|
15
|
+
releaseId?: string;
|
|
16
|
+
createdAt?: Date;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
deletedAt?: Date;
|
|
19
|
+
creator?: User;
|
|
20
|
+
creatorId?: string;
|
|
21
|
+
updater?: User;
|
|
22
|
+
updaterId?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FigureTypeMapEntry = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
const figure_library_release_1 = require("../figure-library-release/figure-library-release");
|
|
10
|
+
const figure_type_map_1 = require("./figure-type-map");
|
|
11
|
+
/** One line of a type map: a full name and the imported release it draws with. */
|
|
12
|
+
let FigureTypeMapEntry = class FigureTypeMapEntry {
|
|
13
|
+
};
|
|
14
|
+
exports.FigureTypeMapEntry = FigureTypeMapEntry;
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
17
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier.' }),
|
|
18
|
+
tslib_1.__metadata("design:type", String)
|
|
19
|
+
], FigureTypeMapEntry.prototype, "id", void 0);
|
|
20
|
+
tslib_1.__decorate([
|
|
21
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
22
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain the map belongs to.' }),
|
|
23
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
24
|
+
], FigureTypeMapEntry.prototype, "domain", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, typeorm_1.RelationId)((entry) => entry.domain),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], FigureTypeMapEntry.prototype, "domainId", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(type => figure_type_map_1.FigureTypeMap, { onDelete: 'CASCADE' }),
|
|
31
|
+
(0, type_graphql_1.Field)(type => figure_type_map_1.FigureTypeMap, { nullable: true, description: 'The type map release this line belongs to.' }),
|
|
32
|
+
tslib_1.__metadata("design:type", figure_type_map_1.FigureTypeMap)
|
|
33
|
+
], FigureTypeMapEntry.prototype, "typeMap", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, typeorm_1.RelationId)((entry) => entry.typeMap),
|
|
36
|
+
tslib_1.__metadata("design:type", String)
|
|
37
|
+
], FigureTypeMapEntry.prototype, "typeMapId", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, typeorm_1.Column)(),
|
|
40
|
+
(0, type_graphql_1.Field)({ description: 'Full figure name {namespace}/{type} boards store.' }),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], FigureTypeMapEntry.prototype, "name", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Note on the line.' }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], FigureTypeMapEntry.prototype, "description", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, typeorm_1.ManyToOne)(type => figure_library_release_1.FigureLibraryRelease),
|
|
50
|
+
(0, type_graphql_1.Field)(type => figure_library_release_1.FigureLibraryRelease, { nullable: true, description: 'The imported release this name draws with.' }),
|
|
51
|
+
tslib_1.__metadata("design:type", figure_library_release_1.FigureLibraryRelease)
|
|
52
|
+
], FigureTypeMapEntry.prototype, "release", void 0);
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, typeorm_1.RelationId)((entry) => entry.release),
|
|
55
|
+
tslib_1.__metadata("design:type", String)
|
|
56
|
+
], FigureTypeMapEntry.prototype, "releaseId", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Creation timestamp.' }),
|
|
60
|
+
tslib_1.__metadata("design:type", Date)
|
|
61
|
+
], FigureTypeMapEntry.prototype, "createdAt", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
64
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Last update timestamp.' }),
|
|
65
|
+
tslib_1.__metadata("design:type", Date)
|
|
66
|
+
], FigureTypeMapEntry.prototype, "updatedAt", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Soft-delete timestamp.' }),
|
|
70
|
+
tslib_1.__metadata("design:type", Date)
|
|
71
|
+
], FigureTypeMapEntry.prototype, "deletedAt", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
74
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created it.' }),
|
|
75
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
76
|
+
], FigureTypeMapEntry.prototype, "creator", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, typeorm_1.RelationId)((entry) => entry.creator),
|
|
79
|
+
tslib_1.__metadata("design:type", String)
|
|
80
|
+
], FigureTypeMapEntry.prototype, "creatorId", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
83
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated it.' }),
|
|
84
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
85
|
+
], FigureTypeMapEntry.prototype, "updater", void 0);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, typeorm_1.RelationId)((entry) => entry.updater),
|
|
88
|
+
tslib_1.__metadata("design:type", String)
|
|
89
|
+
], FigureTypeMapEntry.prototype, "updaterId", void 0);
|
|
90
|
+
exports.FigureTypeMapEntry = FigureTypeMapEntry = tslib_1.__decorate([
|
|
91
|
+
(0, typeorm_1.Entity)(),
|
|
92
|
+
(0, typeorm_1.Index)('ix_figure_type_map_entry_1', (entry) => [entry.typeMap, entry.name], {
|
|
93
|
+
unique: true,
|
|
94
|
+
where: '"deleted_at" IS NULL'
|
|
95
|
+
}),
|
|
96
|
+
(0, type_graphql_1.ObjectType)({ description: 'A line of a type map: full name {namespace}/{type} to an imported release.' })
|
|
97
|
+
], FigureTypeMapEntry);
|
|
98
|
+
//# sourceMappingURL=figure-type-map-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure-type-map-entry.js","sourceRoot":"","sources":["../../../server/service/figure-type-map/figure-type-map-entry.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAoD;AAEpD,yDAAgD;AAChD,iDAA8C;AAE9C,6FAAuF;AACvF,uDAAiD;AAEjD,kFAAkF;AAO3E,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CA2D9B,CAAA;AA3DY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;;8CACrC;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;sCAChF,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;;oDACvC;AAIjB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,+BAAa,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACzD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,+BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;sCAClG,+BAAa;mDAAA;AAGvB;IADC,IAAA,oBAAU,EAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;qDACvC;AAIlB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAA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E,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;qDACvC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;sCAC5E,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;qDACvC;6BA1DP,kBAAkB;IAN9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,4BAA4B,EAAE,CAAC,KAAyB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;QAC/F,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4EAA4E,EAAE,CAAC;GAC7F,kBAAkB,CA2D9B","sourcesContent":["import {\n Column,\n CreateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, ObjectType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { FigureLibraryRelease } from '../figure-library-release/figure-library-release'\nimport { FigureTypeMap } from './figure-type-map'\n\n/** One line of a type map: a full name and the imported release it draws with. */\n@Entity()\n@Index('ix_figure_type_map_entry_1', (entry: FigureTypeMapEntry) => [entry.typeMap, entry.name], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'A line of a type map: full name {namespace}/{type} to an imported release.' })\nexport class FigureTypeMapEntry {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier.' })\n readonly id?: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain the map belongs to.' })\n domain?: Domain\n\n @RelationId((entry: FigureTypeMapEntry) => entry.domain)\n domainId?: string\n\n @ManyToOne(type => FigureTypeMap, { onDelete: 'CASCADE' })\n @Field(type => FigureTypeMap, { nullable: true, description: 'The type map release this line belongs to.' })\n typeMap?: FigureTypeMap\n\n @RelationId((entry: FigureTypeMapEntry) => entry.typeMap)\n typeMapId?: string\n\n @Column()\n @Field({ description: 'Full figure name {namespace}/{type} boards store.' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Note on the line.' })\n description?: string\n\n @ManyToOne(type => FigureLibraryRelease)\n @Field(type => FigureLibraryRelease, { nullable: true, description: 'The imported release this name draws with.' })\n release?: FigureLibraryRelease\n\n @RelationId((entry: FigureTypeMapEntry) => entry.release)\n releaseId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft-delete timestamp.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created it.' })\n creator?: User\n\n @RelationId((entry: FigureTypeMapEntry) => entry.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated it.' })\n updater?: User\n\n @RelationId((entry: FigureTypeMapEntry) => entry.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
export declare enum FigureTypeMapState {
|
|
4
|
+
CANDIDATE = "CANDIDATE",
|
|
5
|
+
ACTIVE = "ACTIVE",
|
|
6
|
+
ARCHIVED = "ARCHIVED"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* One release of a domain's type map: which imported release each figure draws with (ADR-0114 결정 6).
|
|
10
|
+
*
|
|
11
|
+
* A domain has one ACTIVE and at most one CANDIDATE. Only the candidate changes; each save raises `revision`, so an
|
|
12
|
+
* open preview knows the candidate it registered is no longer the one stored (결정 12). Activation turns the candidate
|
|
13
|
+
* ACTIVE and the previous ACTIVE ARCHIVED in one transaction; rolling back activates an ARCHIVED release again.
|
|
14
|
+
*/
|
|
15
|
+
export declare class FigureTypeMap {
|
|
16
|
+
readonly id?: string;
|
|
17
|
+
domain?: Domain;
|
|
18
|
+
domainId?: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
version: number;
|
|
22
|
+
revision: number;
|
|
23
|
+
state: FigureTypeMapState;
|
|
24
|
+
activatedAt?: Date;
|
|
25
|
+
activator?: User;
|
|
26
|
+
activatorId?: string;
|
|
27
|
+
createdAt?: Date;
|
|
28
|
+
updatedAt?: Date;
|
|
29
|
+
deletedAt?: Date;
|
|
30
|
+
creator?: User;
|
|
31
|
+
creatorId?: string;
|
|
32
|
+
updater?: User;
|
|
33
|
+
updaterId?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FigureTypeMap = exports.FigureTypeMapState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
var FigureTypeMapState;
|
|
10
|
+
(function (FigureTypeMapState) {
|
|
11
|
+
FigureTypeMapState["CANDIDATE"] = "CANDIDATE";
|
|
12
|
+
FigureTypeMapState["ACTIVE"] = "ACTIVE";
|
|
13
|
+
FigureTypeMapState["ARCHIVED"] = "ARCHIVED";
|
|
14
|
+
})(FigureTypeMapState || (exports.FigureTypeMapState = FigureTypeMapState = {}));
|
|
15
|
+
(0, type_graphql_1.registerEnumType)(FigureTypeMapState, {
|
|
16
|
+
name: 'FigureTypeMapState',
|
|
17
|
+
description: 'State of a type map release: CANDIDATE is edited, ACTIVE draws boards, ARCHIVED can be activated again.'
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* One release of a domain's type map: which imported release each figure draws with (ADR-0114 결정 6).
|
|
21
|
+
*
|
|
22
|
+
* A domain has one ACTIVE and at most one CANDIDATE. Only the candidate changes; each save raises `revision`, so an
|
|
23
|
+
* open preview knows the candidate it registered is no longer the one stored (결정 12). Activation turns the candidate
|
|
24
|
+
* ACTIVE and the previous ACTIVE ARCHIVED in one transaction; rolling back activates an ARCHIVED release again.
|
|
25
|
+
*/
|
|
26
|
+
let FigureTypeMap = class FigureTypeMap {
|
|
27
|
+
};
|
|
28
|
+
exports.FigureTypeMap = FigureTypeMap;
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
31
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier.' }),
|
|
32
|
+
tslib_1.__metadata("design:type", String)
|
|
33
|
+
], FigureTypeMap.prototype, "id", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
36
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain the map belongs to.' }),
|
|
37
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
38
|
+
], FigureTypeMap.prototype, "domain", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, typeorm_1.RelationId)((map) => map.domain),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], FigureTypeMap.prototype, "domainId", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, typeorm_1.Column)(),
|
|
45
|
+
(0, type_graphql_1.Field)({ description: 'Name of the release, R{version}.' }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], FigureTypeMap.prototype, "name", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
50
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Note on the release.' }),
|
|
51
|
+
tslib_1.__metadata("design:type", String)
|
|
52
|
+
], FigureTypeMap.prototype, "description", void 0);
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, typeorm_1.Column)(),
|
|
55
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Release number within the domain.' }),
|
|
56
|
+
tslib_1.__metadata("design:type", Number)
|
|
57
|
+
], FigureTypeMap.prototype, "version", void 0);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
60
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Raised on each save of a candidate; fixed once active.' }),
|
|
61
|
+
tslib_1.__metadata("design:type", Number)
|
|
62
|
+
], FigureTypeMap.prototype, "revision", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, typeorm_1.Column)(),
|
|
65
|
+
(0, type_graphql_1.Field)(type => FigureTypeMapState, { description: 'CANDIDATE, ACTIVE or ARCHIVED.' }),
|
|
66
|
+
tslib_1.__metadata("design:type", String)
|
|
67
|
+
], FigureTypeMap.prototype, "state", void 0);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was last activated.' }),
|
|
71
|
+
tslib_1.__metadata("design:type", Date)
|
|
72
|
+
], FigureTypeMap.prototype, "activatedAt", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
75
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last activated it.' }),
|
|
76
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
77
|
+
], FigureTypeMap.prototype, "activator", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, typeorm_1.RelationId)((map) => map.activator),
|
|
80
|
+
tslib_1.__metadata("design:type", String)
|
|
81
|
+
], FigureTypeMap.prototype, "activatorId", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
84
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Creation timestamp.' }),
|
|
85
|
+
tslib_1.__metadata("design:type", Date)
|
|
86
|
+
], FigureTypeMap.prototype, "createdAt", void 0);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
89
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Last update timestamp.' }),
|
|
90
|
+
tslib_1.__metadata("design:type", Date)
|
|
91
|
+
], FigureTypeMap.prototype, "updatedAt", void 0);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
94
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Soft-delete timestamp.' }),
|
|
95
|
+
tslib_1.__metadata("design:type", Date)
|
|
96
|
+
], FigureTypeMap.prototype, "deletedAt", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
99
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created it.' }),
|
|
100
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
101
|
+
], FigureTypeMap.prototype, "creator", void 0);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, typeorm_1.RelationId)((map) => map.creator),
|
|
104
|
+
tslib_1.__metadata("design:type", String)
|
|
105
|
+
], FigureTypeMap.prototype, "creatorId", void 0);
|
|
106
|
+
tslib_1.__decorate([
|
|
107
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
108
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated it.' }),
|
|
109
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
110
|
+
], FigureTypeMap.prototype, "updater", void 0);
|
|
111
|
+
tslib_1.__decorate([
|
|
112
|
+
(0, typeorm_1.RelationId)((map) => map.updater),
|
|
113
|
+
tslib_1.__metadata("design:type", String)
|
|
114
|
+
], FigureTypeMap.prototype, "updaterId", void 0);
|
|
115
|
+
exports.FigureTypeMap = FigureTypeMap = tslib_1.__decorate([
|
|
116
|
+
(0, typeorm_1.Entity)(),
|
|
117
|
+
(0, typeorm_1.Index)('ix_figure_type_map_1', (map) => [map.domain, map.version], { unique: true, where: '"deleted_at" IS NULL' }),
|
|
118
|
+
(0, type_graphql_1.ObjectType)({ description: 'A release of the domain type map.' })
|
|
119
|
+
], FigureTypeMap);
|
|
120
|
+
//# sourceMappingURL=figure-type-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure-type-map.js","sourceRoot":"","sources":["../../../server/service/figure-type-map/figure-type-map.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAA2E;AAE3E,yDAAgD;AAChD,iDAA8C;AAE9C,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;AACvB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAA,+BAAgB,EAAC,k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AC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;sCACvE,gBAAI;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;gDAC9B;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;sCAC5E,gBAAI;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;gDAC9B;wBAnEP,aAAa;IAHzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,sBAAsB,EAAE,CAAC,GAAkB,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;IACjI,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;GACpD,aAAa,CAoEzB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, Int, ObjectType, registerEnumType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nexport enum FigureTypeMapState {\n CANDIDATE = 'CANDIDATE',\n ACTIVE = 'ACTIVE',\n ARCHIVED = 'ARCHIVED'\n}\n\nregisterEnumType(FigureTypeMapState, {\n name: 'FigureTypeMapState',\n description: 'State of a type map release: CANDIDATE is edited, ACTIVE draws boards, ARCHIVED can be activated again.'\n})\n\n/**\n * One release of a domain's type map: which imported release each figure draws with (ADR-0114 결정 6).\n *\n * A domain has one ACTIVE and at most one CANDIDATE. Only the candidate changes; each save raises `revision`, so an\n * open preview knows the candidate it registered is no longer the one stored (결정 12). Activation turns the candidate\n * ACTIVE and the previous ACTIVE ARCHIVED in one transaction; rolling back activates an ARCHIVED release again.\n */\n@Entity()\n@Index('ix_figure_type_map_1', (map: FigureTypeMap) => [map.domain, map.version], { unique: true, where: '\"deleted_at\" IS NULL' })\n@ObjectType({ description: 'A release of the domain type map.' })\nexport class FigureTypeMap {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier.' })\n readonly id?: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain the map belongs to.' })\n domain?: Domain\n\n @RelationId((map: FigureTypeMap) => map.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'Name of the release, R{version}.' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Note on the release.' })\n description?: string\n\n @Column()\n @Field(type => Int, { description: 'Release number within the domain.' })\n version: number\n\n @Column({ default: 0 })\n @Field(type => Int, { description: 'Raised on each save of a candidate; fixed once active.' })\n revision: number\n\n @Column()\n @Field(type => FigureTypeMapState, { description: 'CANDIDATE, ACTIVE or ARCHIVED.' })\n state: FigureTypeMapState\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When it was last activated.' })\n activatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last activated it.' })\n activator?: User\n\n @RelationId((map: FigureTypeMap) => map.activator)\n activatorId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft-delete timestamp.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created it.' })\n creator?: User\n\n @RelationId((map: FigureTypeMap) => map.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated it.' })\n updater?: User\n\n @RelationId((map: FigureTypeMap) => map.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FigureLibraryRelease } from './figure-library-release/figure-library-release';
|
|
2
|
+
import { FigureTypeMap } from './figure-type-map/figure-type-map';
|
|
3
|
+
import { FigureTypeMapEntry } from './figure-type-map/figure-type-map-entry';
|
|
4
|
+
import { FigureLibraryResolver } from './figure-library-resolver';
|
|
5
|
+
export * from './figure-library-release/figure-library-release';
|
|
6
|
+
export * from './figure-type-map/figure-type-map';
|
|
7
|
+
export * from './figure-type-map/figure-type-map-entry';
|
|
8
|
+
export * from './figure-library-types';
|
|
9
|
+
export * from './figure-library-resolver';
|
|
10
|
+
export * from './library/blueprints';
|
|
11
|
+
export * from './library/board-walk';
|
|
12
|
+
export * from './library/derived';
|
|
13
|
+
export * from './library/import';
|
|
14
|
+
export * from './library/inspection';
|
|
15
|
+
export * from './library/library-files';
|
|
16
|
+
export * from './library/type-map';
|
|
17
|
+
export declare const entities: (typeof FigureTypeMap | typeof FigureTypeMapEntry | typeof FigureLibraryRelease)[];
|
|
18
|
+
export declare const schema: {
|
|
19
|
+
resolverClasses: (typeof FigureLibraryResolver)[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.entities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/*
|
|
6
|
+
* The board server's own figures (ADR-0114): the library of imported releases and the domain type map.
|
|
7
|
+
* Each source file is named rather than re-exporting folder barrels.
|
|
8
|
+
*/
|
|
9
|
+
const figure_library_release_1 = require("./figure-library-release/figure-library-release");
|
|
10
|
+
const figure_type_map_1 = require("./figure-type-map/figure-type-map");
|
|
11
|
+
const figure_type_map_entry_1 = require("./figure-type-map/figure-type-map-entry");
|
|
12
|
+
const figure_library_resolver_1 = require("./figure-library-resolver");
|
|
13
|
+
tslib_1.__exportStar(require("./figure-library-release/figure-library-release"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./figure-type-map/figure-type-map"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./figure-type-map/figure-type-map-entry"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./figure-library-types"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./figure-library-resolver"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./library/blueprints"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./library/board-walk"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./library/derived"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./library/import"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./library/inspection"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./library/library-files"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./library/type-map"), exports);
|
|
25
|
+
/* The shell builds the database and the schema from these two names; a module without them has no tables and no doors. */
|
|
26
|
+
exports.entities = [figure_library_release_1.FigureLibraryRelease, figure_type_map_1.FigureTypeMap, figure_type_map_entry_1.FigureTypeMapEntry];
|
|
27
|
+
exports.schema = { resolverClasses: [figure_library_resolver_1.FigureLibraryResolver] };
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,4FAAsF;AACtF,uEAAiE;AACjE,mFAA4E;AAC5E,uEAAiE;AAEjE,0FAA+D;AAC/D,4EAAiD;AACjD,kFAAuD;AACvD,iEAAsC;AACtC,oEAAyC;AACzC,+DAAoC;AACpC,+DAAoC;AACpC,4DAAiC;AACjC,2DAAgC;AAChC,+DAAoC;AACpC,kEAAuC;AACvC,6DAAkC;AAElC,0HAA0H;AAC7G,QAAA,QAAQ,GAAG,CAAC,6CAAoB,EAAE,+BAAa,EAAE,0CAAkB,CAAC,CAAA;AAEpE,QAAA,MAAM,GAAG,EAAE,eAAe,EAAE,CAAC,+CAAqB,CAAC,EAAE,CAAA","sourcesContent":["/*\n * The board server's own figures (ADR-0114): the library of imported releases and the domain type map.\n * Each source file is named rather than re-exporting folder barrels.\n */\nimport { FigureLibraryRelease } from './figure-library-release/figure-library-release'\nimport { FigureTypeMap } from './figure-type-map/figure-type-map'\nimport { FigureTypeMapEntry } from './figure-type-map/figure-type-map-entry'\nimport { FigureLibraryResolver } from './figure-library-resolver'\n\nexport * from './figure-library-release/figure-library-release'\nexport * from './figure-type-map/figure-type-map'\nexport * from './figure-type-map/figure-type-map-entry'\nexport * from './figure-library-types'\nexport * from './figure-library-resolver'\nexport * from './library/blueprints'\nexport * from './library/board-walk'\nexport * from './library/derived'\nexport * from './library/import'\nexport * from './library/inspection'\nexport * from './library/library-files'\nexport * from './library/type-map'\n\n/* The shell builds the database and the schema from these two names; a module without them has no tables and no doors. */\nexport const entities = [FigureLibraryRelease, FigureTypeMap, FigureTypeMapEntry]\n\nexport const schema = { resolverClasses: [FigureLibraryResolver] }\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm';
|
|
2
|
+
import { Refusal } from '@things-factory/shell';
|
|
3
|
+
import { FigureTypeMapState } from '../figure-type-map/figure-type-map';
|
|
4
|
+
import { type LibraryFiles } from './library-files';
|
|
5
|
+
export declare const FIGURE_BLUEPRINTS_MAX = 500;
|
|
6
|
+
export interface BlueprintsAnswer {
|
|
7
|
+
release: {
|
|
8
|
+
version: number;
|
|
9
|
+
revision: number;
|
|
10
|
+
} | null;
|
|
11
|
+
items: {
|
|
12
|
+
type: string;
|
|
13
|
+
ref: string;
|
|
14
|
+
asset: unknown;
|
|
15
|
+
}[];
|
|
16
|
+
refused: {
|
|
17
|
+
type: string;
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The batch door a board asks when it opens (ADR-0114 결정 9 · 13 · 14): every name answered from one map release,
|
|
24
|
+
* an item under the name asked or a refusal with its cause. One refusal never removes another item.
|
|
25
|
+
*/
|
|
26
|
+
export declare function blueprintsOf(tx: EntityManager, domain: {
|
|
27
|
+
id: string;
|
|
28
|
+
}, types: readonly string[], state: FigureTypeMapState.ACTIVE | FigureTypeMapState.CANDIDATE, speak: (refusal: Refusal) => string, files?: LibraryFiles): Promise<BlueprintsAnswer>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIGURE_BLUEPRINTS_MAX = void 0;
|
|
4
|
+
exports.blueprintsOf = blueprintsOf;
|
|
5
|
+
const figure_model_1 = require("@hatiolab/figure-model");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const inspection_1 = require("./inspection");
|
|
8
|
+
const type_map_1 = require("./type-map");
|
|
9
|
+
exports.FIGURE_BLUEPRINTS_MAX = 500;
|
|
10
|
+
/**
|
|
11
|
+
* The batch door a board asks when it opens (ADR-0114 결정 9 · 13 · 14): every name answered from one map release,
|
|
12
|
+
* an item under the name asked or a refusal with its cause. One refusal never removes another item.
|
|
13
|
+
*/
|
|
14
|
+
async function blueprintsOf(tx, domain, types, state, speak, files) {
|
|
15
|
+
const names = [...new Set(types)];
|
|
16
|
+
if (names.length > exports.FIGURE_BLUEPRINTS_MAX) {
|
|
17
|
+
throw new shell_1.Refusal('figure-names-too-many', { count: names.length, max: exports.FIGURE_BLUEPRINTS_MAX }, 'at most {max} figure names can be asked at once, not {count}.');
|
|
18
|
+
}
|
|
19
|
+
const map = await (0, type_map_1.mapOfState)(tx, domain, state);
|
|
20
|
+
const lines = new Map(map ? (await (0, type_map_1.entriesOf)(tx, map)).map(line => [line.name, line]) : []);
|
|
21
|
+
const answer = { release: map ? { version: map.version, revision: map.revision } : null, items: [], refused: [] };
|
|
22
|
+
const refuse = (type, refusal) => answer.refused.push({ type, code: refusal.code, message: speak(refusal) });
|
|
23
|
+
for (const type of names) {
|
|
24
|
+
if (!(0, figure_model_1.parseFigureName)(type)) {
|
|
25
|
+
refuse(type, new shell_1.Refusal('figure-name-malformed', { type }, '{type} is not a full figure name of the form namespace/type.'));
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const line = lines.get(type);
|
|
29
|
+
if (!line) {
|
|
30
|
+
refuse(type, new shell_1.Refusal('figure-not-in-type-map', { type }, 'not in the type map of this domain.'));
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (!line.release || line.release.deletedAt) {
|
|
34
|
+
refuse(type, new shell_1.Refusal('figure-release-unavailable', { type }, 'the release the type map chose is not in the library.'));
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if ((await (0, inspection_1.dependencyFaults)(tx, line.release, files)).length) {
|
|
38
|
+
refuse(type, new shell_1.Refusal('figure-dependency-missing', { type, ref: line.release.ref }, 'a file {ref} depends on is missing or damaged.'));
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
let asset;
|
|
42
|
+
try {
|
|
43
|
+
asset = JSON.parse(line.release.source);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
refuse(type, new shell_1.Refusal('figure-format-unsupported', { type, ref: line.release.ref }, '{ref} cannot be read here.'));
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
answer.items.push({ type, ref: line.release.ref, asset });
|
|
50
|
+
}
|
|
51
|
+
return answer;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=blueprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blueprints.js","sourceRoot":"","sources":["../../../server/service/library/blueprints.ts"],"names":[],"mappings":";;;AAsBA,oCA8CC;AAlED,yDAAwD;AACxD,iDAA+C;AAG/C,6CAA+C;AAE/C,yCAAkD;AAErC,QAAA,qBAAqB,GAAG,GAAG,CAAA;AAQxC;;;GAGG;AACI,KAAK,UAAU,YAAY,CAChC,EAAiB,EACjB,MAAsB,EACtB,KAAwB,EACxB,KAA+D,EAC/D,KAAmC,EACnC,KAAoB;IAEpB,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,6BAAqB,EAAE,CAAC;QACzC,MAAM,IAAI,eAAO,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,6BAAqB,EAAE,EAAE,+DAA+D,CAAC,CAAA;IAClK,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,IAAA,qBAAU,EAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAA,oBAAS,EAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAE3F,MAAM,MAAM,GAAqB,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAA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,CAAC;QACD,IAAI,KAAc,CAAA;QAClB,IAAI,CAAC;YACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,IAAI,EAAE,IAAI,eAAO,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC,CAAA;YACrH,SAAQ;QACV,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { EntityManager } from 'typeorm'\n\nimport { parseFigureName } from '@hatiolab/figure-model'\nimport { Refusal } from '@things-factory/shell'\n\nimport { FigureTypeMapState } from '../figure-type-map/figure-type-map'\nimport { dependencyFaults } from './inspection'\nimport { type LibraryFiles } from './library-files'\nimport { entriesOf, mapOfState } from './type-map'\n\nexport const FIGURE_BLUEPRINTS_MAX = 500\n\nexport interface BlueprintsAnswer {\n release: { version: number; revision: number } | null\n items: { type: string; ref: string; asset: unknown }[]\n refused: { type: string; code: string; message: string }[]\n}\n\n/**\n * The batch door a board asks when it opens (ADR-0114 결정 9 · 13 · 14): every name answered from one map release,\n * an item under the name asked or a refusal with its cause. One refusal never removes another item.\n */\nexport async function blueprintsOf(\n tx: EntityManager,\n domain: { id: string },\n types: readonly string[],\n state: FigureTypeMapState.ACTIVE | FigureTypeMapState.CANDIDATE,\n speak: (refusal: Refusal) => string,\n files?: LibraryFiles\n): Promise<BlueprintsAnswer> {\n const names = [...new Set(types)]\n if (names.length > FIGURE_BLUEPRINTS_MAX) {\n throw new Refusal('figure-names-too-many', { count: names.length, max: FIGURE_BLUEPRINTS_MAX }, 'at most {max} figure names can be asked at once, not {count}.')\n }\n const map = await mapOfState(tx, domain, state)\n const lines = new Map(map ? (await entriesOf(tx, map)).map(line => [line.name, line]) : [])\n\n const answer: BlueprintsAnswer = { release: map ? { version: map.version, revision: map.revision } : null, items: [], refused: [] }\n const refuse = (type: string, refusal: Refusal) => answer.refused.push({ type, code: refusal.code, message: speak(refusal) })\n\n for (const type of names) {\n if (!parseFigureName(type)) {\n refuse(type, new Refusal('figure-name-malformed', { type }, '{type} is not a full figure name of the form namespace/type.'))\n continue\n }\n const line = lines.get(type)\n if (!line) {\n refuse(type, new Refusal('figure-not-in-type-map', { type }, 'not in the type map of this domain.'))\n continue\n }\n if (!line.release || line.release.deletedAt) {\n refuse(type, new Refusal('figure-release-unavailable', { type }, 'the release the type map chose is not in the library.'))\n continue\n }\n if ((await dependencyFaults(tx, line.release, files)).length) {\n refuse(type, new Refusal('figure-dependency-missing', { type, ref: line.release.ref }, 'a file {ref} depends on is missing or damaged.'))\n continue\n }\n let asset: unknown\n try {\n asset = JSON.parse(line.release.source)\n } catch {\n refuse(type, new Refusal('figure-format-unsupported', { type, ref: line.release.ref }, '{ref} cannot be read here.'))\n continue\n }\n answer.items.push({ type, ref: line.release.ref, asset })\n }\n return answer\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function figureNodesOf(model: unknown): Map<string, number>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.figureNodesOf = figureNodesOf;
|
|
4
|
+
/**
|
|
5
|
+
* Counts the figure nodes a board model holds, by full name. A figure node is one whose `type` is a full figure name
|
|
6
|
+
* `{namespace}/{type}` -- the `/` that keeps figures apart from built-in components (ADR-0114 결정 2).
|
|
7
|
+
*/
|
|
8
|
+
const figure_model_1 = require("@hatiolab/figure-model");
|
|
9
|
+
function figureNodesOf(model) {
|
|
10
|
+
const counts = new Map();
|
|
11
|
+
const parsed = typeof model === 'string' ? safeParse(model) : model;
|
|
12
|
+
const walk = (node) => {
|
|
13
|
+
for (const child of Array.isArray(node?.components) ? node.components : []) {
|
|
14
|
+
const type = child?.type;
|
|
15
|
+
if (typeof type === 'string' && (0, figure_model_1.parseFigureName)(type))
|
|
16
|
+
counts.set(type, (counts.get(type) ?? 0) + 1);
|
|
17
|
+
walk(child);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
walk(parsed);
|
|
21
|
+
return counts;
|
|
22
|
+
}
|
|
23
|
+
function safeParse(text) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(text);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=board-walk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-walk.js","sourceRoot":"","sources":["../../../server/service/library/board-walk.ts"],"names":[],"mappings":";;AAMA,sCAYC;AAlBD;;;GAGG;AACH,yDAAwD;AAExD,SAAgB,aAAa,CAAC,KAAc;IAC1C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IACnE,MAAM,IAAI,GAAG,CAAC,IAAS,EAAE,EAAE;QACzB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAC3E,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAA;YACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAA,8BAAe,EAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YACpG,IAAI,CAAC,KAAK,CAAC,CAAA;QACb,CAAC;IACH,CAAC,CAAA;IACD,IAAI,CAAC,MAAM,CAAC,CAAA;IACZ,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["/**\n * Counts the figure nodes a board model holds, by full name. A figure node is one whose `type` is a full figure name\n * `{namespace}/{type}` -- the `/` that keeps figures apart from built-in components (ADR-0114 결정 2).\n */\nimport { parseFigureName } from '@hatiolab/figure-model'\n\nexport function figureNodesOf(model: unknown): Map<string, number> {\n const counts = new Map<string, number>()\n const parsed = typeof model === 'string' ? safeParse(model) : model\n const walk = (node: any) => {\n for (const child of Array.isArray(node?.components) ? node.components : []) {\n const type = child?.type\n if (typeof type === 'string' && parseFigureName(type)) counts.set(type, (counts.get(type) ?? 0) + 1)\n walk(child)\n }\n }\n walk(parsed)\n return counts\n}\n\nfunction safeParse(text: string): unknown {\n try {\n return JSON.parse(text)\n } catch {\n return null\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** What this server derives from a release's source: whether its kernel reads it, and its authored size. */
|
|
2
|
+
export interface DerivedOfSource {
|
|
3
|
+
formatSupported: boolean;
|
|
4
|
+
checkedKernel: string;
|
|
5
|
+
width: number | null;
|
|
6
|
+
depth: number | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size is
|
|
10
|
+
* then unknown, never guessed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function derivedOfSource(source: string): DerivedOfSource;
|
|
13
|
+
/** Whether a row's derived values were made by another kernel than this server's and must be made again. */
|
|
14
|
+
export declare function derivedIsStale(row: {
|
|
15
|
+
checkedKernel?: string | null;
|
|
16
|
+
}): boolean;
|