@atomic-ehr/codegen 0.0.1-canary.20251003150631.104cb21 → 0.0.1-canary.20251006070905.fb6ed98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/typeschema/core/binding.d.ts +1 -3
- package/dist/typeschema/core/binding.js +2 -2
- package/dist/typeschema/core/field-builder.d.ts +1 -4
- package/dist/typeschema/core/field-builder.js +3 -3
- package/dist/typeschema/core/identifier.d.ts +0 -1
- package/dist/typeschema/core/identifier.js +1 -1
- package/dist/typeschema/core/nested-types.d.ts +1 -4
- package/dist/typeschema/core/nested-types.js +2 -2
- package/dist/typeschema/types.d.ts +3 -3
- package/package.json +1 -1
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
7
7
|
import type { Register } from "@typeschema/register";
|
|
8
|
-
import type { BindingTypeSchema, CanonicalUrl, Concept, RichFHIRSchema
|
|
8
|
+
import type { BindingTypeSchema, CanonicalUrl, Concept, RichFHIRSchema } from "@typeschema/types";
|
|
9
9
|
export declare function extractValueSetConceptsByUrl(register: Register, valueSetUrl: CanonicalUrl): Concept[] | undefined;
|
|
10
|
-
export declare function extractValueSetConcepts(register: Register, valueSet: RichValueSet): Concept[] | undefined;
|
|
11
10
|
export declare function buildEnum(register: Register, element: FHIRSchemaElement): string[] | undefined;
|
|
12
|
-
export declare function generateBindingSchema(register: Register, fhirSchema: RichFHIRSchema, path: string[], element: FHIRSchemaElement): Promise<BindingTypeSchema | undefined>;
|
|
13
11
|
export declare function collectBindingSchemas(register: Register, fhirSchema: RichFHIRSchema): Promise<BindingTypeSchema[]>;
|
|
@@ -12,7 +12,7 @@ export function extractValueSetConceptsByUrl(register, valueSetUrl) {
|
|
|
12
12
|
return undefined;
|
|
13
13
|
return extractValueSetConcepts(register, valueSet);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
function extractValueSetConcepts(register, valueSet) {
|
|
16
16
|
if (valueSet.expansion?.contains)
|
|
17
17
|
return valueSet.expansion.contains;
|
|
18
18
|
const concepts = [];
|
|
@@ -85,7 +85,7 @@ export function buildEnum(register, element) {
|
|
|
85
85
|
}
|
|
86
86
|
return codes.length > 0 ? codes : undefined;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
async function generateBindingSchema(register, fhirSchema, path, element) {
|
|
89
89
|
if (!element.binding?.valueSet)
|
|
90
90
|
return undefined;
|
|
91
91
|
const identifier = mkBindingIdentifier(fhirSchema, path, element.binding.bindingName);
|
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
7
7
|
import type { Register } from "@root/typeschema/register";
|
|
8
|
-
import type { Field, Identifier,
|
|
9
|
-
export declare function isRequired(register: Register, fhirSchema: RichFHIRSchema, path: string[]): boolean;
|
|
10
|
-
export declare function isExcluded(register: Register, fhirSchema: RichFHIRSchema, path: string[]): boolean;
|
|
11
|
-
export declare const buildReferences: (element: FHIRSchemaElement, register: Register, _packageInfo?: PackageMeta) => Identifier[] | undefined;
|
|
8
|
+
import type { Field, Identifier, RegularField, RichFHIRSchema } from "../types";
|
|
12
9
|
export declare function buildFieldType(register: Register, fhirSchema: RichFHIRSchema, element: FHIRSchemaElement): Identifier | undefined;
|
|
13
10
|
export declare const mkField: (register: Register, fhirSchema: RichFHIRSchema, path: string[], element: FHIRSchemaElement) => Field;
|
|
14
11
|
export declare function isNestedElement(element: FHIRSchemaElement): boolean;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { buildEnum } from "./binding";
|
|
7
7
|
import { mkBindingIdentifier, mkIdentifier, mkNestedIdentifier } from "./identifier";
|
|
8
|
-
|
|
8
|
+
function isRequired(register, fhirSchema, path) {
|
|
9
9
|
const fieldName = path[path.length - 1];
|
|
10
10
|
const parentPath = path.slice(0, -1);
|
|
11
11
|
const requires = register.resolveFsGenealogy(fhirSchema.url).flatMap((fs) => {
|
|
@@ -21,7 +21,7 @@ export function isRequired(register, fhirSchema, path) {
|
|
|
21
21
|
});
|
|
22
22
|
return new Set(requires).has(fieldName);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
function isExcluded(register, fhirSchema, path) {
|
|
25
25
|
const fieldName = path[path.length - 1];
|
|
26
26
|
if (!fieldName)
|
|
27
27
|
throw new Error(`Internal error: fieldName is missing for path ${path.join("/")}`);
|
|
@@ -39,7 +39,7 @@ export function isExcluded(register, fhirSchema, path) {
|
|
|
39
39
|
});
|
|
40
40
|
return new Set(requires).has(fieldName);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const buildReferences = (element, register, _packageInfo) => {
|
|
43
43
|
if (!element.refers)
|
|
44
44
|
return undefined;
|
|
45
45
|
return element.refers.map((ref) => {
|
|
@@ -7,7 +7,6 @@ import type { FHIRSchema } from "@atomic-ehr/fhirschema";
|
|
|
7
7
|
import type { BindingIdentifier, CanonicalUrl, Identifier, NestedIdentifier, RichFHIRSchema, ValueSetIdentifier } from "@typeschema/types";
|
|
8
8
|
import type { Register } from "../register";
|
|
9
9
|
export declare function dropVersionFromUrl(url: CanonicalUrl): CanonicalUrl;
|
|
10
|
-
export declare function getVersionFromUrl(url: CanonicalUrl): string | undefined;
|
|
11
10
|
export declare function mkIdentifier(fhirSchema: RichFHIRSchema): Identifier;
|
|
12
11
|
export declare function mkNestedIdentifier(fhirSchema: RichFHIRSchema, path: string[]): NestedIdentifier;
|
|
13
12
|
export declare function mkValueSetIdentifierByUrl(register: Register, fullValueSetUrl: CanonicalUrl): ValueSetIdentifier;
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Functions for extracting and transforming nested types from FHIRSchema
|
|
5
5
|
*/
|
|
6
|
-
import type { FHIRSchema, FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
7
6
|
import type { Register } from "@root/typeschema/register";
|
|
8
|
-
import type {
|
|
9
|
-
export declare function collectNestedElements(fhirSchema: FHIRSchema, parentPath: string[], elements: Record<string, FHIRSchemaElement>): Array<[string[], FHIRSchemaElement]>;
|
|
10
|
-
export declare function transformNestedElements(fhirSchema: RichFHIRSchema, parentPath: string[], elements: Record<string, FHIRSchemaElement>, register: Register, _packageInfo?: PackageMeta): Promise<Record<string, Field>>;
|
|
7
|
+
import type { Identifier, NestedType, RichFHIRSchema } from "../types";
|
|
11
8
|
export declare function mkNestedTypes(register: Register, fhirSchema: RichFHIRSchema): Promise<NestedType[] | undefined>;
|
|
12
9
|
export declare function extractNestedDependencies(nestedTypes: NestedType[]): Identifier[];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { isNestedElement, mkField, mkNestedField } from "./field-builder";
|
|
7
7
|
import { mkNestedIdentifier } from "./identifier";
|
|
8
|
-
|
|
8
|
+
function collectNestedElements(fhirSchema, parentPath, elements) {
|
|
9
9
|
const nested = [];
|
|
10
10
|
for (const [key, element] of Object.entries(elements)) {
|
|
11
11
|
const path = [...parentPath, key];
|
|
@@ -18,7 +18,7 @@ export function collectNestedElements(fhirSchema, parentPath, elements) {
|
|
|
18
18
|
}
|
|
19
19
|
return nested;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
async function transformNestedElements(fhirSchema, parentPath, elements, register, _packageInfo) {
|
|
22
22
|
const fields = {};
|
|
23
23
|
for (const [key, element] of Object.entries(elements)) {
|
|
24
24
|
const path = [...parentPath, key];
|
|
@@ -121,7 +121,7 @@ export interface ProfileMetadata {
|
|
|
121
121
|
jurisdiction?: any[];
|
|
122
122
|
package?: string;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
interface RegularTypeSchema {
|
|
125
125
|
identifier: Identifier;
|
|
126
126
|
base?: Identifier;
|
|
127
127
|
description?: string;
|
|
@@ -150,7 +150,7 @@ export interface ChoiceFieldDeclaration {
|
|
|
150
150
|
min?: number;
|
|
151
151
|
max?: number;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
interface ChoiceFieldInstance {
|
|
154
154
|
choiceOf: string;
|
|
155
155
|
type: Identifier;
|
|
156
156
|
required?: boolean;
|
|
@@ -217,7 +217,7 @@ export type ValueSet = {
|
|
|
217
217
|
date?: string;
|
|
218
218
|
contact?: any;
|
|
219
219
|
};
|
|
220
|
-
|
|
220
|
+
type ValueSetCompose = {
|
|
221
221
|
include: {
|
|
222
222
|
concept?: Concept[];
|
|
223
223
|
system?: string;
|
package/package.json
CHANGED