Skip to content

Commit 28ab72a

Browse files
committed
Top-level type re-exports for Plan 45 custom-field types
Consumers (hds-forms-js, doctor-dashboard, hds-webapp) want to write `import type { CustomFieldDeclaration } from 'hds-lib'`. Without explicit top-level re-exports, the types live only inside the `appTemplates` namespace. Re-export the full type surface alongside the existing namespace export.
1 parent 23fb195 commit 28ab72a

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

ts/appTemplates/loader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
import * as AjvNs from 'ajv';
1919
import type { ErrorObject, ValidateFunction } from 'ajv';
20+
import { HDSLibError } from '../errors.ts';
21+
import schema from './schemas/appTemplate.schema.json' with { type: 'json' };
22+
import type { AppTemplate, CustomFieldDeclaration, ExistingStreamRef } from './templateTypes.ts';
2023

2124
// Ajv ships an ESM default + CJS interop. `default` may be the class itself
2225
// or the namespace depending on bundler. Resolve once at load.
2326
const Ajv: any = (AjvNs as any).default ?? AjvNs;
24-
import { HDSLibError } from '../errors.ts';
25-
import schema from './schemas/appTemplate.schema.json' with { type: 'json' };
26-
import type { AppTemplate, CustomFieldDeclaration, ExistingStreamRef } from './templateTypes.ts';
2727

2828
const ajv = new Ajv({ allErrors: true, strict: false });
2929
const validate: ValidateFunction<AppTemplate> = ajv.compile(schema as any);

ts/index.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ export const getHDSModel = HDSModelInitAndSingleton.getModel;
3535
export const initHDSModel = HDSModelInitAndSingleton.initHDSModel;
3636
export { pryv, settings, HDSService, HDSModel, appTemplates, localizeText, localizeText as l, toolkit, logger, durationToSeconds, durationToLabel, computeReminders, eventToShortText, formatEventDate, MonitorScope, HDSSettings, SETTING_TYPES, HDSProfile, PROFILE_FIELDS, HDSModelConversions, HDSModelConverters, HDSModelPreferred, getPreferredInput, getPreferredDisplay, HDSModelAppStreams, EuclidianDistanceEngine, HDSLibError, extractOverloadAsDefinitions };
3737

38+
// Plan 45 — top-level type re-exports so consumers can `import type { CustomFieldDeclaration } from 'hds-lib'`.
39+
export type {
40+
CustomFieldEventType,
41+
EmptyDef,
42+
HDSCustomFieldDef,
43+
HDSCustomField
44+
} from './appTemplates/customFieldTypes.ts';
45+
export type {
46+
SystemMessageType,
47+
HDSSystemAlertDef,
48+
HDSSystemAckDef,
49+
HDSSystemFeature
50+
} from './appTemplates/systemFeatureTypes.ts';
51+
export type {
52+
StreamPermission,
53+
ExistingStreamRef,
54+
CustomFieldDeclaration,
55+
AppTemplateSection,
56+
AppTemplate
57+
} from './appTemplates/templateTypes.ts';
58+
export type {
59+
CustomFieldResolution,
60+
SystemFeatureResolution,
61+
ResolutionKind,
62+
VirtualItemDef,
63+
VirtualItemFieldType
64+
} from './appTemplates/resolveStream.ts';
65+
3866
// also exporting default for typescript to capture HDSLib.. there is surely a nicer way to do
3967
const HDSLib = {
4068
getHDSModel,

0 commit comments

Comments
 (0)