@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.
@@ -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, RichValueSet } from "@typeschema/types";
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
- export function extractValueSetConcepts(register, valueSet) {
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
- export async function generateBindingSchema(register, fhirSchema, path, element) {
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, PackageMeta, RegularField, RichFHIRSchema } from "../types";
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
- export function isRequired(register, fhirSchema, path) {
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
- export function isExcluded(register, fhirSchema, path) {
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
- export const buildReferences = (element, register, _packageInfo) => {
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;
@@ -7,7 +7,7 @@ export function dropVersionFromUrl(url) {
7
7
  const baseUrl = url.split("|")[0];
8
8
  return baseUrl ? baseUrl : url;
9
9
  }
10
- export function getVersionFromUrl(url) {
10
+ function getVersionFromUrl(url) {
11
11
  const version = url.split("|")[1];
12
12
  return version;
13
13
  }
@@ -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 { Field, Identifier, NestedType, PackageMeta, RichFHIRSchema } from "../types";
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
- export function collectNestedElements(fhirSchema, parentPath, elements) {
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
- export async function transformNestedElements(fhirSchema, parentPath, elements, register, _packageInfo) {
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
- export interface RegularTypeSchema {
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
- export interface ChoiceFieldInstance {
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
- export type ValueSetCompose = {
220
+ type ValueSetCompose = {
221
221
  include: {
222
222
  concept?: Concept[];
223
223
  system?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomic-ehr/codegen",
3
- "version": "0.0.1-canary.20251003150631.104cb21",
3
+ "version": "0.0.1-canary.20251006070905.fb6ed98",
4
4
  "description": "Code generation tools for FHIR resources and TypeSchema definitions",
5
5
  "keywords": [
6
6
  "fhir",