@atomic-ehr/codegen 0.0.1-canary.20250924120719.44f2f7c → 0.0.1-canary.20250927094522.7f26cfe

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 (71) hide show
  1. package/dist/api/builder.d.ts +7 -5
  2. package/dist/api/builder.js +8 -6
  3. package/dist/api/generators/base/BaseGenerator.d.ts +5 -5
  4. package/dist/api/generators/base/BaseGenerator.js +4 -4
  5. package/dist/api/generators/base/FileManager.d.ts +2 -2
  6. package/dist/api/generators/base/FileManager.js +1 -1
  7. package/dist/api/generators/base/PythonTypeMapper.d.ts +3 -3
  8. package/dist/api/generators/base/PythonTypeMapper.js +1 -1
  9. package/dist/api/generators/base/TemplateEngine.d.ts +1 -1
  10. package/dist/api/generators/base/TemplateEngine.js +1 -1
  11. package/dist/api/generators/base/TypeMapper.d.ts +2 -2
  12. package/dist/api/generators/base/TypeScriptTypeMapper.d.ts +3 -3
  13. package/dist/api/generators/base/TypeScriptTypeMapper.js +1 -1
  14. package/dist/api/generators/base/builders/DirectoryBuilder.d.ts +4 -4
  15. package/dist/api/generators/base/builders/FileBuilder.d.ts +2 -2
  16. package/dist/api/generators/base/builders/IndexBuilder.d.ts +2 -2
  17. package/dist/api/generators/base/enhanced-errors.d.ts +2 -2
  18. package/dist/api/generators/base/enhanced-errors.js +1 -1
  19. package/dist/api/generators/base/error-handler.d.ts +2 -2
  20. package/dist/api/generators/base/error-handler.js +1 -1
  21. package/dist/api/generators/base/errors.d.ts +2 -2
  22. package/dist/api/generators/base/index.d.ts +22 -22
  23. package/dist/api/generators/base/index.js +11 -11
  24. package/dist/api/generators/base/types.d.ts +4 -4
  25. package/dist/api/generators/typescript.d.ts +6 -6
  26. package/dist/api/generators/typescript.js +54 -46
  27. package/dist/api/index.d.ts +8 -8
  28. package/dist/api/index.js +3 -3
  29. package/dist/cli/commands/generate/typescript.d.ts +1 -1
  30. package/dist/cli/commands/generate/typescript.js +2 -2
  31. package/dist/cli/commands/generate.d.ts +1 -1
  32. package/dist/cli/commands/generate.js +4 -4
  33. package/dist/cli/commands/index.js +3 -3
  34. package/dist/cli/commands/typeschema/generate.js +3 -3
  35. package/dist/cli/commands/typeschema.js +2 -2
  36. package/dist/cli/index.js +55 -55
  37. package/dist/cli/utils/log.d.ts +2 -2
  38. package/dist/cli/utils/log.js +2 -2
  39. package/dist/config.d.ts +2 -2
  40. package/dist/config.js +5 -5
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +2 -2
  43. package/dist/typeschema/cache.d.ts +7 -7
  44. package/dist/typeschema/core/binding.d.ts +1 -1
  45. package/dist/typeschema/core/binding.js +6 -4
  46. package/dist/typeschema/core/field-builder.d.ts +3 -3
  47. package/dist/typeschema/core/field-builder.js +3 -3
  48. package/dist/typeschema/core/identifier.d.ts +5 -17
  49. package/dist/typeschema/core/identifier.js +15 -47
  50. package/dist/typeschema/core/nested-types.d.ts +2 -2
  51. package/dist/typeschema/core/nested-types.js +2 -2
  52. package/dist/typeschema/core/transformer.d.ts +3 -3
  53. package/dist/typeschema/core/transformer.js +20 -28
  54. package/dist/typeschema/generator.d.ts +3 -4
  55. package/dist/typeschema/generator.js +12 -14
  56. package/dist/typeschema/index.d.ts +4 -5
  57. package/dist/typeschema/index.js +4 -4
  58. package/dist/typeschema/parser.d.ts +5 -5
  59. package/dist/typeschema/profile/processor.d.ts +2 -3
  60. package/dist/typeschema/profile/processor.js +12 -10
  61. package/dist/typeschema/types.d.ts +66 -375
  62. package/dist/typeschema/types.js +14 -2
  63. package/dist/typeschema/value-set/processor.d.ts +1 -1
  64. package/dist/typeschema/value-set/processor.js +1 -1
  65. package/package.json +2 -2
  66. package/dist/typeschema/schema.d.ts +0 -485
  67. package/dist/typeschema/schema.js +0 -456
  68. package/dist/typeschema/type-schema.types.d.ts +0 -186
  69. package/dist/typeschema/type-schema.types.js +0 -39
  70. package/dist/typeschema/utils.d.ts +0 -6
  71. package/dist/typeschema/utils.js +0 -13
@@ -1,456 +0,0 @@
1
- export const validationSchema = {
2
- $schema: "http://json-schema.org/draft-07/schema#",
3
- $id: "https://fhir-clj.github.io/type-schema/json-schema/type-schema.json",
4
- $comment: "Maturity Level: Draft",
5
- title: "Type Schema",
6
- description: "A code generation friendly representation of FHIR StructureDefinition and FHIR Schema designed to simplify SDK resource classes/types generation.",
7
- type: "object",
8
- definitions: {
9
- "type-schema-identifier": {
10
- type: "object",
11
- oneOf: [
12
- { $ref: "#/definitions/with-primitive-type-kind" },
13
- { $ref: "#/definitions/with-valueset-kind" },
14
- { $ref: "#/definitions/with-complex-type-kind" },
15
- { $ref: "#/definitions/with-resource-kind" },
16
- { $ref: "#/definitions/with-nested-kind" },
17
- { $ref: "#/definitions/with-logical-kind" },
18
- { $ref: "#/definitions/with-binding-kind" },
19
- ],
20
- properties: {
21
- kind: {
22
- type: "string",
23
- },
24
- package: {
25
- type: "string",
26
- description: "The FHIR package identifier (e.g., hl7.fhir.r4.core)",
27
- },
28
- version: {
29
- type: "string",
30
- description: "The version of the package",
31
- },
32
- name: {
33
- type: "string",
34
- description: "Computer friendly identifier for the element",
35
- },
36
- url: {
37
- type: "string",
38
- pattern: "^(https?://|urn:)[^\\s]+$",
39
- description: "A canonical URL identifying this resource uniquely in the FHIR ecosystem",
40
- },
41
- },
42
- required: ["kind", "package", "version", "name", "url"],
43
- additionalProperties: false,
44
- },
45
- "with-primitive-type-kind": {
46
- type: "object",
47
- description: "Constraint helper to ensure the kind is primitive-type",
48
- properties: {
49
- kind: { const: "primitive-type" },
50
- },
51
- },
52
- "with-valueset-kind": {
53
- type: "object",
54
- description: "Constraint helper to ensure the kind is value-set",
55
- properties: {
56
- kind: { const: "value-set" },
57
- },
58
- },
59
- "with-binding-kind": {
60
- type: "object",
61
- description: "Constraint helper to ensure the kind is value-set",
62
- properties: {
63
- kind: { const: "binding" },
64
- },
65
- },
66
- "with-complex-type-kind": {
67
- type: "object",
68
- description: "Constraint helper to ensure the kind is complex-type",
69
- properties: {
70
- kind: { const: "complex-type" },
71
- },
72
- },
73
- "with-resource-kind": {
74
- type: "object",
75
- description: "Constraint helper to ensure the kind is resource",
76
- properties: {
77
- kind: { const: "resource" },
78
- },
79
- },
80
- "with-nested-kind": {
81
- type: "object",
82
- description: "Constraint helper to ensure the kind is nested",
83
- properties: {
84
- kind: { const: "nested" },
85
- },
86
- },
87
- "with-logical-kind": {
88
- type: "object",
89
- description: "Constraint helper to ensure the kind is logical",
90
- properties: {
91
- kind: { const: "logical" },
92
- },
93
- },
94
- "field.regular": {
95
- title: "Regular field",
96
- description: "A standard field with a single type",
97
- type: "object",
98
- properties: {
99
- type: {
100
- $ref: "#/definitions/type-schema-identifier",
101
- description: "The data type of this field",
102
- },
103
- reference: {
104
- type: "array",
105
- description: "Reference to other types that this field can point to",
106
- items: {
107
- $ref: "#/definitions/type-schema-identifier",
108
- },
109
- },
110
- required: {
111
- type: "boolean",
112
- default: false,
113
- description: "Whether this field must be provided in valid instances",
114
- },
115
- excluded: {
116
- type: "boolean",
117
- default: false,
118
- description: "Whether this field is prohibited in valid instances",
119
- },
120
- array: {
121
- type: "boolean",
122
- default: false,
123
- description: "Whether this field can contain multiple values (cardinality > 1)",
124
- },
125
- binding: {
126
- allOf: [
127
- { $ref: "#/definitions/type-schema-identifier" },
128
- { $ref: "#/definitions/with-binding-kind" },
129
- ],
130
- },
131
- enum: {
132
- type: "array",
133
- items: { type: "string" },
134
- description: "For code fields, the set of valid values when bound to a required value set",
135
- },
136
- min: {
137
- type: "number",
138
- description: "Minimum limit of items for an array",
139
- },
140
- max: {
141
- type: "number",
142
- description: "Maximum limit of items for an array",
143
- },
144
- },
145
- required: ["type"],
146
- additionalProperties: false,
147
- },
148
- "field.polymorphic-declaration": {
149
- title: "Polymorphic value[x] field declaration",
150
- description: "The base declaration for a FHIR choice type (e.g., value[x])",
151
- type: "object",
152
- properties: {
153
- choices: {
154
- type: "array",
155
- items: { type: "string" },
156
- description: "The names of all concrete type options for this choice field",
157
- },
158
- required: {
159
- type: "boolean",
160
- default: false,
161
- description: "Whether at least one choice must be provided",
162
- },
163
- excluded: {
164
- type: "boolean",
165
- default: false,
166
- description: "Whether all choices are prohibited",
167
- },
168
- array: {
169
- type: "boolean",
170
- default: false,
171
- description: "Whether the selected choice can contain multiple values",
172
- },
173
- min: {
174
- type: "number",
175
- description: "Minimum limit of items for an array",
176
- },
177
- max: {
178
- type: "number",
179
- description: "Maximum limit of items for an array",
180
- },
181
- },
182
- required: ["choices"],
183
- additionalProperties: false,
184
- },
185
- "field.polymorphic-instance": {
186
- title: "Polymorphic value[x] field instance",
187
- description: "A specific type option for a FHIR choice type (e.g., valueString, valueInteger)",
188
- type: "object",
189
- properties: {
190
- choiceOf: {
191
- type: "string",
192
- description: "The name of the choice field this instance belongs to (e.g., 'value' for valueString)",
193
- },
194
- type: {
195
- $ref: "#/definitions/type-schema-identifier",
196
- description: "The data type of this choice option",
197
- },
198
- required: {
199
- type: "boolean",
200
- default: false,
201
- description: "Whether this specific choice must be provided",
202
- },
203
- excluded: {
204
- type: "boolean",
205
- default: false,
206
- description: "Whether this specific choice is prohibited",
207
- },
208
- array: {
209
- type: "boolean",
210
- default: false,
211
- description: "Whether this choice can contain multiple values",
212
- },
213
- reference: {
214
- type: "array",
215
- description: "Reference to other types that this field can point to",
216
- items: {
217
- $ref: "#/definitions/type-schema-identifier",
218
- },
219
- },
220
- binding: {
221
- allOf: [
222
- { $ref: "#/definitions/type-schema-identifier" },
223
- { $ref: "#/definitions/with-binding-kind" },
224
- ],
225
- description: "For coded choices, information about the value set binding",
226
- },
227
- enum: {
228
- type: "array",
229
- items: { type: "string" },
230
- description: "For code fields, the set of valid values when bound to a required value set",
231
- },
232
- min: {
233
- type: "number",
234
- description: "Minimum limit of items for an array",
235
- },
236
- max: {
237
- type: "number",
238
- description: "Maximum limit of items for an array",
239
- },
240
- },
241
- required: ["type", "choiceOf"],
242
- additionalProperties: false,
243
- },
244
- dependencies: {
245
- type: "array",
246
- description: "Other types that this type depends on",
247
- items: {
248
- $ref: "#/definitions/type-schema-identifier",
249
- },
250
- },
251
- },
252
- oneOf: [
253
- {
254
- title: "Type Schema for Primitive Type",
255
- description: "Schema for basic FHIR data types like string, boolean, decimal",
256
- type: "object",
257
- properties: {
258
- identifier: {
259
- allOf: [
260
- { $ref: "#/definitions/type-schema-identifier" },
261
- { $ref: "#/definitions/with-primitive-type-kind" },
262
- ],
263
- description: "The unique identifier for this primitive type",
264
- },
265
- description: {
266
- type: "string",
267
- description: "Human-readable description of the primitive type",
268
- },
269
- base: {
270
- $ref: "#/definitions/type-schema-identifier",
271
- description: "The base type this primitive type extends (typically Element)",
272
- },
273
- dependencies: {
274
- $ref: "#/definitions/dependencies",
275
- description: "Other types that this primitive type depends on",
276
- },
277
- },
278
- required: ["identifier", "base"],
279
- additionalProperties: false,
280
- },
281
- {
282
- title: "Type Schema for Resource, Complex Type, Logical",
283
- description: "Schema for FHIR resources, complex types, and logical types",
284
- type: "object",
285
- properties: {
286
- identifier: {
287
- allOf: [
288
- { $ref: "#/definitions/type-schema-identifier" },
289
- {
290
- oneOf: [
291
- { $ref: "#/definitions/with-resource-kind" },
292
- { $ref: "#/definitions/with-complex-type-kind" },
293
- { $ref: "#/definitions/with-logical-kind" },
294
- ],
295
- },
296
- ],
297
- description: "The unique identifier for this resource or type",
298
- },
299
- base: {
300
- $ref: "#/definitions/type-schema-identifier",
301
- description: "The base type this resource or type extends",
302
- },
303
- description: {
304
- type: "string",
305
- description: "Human-readable description of the resource or type",
306
- },
307
- fields: {
308
- type: "object",
309
- description: "The fields contained in this resource or type",
310
- additionalProperties: {
311
- anyOf: [
312
- { $ref: "#/definitions/field.regular" },
313
- { $ref: "#/definitions/field.polymorphic-declaration" },
314
- { $ref: "#/definitions/field.polymorphic-instance" },
315
- ],
316
- },
317
- },
318
- nested: {
319
- type: "array",
320
- description: "BackboneElement types nested within this resource or type",
321
- items: {
322
- type: "object",
323
- properties: {
324
- identifier: {
325
- allOf: [
326
- { $ref: "#/definitions/type-schema-identifier" },
327
- { $ref: "#/definitions/with-nested-kind" },
328
- ],
329
- description: "The unique identifier for this nested type",
330
- },
331
- base: {
332
- $ref: "#/definitions/type-schema-identifier",
333
- description: "The base type this nested type extends (typically BackboneElement)",
334
- },
335
- fields: {
336
- type: "object",
337
- description: "The fields contained in this nested type",
338
- additionalProperties: {
339
- anyOf: [
340
- { $ref: "#/definitions/field.regular" },
341
- { $ref: "#/definitions/field.polymorphic-declaration" },
342
- { $ref: "#/definitions/field.polymorphic-instance" },
343
- ],
344
- },
345
- },
346
- },
347
- required: ["identifier", "base"],
348
- additionalProperties: false,
349
- },
350
- },
351
- dependencies: {
352
- type: "array",
353
- description: "Other types that this resource or type depends on",
354
- items: {
355
- $ref: "#/definitions/type-schema-identifier",
356
- },
357
- },
358
- },
359
- required: ["identifier"],
360
- additionalProperties: false,
361
- },
362
- {
363
- title: "Type Schema for ValueSet",
364
- description: "Schema for FHIR value sets that define terminology bindings",
365
- type: "object",
366
- properties: {
367
- identifier: {
368
- allOf: [
369
- { $ref: "#/definitions/type-schema-identifier" },
370
- { $ref: "#/definitions/with-valueset-kind" },
371
- ],
372
- description: "The unique identifier for this value set",
373
- },
374
- description: {
375
- type: "string",
376
- description: "Human-readable description of the value set",
377
- },
378
- concept: {
379
- type: "array",
380
- description: "The list of coded concepts contained in this value set",
381
- items: {
382
- type: "object",
383
- properties: {
384
- code: {
385
- type: "string",
386
- description: "The code value",
387
- },
388
- display: {
389
- type: "string",
390
- description: "The human-readable display text for this code",
391
- },
392
- system: {
393
- type: "string",
394
- description: "The code system URL that defines this code",
395
- },
396
- },
397
- required: ["code"],
398
- additionalProperties: false,
399
- },
400
- },
401
- compose: {
402
- type: "object",
403
- description: "Complex value set composition rules when the value set is defined as a composition of other value sets",
404
- },
405
- },
406
- required: ["identifier"],
407
- additionalProperties: false,
408
- },
409
- {
410
- title: "Type Schema for Binding",
411
- type: "object",
412
- properties: {
413
- identifier: {
414
- allOf: [
415
- { $ref: "#/definitions/type-schema-identifier" },
416
- { $ref: "#/definitions/with-binding-kind" },
417
- ],
418
- description: "The unique identifier for this value set",
419
- },
420
- description: {
421
- type: "string",
422
- description: "Human-readable description of the value set",
423
- },
424
- type: {
425
- $ref: "#/definitions/type-schema-identifier",
426
- },
427
- strength: {
428
- type: "string",
429
- description: "The strength of the binding",
430
- },
431
- enum: {
432
- type: "array",
433
- items: {
434
- type: "string",
435
- },
436
- description: "The enumeration of values for the binding",
437
- },
438
- valueset: {
439
- allOf: [
440
- { $ref: "#/definitions/type-schema-identifier" },
441
- { $ref: "#/definitions/with-valueset-kind" },
442
- ],
443
- },
444
- dependencies: {
445
- type: "array",
446
- description: "Other types that this resource or type depends on",
447
- items: {
448
- $ref: "#/definitions/type-schema-identifier",
449
- },
450
- },
451
- },
452
- required: ["identifier"],
453
- additionalProperties: false,
454
- },
455
- ],
456
- };
@@ -1,186 +0,0 @@
1
- /**
2
- * TypeScript type definitions for Type Schema
3
- *
4
- * Generated based on type-schema.schema.json
5
- * A code generation friendly representation of FHIR StructureDefinition
6
- * and FHIR Schema designed to simplify SDK resource classes/types generation.
7
- */
8
- export interface TypeSchemaIdentifierBase {
9
- /** The FHIR package identifier (e.g., hl7.fhir.r4.core) */
10
- package: string;
11
- /** The version of the package */
12
- version: string;
13
- /** Computer friendly identifier for the element */
14
- name: string;
15
- /** A canonical URL identifying this resource uniquely in the FHIR ecosystem */
16
- url: string;
17
- }
18
- export interface WithPrimitiveTypeKind {
19
- kind: "primitive-type";
20
- }
21
- export interface WithValueSetKind {
22
- kind: "value-set";
23
- }
24
- export interface WithBindingKind {
25
- kind: "binding";
26
- }
27
- export interface WithComplexTypeKind {
28
- kind: "complex-type";
29
- }
30
- export interface WithResourceKind {
31
- kind: "resource";
32
- }
33
- export interface WithNestedKind {
34
- kind: "nested";
35
- }
36
- export interface WithLogicalKind {
37
- kind: "logical";
38
- }
39
- export type TypeSchemaIdentifier = (TypeSchemaIdentifierBase & WithPrimitiveTypeKind) | (TypeSchemaIdentifierBase & WithValueSetKind) | (TypeSchemaIdentifierBase & WithBindingKind) | (TypeSchemaIdentifierBase & WithComplexTypeKind) | (TypeSchemaIdentifierBase & WithResourceKind) | (TypeSchemaIdentifierBase & WithNestedKind) | (TypeSchemaIdentifierBase & WithLogicalKind);
40
- export interface RegularField {
41
- /** The data type of this field */
42
- type: TypeSchemaIdentifier;
43
- /** Reference to other types that this field can point to */
44
- reference?: TypeSchemaIdentifier[];
45
- /** Whether this field must be provided in valid instances */
46
- required?: boolean;
47
- /** Whether this field is prohibited in valid instances */
48
- excluded?: boolean;
49
- /** Whether this field can contain multiple values (cardinality > 1) */
50
- array?: boolean;
51
- /** Binding information for coded fields */
52
- binding?: TypeSchemaIdentifierBase & WithBindingKind;
53
- /** For code fields, the set of valid values when bound to a required value set */
54
- enum?: string[];
55
- /** Minimum limit of items for an array */
56
- min?: number;
57
- /** Maximum limit of items for an array */
58
- max?: number;
59
- }
60
- export interface PolymorphicDeclarationField {
61
- /** The names of all concrete type options for this choice field */
62
- choices: string[];
63
- /** Whether at least one choice must be provided */
64
- required?: boolean;
65
- /** Whether all choices are prohibited */
66
- excluded?: boolean;
67
- /** Whether the selected choice can contain multiple values */
68
- array?: boolean;
69
- /** Minimum limit of items for an array */
70
- min?: number;
71
- /** Maximum limit of items for an array */
72
- max?: number;
73
- }
74
- export interface PolymorphicInstanceField {
75
- /** The name of the choice field this instance belongs to (e.g., 'value' for valueString) */
76
- choiceOf: string;
77
- /** The data type of this choice option */
78
- type: TypeSchemaIdentifier;
79
- /** Whether this specific choice must be provided */
80
- required?: boolean;
81
- /** Whether this specific choice is prohibited */
82
- excluded?: boolean;
83
- /** Whether this choice can contain multiple values */
84
- array?: boolean;
85
- /** Reference to other types that this field can point to */
86
- reference?: TypeSchemaIdentifier[];
87
- /** For coded choices, information about the value set binding */
88
- binding?: TypeSchemaIdentifierBase & WithBindingKind;
89
- /** For code fields, the set of valid values when bound to a required value set */
90
- enum?: string[];
91
- /** Minimum limit of items for an array */
92
- min?: number;
93
- /** Maximum limit of items for an array */
94
- max?: number;
95
- }
96
- export type TypeSchemaField = RegularField | PolymorphicDeclarationField | PolymorphicInstanceField;
97
- export interface NestedType {
98
- /** The unique identifier for this nested type */
99
- identifier: TypeSchemaIdentifierBase & WithNestedKind;
100
- /** The base type this nested type extends (typically BackboneElement) */
101
- base: TypeSchemaIdentifier;
102
- /** The fields contained in this nested type */
103
- fields?: Record<string, TypeSchemaField>;
104
- }
105
- export interface ValueSetConcept {
106
- /** The code value */
107
- code: string;
108
- /** The human-readable display text for this code */
109
- display?: string;
110
- /** The code system URL that defines this code */
111
- system?: string;
112
- }
113
- export interface TypeSchemaForPrimitiveType {
114
- /** The unique identifier for this primitive type */
115
- identifier: TypeSchemaIdentifierBase & WithPrimitiveTypeKind;
116
- /** The base type this primitive type extends (typically Element) */
117
- base: TypeSchemaIdentifier;
118
- /** Human-readable description of the primitive type */
119
- description?: string;
120
- /** Other types that this primitive type depends on */
121
- dependencies?: TypeSchemaIdentifier[];
122
- }
123
- export interface TypeSchemaForResourceComplexLogical {
124
- /** The unique identifier for this resource or type */
125
- identifier: (TypeSchemaIdentifierBase & WithResourceKind) | (TypeSchemaIdentifierBase & WithComplexTypeKind) | (TypeSchemaIdentifierBase & WithLogicalKind);
126
- /** The base type this resource or type extends */
127
- base?: TypeSchemaIdentifier;
128
- /** Human-readable description of the resource or type */
129
- description?: string;
130
- /** The fields contained in this resource or type */
131
- fields?: Record<string, TypeSchemaField>;
132
- /** BackboneElement types nested within this resource or type */
133
- nested?: NestedType[];
134
- /** Other types that this resource or type depends on */
135
- dependencies?: TypeSchemaIdentifier[];
136
- }
137
- export interface TypeSchemaForValueSet {
138
- /** The unique identifier for this value set */
139
- identifier: TypeSchemaIdentifierBase & WithValueSetKind;
140
- /** Human-readable description of the value set */
141
- description?: string;
142
- /** The list of coded concepts contained in this value set */
143
- concept?: ValueSetConcept[];
144
- /** Complex value set composition rules when the value set is defined as a composition of other value sets */
145
- compose?: Record<string, unknown>;
146
- }
147
- export interface TypeSchemaForBinding {
148
- /** The unique identifier for this binding */
149
- identifier: TypeSchemaIdentifierBase & WithBindingKind;
150
- /** Human-readable description of the binding */
151
- description?: string;
152
- /** The type this binding applies to */
153
- type?: TypeSchemaIdentifier;
154
- /** The strength of the binding */
155
- strength?: string;
156
- /** The enumeration of values for the binding */
157
- enum?: string[];
158
- /** Reference to the value set for this binding */
159
- valueset?: TypeSchemaIdentifierBase & WithValueSetKind;
160
- /** Other types that this binding depends on */
161
- dependencies?: TypeSchemaIdentifier[];
162
- }
163
- export type TypeSchema = TypeSchemaForPrimitiveType | TypeSchemaForResourceComplexLogical | TypeSchemaForValueSet | TypeSchemaForBinding;
164
- export declare function isPrimitiveTypeSchema(schema: TypeSchema): schema is TypeSchemaForPrimitiveType;
165
- export declare function isResourceSchema(schema: TypeSchema): schema is TypeSchemaForResourceComplexLogical;
166
- export declare function isComplexTypeSchema(schema: TypeSchema): schema is TypeSchemaForResourceComplexLogical;
167
- export declare function isLogicalSchema(schema: TypeSchema): schema is TypeSchemaForResourceComplexLogical;
168
- export declare function isValueSetSchema(schema: TypeSchema): schema is TypeSchemaForValueSet;
169
- export declare function isBindingSchema(schema: TypeSchema): schema is TypeSchemaForBinding;
170
- export declare function isNestedTypeSchema(identifier: TypeSchemaIdentifier): identifier is TypeSchemaIdentifierBase & WithNestedKind;
171
- export declare function isRegularField(field: TypeSchemaField): field is RegularField;
172
- export declare function isPolymorphicDeclarationField(field: TypeSchemaField): field is PolymorphicDeclarationField;
173
- export declare function isPolymorphicInstanceField(field: TypeSchemaField): field is PolymorphicInstanceField;
174
- export type SchemaKind = TypeSchemaIdentifier["kind"];
175
- export type SchemasByKind = {
176
- "primitive-type": TypeSchemaForPrimitiveType;
177
- resource: TypeSchemaForResourceComplexLogical;
178
- "complex-type": TypeSchemaForResourceComplexLogical;
179
- logical: TypeSchemaForResourceComplexLogical;
180
- "value-set": TypeSchemaForValueSet;
181
- binding: TypeSchemaForBinding;
182
- nested: never;
183
- };
184
- export type GetSchemaByKind<K extends SchemaKind> = K extends keyof SchemasByKind ? SchemasByKind[K] : never;
185
- export type ExtractFieldNames<T extends TypeSchema> = T extends TypeSchemaForResourceComplexLogical ? T["fields"] extends Record<string, any> ? keyof T["fields"] : never : never;
186
- export type ExtractFieldType<T extends TypeSchema, F extends string> = T extends TypeSchemaForResourceComplexLogical ? T["fields"] extends Record<string, any> ? F extends keyof T["fields"] ? T["fields"][F] : never : never : never;
@@ -1,39 +0,0 @@
1
- /**
2
- * TypeScript type definitions for Type Schema
3
- *
4
- * Generated based on type-schema.schema.json
5
- * A code generation friendly representation of FHIR StructureDefinition
6
- * and FHIR Schema designed to simplify SDK resource classes/types generation.
7
- */
8
- // Type guards for discriminating between different schema types
9
- export function isPrimitiveTypeSchema(schema) {
10
- return schema.identifier.kind === "primitive-type";
11
- }
12
- export function isResourceSchema(schema) {
13
- return schema.identifier.kind === "resource";
14
- }
15
- export function isComplexTypeSchema(schema) {
16
- return schema.identifier.kind === "complex-type";
17
- }
18
- export function isLogicalSchema(schema) {
19
- return schema.identifier.kind === "logical";
20
- }
21
- export function isValueSetSchema(schema) {
22
- return schema.identifier.kind === "value-set";
23
- }
24
- export function isBindingSchema(schema) {
25
- return schema.identifier.kind === "binding";
26
- }
27
- export function isNestedTypeSchema(identifier) {
28
- return identifier.kind === "nested";
29
- }
30
- // Field type guards
31
- export function isRegularField(field) {
32
- return "type" in field && !("choiceOf" in field) && !("choices" in field);
33
- }
34
- export function isPolymorphicDeclarationField(field) {
35
- return "choices" in field;
36
- }
37
- export function isPolymorphicInstanceField(field) {
38
- return "choiceOf" in field && "type" in field;
39
- }