gdc-common-utils-ts 1.14.13 → 1.14.15
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 +20 -7
- package/dist/examples/communication-attached-bundle-session.d.ts +22 -0
- package/dist/examples/communication-attached-bundle-session.js +79 -0
- package/dist/examples/employee.d.ts +41 -0
- package/dist/examples/employee.js +39 -0
- package/dist/examples/index.d.ts +2 -1
- package/dist/examples/index.js +2 -1
- package/dist/examples/ips-bundle.js +3 -3
- package/dist/models/bundle.d.ts +20 -2
- package/dist/models/bundle.js +8 -1
- package/dist/models/comm.d.ts +29 -0
- package/dist/models/confidential-message.d.ts +30 -2
- package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +1 -1
- package/dist/models/interoperable-claims/diagnostic-report-claims.js +1 -1
- package/dist/utils/communication-attached-bundle-session.d.ts +191 -0
- package/dist/utils/communication-attached-bundle-session.js +542 -0
- package/dist/utils/communication-bundle-document-request.d.ts +6 -0
- package/dist/utils/communication-bundle-document-request.js +8 -0
- package/dist/utils/employee.d.ts +87 -0
- package/dist/utils/employee.js +134 -0
- package/dist/utils/fhir-search.d.ts +26 -0
- package/dist/utils/fhir-search.js +84 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { BundleEntry, BundleJsonApi, BundleRequest } from '../models/bundle';
|
|
2
|
+
import { type BundleResourceIdFilters } from './bundle-query';
|
|
3
|
+
import { type MedicationStatementClaimsFlat } from '../models/interoperable-claims/medication-statement-claims';
|
|
4
|
+
export type CommunicationAttachedBundleSessionMode = 'strict' | 'normalize';
|
|
5
|
+
export type CommunicationAttachedBundleSessionOptions = Readonly<{
|
|
6
|
+
communicationClaims?: Record<string, unknown>;
|
|
7
|
+
initialBundle?: BundleJsonApi<BundleEntry>;
|
|
8
|
+
mode?: CommunicationAttachedBundleSessionMode;
|
|
9
|
+
}>;
|
|
10
|
+
export type ActiveEntrySelection = Readonly<{
|
|
11
|
+
index?: number;
|
|
12
|
+
fullUrl?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type UpsertEntryInput = Readonly<{
|
|
15
|
+
resourceType: string;
|
|
16
|
+
claims: Record<string, unknown>;
|
|
17
|
+
type?: string;
|
|
18
|
+
fullUrl?: string;
|
|
19
|
+
request?: BundleRequest;
|
|
20
|
+
}>;
|
|
21
|
+
export type AddContainedDocumentToActiveEntryInput = Readonly<{
|
|
22
|
+
identifier?: string;
|
|
23
|
+
fullUrl?: string;
|
|
24
|
+
claims?: Record<string, unknown>;
|
|
25
|
+
attachmentContentType?: string;
|
|
26
|
+
attachmentDataBase64?: string;
|
|
27
|
+
attachmentUrl?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
date?: string;
|
|
30
|
+
language?: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Communication editing session with bundle-in-memory as source of truth.
|
|
34
|
+
*
|
|
35
|
+
* Design contract:
|
|
36
|
+
* - `activeEntry` is the real editing unit (not only `activeResource`), because
|
|
37
|
+
* it can include `fullUrl`, `request`, and entry-level context.
|
|
38
|
+
* - `Communication.content-attachment-data` is always derived from the
|
|
39
|
+
* in-memory bundle after each committed update.
|
|
40
|
+
* - saving can release active entry memory via `saveAndReleaseActiveEntry()`.
|
|
41
|
+
*/
|
|
42
|
+
export declare class CommunicationAttachedBundleSession {
|
|
43
|
+
private communicationClaims;
|
|
44
|
+
private bundleInMemory;
|
|
45
|
+
private activeEntryIndex;
|
|
46
|
+
private mode;
|
|
47
|
+
constructor(options?: CommunicationAttachedBundleSessionOptions);
|
|
48
|
+
/** Returns a deep copy of communication claims. */
|
|
49
|
+
getCommunicationClaims(): Record<string, unknown>;
|
|
50
|
+
/** Returns a deep copy of the current in-memory bundle. */
|
|
51
|
+
getBundleInMemory(): BundleJsonApi<BundleEntry>;
|
|
52
|
+
/** Returns the active entry index, or null when no entry is selected. */
|
|
53
|
+
getActiveEntryIndex(): number | null;
|
|
54
|
+
/** Returns a deep copy of the active entry when selected. */
|
|
55
|
+
getActiveEntry(): BundleEntry | null;
|
|
56
|
+
/** Selects an active entry by index or fullUrl. */
|
|
57
|
+
selectActiveEntry(selection: ActiveEntrySelection): this;
|
|
58
|
+
/** Clears active entry selection from memory. */
|
|
59
|
+
clearActiveEntry(): this;
|
|
60
|
+
/**
|
|
61
|
+
* Upserts an entry in bundle memory and marks it as active.
|
|
62
|
+
* Matching priority: `fullUrl` if present, then resource claim identifier.
|
|
63
|
+
*/
|
|
64
|
+
upsertActiveEntry(input: UpsertEntryInput): this;
|
|
65
|
+
/**
|
|
66
|
+
* Consent-first helper for developer onboarding.
|
|
67
|
+
*
|
|
68
|
+
* Expected keys should come from `ClaimConsent` in caller code.
|
|
69
|
+
*/
|
|
70
|
+
upsertActiveConsentEntry(input: Readonly<{
|
|
71
|
+
claims: Record<string, unknown>;
|
|
72
|
+
fullUrl?: string;
|
|
73
|
+
type?: string;
|
|
74
|
+
request?: BundleRequest;
|
|
75
|
+
}>): this;
|
|
76
|
+
/**
|
|
77
|
+
* MedicationStatement helper for IPS-in-Communication use cases.
|
|
78
|
+
*
|
|
79
|
+
* Expected keys should come from MedicationStatement claims constants.
|
|
80
|
+
*/
|
|
81
|
+
upsertActiveMedicationStatementEntry(input: Readonly<{
|
|
82
|
+
claims: MedicationStatementClaimsFlat | Record<string, unknown>;
|
|
83
|
+
fullUrl?: string;
|
|
84
|
+
type?: string;
|
|
85
|
+
request?: BundleRequest;
|
|
86
|
+
}>): this;
|
|
87
|
+
/**
|
|
88
|
+
* DocumentReference helper for bundle-contained attachments linked from
|
|
89
|
+
* other clinical resources through `*.contained-documents`.
|
|
90
|
+
*/
|
|
91
|
+
upsertActiveDocumentReferenceEntry(input: Readonly<{
|
|
92
|
+
claims: Record<string, unknown>;
|
|
93
|
+
fullUrl?: string;
|
|
94
|
+
type?: string;
|
|
95
|
+
request?: BundleRequest;
|
|
96
|
+
}>): this;
|
|
97
|
+
/**
|
|
98
|
+
* Condition helper for IPS-in-Communication use cases.
|
|
99
|
+
*
|
|
100
|
+
* Expected keys should come from Condition claims constants.
|
|
101
|
+
*/
|
|
102
|
+
upsertActiveConditionEntry(input: Readonly<{
|
|
103
|
+
claims: Record<string, unknown>;
|
|
104
|
+
fullUrl?: string;
|
|
105
|
+
type?: string;
|
|
106
|
+
request?: BundleRequest;
|
|
107
|
+
}>): this;
|
|
108
|
+
/**
|
|
109
|
+
* AllergyIntolerance helper for IPS-in-Communication use cases.
|
|
110
|
+
*
|
|
111
|
+
* Expected keys should come from AllergyIntolerance claims constants.
|
|
112
|
+
*/
|
|
113
|
+
upsertActiveAllergyIntoleranceEntry(input: Readonly<{
|
|
114
|
+
claims: Record<string, unknown>;
|
|
115
|
+
fullUrl?: string;
|
|
116
|
+
type?: string;
|
|
117
|
+
request?: BundleRequest;
|
|
118
|
+
}>): this;
|
|
119
|
+
/**
|
|
120
|
+
* TODO(ips-next):
|
|
121
|
+
* Add `upsertActiveDiagnosticReportEntry(...)` once the shared claim helpers
|
|
122
|
+
* for `DiagnosticReport` are in place.
|
|
123
|
+
*
|
|
124
|
+
* Expected shape should mirror the existing resource helpers:
|
|
125
|
+
* - `claims` authored with `@context = org.hl7.fhir.api`
|
|
126
|
+
* - matching priority by `DiagnosticReport.identifier`
|
|
127
|
+
* - support for linked `DocumentReference` ids through
|
|
128
|
+
* `DiagnosticReport.contained-documents`
|
|
129
|
+
*
|
|
130
|
+
* Intentionally not implemented in this pass:
|
|
131
|
+
* - IPS authoring already works for the currently documented resources
|
|
132
|
+
* - GW Core can already consume bundle-contained `DocumentReference` rows
|
|
133
|
+
* - adding the DiagnosticReport editing surface now would expand the IPS
|
|
134
|
+
* contract further than intended for this release slice
|
|
135
|
+
*/
|
|
136
|
+
/**
|
|
137
|
+
* Creates or updates a linked `DocumentReference` entry and stores its
|
|
138
|
+
* identifier under the active resource `*.contained-documents` claim.
|
|
139
|
+
*/
|
|
140
|
+
addContainedDocumentToActiveEntry(input: AddContainedDocumentToActiveEntryInput): this;
|
|
141
|
+
/**
|
|
142
|
+
* Patches active entry `resource.meta.claims` and synchronizes attachment data.
|
|
143
|
+
*/
|
|
144
|
+
patchActiveEntryClaims(claimPatch: Record<string, unknown>): this;
|
|
145
|
+
/**
|
|
146
|
+
* Persists current memory state into communication claims attachment.
|
|
147
|
+
* No-op for active entry pointer.
|
|
148
|
+
*/
|
|
149
|
+
saveActiveEntry(): this;
|
|
150
|
+
/**
|
|
151
|
+
* Persists and releases active entry memory pointer.
|
|
152
|
+
* This is the recommended step after a successful save operation.
|
|
153
|
+
*/
|
|
154
|
+
saveAndReleaseActiveEntry(): this;
|
|
155
|
+
/**
|
|
156
|
+
* Returns stable resource IDs from bundle entries with optional filters.
|
|
157
|
+
*/
|
|
158
|
+
getResourceIds(filters?: BundleResourceIdFilters): string[];
|
|
159
|
+
/**
|
|
160
|
+
* Returns bundle entries matching resource IDs produced by `getResourceIds`.
|
|
161
|
+
*/
|
|
162
|
+
getResourceEntriesByIds(resourceIds: readonly string[]): BundleEntry[];
|
|
163
|
+
/**
|
|
164
|
+
* Resolves the entry URL (`fullUrl`) for a given entry/resource identifier.
|
|
165
|
+
*/
|
|
166
|
+
getEntryUrl(entryId: string): string | undefined;
|
|
167
|
+
private decodeBundleFromClaims;
|
|
168
|
+
private syncAttachmentFromBundle;
|
|
169
|
+
private resolveCurrentSubject;
|
|
170
|
+
private findUpsertIndex;
|
|
171
|
+
private resolveEntryIdentifier;
|
|
172
|
+
private createBundleEntry;
|
|
173
|
+
private resolveEntryCanonicalIdValue;
|
|
174
|
+
private assertEntryIndex;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* High-level consent-access editor alias for onboarding and app-facing code.
|
|
178
|
+
*
|
|
179
|
+
* This keeps the business intent explicit for developers who are editing
|
|
180
|
+
* Consent access rules inside a Communication-carried bundle and should not
|
|
181
|
+
* need to start from the lower-level generic session name.
|
|
182
|
+
*/
|
|
183
|
+
export declare class ConsentAccessEditor extends CommunicationAttachedBundleSession {
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* High-level factory for consent-access editing.
|
|
187
|
+
*
|
|
188
|
+
* Prefer this name in onboarding docs when the developer intent is:
|
|
189
|
+
* "edit a Consent access bundle carried by a Communication".
|
|
190
|
+
*/
|
|
191
|
+
export declare function createConsentAccessEditor(options?: CommunicationAttachedBundleSessionOptions): ConsentAccessEditor;
|