@msbci/form-server 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +68 -7
- package/dist/index.d.ts +68 -7
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -17
- package/src/prisma/schema.prisma +71 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PrismaClient } from '../generated/prisma';
|
|
2
|
-
import {
|
|
2
|
+
import { IFormDefinition } from '@msbci/form-core';
|
|
3
3
|
export { IFormDefinition, IFormPage, IFormRoster, IFormVariable } from '@msbci/form-core';
|
|
4
|
+
import { z } from 'zod';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Auth middleware — injectable hook for the host application.
|
|
@@ -159,6 +160,7 @@ declare class FormService {
|
|
|
159
160
|
version: string;
|
|
160
161
|
isPublished: boolean;
|
|
161
162
|
formTypeId: string | null;
|
|
163
|
+
scopeId: string | null;
|
|
162
164
|
createdBy: string | null;
|
|
163
165
|
updatedBy: string | null;
|
|
164
166
|
})[];
|
|
@@ -187,7 +189,9 @@ declare class FormService {
|
|
|
187
189
|
conditions: string | null;
|
|
188
190
|
options: string | null;
|
|
189
191
|
pageId: string | null;
|
|
192
|
+
templateOverrides: string | null;
|
|
190
193
|
type: string;
|
|
194
|
+
rosterId: string | null;
|
|
191
195
|
isRequired: boolean;
|
|
192
196
|
isReadonly: boolean;
|
|
193
197
|
isHidden: boolean;
|
|
@@ -198,7 +202,7 @@ declare class FormService {
|
|
|
198
202
|
dataSourceId: string | null;
|
|
199
203
|
dataSourceDependencies: string | null;
|
|
200
204
|
style: string | null;
|
|
201
|
-
|
|
205
|
+
templateId: string | null;
|
|
202
206
|
}[];
|
|
203
207
|
rosters: ({
|
|
204
208
|
variables: {
|
|
@@ -213,7 +217,9 @@ declare class FormService {
|
|
|
213
217
|
conditions: string | null;
|
|
214
218
|
options: string | null;
|
|
215
219
|
pageId: string | null;
|
|
220
|
+
templateOverrides: string | null;
|
|
216
221
|
type: string;
|
|
222
|
+
rosterId: string | null;
|
|
217
223
|
isRequired: boolean;
|
|
218
224
|
isReadonly: boolean;
|
|
219
225
|
isHidden: boolean;
|
|
@@ -224,7 +230,7 @@ declare class FormService {
|
|
|
224
230
|
dataSourceId: string | null;
|
|
225
231
|
dataSourceDependencies: string | null;
|
|
226
232
|
style: string | null;
|
|
227
|
-
|
|
233
|
+
templateId: string | null;
|
|
228
234
|
}[];
|
|
229
235
|
} & {
|
|
230
236
|
id: string;
|
|
@@ -268,6 +274,7 @@ declare class FormService {
|
|
|
268
274
|
version: string;
|
|
269
275
|
isPublished: boolean;
|
|
270
276
|
formTypeId: string | null;
|
|
277
|
+
scopeId: string | null;
|
|
271
278
|
createdBy: string | null;
|
|
272
279
|
updatedBy: string | null;
|
|
273
280
|
}>;
|
|
@@ -279,6 +286,7 @@ declare class FormService {
|
|
|
279
286
|
isPublished?: boolean;
|
|
280
287
|
tenantId?: string;
|
|
281
288
|
formTypeId?: string;
|
|
289
|
+
scopeId?: string;
|
|
282
290
|
metadata?: Record<string, unknown>;
|
|
283
291
|
}, ctx?: IRequestContext): Promise<{
|
|
284
292
|
id: string;
|
|
@@ -292,6 +300,7 @@ declare class FormService {
|
|
|
292
300
|
version: string;
|
|
293
301
|
isPublished: boolean;
|
|
294
302
|
formTypeId: string | null;
|
|
303
|
+
scopeId: string | null;
|
|
295
304
|
createdBy: string | null;
|
|
296
305
|
updatedBy: string | null;
|
|
297
306
|
}>;
|
|
@@ -302,6 +311,7 @@ declare class FormService {
|
|
|
302
311
|
version: string;
|
|
303
312
|
isPublished: boolean;
|
|
304
313
|
formTypeId: string;
|
|
314
|
+
scopeId: string;
|
|
305
315
|
metadata: Record<string, unknown>;
|
|
306
316
|
}>, ctx?: IRequestContext): Promise<{
|
|
307
317
|
id: string;
|
|
@@ -315,9 +325,17 @@ declare class FormService {
|
|
|
315
325
|
version: string;
|
|
316
326
|
isPublished: boolean;
|
|
317
327
|
formTypeId: string | null;
|
|
328
|
+
scopeId: string | null;
|
|
318
329
|
createdBy: string | null;
|
|
319
330
|
updatedBy: string | null;
|
|
320
331
|
}>;
|
|
332
|
+
/**
|
|
333
|
+
* Load a form by id and return it as a fully-resolved `IFormDefinition`
|
|
334
|
+
* (templates applied — Option B). Used by `GET /forms/:id/resolved` and
|
|
335
|
+
* `exportForm`. The original DB-include shape is still available via
|
|
336
|
+
* {@link getFormDefinition}.
|
|
337
|
+
*/
|
|
338
|
+
getResolvedFormDefinition(id: string): Promise<IFormDefinition>;
|
|
321
339
|
deleteFormDefinition(id: string): Promise<{
|
|
322
340
|
id: string;
|
|
323
341
|
code: string;
|
|
@@ -330,6 +348,7 @@ declare class FormService {
|
|
|
330
348
|
version: string;
|
|
331
349
|
isPublished: boolean;
|
|
332
350
|
formTypeId: string | null;
|
|
351
|
+
scopeId: string | null;
|
|
333
352
|
createdBy: string | null;
|
|
334
353
|
updatedBy: string | null;
|
|
335
354
|
}>;
|
|
@@ -484,6 +503,8 @@ declare class FormService {
|
|
|
484
503
|
dataSourceDependencies?: Record<string, string>;
|
|
485
504
|
style?: unknown;
|
|
486
505
|
metadata?: Record<string, unknown>;
|
|
506
|
+
templateId?: string;
|
|
507
|
+
templateOverrides?: Record<string, unknown>;
|
|
487
508
|
}): Promise<{
|
|
488
509
|
id: string;
|
|
489
510
|
code: string;
|
|
@@ -496,7 +517,9 @@ declare class FormService {
|
|
|
496
517
|
conditions: string | null;
|
|
497
518
|
options: string | null;
|
|
498
519
|
pageId: string | null;
|
|
520
|
+
templateOverrides: string | null;
|
|
499
521
|
type: string;
|
|
522
|
+
rosterId: string | null;
|
|
500
523
|
isRequired: boolean;
|
|
501
524
|
isReadonly: boolean;
|
|
502
525
|
isHidden: boolean;
|
|
@@ -507,7 +530,7 @@ declare class FormService {
|
|
|
507
530
|
dataSourceId: string | null;
|
|
508
531
|
dataSourceDependencies: string | null;
|
|
509
532
|
style: string | null;
|
|
510
|
-
|
|
533
|
+
templateId: string | null;
|
|
511
534
|
}>;
|
|
512
535
|
updateFormVariable(id: string, data: Partial<{
|
|
513
536
|
code: string;
|
|
@@ -528,6 +551,8 @@ declare class FormService {
|
|
|
528
551
|
dataSourceDependencies: Record<string, string>;
|
|
529
552
|
style: unknown;
|
|
530
553
|
metadata: Record<string, unknown>;
|
|
554
|
+
templateId: string | null;
|
|
555
|
+
templateOverrides: Record<string, unknown> | null;
|
|
531
556
|
}>): Promise<{
|
|
532
557
|
id: string;
|
|
533
558
|
code: string;
|
|
@@ -540,7 +565,9 @@ declare class FormService {
|
|
|
540
565
|
conditions: string | null;
|
|
541
566
|
options: string | null;
|
|
542
567
|
pageId: string | null;
|
|
568
|
+
templateOverrides: string | null;
|
|
543
569
|
type: string;
|
|
570
|
+
rosterId: string | null;
|
|
544
571
|
isRequired: boolean;
|
|
545
572
|
isReadonly: boolean;
|
|
546
573
|
isHidden: boolean;
|
|
@@ -551,7 +578,7 @@ declare class FormService {
|
|
|
551
578
|
dataSourceId: string | null;
|
|
552
579
|
dataSourceDependencies: string | null;
|
|
553
580
|
style: string | null;
|
|
554
|
-
|
|
581
|
+
templateId: string | null;
|
|
555
582
|
}>;
|
|
556
583
|
deleteFormVariable(id: string): Promise<{
|
|
557
584
|
id: string;
|
|
@@ -565,7 +592,9 @@ declare class FormService {
|
|
|
565
592
|
conditions: string | null;
|
|
566
593
|
options: string | null;
|
|
567
594
|
pageId: string | null;
|
|
595
|
+
templateOverrides: string | null;
|
|
568
596
|
type: string;
|
|
597
|
+
rosterId: string | null;
|
|
569
598
|
isRequired: boolean;
|
|
570
599
|
isReadonly: boolean;
|
|
571
600
|
isHidden: boolean;
|
|
@@ -576,7 +605,7 @@ declare class FormService {
|
|
|
576
605
|
dataSourceId: string | null;
|
|
577
606
|
dataSourceDependencies: string | null;
|
|
578
607
|
style: string | null;
|
|
579
|
-
|
|
608
|
+
templateId: string | null;
|
|
580
609
|
}>;
|
|
581
610
|
getSubmissions(params: {
|
|
582
611
|
formId: string;
|
|
@@ -654,9 +683,23 @@ declare class FormService {
|
|
|
654
683
|
importForm(json: string, tenantId?: string): Promise<string>;
|
|
655
684
|
/** Extract variable data for createFormVariable (omit `id` to let Prisma generate it) */
|
|
656
685
|
private extractVariableData;
|
|
657
|
-
/**
|
|
686
|
+
/**
|
|
687
|
+
* Convert a Prisma DB result to a fully-resolved `IFormDefinition`.
|
|
688
|
+
*
|
|
689
|
+
* Templates referenced by `IFormVariable.templateId` are loaded in a
|
|
690
|
+
* single batch and applied via `resolveFormTemplates` (Option B —
|
|
691
|
+
* in-memory only, no mutation in DB). Pass `resolveTemplates = false`
|
|
692
|
+
* to obtain the raw shape (useful for editor tooling that wants to
|
|
693
|
+
* preserve `templateOverrides`).
|
|
694
|
+
*/
|
|
658
695
|
private dbToFormDefinition;
|
|
659
696
|
private dbToVariable;
|
|
697
|
+
/**
|
|
698
|
+
* Convert a Prisma VariableTemplate row to the domain type. Duplicated
|
|
699
|
+
* locally (kept in sync with `ScopeService.dbToTemplate`) to avoid an
|
|
700
|
+
* import cycle between the two services.
|
|
701
|
+
*/
|
|
702
|
+
private dbToTemplate;
|
|
660
703
|
}
|
|
661
704
|
|
|
662
705
|
/**
|
|
@@ -730,6 +773,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
730
773
|
isPublished: z.ZodDefault<z.ZodBoolean>;
|
|
731
774
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
732
775
|
formTypeId: z.ZodOptional<z.ZodString>;
|
|
776
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
733
777
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
734
778
|
}, "strip", z.ZodTypeAny, {
|
|
735
779
|
code: string;
|
|
@@ -740,6 +784,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
740
784
|
metadata?: Record<string, unknown> | undefined;
|
|
741
785
|
tenantId?: string | undefined;
|
|
742
786
|
formTypeId?: string | undefined;
|
|
787
|
+
scopeId?: string | undefined;
|
|
743
788
|
}, {
|
|
744
789
|
code: string;
|
|
745
790
|
name: string;
|
|
@@ -749,6 +794,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
749
794
|
version?: string | undefined;
|
|
750
795
|
isPublished?: boolean | undefined;
|
|
751
796
|
formTypeId?: string | undefined;
|
|
797
|
+
scopeId?: string | undefined;
|
|
752
798
|
}>;
|
|
753
799
|
declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
754
800
|
code: z.ZodOptional<z.ZodString>;
|
|
@@ -758,6 +804,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
758
804
|
isPublished: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
759
805
|
tenantId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
760
806
|
formTypeId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
807
|
+
scopeId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
761
808
|
metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
762
809
|
}, "strip", z.ZodTypeAny, {
|
|
763
810
|
code?: string | undefined;
|
|
@@ -768,6 +815,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
768
815
|
version?: string | undefined;
|
|
769
816
|
isPublished?: boolean | undefined;
|
|
770
817
|
formTypeId?: string | undefined;
|
|
818
|
+
scopeId?: string | undefined;
|
|
771
819
|
}, {
|
|
772
820
|
code?: string | undefined;
|
|
773
821
|
name?: string | undefined;
|
|
@@ -777,6 +825,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
777
825
|
version?: string | undefined;
|
|
778
826
|
isPublished?: boolean | undefined;
|
|
779
827
|
formTypeId?: string | undefined;
|
|
828
|
+
scopeId?: string | undefined;
|
|
780
829
|
}>;
|
|
781
830
|
declare const createFormPageSchema: z.ZodObject<{
|
|
782
831
|
code: z.ZodString;
|
|
@@ -985,6 +1034,8 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
985
1034
|
dataSourceDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
986
1035
|
style: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
987
1036
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1037
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
1038
|
+
templateOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
988
1039
|
}, "strip", z.ZodTypeAny, {
|
|
989
1040
|
code: string;
|
|
990
1041
|
name: string;
|
|
@@ -1001,6 +1052,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1001
1052
|
metadata?: Record<string, unknown> | undefined;
|
|
1002
1053
|
value?: unknown;
|
|
1003
1054
|
}[] | undefined;
|
|
1055
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1004
1056
|
defaultValue?: unknown;
|
|
1005
1057
|
placeholder?: string | undefined;
|
|
1006
1058
|
validationRules?: {
|
|
@@ -1012,6 +1064,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1012
1064
|
dataSourceId?: string | undefined;
|
|
1013
1065
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1014
1066
|
style?: Record<string, unknown> | undefined;
|
|
1067
|
+
templateId?: string | undefined;
|
|
1015
1068
|
}, {
|
|
1016
1069
|
code: string;
|
|
1017
1070
|
name: string;
|
|
@@ -1025,6 +1078,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1025
1078
|
metadata?: Record<string, unknown> | undefined;
|
|
1026
1079
|
value?: unknown;
|
|
1027
1080
|
}[] | undefined;
|
|
1081
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1028
1082
|
isRequired?: boolean | undefined;
|
|
1029
1083
|
isReadonly?: boolean | undefined;
|
|
1030
1084
|
isHidden?: boolean | undefined;
|
|
@@ -1039,6 +1093,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1039
1093
|
dataSourceId?: string | undefined;
|
|
1040
1094
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1041
1095
|
style?: Record<string, unknown> | undefined;
|
|
1096
|
+
templateId?: string | undefined;
|
|
1042
1097
|
}>;
|
|
1043
1098
|
declare const updateFormVariableSchema: z.ZodObject<{
|
|
1044
1099
|
code: z.ZodOptional<z.ZodString>;
|
|
@@ -1083,6 +1138,8 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1083
1138
|
dataSourceDependencies: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
1084
1139
|
style: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1085
1140
|
metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1141
|
+
templateId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1142
|
+
templateOverrides: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1086
1143
|
}, "strip", z.ZodTypeAny, {
|
|
1087
1144
|
code?: string | undefined;
|
|
1088
1145
|
name?: string | undefined;
|
|
@@ -1095,6 +1152,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1095
1152
|
metadata?: Record<string, unknown> | undefined;
|
|
1096
1153
|
value?: unknown;
|
|
1097
1154
|
}[] | undefined;
|
|
1155
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1098
1156
|
type?: string | undefined;
|
|
1099
1157
|
isRequired?: boolean | undefined;
|
|
1100
1158
|
isReadonly?: boolean | undefined;
|
|
@@ -1110,6 +1168,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1110
1168
|
dataSourceId?: string | undefined;
|
|
1111
1169
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1112
1170
|
style?: Record<string, unknown> | undefined;
|
|
1171
|
+
templateId?: string | undefined;
|
|
1113
1172
|
}, {
|
|
1114
1173
|
code?: string | undefined;
|
|
1115
1174
|
name?: string | undefined;
|
|
@@ -1122,6 +1181,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1122
1181
|
metadata?: Record<string, unknown> | undefined;
|
|
1123
1182
|
value?: unknown;
|
|
1124
1183
|
}[] | undefined;
|
|
1184
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1125
1185
|
type?: string | undefined;
|
|
1126
1186
|
isRequired?: boolean | undefined;
|
|
1127
1187
|
isReadonly?: boolean | undefined;
|
|
@@ -1137,6 +1197,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1137
1197
|
dataSourceId?: string | undefined;
|
|
1138
1198
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1139
1199
|
style?: Record<string, unknown> | undefined;
|
|
1200
|
+
templateId?: string | undefined;
|
|
1140
1201
|
}>;
|
|
1141
1202
|
declare const createSubmissionSchema: z.ZodObject<{
|
|
1142
1203
|
formId: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PrismaClient } from '../generated/prisma';
|
|
2
|
-
import {
|
|
2
|
+
import { IFormDefinition } from '@msbci/form-core';
|
|
3
3
|
export { IFormDefinition, IFormPage, IFormRoster, IFormVariable } from '@msbci/form-core';
|
|
4
|
+
import { z } from 'zod';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Auth middleware — injectable hook for the host application.
|
|
@@ -159,6 +160,7 @@ declare class FormService {
|
|
|
159
160
|
version: string;
|
|
160
161
|
isPublished: boolean;
|
|
161
162
|
formTypeId: string | null;
|
|
163
|
+
scopeId: string | null;
|
|
162
164
|
createdBy: string | null;
|
|
163
165
|
updatedBy: string | null;
|
|
164
166
|
})[];
|
|
@@ -187,7 +189,9 @@ declare class FormService {
|
|
|
187
189
|
conditions: string | null;
|
|
188
190
|
options: string | null;
|
|
189
191
|
pageId: string | null;
|
|
192
|
+
templateOverrides: string | null;
|
|
190
193
|
type: string;
|
|
194
|
+
rosterId: string | null;
|
|
191
195
|
isRequired: boolean;
|
|
192
196
|
isReadonly: boolean;
|
|
193
197
|
isHidden: boolean;
|
|
@@ -198,7 +202,7 @@ declare class FormService {
|
|
|
198
202
|
dataSourceId: string | null;
|
|
199
203
|
dataSourceDependencies: string | null;
|
|
200
204
|
style: string | null;
|
|
201
|
-
|
|
205
|
+
templateId: string | null;
|
|
202
206
|
}[];
|
|
203
207
|
rosters: ({
|
|
204
208
|
variables: {
|
|
@@ -213,7 +217,9 @@ declare class FormService {
|
|
|
213
217
|
conditions: string | null;
|
|
214
218
|
options: string | null;
|
|
215
219
|
pageId: string | null;
|
|
220
|
+
templateOverrides: string | null;
|
|
216
221
|
type: string;
|
|
222
|
+
rosterId: string | null;
|
|
217
223
|
isRequired: boolean;
|
|
218
224
|
isReadonly: boolean;
|
|
219
225
|
isHidden: boolean;
|
|
@@ -224,7 +230,7 @@ declare class FormService {
|
|
|
224
230
|
dataSourceId: string | null;
|
|
225
231
|
dataSourceDependencies: string | null;
|
|
226
232
|
style: string | null;
|
|
227
|
-
|
|
233
|
+
templateId: string | null;
|
|
228
234
|
}[];
|
|
229
235
|
} & {
|
|
230
236
|
id: string;
|
|
@@ -268,6 +274,7 @@ declare class FormService {
|
|
|
268
274
|
version: string;
|
|
269
275
|
isPublished: boolean;
|
|
270
276
|
formTypeId: string | null;
|
|
277
|
+
scopeId: string | null;
|
|
271
278
|
createdBy: string | null;
|
|
272
279
|
updatedBy: string | null;
|
|
273
280
|
}>;
|
|
@@ -279,6 +286,7 @@ declare class FormService {
|
|
|
279
286
|
isPublished?: boolean;
|
|
280
287
|
tenantId?: string;
|
|
281
288
|
formTypeId?: string;
|
|
289
|
+
scopeId?: string;
|
|
282
290
|
metadata?: Record<string, unknown>;
|
|
283
291
|
}, ctx?: IRequestContext): Promise<{
|
|
284
292
|
id: string;
|
|
@@ -292,6 +300,7 @@ declare class FormService {
|
|
|
292
300
|
version: string;
|
|
293
301
|
isPublished: boolean;
|
|
294
302
|
formTypeId: string | null;
|
|
303
|
+
scopeId: string | null;
|
|
295
304
|
createdBy: string | null;
|
|
296
305
|
updatedBy: string | null;
|
|
297
306
|
}>;
|
|
@@ -302,6 +311,7 @@ declare class FormService {
|
|
|
302
311
|
version: string;
|
|
303
312
|
isPublished: boolean;
|
|
304
313
|
formTypeId: string;
|
|
314
|
+
scopeId: string;
|
|
305
315
|
metadata: Record<string, unknown>;
|
|
306
316
|
}>, ctx?: IRequestContext): Promise<{
|
|
307
317
|
id: string;
|
|
@@ -315,9 +325,17 @@ declare class FormService {
|
|
|
315
325
|
version: string;
|
|
316
326
|
isPublished: boolean;
|
|
317
327
|
formTypeId: string | null;
|
|
328
|
+
scopeId: string | null;
|
|
318
329
|
createdBy: string | null;
|
|
319
330
|
updatedBy: string | null;
|
|
320
331
|
}>;
|
|
332
|
+
/**
|
|
333
|
+
* Load a form by id and return it as a fully-resolved `IFormDefinition`
|
|
334
|
+
* (templates applied — Option B). Used by `GET /forms/:id/resolved` and
|
|
335
|
+
* `exportForm`. The original DB-include shape is still available via
|
|
336
|
+
* {@link getFormDefinition}.
|
|
337
|
+
*/
|
|
338
|
+
getResolvedFormDefinition(id: string): Promise<IFormDefinition>;
|
|
321
339
|
deleteFormDefinition(id: string): Promise<{
|
|
322
340
|
id: string;
|
|
323
341
|
code: string;
|
|
@@ -330,6 +348,7 @@ declare class FormService {
|
|
|
330
348
|
version: string;
|
|
331
349
|
isPublished: boolean;
|
|
332
350
|
formTypeId: string | null;
|
|
351
|
+
scopeId: string | null;
|
|
333
352
|
createdBy: string | null;
|
|
334
353
|
updatedBy: string | null;
|
|
335
354
|
}>;
|
|
@@ -484,6 +503,8 @@ declare class FormService {
|
|
|
484
503
|
dataSourceDependencies?: Record<string, string>;
|
|
485
504
|
style?: unknown;
|
|
486
505
|
metadata?: Record<string, unknown>;
|
|
506
|
+
templateId?: string;
|
|
507
|
+
templateOverrides?: Record<string, unknown>;
|
|
487
508
|
}): Promise<{
|
|
488
509
|
id: string;
|
|
489
510
|
code: string;
|
|
@@ -496,7 +517,9 @@ declare class FormService {
|
|
|
496
517
|
conditions: string | null;
|
|
497
518
|
options: string | null;
|
|
498
519
|
pageId: string | null;
|
|
520
|
+
templateOverrides: string | null;
|
|
499
521
|
type: string;
|
|
522
|
+
rosterId: string | null;
|
|
500
523
|
isRequired: boolean;
|
|
501
524
|
isReadonly: boolean;
|
|
502
525
|
isHidden: boolean;
|
|
@@ -507,7 +530,7 @@ declare class FormService {
|
|
|
507
530
|
dataSourceId: string | null;
|
|
508
531
|
dataSourceDependencies: string | null;
|
|
509
532
|
style: string | null;
|
|
510
|
-
|
|
533
|
+
templateId: string | null;
|
|
511
534
|
}>;
|
|
512
535
|
updateFormVariable(id: string, data: Partial<{
|
|
513
536
|
code: string;
|
|
@@ -528,6 +551,8 @@ declare class FormService {
|
|
|
528
551
|
dataSourceDependencies: Record<string, string>;
|
|
529
552
|
style: unknown;
|
|
530
553
|
metadata: Record<string, unknown>;
|
|
554
|
+
templateId: string | null;
|
|
555
|
+
templateOverrides: Record<string, unknown> | null;
|
|
531
556
|
}>): Promise<{
|
|
532
557
|
id: string;
|
|
533
558
|
code: string;
|
|
@@ -540,7 +565,9 @@ declare class FormService {
|
|
|
540
565
|
conditions: string | null;
|
|
541
566
|
options: string | null;
|
|
542
567
|
pageId: string | null;
|
|
568
|
+
templateOverrides: string | null;
|
|
543
569
|
type: string;
|
|
570
|
+
rosterId: string | null;
|
|
544
571
|
isRequired: boolean;
|
|
545
572
|
isReadonly: boolean;
|
|
546
573
|
isHidden: boolean;
|
|
@@ -551,7 +578,7 @@ declare class FormService {
|
|
|
551
578
|
dataSourceId: string | null;
|
|
552
579
|
dataSourceDependencies: string | null;
|
|
553
580
|
style: string | null;
|
|
554
|
-
|
|
581
|
+
templateId: string | null;
|
|
555
582
|
}>;
|
|
556
583
|
deleteFormVariable(id: string): Promise<{
|
|
557
584
|
id: string;
|
|
@@ -565,7 +592,9 @@ declare class FormService {
|
|
|
565
592
|
conditions: string | null;
|
|
566
593
|
options: string | null;
|
|
567
594
|
pageId: string | null;
|
|
595
|
+
templateOverrides: string | null;
|
|
568
596
|
type: string;
|
|
597
|
+
rosterId: string | null;
|
|
569
598
|
isRequired: boolean;
|
|
570
599
|
isReadonly: boolean;
|
|
571
600
|
isHidden: boolean;
|
|
@@ -576,7 +605,7 @@ declare class FormService {
|
|
|
576
605
|
dataSourceId: string | null;
|
|
577
606
|
dataSourceDependencies: string | null;
|
|
578
607
|
style: string | null;
|
|
579
|
-
|
|
608
|
+
templateId: string | null;
|
|
580
609
|
}>;
|
|
581
610
|
getSubmissions(params: {
|
|
582
611
|
formId: string;
|
|
@@ -654,9 +683,23 @@ declare class FormService {
|
|
|
654
683
|
importForm(json: string, tenantId?: string): Promise<string>;
|
|
655
684
|
/** Extract variable data for createFormVariable (omit `id` to let Prisma generate it) */
|
|
656
685
|
private extractVariableData;
|
|
657
|
-
/**
|
|
686
|
+
/**
|
|
687
|
+
* Convert a Prisma DB result to a fully-resolved `IFormDefinition`.
|
|
688
|
+
*
|
|
689
|
+
* Templates referenced by `IFormVariable.templateId` are loaded in a
|
|
690
|
+
* single batch and applied via `resolveFormTemplates` (Option B —
|
|
691
|
+
* in-memory only, no mutation in DB). Pass `resolveTemplates = false`
|
|
692
|
+
* to obtain the raw shape (useful for editor tooling that wants to
|
|
693
|
+
* preserve `templateOverrides`).
|
|
694
|
+
*/
|
|
658
695
|
private dbToFormDefinition;
|
|
659
696
|
private dbToVariable;
|
|
697
|
+
/**
|
|
698
|
+
* Convert a Prisma VariableTemplate row to the domain type. Duplicated
|
|
699
|
+
* locally (kept in sync with `ScopeService.dbToTemplate`) to avoid an
|
|
700
|
+
* import cycle between the two services.
|
|
701
|
+
*/
|
|
702
|
+
private dbToTemplate;
|
|
660
703
|
}
|
|
661
704
|
|
|
662
705
|
/**
|
|
@@ -730,6 +773,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
730
773
|
isPublished: z.ZodDefault<z.ZodBoolean>;
|
|
731
774
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
732
775
|
formTypeId: z.ZodOptional<z.ZodString>;
|
|
776
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
733
777
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
734
778
|
}, "strip", z.ZodTypeAny, {
|
|
735
779
|
code: string;
|
|
@@ -740,6 +784,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
740
784
|
metadata?: Record<string, unknown> | undefined;
|
|
741
785
|
tenantId?: string | undefined;
|
|
742
786
|
formTypeId?: string | undefined;
|
|
787
|
+
scopeId?: string | undefined;
|
|
743
788
|
}, {
|
|
744
789
|
code: string;
|
|
745
790
|
name: string;
|
|
@@ -749,6 +794,7 @@ declare const createFormDefinitionSchema: z.ZodObject<{
|
|
|
749
794
|
version?: string | undefined;
|
|
750
795
|
isPublished?: boolean | undefined;
|
|
751
796
|
formTypeId?: string | undefined;
|
|
797
|
+
scopeId?: string | undefined;
|
|
752
798
|
}>;
|
|
753
799
|
declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
754
800
|
code: z.ZodOptional<z.ZodString>;
|
|
@@ -758,6 +804,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
758
804
|
isPublished: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
759
805
|
tenantId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
760
806
|
formTypeId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
807
|
+
scopeId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
761
808
|
metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
762
809
|
}, "strip", z.ZodTypeAny, {
|
|
763
810
|
code?: string | undefined;
|
|
@@ -768,6 +815,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
768
815
|
version?: string | undefined;
|
|
769
816
|
isPublished?: boolean | undefined;
|
|
770
817
|
formTypeId?: string | undefined;
|
|
818
|
+
scopeId?: string | undefined;
|
|
771
819
|
}, {
|
|
772
820
|
code?: string | undefined;
|
|
773
821
|
name?: string | undefined;
|
|
@@ -777,6 +825,7 @@ declare const updateFormDefinitionSchema: z.ZodObject<{
|
|
|
777
825
|
version?: string | undefined;
|
|
778
826
|
isPublished?: boolean | undefined;
|
|
779
827
|
formTypeId?: string | undefined;
|
|
828
|
+
scopeId?: string | undefined;
|
|
780
829
|
}>;
|
|
781
830
|
declare const createFormPageSchema: z.ZodObject<{
|
|
782
831
|
code: z.ZodString;
|
|
@@ -985,6 +1034,8 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
985
1034
|
dataSourceDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
986
1035
|
style: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
987
1036
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1037
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
1038
|
+
templateOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
988
1039
|
}, "strip", z.ZodTypeAny, {
|
|
989
1040
|
code: string;
|
|
990
1041
|
name: string;
|
|
@@ -1001,6 +1052,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1001
1052
|
metadata?: Record<string, unknown> | undefined;
|
|
1002
1053
|
value?: unknown;
|
|
1003
1054
|
}[] | undefined;
|
|
1055
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1004
1056
|
defaultValue?: unknown;
|
|
1005
1057
|
placeholder?: string | undefined;
|
|
1006
1058
|
validationRules?: {
|
|
@@ -1012,6 +1064,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1012
1064
|
dataSourceId?: string | undefined;
|
|
1013
1065
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1014
1066
|
style?: Record<string, unknown> | undefined;
|
|
1067
|
+
templateId?: string | undefined;
|
|
1015
1068
|
}, {
|
|
1016
1069
|
code: string;
|
|
1017
1070
|
name: string;
|
|
@@ -1025,6 +1078,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1025
1078
|
metadata?: Record<string, unknown> | undefined;
|
|
1026
1079
|
value?: unknown;
|
|
1027
1080
|
}[] | undefined;
|
|
1081
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1028
1082
|
isRequired?: boolean | undefined;
|
|
1029
1083
|
isReadonly?: boolean | undefined;
|
|
1030
1084
|
isHidden?: boolean | undefined;
|
|
@@ -1039,6 +1093,7 @@ declare const createFormVariableSchema: z.ZodObject<{
|
|
|
1039
1093
|
dataSourceId?: string | undefined;
|
|
1040
1094
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1041
1095
|
style?: Record<string, unknown> | undefined;
|
|
1096
|
+
templateId?: string | undefined;
|
|
1042
1097
|
}>;
|
|
1043
1098
|
declare const updateFormVariableSchema: z.ZodObject<{
|
|
1044
1099
|
code: z.ZodOptional<z.ZodString>;
|
|
@@ -1083,6 +1138,8 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1083
1138
|
dataSourceDependencies: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
1084
1139
|
style: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1085
1140
|
metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1141
|
+
templateId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1142
|
+
templateOverrides: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1086
1143
|
}, "strip", z.ZodTypeAny, {
|
|
1087
1144
|
code?: string | undefined;
|
|
1088
1145
|
name?: string | undefined;
|
|
@@ -1095,6 +1152,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1095
1152
|
metadata?: Record<string, unknown> | undefined;
|
|
1096
1153
|
value?: unknown;
|
|
1097
1154
|
}[] | undefined;
|
|
1155
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1098
1156
|
type?: string | undefined;
|
|
1099
1157
|
isRequired?: boolean | undefined;
|
|
1100
1158
|
isReadonly?: boolean | undefined;
|
|
@@ -1110,6 +1168,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1110
1168
|
dataSourceId?: string | undefined;
|
|
1111
1169
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1112
1170
|
style?: Record<string, unknown> | undefined;
|
|
1171
|
+
templateId?: string | undefined;
|
|
1113
1172
|
}, {
|
|
1114
1173
|
code?: string | undefined;
|
|
1115
1174
|
name?: string | undefined;
|
|
@@ -1122,6 +1181,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1122
1181
|
metadata?: Record<string, unknown> | undefined;
|
|
1123
1182
|
value?: unknown;
|
|
1124
1183
|
}[] | undefined;
|
|
1184
|
+
templateOverrides?: Record<string, unknown> | undefined;
|
|
1125
1185
|
type?: string | undefined;
|
|
1126
1186
|
isRequired?: boolean | undefined;
|
|
1127
1187
|
isReadonly?: boolean | undefined;
|
|
@@ -1137,6 +1197,7 @@ declare const updateFormVariableSchema: z.ZodObject<{
|
|
|
1137
1197
|
dataSourceId?: string | undefined;
|
|
1138
1198
|
dataSourceDependencies?: Record<string, string> | undefined;
|
|
1139
1199
|
style?: Record<string, unknown> | undefined;
|
|
1200
|
+
templateId?: string | undefined;
|
|
1140
1201
|
}>;
|
|
1141
1202
|
declare const createSubmissionSchema: z.ZodObject<{
|
|
1142
1203
|
formId: z.ZodString;
|