@things-factory/figure-library 10.1.154 → 10.1.155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist-client/pages/figure-library-page.d.ts +20 -58
  2. package/dist-client/pages/figure-library-page.js +189 -672
  3. package/dist-client/pages/figure-library-page.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-client/viewparts/figure-card-meta.d.ts +19 -0
  6. package/dist-client/viewparts/figure-card-meta.js +122 -0
  7. package/dist-client/viewparts/figure-card-meta.js.map +1 -0
  8. package/dist-client/viewparts/figure-releases-popup.d.ts +34 -0
  9. package/dist-client/viewparts/figure-releases-popup.js +400 -0
  10. package/dist-client/viewparts/figure-releases-popup.js.map +1 -0
  11. package/dist-client/viewparts/release-pair.d.ts +9 -0
  12. package/dist-client/viewparts/release-pair.js +15 -0
  13. package/dist-client/viewparts/release-pair.js.map +1 -0
  14. package/dist-server/service/figure-library-release/figure-library-release.d.ts +5 -3
  15. package/dist-server/service/figure-library-release/figure-library-release.js +13 -3
  16. package/dist-server/service/figure-library-release/figure-library-release.js.map +1 -1
  17. package/dist-server/service/figure-library-resolver.d.ts +9 -9
  18. package/dist-server/service/figure-library-resolver.js +66 -69
  19. package/dist-server/service/figure-library-resolver.js.map +1 -1
  20. package/dist-server/service/figure-library-types.d.ts +17 -4
  21. package/dist-server/service/figure-library-types.js +63 -15
  22. package/dist-server/service/figure-library-types.js.map +1 -1
  23. package/dist-server/service/figure-type-map/figure-type-map-entry.d.ts +5 -4
  24. package/dist-server/service/figure-type-map/figure-type-map-entry.js +8 -14
  25. package/dist-server/service/figure-type-map/figure-type-map-entry.js.map +1 -1
  26. package/dist-server/service/index.d.ts +2 -3
  27. package/dist-server/service/index.js +2 -3
  28. package/dist-server/service/index.js.map +1 -1
  29. package/dist-server/service/library/blueprints.d.ts +3 -8
  30. package/dist-server/service/library/blueprints.js +5 -6
  31. package/dist-server/service/library/blueprints.js.map +1 -1
  32. package/dist-server/service/library/carriers.d.ts +8 -11
  33. package/dist-server/service/library/carriers.js +8 -14
  34. package/dist-server/service/library/carriers.js.map +1 -1
  35. package/dist-server/service/library/derived.d.ts +5 -3
  36. package/dist-server/service/library/derived.js +4 -3
  37. package/dist-server/service/library/derived.js.map +1 -1
  38. package/dist-server/service/library/figures.d.ts +46 -0
  39. package/dist-server/service/library/figures.js +91 -0
  40. package/dist-server/service/library/figures.js.map +1 -0
  41. package/dist-server/service/library/import.d.ts +1 -1
  42. package/dist-server/service/library/import.js +5 -3
  43. package/dist-server/service/library/import.js.map +1 -1
  44. package/dist-server/service/library/inspection.d.ts +1 -48
  45. package/dist-server/service/library/inspection.js +3 -80
  46. package/dist-server/service/library/inspection.js.map +1 -1
  47. package/dist-server/service/library/type-map.d.ts +10 -22
  48. package/dist-server/service/library/type-map.js +44 -108
  49. package/dist-server/service/library/type-map.js.map +1 -1
  50. package/dist-server/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +11 -10
  52. package/translations/en.json +26 -47
  53. package/translations/es.json +26 -47
  54. package/translations/ja.json +26 -47
  55. package/translations/ko.json +26 -47
  56. package/translations/ms.json +26 -47
  57. package/translations/zh.json +26 -47
  58. package/dist-server/service/figure-type-map/figure-type-map.d.ts +0 -34
  59. package/dist-server/service/figure-type-map/figure-type-map.js +0 -120
  60. package/dist-server/service/figure-type-map/figure-type-map.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FigureImportResult = exports.FigureImportProblem = exports.FigureImportOutcome = exports.FigureTypeMapLineInput = exports.FigureLibraryReleaseList = void 0;
3
+ exports.FigureLibraryFacets = exports.FigureLibraryFigureList = exports.FigureLibraryFigure = exports.FigureImportResult = exports.FigureImportProblem = exports.FigureImportOutcome = exports.FigureLibraryReleaseList = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const figure_library_release_1 = require("./figure-library-release/figure-library-release");
@@ -18,20 +18,6 @@ tslib_1.__decorate([
18
18
  exports.FigureLibraryReleaseList = FigureLibraryReleaseList = tslib_1.__decorate([
19
19
  (0, type_graphql_1.ObjectType)({ description: 'A page of imported releases.' })
20
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
21
  let FigureImportOutcome = class FigureImportOutcome {
36
22
  };
37
23
  exports.FigureImportOutcome = FigureImportOutcome;
@@ -82,4 +68,66 @@ tslib_1.__decorate([
82
68
  exports.FigureImportResult = FigureImportResult = tslib_1.__decorate([
83
69
  (0, type_graphql_1.ObjectType)({ description: 'The result of importing a figure package.' })
84
70
  ], FigureImportResult);
71
+ let FigureLibraryFigure = class FigureLibraryFigure {
72
+ };
73
+ exports.FigureLibraryFigure = FigureLibraryFigure;
74
+ tslib_1.__decorate([
75
+ (0, type_graphql_1.Field)({ description: 'Full figure name {namespace}/{type}.' }),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], FigureLibraryFigure.prototype, "name", void 0);
78
+ tslib_1.__decorate([
79
+ (0, type_graphql_1.Field)(type => figure_library_release_1.FigureLibraryRelease, { nullable: true, description: 'The release this name draws with; null when none of its releases can be drawn here.' }),
80
+ tslib_1.__metadata("design:type", figure_library_release_1.FigureLibraryRelease)
81
+ ], FigureLibraryFigure.prototype, "release", void 0);
82
+ tslib_1.__decorate([
83
+ (0, type_graphql_1.Field)(type => figure_library_release_1.FigureLibraryRelease, { description: 'The newest release imported of this name, drawable or not.' }),
84
+ tslib_1.__metadata("design:type", figure_library_release_1.FigureLibraryRelease)
85
+ ], FigureLibraryFigure.prototype, "latest", void 0);
86
+ tslib_1.__decorate([
87
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The newest version imported of this name.' }),
88
+ tslib_1.__metadata("design:type", Number)
89
+ ], FigureLibraryFigure.prototype, "latestVersion", void 0);
90
+ tslib_1.__decorate([
91
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many releases of this name are imported.' }),
92
+ tslib_1.__metadata("design:type", Number)
93
+ ], FigureLibraryFigure.prototype, "releaseCount", void 0);
94
+ exports.FigureLibraryFigure = FigureLibraryFigure = tslib_1.__decorate([
95
+ (0, type_graphql_1.ObjectType)({ description: 'An imported figure: its full name, the release it draws with, its latest version and how many releases are imported.' })
96
+ ], FigureLibraryFigure);
97
+ let FigureLibraryFigureList = class FigureLibraryFigureList {
98
+ };
99
+ exports.FigureLibraryFigureList = FigureLibraryFigureList;
100
+ tslib_1.__decorate([
101
+ (0, type_graphql_1.Field)(type => [FigureLibraryFigure], { description: 'The figures on this page.' }),
102
+ tslib_1.__metadata("design:type", Array)
103
+ ], FigureLibraryFigureList.prototype, "items", void 0);
104
+ tslib_1.__decorate([
105
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Total number of figures matching the query.' }),
106
+ tslib_1.__metadata("design:type", Number)
107
+ ], FigureLibraryFigureList.prototype, "total", void 0);
108
+ exports.FigureLibraryFigureList = FigureLibraryFigureList = tslib_1.__decorate([
109
+ (0, type_graphql_1.ObjectType)({ description: 'A page of imported figures.' })
110
+ ], FigureLibraryFigureList);
111
+ let FigureLibraryFacets = class FigureLibraryFacets {
112
+ };
113
+ exports.FigureLibraryFacets = FigureLibraryFacets;
114
+ tslib_1.__decorate([
115
+ (0, type_graphql_1.Field)(type => [String], { description: 'Categories of the releases that draw.' }),
116
+ tslib_1.__metadata("design:type", Array)
117
+ ], FigureLibraryFacets.prototype, "categories", void 0);
118
+ tslib_1.__decorate([
119
+ (0, type_graphql_1.Field)({ description: 'Whether a release that draws has no category.' }),
120
+ tslib_1.__metadata("design:type", Boolean)
121
+ ], FigureLibraryFacets.prototype, "uncategorized", void 0);
122
+ tslib_1.__decorate([
123
+ (0, type_graphql_1.Field)(type => [String], { description: 'Place roles (seat, grip) the releases that draw declare.' }),
124
+ tslib_1.__metadata("design:type", Array)
125
+ ], FigureLibraryFacets.prototype, "capabilities", void 0);
126
+ tslib_1.__decorate([
127
+ (0, type_graphql_1.Field)({ description: 'Whether a release that draws declares no place.' }),
128
+ tslib_1.__metadata("design:type", Boolean)
129
+ ], FigureLibraryFacets.prototype, "incapable", void 0);
130
+ exports.FigureLibraryFacets = FigureLibraryFacets = tslib_1.__decorate([
131
+ (0, type_graphql_1.ObjectType)({ description: 'What the figure filters offer.' })
132
+ ], FigureLibraryFacets);
85
133
  //# sourceMappingURL=figure-library-types.js.map
@@ -1 +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,EA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A,yBAAU,EAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;GACxD,mBAAmB,CAM/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"]}
1
+ {"version":3,"file":"figure-library-types.js","sourceRoot":"","sources":["../../server/service/figure-library-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAqD;AAErD,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,mBAAmB,GAAzB,MAAM,mBAAmB;CAY/B,CAAA;AAZY,kDAAmB;AAE9B;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;gDAC/D;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;oDACtC;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;;iDAC9E;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,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W,EAAE,0DAA0D,EAAE,CAAC;;yDAC/E;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;sDACxD;8BAXP,mBAAmB;IAD/B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;GACjD,mBAAmB,CAY/B","sourcesContent":["import { Field, 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@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\n@ObjectType({ description: 'An imported figure: its full name, the release it draws with, its latest version and how many releases are imported.' })\nexport class FigureLibraryFigure {\n @Field({ description: 'Full figure name {namespace}/{type}.' })\n name: string\n\n @Field(type => FigureLibraryRelease, { nullable: true, description: 'The release this name draws with; null when none of its releases can be drawn here.' })\n release: FigureLibraryRelease | null\n\n @Field(type => FigureLibraryRelease, { description: 'The newest release imported of this name, drawable or not.' })\n latest: FigureLibraryRelease\n\n @Field(type => Int, { description: 'The newest version imported of this name.' })\n latestVersion: number\n\n @Field(type => Int, { description: 'How many releases of this name are imported.' })\n releaseCount: number\n}\n\n@ObjectType({ description: 'A page of imported figures.' })\nexport class FigureLibraryFigureList {\n @Field(type => [FigureLibraryFigure], { description: 'The figures on this page.' })\n items: FigureLibraryFigure[]\n\n @Field(type => Int, { description: 'Total number of figures matching the query.' })\n total: number\n}\n\n@ObjectType({ description: 'What the figure filters offer.' })\nexport class FigureLibraryFacets {\n @Field(type => [String], { description: 'Categories of the releases that draw.' })\n categories: string[]\n\n @Field({ description: 'Whether a release that draws has no category.' })\n uncategorized: boolean\n\n @Field(type => [String], { description: 'Place roles (seat, grip) the releases that draw declare.' })\n capabilities: string[]\n\n @Field({ description: 'Whether a release that draws declares no place.' })\n incapable: boolean\n}\n"]}
@@ -1,14 +1,15 @@
1
1
  import { User } from '@things-factory/auth-base';
2
2
  import { Domain } from '@things-factory/shell';
3
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. */
4
+ /**
5
+ * One line of a domain's type map: a full name and the imported release it draws with (ADR-0114 결정 6, amended
6
+ * 2026-10-12). The type map is these lines, one per name; it has no releases of its own. Importing a release of a new
7
+ * name adds its line; a newer release of a name moves the line to it; the operator may choose another imported release.
8
+ */
6
9
  export declare class FigureTypeMapEntry {
7
10
  readonly id?: string;
8
11
  domain?: Domain;
9
12
  domainId?: string;
10
- typeMap?: FigureTypeMap;
11
- typeMapId?: string;
12
13
  name: string;
13
14
  description?: string;
14
15
  release?: FigureLibraryRelease;
@@ -7,8 +7,11 @@ const type_graphql_1 = require("type-graphql");
7
7
  const auth_base_1 = require("@things-factory/auth-base");
8
8
  const shell_1 = require("@things-factory/shell");
9
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. */
10
+ /**
11
+ * One line of a domain's type map: a full name and the imported release it draws with (ADR-0114 결정 6, amended
12
+ * 2026-10-12). The type map is these lines, one per name; it has no releases of its own. Importing a release of a new
13
+ * name adds its line; a newer release of a name moves the line to it; the operator may choose another imported release.
14
+ */
12
15
  let FigureTypeMapEntry = class FigureTypeMapEntry {
13
16
  };
14
17
  exports.FigureTypeMapEntry = FigureTypeMapEntry;
@@ -19,22 +22,13 @@ tslib_1.__decorate([
19
22
  ], FigureTypeMapEntry.prototype, "id", void 0);
20
23
  tslib_1.__decorate([
21
24
  (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.' }),
25
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain the line belongs to.' }),
23
26
  tslib_1.__metadata("design:type", shell_1.Domain)
24
27
  ], FigureTypeMapEntry.prototype, "domain", void 0);
25
28
  tslib_1.__decorate([
26
29
  (0, typeorm_1.RelationId)((entry) => entry.domain),
27
30
  tslib_1.__metadata("design:type", String)
28
31
  ], 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
32
  tslib_1.__decorate([
39
33
  (0, typeorm_1.Column)(),
40
34
  (0, type_graphql_1.Field)({ description: 'Full figure name {namespace}/{type} boards store.' }),
@@ -89,10 +83,10 @@ tslib_1.__decorate([
89
83
  ], FigureTypeMapEntry.prototype, "updaterId", void 0);
90
84
  exports.FigureTypeMapEntry = FigureTypeMapEntry = tslib_1.__decorate([
91
85
  (0, typeorm_1.Entity)(),
92
- (0, typeorm_1.Index)('ix_figure_type_map_entry_1', (entry) => [entry.typeMap, entry.name], {
86
+ (0, typeorm_1.Index)('ix_figure_type_map_entry_1', (entry) => [entry.domain, entry.name], {
93
87
  unique: true,
94
88
  where: '"deleted_at" IS NULL'
95
89
  }),
96
- (0, type_graphql_1.ObjectType)({ description: 'A line of a type map: full name {namespace}/{type} to an imported release.' })
90
+ (0, type_graphql_1.ObjectType)({ description: 'A line of the domain type map: full name {namespace}/{type} to the imported release it draws with.' })
97
91
  ], FigureTypeMapEntry);
98
92
  //# sourceMappingURL=figure-type-map-entry.js.map
@@ -1 +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,IAA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,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"]}
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;AAEvF;;;;GAIG;AAOI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAoD9B,CAAA;AApDY,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,iCAAiC,EAAE,CAAC;sCACjF,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;;oDACvC;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;gDAChE;AAIZ;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM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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;6BAnDP,kBAAkB;IAN9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,4BAA4B,EAAE,CAAC,KAAyB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;QAC9F,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oGAAoG,EAAE,CAAC;GACrH,kBAAkB,CAoD9B","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'\n\n/**\n * One line of a domain's type map: a full name and the imported release it draws with (ADR-0114 결정 6, amended\n * 2026-10-12). The type map is these lines, one per name; it has no releases of its own. Importing a release of a new\n * name adds its line; a newer release of a name moves the line to it; the operator may choose another imported release.\n */\n@Entity()\n@Index('ix_figure_type_map_entry_1', (entry: FigureTypeMapEntry) => [entry.domain, entry.name], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'A line of the domain type map: full name {namespace}/{type} to the imported release it draws with.' })\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 line belongs to.' })\n domain?: Domain\n\n @RelationId((entry: FigureTypeMapEntry) => entry.domain)\n domainId?: 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"]}
@@ -1,9 +1,7 @@
1
1
  import { FigureLibraryRelease } from './figure-library-release/figure-library-release';
2
- import { FigureTypeMap } from './figure-type-map/figure-type-map';
3
2
  import { FigureTypeMapEntry } from './figure-type-map/figure-type-map-entry';
4
3
  import { FigureLibraryResolver } from './figure-library-resolver';
5
4
  export * from './figure-library-release/figure-library-release';
6
- export * from './figure-type-map/figure-type-map';
7
5
  export * from './figure-type-map/figure-type-map-entry';
8
6
  export * from './figure-library-types';
9
7
  export * from './figure-library-resolver';
@@ -11,11 +9,12 @@ export * from './library/blueprints';
11
9
  export * from './library/carriers';
12
10
  export * from './library/board-walk';
13
11
  export * from './library/derived';
12
+ export * from './library/figures';
14
13
  export * from './library/import';
15
14
  export * from './library/inspection';
16
15
  export * from './library/library-files';
17
16
  export * from './library/type-map';
18
- export declare const entities: (typeof FigureLibraryRelease | typeof FigureTypeMap | typeof FigureTypeMapEntry)[];
17
+ export declare const entities: (typeof FigureLibraryRelease | typeof FigureTypeMapEntry)[];
19
18
  export declare const schema: {
20
19
  resolverClasses: (typeof FigureLibraryResolver)[];
21
20
  };
@@ -7,11 +7,9 @@ const tslib_1 = require("tslib");
7
7
  * Each source file is named rather than re-exporting folder barrels.
8
8
  */
9
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
10
  const figure_type_map_entry_1 = require("./figure-type-map/figure-type-map-entry");
12
11
  const figure_library_resolver_1 = require("./figure-library-resolver");
13
12
  tslib_1.__exportStar(require("./figure-library-release/figure-library-release"), exports);
14
- tslib_1.__exportStar(require("./figure-type-map/figure-type-map"), exports);
15
13
  tslib_1.__exportStar(require("./figure-type-map/figure-type-map-entry"), exports);
16
14
  tslib_1.__exportStar(require("./figure-library-types"), exports);
17
15
  tslib_1.__exportStar(require("./figure-library-resolver"), exports);
@@ -19,11 +17,12 @@ tslib_1.__exportStar(require("./library/blueprints"), exports);
19
17
  tslib_1.__exportStar(require("./library/carriers"), exports);
20
18
  tslib_1.__exportStar(require("./library/board-walk"), exports);
21
19
  tslib_1.__exportStar(require("./library/derived"), exports);
20
+ tslib_1.__exportStar(require("./library/figures"), exports);
22
21
  tslib_1.__exportStar(require("./library/import"), exports);
23
22
  tslib_1.__exportStar(require("./library/inspection"), exports);
24
23
  tslib_1.__exportStar(require("./library/library-files"), exports);
25
24
  tslib_1.__exportStar(require("./library/type-map"), exports);
26
25
  /* The shell builds the database and the schema from these two names; a module without them has no tables and no doors. */
27
- exports.entities = [figure_library_release_1.FigureLibraryRelease, figure_type_map_1.FigureTypeMap, figure_type_map_entry_1.FigureTypeMapEntry];
26
+ exports.entities = [figure_library_release_1.FigureLibraryRelease, figure_type_map_entry_1.FigureTypeMapEntry];
28
27
  exports.schema = { resolverClasses: [figure_library_resolver_1.FigureLibraryResolver] };
29
28
  //# sourceMappingURL=index.js.map
@@ -1 +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,6DAAkC;AAClC,+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/carriers'\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,4FAAsF;AACtF,mFAA4E;AAC5E,uEAAiE;AAEjE,0FAA+D;AAC/D,kFAAuD;AACvD,iEAAsC;AACtC,oEAAyC;AACzC,+DAAoC;AACpC,6DAAkC;AAClC,+DAAoC;AACpC,4DAAiC;AACjC,4DAAiC;AACjC,2DAAgC;AAChC,+DAAoC;AACpC,kEAAuC;AACvC,6DAAkC;AAElC,0HAA0H;AAC7G,QAAA,QAAQ,GAAG,CAAC,6CAAoB,EAAE,0CAAkB,CAAC,CAAA;AAErD,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 { 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-entry'\nexport * from './figure-library-types'\nexport * from './figure-library-resolver'\nexport * from './library/blueprints'\nexport * from './library/carriers'\nexport * from './library/board-walk'\nexport * from './library/derived'\nexport * from './library/figures'\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, FigureTypeMapEntry]\n\nexport const schema = { resolverClasses: [FigureLibraryResolver] }\n"]}
@@ -1,13 +1,8 @@
1
1
  import { EntityManager } from 'typeorm';
2
2
  import { Refusal } from '@things-factory/shell';
3
- import { FigureTypeMapState } from '../figure-type-map/figure-type-map';
4
3
  import { type LibraryFiles } from './library-files';
5
4
  export declare const FIGURE_BLUEPRINTS_MAX = 500;
6
5
  export interface BlueprintsAnswer {
7
- release: {
8
- version: number;
9
- revision: number;
10
- } | null;
11
6
  items: {
12
7
  type: string;
13
8
  ref: string;
@@ -20,9 +15,9 @@ export interface BlueprintsAnswer {
20
15
  }[];
21
16
  }
22
17
  /**
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.
18
+ * The batch door a board asks when it opens (ADR-0114 결정 9 · 13 · 14): every name answered from the domain's type
19
+ * map, an item under the name asked or a refusal with its cause. One refusal never removes another item.
25
20
  */
26
21
  export declare function blueprintsOf(tx: EntityManager, domain: {
27
22
  id: string;
28
- }, types: readonly string[], state: FigureTypeMapState.ACTIVE | FigureTypeMapState.CANDIDATE, speak: (refusal: Refusal) => string, files?: LibraryFiles): Promise<BlueprintsAnswer>;
23
+ }, types: readonly string[], speak: (refusal: Refusal) => string, files?: LibraryFiles): Promise<BlueprintsAnswer>;
@@ -8,17 +8,16 @@ const inspection_1 = require("./inspection");
8
8
  const type_map_1 = require("./type-map");
9
9
  exports.FIGURE_BLUEPRINTS_MAX = 500;
10
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.
11
+ * The batch door a board asks when it opens (ADR-0114 결정 9 · 13 · 14): every name answered from the domain's type
12
+ * map, an item under the name asked or a refusal with its cause. One refusal never removes another item.
13
13
  */
14
- async function blueprintsOf(tx, domain, types, state, speak, files) {
14
+ async function blueprintsOf(tx, domain, types, speak, files) {
15
15
  const names = [...new Set(types)];
16
16
  if (names.length > exports.FIGURE_BLUEPRINTS_MAX) {
17
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
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: [] };
19
+ const lines = new Map((await (0, type_map_1.linesOf)(tx, domain)).map(line => [line.name, line]));
20
+ const answer = { items: [], refused: [] };
22
21
  const refuse = (type, refusal) => answer.refused.push({ type, code: refusal.code, message: speak(refusal) });
23
22
  for (const type of names) {
24
23
  if (!(0, figure_model_1.parseFigureName)(type)) {
@@ -1 +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,EA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SAAQ;QACV,CAAC;QACD,IAAI,CAAC,MAAM,IAAA,6BAAgB,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC7D,MAAM,CAAC,IAAI,EAAE,IAAI,eAAO,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gDAAgD,CAAC,CAAC,CAAA;YACzI,SAAQ;QACV,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"]}
1
+ {"version":3,"file":"blueprints.js","sourceRoot":"","sources":["../../../server/service/library/blueprints.ts"],"names":[],"mappings":";;;AAoBA,oCA4CC;AA9DD,yDAAwD;AACxD,iDAA+C;AAE/C,6C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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 { dependencyFaults } from './inspection'\nimport { type LibraryFiles } from './library-files'\nimport { linesOf } from './type-map'\n\nexport const FIGURE_BLUEPRINTS_MAX = 500\n\nexport interface BlueprintsAnswer {\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 the domain's type\n * map, 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 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 lines = new Map((await linesOf(tx, domain)).map(line => [line.name, line]))\n\n const answer: BlueprintsAnswer = { 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"]}
@@ -1,19 +1,14 @@
1
1
  import { EntityManager } from 'typeorm';
2
2
  import { Refusal } from '@things-factory/shell';
3
3
  import { FigureLibraryRelease } from '../figure-library-release/figure-library-release';
4
- import { FigureTypeMap, FigureTypeMapState } from '../figure-type-map/figure-type-map';
5
4
  export declare const FIGURE_CARRIER_TYPES_MAX = 500;
6
- /** The lines of one map whose releases declare a carrier, by the CARRIERTYPE code they declare. */
5
+ /** The type map lines whose releases declare a carrier, by the CARRIERTYPE code they declare. */
7
6
  export interface CarrierLine {
8
7
  /** Full figure name {namespace}/{type}: the map's key, kept apart from the code. */
9
8
  name: string;
10
9
  release: FigureLibraryRelease;
11
10
  }
12
11
  export interface CarrierTypesAnswer {
13
- release: {
14
- version: number;
15
- revision: number;
16
- } | null;
17
12
  items: {
18
13
  carrierType: string;
19
14
  name: string;
@@ -31,13 +26,15 @@ export interface CarrierTypesAnswer {
31
26
  refs?: string[];
32
27
  }[];
33
28
  }
34
- /** Every carrier code the map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */
35
- export declare function carrierLinesOf(tx: EntityManager, map: FigureTypeMap): Promise<Map<string, CarrierLine[]>>;
29
+ /** Every carrier code the type map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */
30
+ export declare function carrierLinesOf(tx: EntityManager, domain: {
31
+ id: string;
32
+ }): Promise<Map<string, CarrierLine[]>>;
36
33
  /**
37
- * Carrier types live data names, answered from one type map release (ADR-0123): per code the release whose declaration
34
+ * Carrier types live data names, answered from the domain's type map (ADR-0123): per code the release whose declaration
38
35
  * names it and its physical size, or a refusal with its cause. A code two releases declare is never picked from; it is
39
- * refused as a conflict naming both. Without a map every code is refused for that.
36
+ * refused as a conflict naming both.
40
37
  */
41
38
  export declare function carrierTypesOf(tx: EntityManager, domain: {
42
39
  id: string;
43
- }, carrierTypes: readonly string[], state: FigureTypeMapState.ACTIVE | FigureTypeMapState.CANDIDATE, speak: (refusal: Refusal) => string): Promise<CarrierTypesAnswer>;
40
+ }, carrierTypes: readonly string[], speak: (refusal: Refusal) => string): Promise<CarrierTypesAnswer>;
@@ -8,10 +8,10 @@ const shell_1 = require("@things-factory/shell");
8
8
  const inspection_1 = require("./inspection");
9
9
  const type_map_1 = require("./type-map");
10
10
  exports.FIGURE_CARRIER_TYPES_MAX = 500;
11
- /** Every carrier code the map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */
12
- async function carrierLinesOf(tx, map) {
11
+ /** Every carrier code the type map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */
12
+ async function carrierLinesOf(tx, domain) {
13
13
  const byCode = new Map();
14
- for (const line of await (0, type_map_1.entriesOf)(tx, map)) {
14
+ for (const line of await (0, type_map_1.linesOf)(tx, domain)) {
15
15
  if (!line.release || line.release.deletedAt)
16
16
  continue;
17
17
  const release = await (0, inspection_1.freshen)(tx, line.release);
@@ -22,24 +22,18 @@ async function carrierLinesOf(tx, map) {
22
22
  return byCode;
23
23
  }
24
24
  /**
25
- * Carrier types live data names, answered from one type map release (ADR-0123): per code the release whose declaration
25
+ * Carrier types live data names, answered from the domain's type map (ADR-0123): per code the release whose declaration
26
26
  * names it and its physical size, or a refusal with its cause. A code two releases declare is never picked from; it is
27
- * refused as a conflict naming both. Without a map every code is refused for that.
27
+ * refused as a conflict naming both.
28
28
  */
29
- async function carrierTypesOf(tx, domain, carrierTypes, state, speak) {
29
+ async function carrierTypesOf(tx, domain, carrierTypes, speak) {
30
30
  const codes = [...new Set(carrierTypes.map(figure_model_1.normalizeCarrierType).filter(Boolean))];
31
31
  if (codes.length > exports.FIGURE_CARRIER_TYPES_MAX) {
32
32
  throw new shell_1.Refusal('figure-carrier-types-too-many', { count: codes.length, max: exports.FIGURE_CARRIER_TYPES_MAX }, 'at most {max} carrier types can be asked at once, not {count}.');
33
33
  }
34
- const map = await (0, type_map_1.mapOfState)(tx, domain, state);
35
- const answer = { release: map ? { version: map.version, revision: map.revision } : null, items: [], refused: [] };
34
+ const answer = { items: [], refused: [] };
36
35
  const refuse = (carrierType, refusal, refs) => answer.refused.push({ carrierType, code: refusal.code, message: speak(refusal), ...(refs ? { refs } : {}) });
37
- if (!map) {
38
- for (const carrierType of codes)
39
- refuse(carrierType, new shell_1.Refusal('figure-carrier-no-type-map', { carrierType }, 'this domain has no type map to find carrier type {carrierType} in.'));
40
- return answer;
41
- }
42
- const lines = await carrierLinesOf(tx, map);
36
+ const lines = await carrierLinesOf(tx, domain);
43
37
  for (const carrierType of codes) {
44
38
  const found = lines.get(carrierType) ?? [];
45
39
  if (!found.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"carriers.js","sourceRoot":"","sources":["../../../server/service/library/carriers.ts"],"names":[],"mappings":";;;AA0BA,wCASC;AAOD,wCA0CC;AAlFD,yDAA6D;AAC7D,iDAA+C;AAI/C,6CAAsC;AACtC,yCAAkD;AAErC,QAAA,wBAAwB,GAAG,GAAG,CAAA;AAe3C,kIAAkI;AAC3H,KAAK,UAAU,cAAc,CAAC,EAAiB,EAAE,GAAkB;IACxE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAA;IAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,IAAA,oBAAS,EAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS;YAAE,SAAQ;QACrD,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/C,IAAI,CAAC,OAAO,CAAC,WAAW;YAAE,SAAQ;QAClC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,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OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { EntityManager } from 'typeorm'\n\nimport { normalizeCarrierType } from '@hatiolab/figure-model'\nimport { Refusal } from '@things-factory/shell'\n\nimport { FigureLibraryRelease } from '../figure-library-release/figure-library-release'\nimport { FigureTypeMap, FigureTypeMapState } from '../figure-type-map/figure-type-map'\nimport { freshen } from './inspection'\nimport { entriesOf, mapOfState } from './type-map'\n\nexport const FIGURE_CARRIER_TYPES_MAX = 500\n\n/** The lines of one map whose releases declare a carrier, by the CARRIERTYPE code they declare. */\nexport interface CarrierLine {\n /** Full figure name {namespace}/{type}: the map's key, kept apart from the code. */\n name: string\n release: FigureLibraryRelease\n}\n\nexport interface CarrierTypesAnswer {\n release: { version: number; revision: number } | null\n items: { carrierType: string; name: string; ref: string; dimensions: { width: number; length: number; height: number } }[]\n refused: { carrierType: string; code: string; message: string; refs?: string[] }[]\n}\n\n/** Every carrier code the map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */\nexport async function carrierLinesOf(tx: EntityManager, map: FigureTypeMap): Promise<Map<string, CarrierLine[]>> {\n const byCode = new Map<string, CarrierLine[]>()\n for (const line of await entriesOf(tx, map)) {\n if (!line.release || line.release.deletedAt) continue\n const release = await freshen(tx, line.release)\n if (!release.carrierType) continue\n byCode.set(release.carrierType, [...(byCode.get(release.carrierType) ?? []), { name: line.name, release }])\n }\n return byCode\n}\n\n/**\n * Carrier types live data names, answered from one type map release (ADR-0123): per code the release whose declaration\n * names it and its physical size, or a refusal with its cause. A code two releases declare is never picked from; it is\n * refused as a conflict naming both. Without a map every code is refused for that.\n */\nexport async function carrierTypesOf(\n tx: EntityManager,\n domain: { id: string },\n carrierTypes: readonly string[],\n state: FigureTypeMapState.ACTIVE | FigureTypeMapState.CANDIDATE,\n speak: (refusal: Refusal) => string\n): Promise<CarrierTypesAnswer> {\n const codes = [...new Set(carrierTypes.map(normalizeCarrierType).filter(Boolean))]\n if (codes.length > FIGURE_CARRIER_TYPES_MAX) {\n throw new Refusal('figure-carrier-types-too-many', { count: codes.length, max: FIGURE_CARRIER_TYPES_MAX }, 'at most {max} carrier types can be asked at once, not {count}.')\n }\n const map = await mapOfState(tx, domain, state)\n const answer: CarrierTypesAnswer = { release: map ? { version: map.version, revision: map.revision } : null, items: [], refused: [] }\n const refuse = (carrierType: string, refusal: Refusal, refs?: string[]) =>\n answer.refused.push({ carrierType, code: refusal.code, message: speak(refusal), ...(refs ? { refs } : {}) })\n\n if (!map) {\n for (const carrierType of codes)\n refuse(carrierType, new Refusal('figure-carrier-no-type-map', { carrierType }, 'this domain has no type map to find carrier type {carrierType} in.'))\n return answer\n }\n\n const lines = await carrierLinesOf(tx, map)\n for (const carrierType of codes) {\n const found = lines.get(carrierType) ?? []\n if (!found.length) {\n refuse(carrierType, new Refusal('figure-carrier-not-in-type-map', { carrierType }, 'no figure in the type map is carrier type {carrierType}.'))\n continue\n }\n if (found.length > 1) {\n const refs = found.map(line => line.release.ref)\n refuse(\n carrierType,\n new Refusal('figure-carrier-conflict', { carrierType, refs: refs.join(', ') }, 'carrier type {carrierType} is declared by more than one figure in the type map: {refs}.'),\n refs\n )\n continue\n }\n const [{ name, release }] = found\n answer.items.push({ carrierType, name, ref: release.ref, dimensions: { ...release.carrierDimensions! } })\n }\n return answer\n}\n"]}
1
+ {"version":3,"file":"carriers.js","sourceRoot":"","sources":["../../../server/service/library/carriers.ts"],"names":[],"mappings":";;;AAwBA,wCASC;AAOD,wCAkCC;AAxED,yDAA6D;AAC7D,iDAA+C;AAG/C,6CAAsC;AACtC,yCAAoC;AAEvB,QAAA,wBAAwB,GAAG,GAAG,CAAA;AAc3C,uIAAuI;AAChI,KAAK,UAAU,cAAc,CAAC,EAAiB,EAAE,MAAsB;IAC5E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAA;IAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,IAAA,kBAAO,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;QAC7C,IAAI,CAA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AI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAE9G,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC9C,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;QAC1C,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,CAAC,WAAW,EAAE,IAAI,eAAO,CAAC,gCAAgC,EAAE,EAAE,WAAW,EAAE,EAAE,0DAA0D,CAAC,CAAC,CAAA;YAC/I,SAAQ;QACV,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAChD,MAAM,CACJ,WAAW,EACX,IAAI,eAAO,CAAC,yBAAyB,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,yFAAyF,CAAC,EACzK,IAAI,CACL,CAAA;YACD,SAAQ;QACV,CAAC;QACD,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAA;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAkB,EAAE,EAAE,CAAC,CAAA;IAC3G,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { EntityManager } from 'typeorm'\n\nimport { normalizeCarrierType } from '@hatiolab/figure-model'\nimport { Refusal } from '@things-factory/shell'\n\nimport { FigureLibraryRelease } from '../figure-library-release/figure-library-release'\nimport { freshen } from './inspection'\nimport { linesOf } from './type-map'\n\nexport const FIGURE_CARRIER_TYPES_MAX = 500\n\n/** The type map lines whose releases declare a carrier, by the CARRIERTYPE code they declare. */\nexport interface CarrierLine {\n /** Full figure name {namespace}/{type}: the map's key, kept apart from the code. */\n name: string\n release: FigureLibraryRelease\n}\n\nexport interface CarrierTypesAnswer {\n items: { carrierType: string; name: string; ref: string; dimensions: { width: number; length: number; height: number } }[]\n refused: { carrierType: string; code: string; message: string; refs?: string[] }[]\n}\n\n/** Every carrier code the type map's releases declare, with the lines that declare it. A code on more lines than one is a conflict. */\nexport async function carrierLinesOf(tx: EntityManager, domain: { id: string }): Promise<Map<string, CarrierLine[]>> {\n const byCode = new Map<string, CarrierLine[]>()\n for (const line of await linesOf(tx, domain)) {\n if (!line.release || line.release.deletedAt) continue\n const release = await freshen(tx, line.release)\n if (!release.carrierType) continue\n byCode.set(release.carrierType, [...(byCode.get(release.carrierType) ?? []), { name: line.name, release }])\n }\n return byCode\n}\n\n/**\n * Carrier types live data names, answered from the domain's type map (ADR-0123): per code the release whose declaration\n * names it and its physical size, or a refusal with its cause. A code two releases declare is never picked from; it is\n * refused as a conflict naming both.\n */\nexport async function carrierTypesOf(\n tx: EntityManager,\n domain: { id: string },\n carrierTypes: readonly string[],\n speak: (refusal: Refusal) => string\n): Promise<CarrierTypesAnswer> {\n const codes = [...new Set(carrierTypes.map(normalizeCarrierType).filter(Boolean))]\n if (codes.length > FIGURE_CARRIER_TYPES_MAX) {\n throw new Refusal('figure-carrier-types-too-many', { count: codes.length, max: FIGURE_CARRIER_TYPES_MAX }, 'at most {max} carrier types can be asked at once, not {count}.')\n }\n const answer: CarrierTypesAnswer = { items: [], refused: [] }\n const refuse = (carrierType: string, refusal: Refusal, refs?: string[]) =>\n answer.refused.push({ carrierType, code: refusal.code, message: speak(refusal), ...(refs ? { refs } : {}) })\n\n const lines = await carrierLinesOf(tx, domain)\n for (const carrierType of codes) {\n const found = lines.get(carrierType) ?? []\n if (!found.length) {\n refuse(carrierType, new Refusal('figure-carrier-not-in-type-map', { carrierType }, 'no figure in the type map is carrier type {carrierType}.'))\n continue\n }\n if (found.length > 1) {\n const refs = found.map(line => line.release.ref)\n refuse(\n carrierType,\n new Refusal('figure-carrier-conflict', { carrierType, refs: refs.join(', ') }, 'carrier type {carrierType} is declared by more than one figure in the type map: {refs}.'),\n refs\n )\n continue\n }\n const [{ name, release }] = found\n answer.items.push({ carrierType, name, ref: release.ref, dimensions: { ...release.carrierDimensions! } })\n }\n return answer\n}\n"]}
@@ -1,9 +1,11 @@
1
- /** What this server derives from a release's source: whether its kernel reads it, its authored size, and its carrier declaration. */
1
+ /** What this server derives from a release's source: whether its kernel reads it, its authored size, its capabilities and its carrier declaration. */
2
2
  export interface DerivedOfSource {
3
3
  formatSupported: boolean;
4
4
  checkedKernel: string;
5
5
  width: number | null;
6
6
  depth: number | null;
7
+ /** The roles of the places the source declares (`document.capabilities.bindings[].role`: seat, grip), [] for none. Null when unread. */
8
+ capabilities: string[] | null;
7
9
  /** The CARRIERTYPE code a carrier figure declares (ADR-0123), as compared. Null when it declares none or is unread. */
8
10
  carrierType: string | null;
9
11
  /** Its physical size in mm, as declared. Null with `carrierType`. */
@@ -14,8 +16,8 @@ export interface DerivedOfSource {
14
16
  } | null;
15
17
  }
16
18
  /**
17
- * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size and
18
- * the carrier declaration are then unknown, never guessed.
19
+ * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size,
20
+ * the capabilities and the carrier declaration are then unknown, never guessed.
19
21
  */
20
22
  export declare function derivedOfSource(source: string): DerivedOfSource;
21
23
  /** Whether a row's derived values were made by another kernel than this server's and must be made again. */
@@ -4,8 +4,8 @@ exports.derivedOfSource = derivedOfSource;
4
4
  exports.derivedIsStale = derivedIsStale;
5
5
  const figure_model_1 = require("@hatiolab/figure-model");
6
6
  /**
7
- * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size and
8
- * the carrier declaration are then unknown, never guessed.
7
+ * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size,
8
+ * the capabilities and the carrier declaration are then unknown, never guessed.
9
9
  */
10
10
  function derivedOfSource(source) {
11
11
  try {
@@ -18,12 +18,13 @@ function derivedOfSource(source) {
18
18
  checkedKernel: figure_model_1.FIGURE_KERNEL_VERSION,
19
19
  width,
20
20
  depth,
21
+ capabilities: [...new Set(asset.document.capabilities.bindings.map(binding => binding.role))].sort(),
21
22
  carrierType: carrier?.type ?? null,
22
23
  carrierDimensions: carrier ? { ...carrier.dimensions } : null
23
24
  };
24
25
  }
25
26
  catch {
26
- return { formatSupported: false, checkedKernel: figure_model_1.FIGURE_KERNEL_VERSION, width: null, depth: null, carrierType: null, carrierDimensions: null };
27
+ return { formatSupported: false, checkedKernel: figure_model_1.FIGURE_KERNEL_VERSION, width: null, depth: null, capabilities: null, carrierType: null, carrierDimensions: null };
27
28
  }
28
29
  }
29
30
  /** Whether a row's derived values were made by another kernel than this server's and must be made again. */
@@ -1 +1 @@
1
- {"version":3,"file":"derived.js","sourceRoot":"","sources":["../../../server/service/library/derived.ts"],"names":[],"mappings":";;AAkBA,0CAiBC;AAGD,wCAEC;AAxCD,yDAA2J;AAc3J;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,+BAAgB,EAAC,MAAM,CAAC,CAAA;QACtC,IAAA,iCAAkB,EAAC,KAAK,CAAC,CAAA;QACzB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,IAAI,CAAA;QACrC,OAAO;YACL,eAAe,EAAE,IAAI;YACrB,aAAa,EAAE,oCAAqB;YACpC,K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,CAAA;IAClF,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACvD,MAAM,IAAI,GAAG,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAClG,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACrF,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC3E,CAAC","sourcesContent":["import { compileFigureAsset, FIGURE_KERNEL_VERSION, FIGURE_SIZE_INPUTS, figureTopViewOf, parseFigureAsset, type FigureAsset } from '@hatiolab/figure-model'\n\n/** What this server derives from a release's source: whether its kernel reads it, its authored size, and its carrier declaration. */\nexport interface DerivedOfSource {\n formatSupported: boolean\n checkedKernel: string\n width: number | null\n depth: number | null\n /** The CARRIERTYPE code a carrier figure declares (ADR-0123), as compared. Null when it declares none or is unread. */\n carrierType: string | null\n /** Its physical size in mm, as declared. Null with `carrierType`. */\n carrierDimensions: { width: number; length: number; height: number } | null\n}\n\n/**\n * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size and\n * the carrier declaration are then unknown, never guessed.\n */\nexport function derivedOfSource(source: string): DerivedOfSource {\n try {\n const asset = parseFigureAsset(source)\n compileFigureAsset(asset)\n const { width, depth } = authoredPlanOf(asset)\n const carrier = asset.carrier ?? null\n return {\n formatSupported: true,\n checkedKernel: FIGURE_KERNEL_VERSION,\n width,\n depth,\n carrierType: carrier?.type ?? null,\n carrierDimensions: carrier ? { ...carrier.dimensions } : null\n }\n } catch {\n return { formatSupported: false, checkedKernel: FIGURE_KERNEL_VERSION, width: null, depth: null, carrierType: null, carrierDimensions: null }\n }\n}\n\n/** Whether a row's derived values were made by another kernel than this server's and must be made again. */\nexport function derivedIsStale(row: { checkedKernel?: string | null }): boolean {\n return row.checkedKernel !== FIGURE_KERNEL_VERSION\n}\n\n/**\n * The plan size a figure is placed at: its size inputs when it declares them (what the scene scales against), else the\n * extent of its top view at the authored size.\n */\nfunction authoredPlanOf(asset: FigureAsset): { width: number | null; depth: number | null } {\n const input = (axis: 'x' | 'z') => {\n const value = asset.designInputs?.[FIGURE_SIZE_INPUTS[axis]]\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null\n }\n const width = input('x')\n const depth = input('z')\n if (width !== null && depth !== null) return { width, depth }\n\n const points = figureTopViewOf(asset, null).shapes.flatMap(shape => shape.outline)\n if (!points.length) return { width: null, depth: null }\n const span = (i: 0 | 1) => Math.max(...points.map(p => p[i])) - Math.min(...points.map(p => p[i]))\n const round = (value: number) => (value > 0 ? Math.round(value * 1000) / 1000 : null)\n return { width: width ?? round(span(0)), depth: depth ?? round(span(1)) }\n}\n"]}
1
+ {"version":3,"file":"derived.js","sourceRoot":"","sources":["../../../server/service/library/derived.ts"],"names":[],"mappings":";;AAoBA,0CAkBC;AAGD,wCAEC;AA3CD,yDAA2J;AAgB3J;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,+BAAgB,EAAC,MAAM,CAAC,CAAA;QACtC,IAAA,iCAAkB,EAAC,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["import { compileFigureAsset, FIGURE_KERNEL_VERSION, FIGURE_SIZE_INPUTS, figureTopViewOf, parseFigureAsset, type FigureAsset } from '@hatiolab/figure-model'\n\n/** What this server derives from a release's source: whether its kernel reads it, its authored size, its capabilities and its carrier declaration. */\nexport interface DerivedOfSource {\n formatSupported: boolean\n checkedKernel: string\n width: number | null\n depth: number | null\n /** The roles of the places the source declares (`document.capabilities.bindings[].role`: seat, grip), [] for none. Null when unread. */\n capabilities: string[] | null\n /** The CARRIERTYPE code a carrier figure declares (ADR-0123), as compared. Null when it declares none or is unread. */\n carrierType: string | null\n /** Its physical size in mm, as declared. Null with `carrierType`. */\n carrierDimensions: { width: number; length: number; height: number } | null\n}\n\n/**\n * Reads a source with this server's kernel. A source it cannot read is kept (ADR-0114 결정 5) and marked; the size,\n * the capabilities and the carrier declaration are then unknown, never guessed.\n */\nexport function derivedOfSource(source: string): DerivedOfSource {\n try {\n const asset = parseFigureAsset(source)\n compileFigureAsset(asset)\n const { width, depth } = authoredPlanOf(asset)\n const carrier = asset.carrier ?? null\n return {\n formatSupported: true,\n checkedKernel: FIGURE_KERNEL_VERSION,\n width,\n depth,\n capabilities: [...new Set(asset.document.capabilities.bindings.map(binding => binding.role))].sort(),\n carrierType: carrier?.type ?? null,\n carrierDimensions: carrier ? { ...carrier.dimensions } : null\n }\n } catch {\n return { formatSupported: false, checkedKernel: FIGURE_KERNEL_VERSION, width: null, depth: null, capabilities: null, carrierType: null, carrierDimensions: null }\n }\n}\n\n/** Whether a row's derived values were made by another kernel than this server's and must be made again. */\nexport function derivedIsStale(row: { checkedKernel?: string | null }): boolean {\n return row.checkedKernel !== FIGURE_KERNEL_VERSION\n}\n\n/**\n * The plan size a figure is placed at: its size inputs when it declares them (what the scene scales against), else the\n * extent of its top view at the authored size.\n */\nfunction authoredPlanOf(asset: FigureAsset): { width: number | null; depth: number | null } {\n const input = (axis: 'x' | 'z') => {\n const value = asset.designInputs?.[FIGURE_SIZE_INPUTS[axis]]\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null\n }\n const width = input('x')\n const depth = input('z')\n if (width !== null && depth !== null) return { width, depth }\n\n const points = figureTopViewOf(asset, null).shapes.flatMap(shape => shape.outline)\n if (!points.length) return { width: null, depth: null }\n const span = (i: 0 | 1) => Math.max(...points.map(p => p[i])) - Math.min(...points.map(p => p[i]))\n const round = (value: number) => (value > 0 ? Math.round(value * 1000) / 1000 : null)\n return { width: width ?? round(span(0)), depth: depth ?? round(span(1)) }\n}\n"]}