@things-factory/figure-service 10.1.3

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 (50) hide show
  1. package/README.md +34 -0
  2. package/dist-server/index.d.ts +2 -0
  3. package/dist-server/index.js +6 -0
  4. package/dist-server/index.js.map +1 -0
  5. package/dist-server/migrations/index.d.ts +1 -0
  6. package/dist-server/migrations/index.js +12 -0
  7. package/dist-server/migrations/index.js.map +1 -0
  8. package/dist-server/service/figure/figure-mutation.d.ts +19 -0
  9. package/dist-server/service/figure/figure-mutation.js +171 -0
  10. package/dist-server/service/figure/figure-mutation.js.map +1 -0
  11. package/dist-server/service/figure/figure-propose-type.d.ts +43 -0
  12. package/dist-server/service/figure/figure-propose-type.js +89 -0
  13. package/dist-server/service/figure/figure-propose-type.js.map +1 -0
  14. package/dist-server/service/figure/figure-propose.d.ts +67 -0
  15. package/dist-server/service/figure/figure-propose.js +213 -0
  16. package/dist-server/service/figure/figure-propose.js.map +1 -0
  17. package/dist-server/service/figure/figure-query.d.ts +16 -0
  18. package/dist-server/service/figure/figure-query.js +77 -0
  19. package/dist-server/service/figure/figure-query.js.map +1 -0
  20. package/dist-server/service/figure/figure-source.d.ts +45 -0
  21. package/dist-server/service/figure/figure-source.js +53 -0
  22. package/dist-server/service/figure/figure-source.js.map +1 -0
  23. package/dist-server/service/figure/figure-type.d.ts +57 -0
  24. package/dist-server/service/figure/figure-type.js +149 -0
  25. package/dist-server/service/figure/figure-type.js.map +1 -0
  26. package/dist-server/service/figure/figure.d.ts +71 -0
  27. package/dist-server/service/figure/figure.js +160 -0
  28. package/dist-server/service/figure/figure.js.map +1 -0
  29. package/dist-server/service/figure/index.d.ts +5 -0
  30. package/dist-server/service/figure/index.js +9 -0
  31. package/dist-server/service/figure/index.js.map +1 -0
  32. package/dist-server/service/index.d.ts +5 -0
  33. package/dist-server/service/index.js +13 -0
  34. package/dist-server/service/index.js.map +1 -0
  35. package/package.json +33 -0
  36. package/server/index.ts +2 -0
  37. package/server/migrations/index.ts +9 -0
  38. package/server/service/figure/figure-mutation.ts +163 -0
  39. package/server/service/figure/figure-propose-type.ts +74 -0
  40. package/server/service/figure/figure-propose.test.ts +164 -0
  41. package/server/service/figure/figure-propose.ts +271 -0
  42. package/server/service/figure/figure-query.ts +60 -0
  43. package/server/service/figure/figure-source.test.ts +129 -0
  44. package/server/service/figure/figure-source.ts +87 -0
  45. package/server/service/figure/figure-type.ts +108 -0
  46. package/server/service/figure/figure.ts +168 -0
  47. package/server/service/figure/index.ts +6 -0
  48. package/server/service/index.ts +10 -0
  49. package/things-factory.config.js +1 -0
  50. package/tsconfig.json +14 -0
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FigureSaveResult = exports.FigureFinding = exports.FigureList = exports.FigurePatch = exports.NewFigure = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const figure_js_1 = require("./figure.js");
7
+ /**
8
+ * 새 Figure.
9
+ *
10
+ * `score`·`triangles`·`groups` 는 **받지 않는다.** 서버가 `source` 에서 계산한다 —
11
+ * 받으면 거짓이 들어오고 목록이 실물과 다른 것을 보여 준다.
12
+ */
13
+ let NewFigure = class NewFigure {
14
+ };
15
+ exports.NewFigure = NewFigure;
16
+ tslib_1.__decorate([
17
+ (0, type_graphql_1.Field)({ description: 'Component type name. Immutable once created, unique per domain.' }),
18
+ tslib_1.__metadata("design:type", String)
19
+ ], NewFigure.prototype, "type", void 0);
20
+ tslib_1.__decorate([
21
+ (0, type_graphql_1.Field)({ description: 'Display name shown to authors.' }),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], NewFigure.prototype, "name", void 0);
24
+ tslib_1.__decorate([
25
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the figure.' }),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], NewFigure.prototype, "description", void 0);
28
+ tslib_1.__decorate([
29
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Classification code used to group figures in the palette.' }),
30
+ tslib_1.__metadata("design:type", String)
31
+ ], NewFigure.prototype, "category", void 0);
32
+ tslib_1.__decorate([
33
+ (0, type_graphql_1.Field)({ description: 'The canonical FigureSource JSON.' }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], NewFigure.prototype, "source", void 0);
36
+ tslib_1.__decorate([
37
+ (0, type_graphql_1.Field)({ nullable: true, description: 'JSON definition of the master-data fields an instance carries.' }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], NewFigure.prototype, "properties", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)({ nullable: true, description: "Lifecycle state — defaults to 'draft'." }),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], NewFigure.prototype, "state", void 0);
44
+ tslib_1.__decorate([
45
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A base64 encoded thumbnail image.' }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], NewFigure.prototype, "thumbnail", void 0);
48
+ exports.NewFigure = NewFigure = tslib_1.__decorate([
49
+ (0, type_graphql_1.InputType)({ description: 'Input for creating a new figure.' })
50
+ ], NewFigure);
51
+ /**
52
+ * 수정.
53
+ *
54
+ * `type` 이 없다. **저장되는 식별자라 고칠 수 없다** — 바꾸면 이미 배치된 보드가
55
+ * 타입을 못 찾아 오류 없이 빈 화면이 된다. 고칠 수 있는 이름은 `name` 뿐이다.
56
+ */
57
+ let FigurePatch = class FigurePatch {
58
+ };
59
+ exports.FigurePatch = FigurePatch;
60
+ tslib_1.__decorate([
61
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new display name.' }),
62
+ tslib_1.__metadata("design:type", String)
63
+ ], FigurePatch.prototype, "name", void 0);
64
+ tslib_1.__decorate([
65
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new description.' }),
66
+ tslib_1.__metadata("design:type", String)
67
+ ], FigurePatch.prototype, "description", void 0);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new classification code.' }),
70
+ tslib_1.__metadata("design:type", String)
71
+ ], FigurePatch.prototype, "category", void 0);
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new FigureSource JSON.' }),
74
+ tslib_1.__metadata("design:type", String)
75
+ ], FigurePatch.prototype, "source", void 0);
76
+ tslib_1.__decorate([
77
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new master-data field definition.' }),
78
+ tslib_1.__metadata("design:type", String)
79
+ ], FigurePatch.prototype, "properties", void 0);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new lifecycle state.' }),
82
+ tslib_1.__metadata("design:type", String)
83
+ ], FigurePatch.prototype, "state", void 0);
84
+ tslib_1.__decorate([
85
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A base64 encoded thumbnail image.' }),
86
+ tslib_1.__metadata("design:type", String)
87
+ ], FigurePatch.prototype, "thumbnail", void 0);
88
+ exports.FigurePatch = FigurePatch = tslib_1.__decorate([
89
+ (0, type_graphql_1.InputType)({ description: 'Input for updating an existing figure. The `type` field is absent by design — it is a stored identifier.' })
90
+ ], FigurePatch);
91
+ let FigureList = class FigureList {
92
+ };
93
+ exports.FigureList = FigureList;
94
+ tslib_1.__decorate([
95
+ (0, type_graphql_1.Field)(type => [figure_js_1.Figure], { description: 'The figures on this page.' }),
96
+ tslib_1.__metadata("design:type", Array)
97
+ ], FigureList.prototype, "items", void 0);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Total number of figures matching the query.' }),
100
+ tslib_1.__metadata("design:type", Number)
101
+ ], FigureList.prototype, "total", void 0);
102
+ exports.FigureList = FigureList = tslib_1.__decorate([
103
+ (0, type_graphql_1.ObjectType)({ description: 'A paginated list of figures.' })
104
+ ], FigureList);
105
+ /**
106
+ * 검증 결과 한 줄.
107
+ *
108
+ * 정본 형식의 검증은 `@hatiolab/figure-model` 이 두 단계로 나눈다 — `errors` 는
109
+ * 막고, `violations` 는 알린다. 그 경계를 서버가 다시 정하지 않는다.
110
+ */
111
+ let FigureFinding = class FigureFinding {
112
+ };
113
+ exports.FigureFinding = FigureFinding;
114
+ tslib_1.__decorate([
115
+ (0, type_graphql_1.Field)({ description: 'Stable code from figure-model (ERROR_CODES / VIOLATION_CODES).' }),
116
+ tslib_1.__metadata("design:type", String)
117
+ ], FigureFinding.prototype, "code", void 0);
118
+ tslib_1.__decorate([
119
+ (0, type_graphql_1.Field)({ description: 'Human-readable message.' }),
120
+ tslib_1.__metadata("design:type", String)
121
+ ], FigureFinding.prototype, "message", void 0);
122
+ tslib_1.__decorate([
123
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Path within the source that the finding points at.' }),
124
+ tslib_1.__metadata("design:type", String)
125
+ ], FigureFinding.prototype, "at", void 0);
126
+ exports.FigureFinding = FigureFinding = tslib_1.__decorate([
127
+ (0, type_graphql_1.ObjectType)({ description: 'One validation finding from figure-model.' })
128
+ ], FigureFinding);
129
+ /**
130
+ * 저장 결과.
131
+ *
132
+ * `violations` 가 있어도 저장은 된다 — 막는 것과 알리는 것을 가른다. 화면이
133
+ * 이것을 그대로 보여 줘야 한다. 조용히 버리면 저작자가 모른다.
134
+ */
135
+ let FigureSaveResult = class FigureSaveResult {
136
+ };
137
+ exports.FigureSaveResult = FigureSaveResult;
138
+ tslib_1.__decorate([
139
+ (0, type_graphql_1.Field)(type => figure_js_1.Figure, { description: 'The saved figure.' }),
140
+ tslib_1.__metadata("design:type", figure_js_1.Figure)
141
+ ], FigureSaveResult.prototype, "figure", void 0);
142
+ tslib_1.__decorate([
143
+ (0, type_graphql_1.Field)(type => [FigureFinding], { description: 'Non-blocking findings. The save succeeded despite these.' }),
144
+ tslib_1.__metadata("design:type", Array)
145
+ ], FigureSaveResult.prototype, "violations", void 0);
146
+ exports.FigureSaveResult = FigureSaveResult = tslib_1.__decorate([
147
+ (0, type_graphql_1.ObjectType)({ description: 'Result of saving a figure, carrying non-blocking violations.' })
148
+ ], FigureSaveResult);
149
+ //# sourceMappingURL=figure-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-type.js","sourceRoot":"","sources":["../../../server/service/figure/figure-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAEhE,2CAAoC;AAEpC;;;;;GAKG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;CAwBrB,CAAA;AAxBY,8BAAS;AAEpB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,iEAAiE,EAAE,CAAC;;uCAC9E;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;uCAC7C;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;8CAC7D;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;;2CACnF;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;yCAC7C;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gEAAgE,EAAE,CAAC;;6CACtF;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;wCACrD;AAG5B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;4CAC1D;oBAvBP,SAAS;IADrB,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;GAClD,SAAS,CAwBrB;AAED;;;;;GAKG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;CAqBvB,CAAA;AArBY,kCA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;;;;GAKG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;CASzB,CAAA;AATY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,gEAAgE,EAAE,CAAC;;2CAC7E;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;;8CACnC;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;;yCAClF;wBARA,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;GAC5D,aAAa,CASzB;AAED;;;;;GAKG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;sCACpD,kBAAM;gDAAA;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;;oDACjF;2BALhB,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;GAC/E,gBAAgB,CAM5B","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { Figure } from './figure.js'\n\n/**\n * 새 Figure.\n *\n * `score`·`triangles`·`groups` 는 **받지 않는다.** 서버가 `source` 에서 계산한다 —\n * 받으면 거짓이 들어오고 목록이 실물과 다른 것을 보여 준다.\n */\n@InputType({ description: 'Input for creating a new figure.' })\nexport class NewFigure {\n @Field({ description: 'Component type name. Immutable once created, unique per domain.' })\n type: string\n\n @Field({ description: 'Display name shown to authors.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette.' })\n category?: string\n\n @Field({ description: 'The canonical FigureSource JSON.' })\n source: string\n\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance carries.' })\n properties?: string\n\n @Field({ nullable: true, description: \"Lifecycle state — defaults to 'draft'.\" })\n state?: 'draft' | 'released'\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n}\n\n/**\n * 수정.\n *\n * `type` 이 없다. **저장되는 식별자라 고칠 수 없다** — 바꾸면 이미 배치된 보드가\n * 타입을 못 찾아 오류 없이 빈 화면이 된다. 고칠 수 있는 이름은 `name` 뿐이다.\n */\n@InputType({ description: 'Input for updating an existing figure. The `type` field is absent by design — it is a stored identifier.' })\nexport class FigurePatch {\n @Field({ nullable: true, description: 'The new display name.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description.' })\n description?: string\n\n @Field({ nullable: true, description: 'The new classification code.' })\n category?: string\n\n @Field({ nullable: true, description: 'The new FigureSource JSON.' })\n source?: string\n\n @Field({ nullable: true, description: 'The new master-data field definition.' })\n properties?: string\n\n @Field({ nullable: true, description: 'The new lifecycle state.' })\n state?: 'draft' | 'released'\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n}\n\n@ObjectType({ description: 'A paginated list of figures.' })\nexport class FigureList {\n @Field(type => [Figure], { description: 'The figures on this page.' })\n items: Figure[]\n\n @Field(type => Int, { description: 'Total number of figures matching the query.' })\n total: number\n}\n\n/**\n * 검증 결과 한 줄.\n *\n * 정본 형식의 검증은 `@hatiolab/figure-model` 이 두 단계로 나눈다 — `errors` 는\n * 막고, `violations` 는 알린다. 그 경계를 서버가 다시 정하지 않는다.\n */\n@ObjectType({ description: 'One validation finding from figure-model.' })\nexport class FigureFinding {\n @Field({ description: 'Stable code from figure-model (ERROR_CODES / VIOLATION_CODES).' })\n code: string\n\n @Field({ description: 'Human-readable message.' })\n message: string\n\n @Field({ nullable: true, description: 'Path within the source that the finding points at.' })\n at?: string\n}\n\n/**\n * 저장 결과.\n *\n * `violations` 가 있어도 저장은 된다 — 막는 것과 알리는 것을 가른다. 화면이\n * 이것을 그대로 보여 줘야 한다. 조용히 버리면 저작자가 모른다.\n */\n@ObjectType({ description: 'Result of saving a figure, carrying non-blocking violations.' })\nexport class FigureSaveResult {\n @Field(type => Figure, { description: 'The saved figure.' })\n figure: Figure\n\n @Field(type => [FigureFinding], { description: 'Non-blocking findings. The save succeeded despite these.' })\n violations: FigureFinding[]\n}\n"]}
@@ -0,0 +1,71 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain } from '@things-factory/shell';
3
+ /**
4
+ * Figure — 저작된 3D 컴포넌트 한 종류.
5
+ *
6
+ * `Board` 를 준용한다. 다른 점만 주석으로 적는다.
7
+ *
8
+ * ## 무엇을 담나 — `FigureSource` 다, 씬 모델이 아니다
9
+ *
10
+ * 정본 형식은 `@hatiolab/figure-model` 이 정한다(`FigureSource`). 씬 컴포넌트 트리를
11
+ * 담지 않는다. 담으면 저작도구가 씬 편집기가 되고, 부품 이름·상태 슬롯·애니메이션
12
+ * 자리가 형식에 없어 따로 관리해야 한다.
13
+ *
14
+ * 청사진(`FigureBlueprint`)은 **저장하지 않는다.** 정본에서 파생되는 캐시이므로
15
+ * 소비하는 쪽이 `compile()` 로 만든다. 저장하면 정본과 갈린다.
16
+ *
17
+ * 그래서 `baseWidth`·`anchor`·`statusSlots`·`parts`·`animations` 같은 것을 컬럼으로
18
+ * 두지 않는다 — 전부 `source` 안에 이미 있는 자리다. 두 벌이면 갈린다.
19
+ *
20
+ * 설계: `docs/design/figure-modules.md` §2
21
+ */
22
+ export declare class Figure {
23
+ readonly id?: string;
24
+ version?: number;
25
+ domain?: Domain;
26
+ domainId?: string;
27
+ /**
28
+ * 컴포넌트 타입 이름. **저장되는 식별자다.**
29
+ *
30
+ * 배치된 보드가 이 이름으로 타입을 찾는다. 바꾸면 그 보드는 타입을 못 찾아
31
+ * **오류 없이 빈 화면**이 된다. 그래서 만들 때 정하고 잠근다 — 고칠 수 있는 것은
32
+ * 표시 이름(`name`)뿐이다. 수정 리졸버가 이 필드를 받지 않는다.
33
+ *
34
+ * `Board.type`(main/sub/popup)과 뜻이 전혀 다르다. 혼동하지 않는다.
35
+ */
36
+ type?: string;
37
+ name?: string;
38
+ description?: string;
39
+ /** 분류 코드. 팔레트에서 묶어 보이는 기준. */
40
+ category?: string;
41
+ state?: 'draft' | 'released';
42
+ /**
43
+ * `FigureSource` JSON.
44
+ *
45
+ * `Board.model` 자리이지만 이름을 바꿨다 — 「씬 모델이 아니다」를 필드 이름이
46
+ * 드러내야 한다.
47
+ */
48
+ source?: string;
49
+ /** 재활용 점수 0~100. `scoreOf()` 가 계산한다. */
50
+ score?: number;
51
+ /** 삼각형 수. `costOf()` 가 계산한다. */
52
+ triangles?: number;
53
+ /** 재질 묶음 수 — 인스턴스당 draw call 의 근거. */
54
+ groups?: number;
55
+ /** 기준정보 항목 정의. Figure 를 배치할 때 인스턴스가 채우는 자리. */
56
+ properties?: string;
57
+ thumbnail?: string;
58
+ /**
59
+ * 썸네일이 **썸네일로서** 마지막으로 갱신된 시각. `updatedAt` 과는 별개 도메인이다 —
60
+ * 이름·설명만 고쳤을 때는 갱신되지 않는다. `Board` 와 같은 방식.
61
+ */
62
+ thumbnailUpdatedAt?: Date;
63
+ sortOrder?: number;
64
+ createdAt?: Date;
65
+ updatedAt?: Date;
66
+ deletedAt?: Date;
67
+ creator?: User;
68
+ creatorId?: string;
69
+ updater?: User;
70
+ updaterId?: string;
71
+ }
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Figure = 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
+ /**
10
+ * Figure — 저작된 3D 컴포넌트 한 종류.
11
+ *
12
+ * `Board` 를 준용한다. 다른 점만 주석으로 적는다.
13
+ *
14
+ * ## 무엇을 담나 — `FigureSource` 다, 씬 모델이 아니다
15
+ *
16
+ * 정본 형식은 `@hatiolab/figure-model` 이 정한다(`FigureSource`). 씬 컴포넌트 트리를
17
+ * 담지 않는다. 담으면 저작도구가 씬 편집기가 되고, 부품 이름·상태 슬롯·애니메이션
18
+ * 자리가 형식에 없어 따로 관리해야 한다.
19
+ *
20
+ * 청사진(`FigureBlueprint`)은 **저장하지 않는다.** 정본에서 파생되는 캐시이므로
21
+ * 소비하는 쪽이 `compile()` 로 만든다. 저장하면 정본과 갈린다.
22
+ *
23
+ * 그래서 `baseWidth`·`anchor`·`statusSlots`·`parts`·`animations` 같은 것을 컬럼으로
24
+ * 두지 않는다 — 전부 `source` 안에 이미 있는 자리다. 두 벌이면 갈린다.
25
+ *
26
+ * 설계: `docs/design/figure-modules.md` §2
27
+ */
28
+ let Figure = class Figure {
29
+ constructor() {
30
+ this.version = 1;
31
+ }
32
+ };
33
+ exports.Figure = Figure;
34
+ tslib_1.__decorate([
35
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
36
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'Unique identifier for the figure.' }),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], Figure.prototype, "id", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.Column)({ nullable: true, default: 1 }),
41
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Revision counter, incremented on each save.' }),
42
+ tslib_1.__metadata("design:type", Number)
43
+ ], Figure.prototype, "version", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
46
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain this figure belongs to.' }),
47
+ tslib_1.__metadata("design:type", shell_1.Domain)
48
+ ], Figure.prototype, "domain", void 0);
49
+ tslib_1.__decorate([
50
+ (0, typeorm_1.RelationId)((figure) => figure.domain),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], Figure.prototype, "domainId", void 0);
53
+ tslib_1.__decorate([
54
+ (0, typeorm_1.Column)(),
55
+ (0, type_graphql_1.Field)({ description: 'Component type name. A stored identifier — unique per domain and immutable once created.' }),
56
+ tslib_1.__metadata("design:type", String)
57
+ ], Figure.prototype, "type", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.Column)(),
60
+ (0, type_graphql_1.Field)({ description: 'Display name shown to authors. Safe to rename.' }),
61
+ tslib_1.__metadata("design:type", String)
62
+ ], Figure.prototype, "name", void 0);
63
+ tslib_1.__decorate([
64
+ (0, typeorm_1.Column)({ nullable: true }),
65
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the figure.' }),
66
+ tslib_1.__metadata("design:type", String)
67
+ ], Figure.prototype, "description", void 0);
68
+ tslib_1.__decorate([
69
+ (0, typeorm_1.Column)({ nullable: true }),
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Classification code used to group figures in the palette.' }),
71
+ tslib_1.__metadata("design:type", String)
72
+ ], Figure.prototype, "category", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.Column)({ nullable: true, default: 'draft' }),
75
+ (0, type_graphql_1.Field)({ nullable: true, description: "Lifecycle state — 'draft' figures do not appear in the board palette." }),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], Figure.prototype, "state", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.Column)({ nullable: true, ...(0, shell_1.longTextColumn)() }),
80
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The canonical FigureSource JSON authored by the modeller.' }),
81
+ tslib_1.__metadata("design:type", String)
82
+ ], Figure.prototype, "source", void 0);
83
+ tslib_1.__decorate([
84
+ (0, typeorm_1.Column)({ type: 'float', nullable: true }),
85
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Reuse score 0-100, computed from source on save.' }),
86
+ tslib_1.__metadata("design:type", Number)
87
+ ], Figure.prototype, "score", void 0);
88
+ tslib_1.__decorate([
89
+ (0, typeorm_1.Column)({ nullable: true }),
90
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Triangle count, computed from source on save.' }),
91
+ tslib_1.__metadata("design:type", Number)
92
+ ], Figure.prototype, "triangles", void 0);
93
+ tslib_1.__decorate([
94
+ (0, typeorm_1.Column)({ nullable: true }),
95
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Material group count — the basis of per-instance draw calls.' }),
96
+ tslib_1.__metadata("design:type", Number)
97
+ ], Figure.prototype, "groups", void 0);
98
+ tslib_1.__decorate([
99
+ (0, typeorm_1.Column)({ nullable: true, ...(0, shell_1.longTextColumn)() }),
100
+ (0, type_graphql_1.Field)({ nullable: true, description: 'JSON definition of the master-data fields an instance of this figure carries.' }),
101
+ tslib_1.__metadata("design:type", String)
102
+ ], Figure.prototype, "properties", void 0);
103
+ tslib_1.__decorate([
104
+ (0, typeorm_1.Column)({ nullable: true, ...(0, shell_1.longTextColumn)() }),
105
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A base64 encoded thumbnail image of the figure.' }),
106
+ tslib_1.__metadata("design:type", String)
107
+ ], Figure.prototype, "thumbnail", void 0);
108
+ tslib_1.__decorate([
109
+ (0, typeorm_1.Column)({ nullable: true }),
110
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp of the last thumbnail generation. Separate lifecycle from updatedAt.' }),
111
+ tslib_1.__metadata("design:type", Date)
112
+ ], Figure.prototype, "thumbnailUpdatedAt", void 0);
113
+ tslib_1.__decorate([
114
+ (0, typeorm_1.Column)({ type: 'float', nullable: true, default: 0 }),
115
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Sort order within a listing.' }),
116
+ tslib_1.__metadata("design:type", Number)
117
+ ], Figure.prototype, "sortOrder", void 0);
118
+ tslib_1.__decorate([
119
+ (0, typeorm_1.CreateDateColumn)(),
120
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Creation timestamp.' }),
121
+ tslib_1.__metadata("design:type", Date)
122
+ ], Figure.prototype, "createdAt", void 0);
123
+ tslib_1.__decorate([
124
+ (0, typeorm_1.UpdateDateColumn)(),
125
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Last update timestamp.' }),
126
+ tslib_1.__metadata("design:type", Date)
127
+ ], Figure.prototype, "updatedAt", void 0);
128
+ tslib_1.__decorate([
129
+ (0, typeorm_1.DeleteDateColumn)(),
130
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Soft-delete timestamp.' }),
131
+ tslib_1.__metadata("design:type", Date)
132
+ ], Figure.prototype, "deletedAt", void 0);
133
+ tslib_1.__decorate([
134
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
135
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created this figure.' }),
136
+ tslib_1.__metadata("design:type", auth_base_1.User)
137
+ ], Figure.prototype, "creator", void 0);
138
+ tslib_1.__decorate([
139
+ (0, typeorm_1.RelationId)((figure) => figure.creator),
140
+ tslib_1.__metadata("design:type", String)
141
+ ], Figure.prototype, "creatorId", void 0);
142
+ tslib_1.__decorate([
143
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
144
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated this figure.' }),
145
+ tslib_1.__metadata("design:type", auth_base_1.User)
146
+ ], Figure.prototype, "updater", void 0);
147
+ tslib_1.__decorate([
148
+ (0, typeorm_1.RelationId)((figure) => figure.updater),
149
+ tslib_1.__metadata("design:type", String)
150
+ ], Figure.prototype, "updaterId", void 0);
151
+ exports.Figure = Figure = tslib_1.__decorate([
152
+ (0, typeorm_1.Entity)(),
153
+ (0, typeorm_1.Index)('ix_figure_1', (figure) => [figure.domain, figure.type], {
154
+ unique: true,
155
+ where: '"deleted_at" IS NULL'
156
+ }),
157
+ (0, typeorm_1.Index)('ix_figure_2', (figure) => [figure.domain, figure.category]),
158
+ (0, type_graphql_1.ObjectType)({ description: 'An authored 3D component type — the canonical FigureSource plus its metadata.' })
159
+ ], Figure);
160
+ //# sourceMappingURL=figure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure.js","sourceRoot":"","sources":["../../../server/service/figure/figure.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAgE;AAEhE,yDAAgD;AAChD,iDAA8D;AAE9D;;;;;;;;;;;;;;;;;;GAkBG;AAQI,IAAM,MAAM,GAAZ,MAAM,MAAM;IAAZ;QAOL,YAAO,GAAY,CAAC,CAAA;IAsHtB,CAAC;CAAA,CAAA;AA7HY,wBAAM;AAGR;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;kCACpE;AAIpB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;;uCAC/E;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,oCAAoC,EAAE,CAAC;sCACpF,cAAM;sCAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;;wCAC7B;AAajB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA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AAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,eAAK,EAAC,aAAa,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1E,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;GAChG,MAAM,CA6HlB","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, Float, ID, Int, ObjectType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, longTextColumn } from '@things-factory/shell'\n\n/**\n * Figure — 저작된 3D 컴포넌트 한 종류.\n *\n * `Board` 를 준용한다. 다른 점만 주석으로 적는다.\n *\n * ## 무엇을 담나 — `FigureSource` 다, 씬 모델이 아니다\n *\n * 정본 형식은 `@hatiolab/figure-model` 이 정한다(`FigureSource`). 씬 컴포넌트 트리를\n * 담지 않는다. 담으면 저작도구가 씬 편집기가 되고, 부품 이름·상태 슬롯·애니메이션\n * 자리가 형식에 없어 따로 관리해야 한다.\n *\n * 청사진(`FigureBlueprint`)은 **저장하지 않는다.** 정본에서 파생되는 캐시이므로\n * 소비하는 쪽이 `compile()` 로 만든다. 저장하면 정본과 갈린다.\n *\n * 그래서 `baseWidth`·`anchor`·`statusSlots`·`parts`·`animations` 같은 것을 컬럼으로\n * 두지 않는다 — 전부 `source` 안에 이미 있는 자리다. 두 벌이면 갈린다.\n *\n * 설계: `docs/design/figure-modules.md` §2\n */\n@Entity()\n@Index('ix_figure_1', (figure: Figure) => [figure.domain, figure.type], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@Index('ix_figure_2', (figure: Figure) => [figure.domain, figure.category])\n@ObjectType({ description: 'An authored 3D component type — the canonical FigureSource plus its metadata.' })\nexport class Figure {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { nullable: true, description: 'Unique identifier for the figure.' })\n readonly id?: string\n\n @Column({ nullable: true, default: 1 })\n @Field(type => Int, { nullable: true, description: 'Revision counter, incremented on each save.' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain this figure belongs to.' })\n domain?: Domain\n\n @RelationId((figure: Figure) => figure.domain)\n domainId?: string\n\n /**\n * 컴포넌트 타입 이름. **저장되는 식별자다.**\n *\n * 배치된 보드가 이 이름으로 타입을 찾는다. 바꾸면 그 보드는 타입을 못 찾아\n * **오류 없이 빈 화면**이 된다. 그래서 만들 때 정하고 잠근다 — 고칠 수 있는 것은\n * 표시 이름(`name`)뿐이다. 수정 리졸버가 이 필드를 받지 않는다.\n *\n * `Board.type`(main/sub/popup)과 뜻이 전혀 다르다. 혼동하지 않는다.\n */\n @Column()\n @Field({ description: 'Component type name. A stored identifier — unique per domain and immutable once created.' })\n type?: string\n\n @Column()\n @Field({ description: 'Display name shown to authors. Safe to rename.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n /** 분류 코드. 팔레트에서 묶어 보이는 기준. */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette.' })\n category?: string\n\n @Column({ nullable: true, default: 'draft' })\n @Field({ nullable: true, description: \"Lifecycle state — 'draft' figures do not appear in the board palette.\" })\n state?: 'draft' | 'released'\n\n /**\n * `FigureSource` JSON.\n *\n * `Board.model` 자리이지만 이름을 바꿨다 — 「씬 모델이 아니다」를 필드 이름이\n * 드러내야 한다.\n */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The canonical FigureSource JSON authored by the modeller.' })\n source?: string\n\n // ── 파생값 — 저장하는 이유가 하나뿐이다 ──────────────────────────────────\n //\n // 셋 다 `source` 에서 계산된다. 그런데도 컬럼으로 두는 이유는 **목록 화면이\n // 정렬·필터를 해야** 하기 때문이다. JSON 을 파싱해 정렬할 수는 없다.\n //\n // 저장할 때 `figure-model` 로 계산해 채운다. **클라이언트가 준 값을 받지 않는다** —\n // 받으면 거짓이 들어오고, 목록이 실물과 다른 것을 보여 준다.\n\n /** 재활용 점수 0~100. `scoreOf()` 가 계산한다. */\n @Column({ type: 'float', nullable: true })\n @Field(type => Float, { nullable: true, description: 'Reuse score 0-100, computed from source on save.' })\n score?: number\n\n /** 삼각형 수. `costOf()` 가 계산한다. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Triangle count, computed from source on save.' })\n triangles?: number\n\n /** 재질 묶음 수 — 인스턴스당 draw call 의 근거. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Material group count — the basis of per-instance draw calls.' })\n groups?: number\n\n /** 기준정보 항목 정의. Figure 를 배치할 때 인스턴스가 채우는 자리. */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance of this figure carries.' })\n properties?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image of the figure.' })\n thumbnail?: string\n\n /**\n * 썸네일이 **썸네일로서** 마지막으로 갱신된 시각. `updatedAt` 과는 별개 도메인이다 —\n * 이름·설명만 고쳤을 때는 갱신되지 않는다. `Board` 와 같은 방식.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Timestamp of the last thumbnail generation. Separate lifecycle from updatedAt.' })\n thumbnailUpdatedAt?: Date\n\n @Column({ type: 'float', nullable: true, default: 0 })\n @Field(type => Float, { nullable: true, description: 'Sort order within a listing.' })\n sortOrder?: number\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 this figure.' })\n creator?: User\n\n @RelationId((figure: Figure) => figure.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated this figure.' })\n updater?: User\n\n @RelationId((figure: Figure) => figure.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { Figure } from './figure.js';
2
+ import { FigureQuery } from './figure-query.js';
3
+ import { FigureMutation } from './figure-mutation.js';
4
+ export declare const entities: (typeof Figure)[];
5
+ export declare const resolvers: (typeof FigureQuery | typeof FigureMutation)[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const figure_js_1 = require("./figure.js");
5
+ const figure_query_js_1 = require("./figure-query.js");
6
+ const figure_mutation_js_1 = require("./figure-mutation.js");
7
+ exports.entities = [figure_js_1.Figure];
8
+ exports.resolvers = [figure_query_js_1.FigureQuery, figure_mutation_js_1.FigureMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/figure/index.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AACpC,uDAA+C;AAC/C,6DAAqD;AAExC,QAAA,QAAQ,GAAG,CAAC,kBAAM,CAAC,CAAA;AACnB,QAAA,SAAS,GAAG,CAAC,6BAAW,EAAE,mCAAc,CAAC,CAAA","sourcesContent":["import { Figure } from './figure.js'\nimport { FigureQuery } from './figure-query.js'\nimport { FigureMutation } from './figure-mutation.js'\n\nexport const entities = [Figure]\nexport const resolvers = [FigureQuery, FigureMutation]\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './figure/figure.js';
2
+ export * from './figure/figure-type.js';
3
+ export * from './figure/figure-source.js';
4
+ export declare const entities: typeof import("./figure/figure.js").Figure[];
5
+ export declare const resolvers: (typeof import("./figure/figure-query.js").FigureQuery | typeof import("./figure/figure-mutation.js").FigureMutation)[];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Entity types
6
+ tslib_1.__exportStar(require("./figure/figure.js"), exports);
7
+ tslib_1.__exportStar(require("./figure/figure-type.js"), exports);
8
+ tslib_1.__exportStar(require("./figure/figure-source.js"), exports);
9
+ // Entities, resolvers
10
+ const index_js_1 = require("./figure/index.js");
11
+ exports.entities = [...index_js_1.entities];
12
+ exports.resolvers = [...index_js_1.resolvers];
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,eAAe;AACf,6DAAkC;AAClC,kEAAuC;AACvC,oEAAyC;AAEzC,sBAAsB;AACtB,gDAA4F;AAE/E,QAAA,QAAQ,GAAG,CAAC,GAAG,mBAAc,CAAC,CAAA;AAC9B,QAAA,SAAS,GAAG,CAAC,GAAG,oBAAe,CAAC,CAAA","sourcesContent":["// Entity types\nexport * from './figure/figure.js'\nexport * from './figure/figure-type.js'\nexport * from './figure/figure-source.js'\n\n// Entities, resolvers\nimport { entities as FigureEntities, resolvers as FigureResolvers } from './figure/index.js'\n\nexport const entities = [...FigureEntities]\nexport const resolvers = [...FigureResolvers]\n"]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@things-factory/figure-service",
3
+ "version": "10.1.3",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "@things-factory:registry": "https://registry.npmjs.org"
7
+ },
8
+ "description": "Figure 저작 결과의 저장·검증·조회. 컴포넌트 저작도구의 서버 몫.",
9
+ "main": "dist-server/index.js",
10
+ "things-factory": true,
11
+ "author": "",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/hatiolab/things-factory.git",
16
+ "directory": "packages/board-service"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run clean:server && tsc --p tsconfig.json",
20
+ "build:server": "npm run clean:server && tsc",
21
+ "clean:server": "rm -rf dist-server",
22
+ "clean": "npm run clean:server",
23
+ "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
24
+ },
25
+ "dependencies": {
26
+ "@hatiolab/figure-model": "^0.1.12",
27
+ "@things-factory/ai-client-base": "^10.1.3",
28
+ "@things-factory/auth-base": "^10.1.3",
29
+ "@things-factory/env": "^10.1.3",
30
+ "graphql-upload": "^15.0.2"
31
+ },
32
+ "gitHead": "8407b1e9d1f47f6676af144d4a33c8ac01cb49c4"
33
+ }
@@ -0,0 +1,2 @@
1
+ export * from './service/index.js'
2
+ export * from './migrations/index.js'
@@ -0,0 +1,9 @@
1
+ const glob = require('glob')
2
+ const path = require('path')
3
+
4
+ export var migrations = []
5
+
6
+ glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
7
+ if (file.indexOf('index.js') !== -1) return
8
+ migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
9
+ })