gdc-common-utils-ts 1.20.2 → 1.23.0

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 (86) hide show
  1. package/README.md +2 -2
  2. package/dist/claims/claims-helpers-related-person.d.ts +14 -0
  3. package/dist/claims/claims-helpers-related-person.js +28 -0
  4. package/dist/constants/Schemas.d.ts +3 -0
  5. package/dist/constants/Schemas.js +3 -0
  6. package/dist/constants/fhir-code-systems.d.ts +1 -0
  7. package/dist/constants/fhir-code-systems.js +1 -0
  8. package/dist/constants/fhir-resource-types.d.ts +2 -0
  9. package/dist/constants/fhir-resource-types.js +1 -0
  10. package/dist/constants/index.d.ts +3 -0
  11. package/dist/constants/index.js +3 -0
  12. package/dist/constants/individual-sections.d.ts +210 -0
  13. package/dist/constants/individual-sections.js +35 -0
  14. package/dist/constants/lifecycle.d.ts +17 -0
  15. package/dist/constants/lifecycle.js +18 -0
  16. package/dist/constants/observation-category.d.ts +72 -0
  17. package/dist/constants/observation-category.js +30 -0
  18. package/dist/constants/schemaorg.d.ts +4 -0
  19. package/dist/constants/schemaorg.js +4 -0
  20. package/dist/constants/vital-signs.d.ts +2 -17
  21. package/dist/constants/vital-signs.js +1 -6
  22. package/dist/convert/convert-observation.d.ts +20 -2
  23. package/dist/convert/convert-observation.js +80 -9
  24. package/dist/examples/index.d.ts +2 -0
  25. package/dist/examples/index.js +2 -0
  26. package/dist/examples/invoice.d.ts +37 -0
  27. package/dist/examples/invoice.js +72 -0
  28. package/dist/examples/license.d.ts +161 -0
  29. package/dist/examples/license.js +136 -7
  30. package/dist/examples/lifecycle.d.ts +44 -0
  31. package/dist/examples/lifecycle.js +25 -0
  32. package/dist/examples/related-person.d.ts +348 -0
  33. package/dist/examples/related-person.js +184 -2
  34. package/dist/examples/shared.d.ts +110 -8
  35. package/dist/examples/shared.js +129 -17
  36. package/dist/examples/vital-signs.d.ts +56 -0
  37. package/dist/examples/vital-signs.js +159 -0
  38. package/dist/models/fhir-documents.d.ts +35 -0
  39. package/dist/models/indexing.d.ts +68 -6
  40. package/dist/models/indexing.js +294 -11
  41. package/dist/models/interoperable-claims/index.d.ts +1 -0
  42. package/dist/models/interoperable-claims/index.js +1 -0
  43. package/dist/models/interoperable-claims/invoice-claims.d.ts +277 -0
  44. package/dist/models/interoperable-claims/invoice-claims.js +353 -0
  45. package/dist/models/interoperable-claims/observation-claims.d.ts +253 -1
  46. package/dist/models/interoperable-claims/observation-claims.js +249 -3
  47. package/dist/models/interoperable-claims.d.ts +1 -1
  48. package/dist/models/interoperable-claims.js +1 -1
  49. package/dist/models/urlPath.d.ts +3 -1
  50. package/dist/models/urlPath.js +2 -0
  51. package/dist/utils/bundle-document-builder.js +22 -4
  52. package/dist/utils/bundle-editor.d.ts +105 -2
  53. package/dist/utils/bundle-editor.js +282 -2
  54. package/dist/utils/clinical-resource-converters.d.ts +4 -4
  55. package/dist/utils/clinical-resource-converters.js +5 -5
  56. package/dist/utils/communication-attached-bundle-session.d.ts +11 -0
  57. package/dist/utils/communication-attached-bundle-session.js +29 -0
  58. package/dist/utils/consent-lifecycle-result-reader.d.ts +24 -0
  59. package/dist/utils/consent-lifecycle-result-reader.js +27 -0
  60. package/dist/utils/employee.d.ts +25 -0
  61. package/dist/utils/employee.js +57 -0
  62. package/dist/utils/gw-core-path.d.ts +24 -0
  63. package/dist/utils/gw-core-path.js +21 -0
  64. package/dist/utils/index.d.ts +11 -0
  65. package/dist/utils/index.js +11 -0
  66. package/dist/utils/individual-bundle-vault.d.ts +144 -0
  67. package/dist/utils/individual-bundle-vault.js +455 -0
  68. package/dist/utils/individual-organization-lifecycle.d.ts +104 -0
  69. package/dist/utils/individual-organization-lifecycle.js +179 -0
  70. package/dist/utils/interoperable-resource-operation.d.ts +158 -0
  71. package/dist/utils/interoperable-resource-operation.js +244 -0
  72. package/dist/utils/invoice-bundle.d.ts +82 -0
  73. package/dist/utils/invoice-bundle.js +240 -0
  74. package/dist/utils/license-commercial-search.d.ts +118 -0
  75. package/dist/utils/license-commercial-search.js +228 -0
  76. package/dist/utils/license-list-search.d.ts +105 -0
  77. package/dist/utils/license-list-search.js +209 -0
  78. package/dist/utils/license-offer-order.d.ts +107 -0
  79. package/dist/utils/license-offer-order.js +262 -0
  80. package/dist/utils/license.d.ts +6 -0
  81. package/dist/utils/license.js +6 -0
  82. package/dist/utils/lifecycle-result-reader.d.ts +33 -0
  83. package/dist/utils/lifecycle-result-reader.js +99 -0
  84. package/dist/utils/related-person-list.d.ts +20 -0
  85. package/dist/utils/related-person-list.js +54 -0
  86. package/package.json +2 -1
@@ -10,6 +10,8 @@ export declare const EXAMPLE_LIFECYCLE_OPERATIONS: {
10
10
  readonly disable: "disable";
11
11
  readonly delete: "delete";
12
12
  };
13
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE: "Family-disable-request-v1.0";
14
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE: "Family-purge-request-v1.0";
13
15
  /**
14
16
  * Shared placeholder values used by copy/paste examples.
15
17
  *
@@ -179,6 +181,27 @@ export declare const EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE: {
179
181
  readonly erasesPersonalDataImmediately: false;
180
182
  };
181
183
  };
184
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_ENTRY: Readonly<{
185
+ type: string;
186
+ request: {
187
+ method: "POST";
188
+ };
189
+ meta: {
190
+ claims: import("..").IndividualOrganizationLifecycleClaims;
191
+ };
192
+ resource: {
193
+ id?: string;
194
+ meta: {
195
+ claims: import("..").IndividualOrganizationLifecycleClaims;
196
+ };
197
+ };
198
+ }>;
199
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_PAYLOAD: Readonly<{
200
+ thid: string;
201
+ body: {
202
+ data: import("..").IndividualOrganizationLifecycleDataEntry[];
203
+ };
204
+ }>;
182
205
  export declare const EXAMPLE_INDIVIDUAL_DELETE_MESSAGE: {
183
206
  readonly operation: "delete";
184
207
  readonly resourceType: "IndividualOrganization";
@@ -199,6 +222,27 @@ export declare const EXAMPLE_INDIVIDUAL_DELETE_MESSAGE: {
199
222
  readonly keepsMinimumAuditTrailRequiredByLaw: true;
200
223
  };
201
224
  };
225
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_ENTRY: Readonly<{
226
+ type: string;
227
+ request: {
228
+ method: "POST";
229
+ };
230
+ meta: {
231
+ claims: import("..").IndividualOrganizationLifecycleClaims;
232
+ };
233
+ resource: {
234
+ id?: string;
235
+ meta: {
236
+ claims: import("..").IndividualOrganizationLifecycleClaims;
237
+ };
238
+ };
239
+ }>;
240
+ export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_PAYLOAD: Readonly<{
241
+ thid: string;
242
+ body: {
243
+ data: import("..").IndividualOrganizationLifecycleDataEntry[];
244
+ };
245
+ }>;
202
246
  export declare const EXAMPLE_CONSENT_ENABLE_MESSAGE: {
203
247
  readonly operation: "enable";
204
248
  readonly resourceType: "Consent";
@@ -1,6 +1,7 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  import { ClaimsOrganizationSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
3
3
  import { ClaimConsent } from '../models/consent-rule.js';
4
+ import { IndividualOrganizationLifecycleDraft, IndividualOrganizationLifecycleOperations, } from '../utils/individual-organization-lifecycle.js';
4
5
  import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
5
6
  /**
6
7
  * Canonical lifecycle naming for `v1`.
@@ -14,6 +15,8 @@ export const EXAMPLE_LIFECYCLE_OPERATIONS = {
14
15
  disable: 'disable',
15
16
  delete: 'delete',
16
17
  };
18
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE = 'Family-disable-request-v1.0';
19
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE = 'Family-purge-request-v1.0';
17
20
  /**
18
21
  * Shared placeholder values used by copy/paste examples.
19
22
  *
@@ -183,6 +186,17 @@ export const EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE = {
183
186
  erasesPersonalDataImmediately: false,
184
187
  },
185
188
  };
189
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_ENTRY = new IndividualOrganizationLifecycleDraft()
190
+ .setClaims(EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE.claims)
191
+ .setOperation(IndividualOrganizationLifecycleOperations.Disable)
192
+ .setRequestType(EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE)
193
+ .buildCurrentGwDataEntry();
194
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_PAYLOAD = new IndividualOrganizationLifecycleDraft()
195
+ .setClaims(EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE.claims)
196
+ .setOperation(IndividualOrganizationLifecycleOperations.Disable)
197
+ .setRequestType(EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE)
198
+ .setThreadId('individual-organization-disable-example-001')
199
+ .buildCurrentGwPayload();
186
200
  export const EXAMPLE_INDIVIDUAL_DELETE_MESSAGE = {
187
201
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.delete,
188
202
  resourceType: 'IndividualOrganization',
@@ -203,6 +217,17 @@ export const EXAMPLE_INDIVIDUAL_DELETE_MESSAGE = {
203
217
  keepsMinimumAuditTrailRequiredByLaw: true,
204
218
  },
205
219
  };
220
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_ENTRY = new IndividualOrganizationLifecycleDraft()
221
+ .setClaims(EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE.claims)
222
+ .setOperation(IndividualOrganizationLifecycleOperations.Purge)
223
+ .setRequestType(EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE)
224
+ .buildCurrentGwDataEntry();
225
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_PAYLOAD = new IndividualOrganizationLifecycleDraft()
226
+ .setClaims(EXAMPLE_INDIVIDUAL_DISABLE_MESSAGE.claims)
227
+ .setOperation(IndividualOrganizationLifecycleOperations.Purge)
228
+ .setRequestType(EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE)
229
+ .setThreadId('individual-organization-purge-example-001')
230
+ .buildCurrentGwPayload();
206
231
  export const EXAMPLE_CONSENT_ENABLE_MESSAGE = {
207
232
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.enable,
208
233
  resourceType: 'Consent',
@@ -1,10 +1,358 @@
1
1
  /**
2
2
  * Examples for related-person / family-member flows.
3
3
  */
4
+ export declare const EXAMPLE_RELATED_PERSON_RESOURCE_TYPE: "RelatedPerson";
5
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_REQUEST_TYPE: "RelatedPerson-disable-request-v1.0";
6
+ export declare const EXAMPLE_RELATED_PERSON_PURGE_REQUEST_TYPE: "RelatedPerson-purge-request-v1.0";
7
+ export declare const EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID: "related-person-internal-001";
8
+ export declare const EXAMPLE_RELATED_PERSON_SEARCH_URL: string;
9
+ export declare const EXAMPLE_RELATED_PERSON_DISPLAY_NAME: "Jose Example";
10
+ /**
11
+ * Minimal semantic input used by SDK helpers to disable one subject-side
12
+ * relationship record through the identifier-first lifecycle contract.
13
+ */
14
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_INPUT: {
15
+ readonly memberClaims: {
16
+ readonly '@context': "org.hl7.fhir.api";
17
+ readonly "RelatedPerson.identifier": "rel-001";
18
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
19
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
20
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
21
+ };
22
+ readonly resourceId: "rel-001";
23
+ };
24
+ /**
25
+ * Canonical lifecycle resource emitted by the shared identifier-first disable
26
+ * contract after the FHIR/business identifier has been normalized.
27
+ */
28
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_LIFECYCLE_RESOURCE: {
29
+ resourceType: string;
30
+ id?: string;
31
+ identifier?: Array<{
32
+ value: string;
33
+ system?: string;
34
+ }>;
35
+ meta: {
36
+ claims: Record<string, unknown>;
37
+ status?: import("..").InteroperableLifecycleStatus;
38
+ };
39
+ };
40
+ /**
41
+ * Shared operational bundle entry for `disableIndividualMember(...)`.
42
+ *
43
+ * Downstream SDK tests can assert against this fixture directly instead of
44
+ * rebuilding the lifecycle resource shape inline.
45
+ */
46
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_ENTRY: {
47
+ readonly request: {
48
+ readonly method: "POST";
49
+ };
50
+ readonly meta: {
51
+ readonly claims: {
52
+ readonly '@context': "org.hl7.fhir.api";
53
+ readonly "RelatedPerson.identifier": "rel-001";
54
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
55
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
56
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
57
+ };
58
+ };
59
+ readonly resource: {
60
+ readonly id: "rel-001";
61
+ readonly resourceType: string;
62
+ readonly identifier?: Array<{
63
+ value: string;
64
+ system?: string;
65
+ }>;
66
+ readonly meta: {
67
+ claims: Record<string, unknown>;
68
+ status?: import("..").InteroperableLifecycleStatus;
69
+ };
70
+ };
71
+ };
72
+ /**
73
+ * Full shared disable payload used by runtime/documentation examples.
74
+ */
75
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_PAYLOAD: {
76
+ readonly thid: "relatedperson-disable-example-001";
77
+ readonly body: {
78
+ readonly resourceType: "Bundle";
79
+ readonly type: "batch";
80
+ readonly entry: readonly [{
81
+ readonly request: {
82
+ readonly method: "POST";
83
+ };
84
+ readonly meta: {
85
+ readonly claims: {
86
+ readonly '@context': "org.hl7.fhir.api";
87
+ readonly "RelatedPerson.identifier": "rel-001";
88
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
89
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
90
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
91
+ };
92
+ };
93
+ readonly resource: {
94
+ readonly id: "rel-001";
95
+ readonly resourceType: string;
96
+ readonly identifier?: Array<{
97
+ value: string;
98
+ system?: string;
99
+ }>;
100
+ readonly meta: {
101
+ claims: Record<string, unknown>;
102
+ status?: import("..").InteroperableLifecycleStatus;
103
+ };
104
+ };
105
+ }];
106
+ };
107
+ };
108
+ export declare const EXAMPLE_RELATED_PERSON_PURGE_LIFECYCLE_RESOURCE: {
109
+ resourceType: string;
110
+ id?: string;
111
+ identifier?: Array<{
112
+ value: string;
113
+ system?: string;
114
+ }>;
115
+ meta: {
116
+ claims: Record<string, unknown>;
117
+ status?: import("..").InteroperableLifecycleStatus;
118
+ };
119
+ };
120
+ export declare const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_ENTRY: {
121
+ readonly type: "RelatedPerson-purge-request-v1.0";
122
+ readonly request: {
123
+ readonly method: "POST";
124
+ };
125
+ readonly meta: {
126
+ readonly claims: {
127
+ readonly '@context': "org.hl7.fhir.api";
128
+ readonly "RelatedPerson.identifier": "rel-001";
129
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
130
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
131
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
132
+ };
133
+ };
134
+ readonly resource: {
135
+ readonly id: "rel-001";
136
+ readonly resourceType: string;
137
+ readonly identifier?: Array<{
138
+ value: string;
139
+ system?: string;
140
+ }>;
141
+ readonly meta: {
142
+ claims: Record<string, unknown>;
143
+ status?: import("..").InteroperableLifecycleStatus;
144
+ };
145
+ };
146
+ };
147
+ export declare const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_PAYLOAD: {
148
+ readonly thid: "relatedperson-purge-example-001";
149
+ readonly body: {
150
+ readonly resourceType: "Bundle";
151
+ readonly type: "batch";
152
+ readonly entry: readonly [{
153
+ readonly type: "RelatedPerson-purge-request-v1.0";
154
+ readonly request: {
155
+ readonly method: "POST";
156
+ };
157
+ readonly meta: {
158
+ readonly claims: {
159
+ readonly '@context': "org.hl7.fhir.api";
160
+ readonly "RelatedPerson.identifier": "rel-001";
161
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
162
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
163
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
164
+ };
165
+ };
166
+ readonly resource: {
167
+ readonly id: "rel-001";
168
+ readonly resourceType: string;
169
+ readonly identifier?: Array<{
170
+ value: string;
171
+ system?: string;
172
+ }>;
173
+ readonly meta: {
174
+ claims: Record<string, unknown>;
175
+ status?: import("..").InteroperableLifecycleStatus;
176
+ };
177
+ };
178
+ }];
179
+ };
180
+ };
181
+ /**
182
+ * Canonical upsert payload for subject-side relationship examples.
183
+ *
184
+ * This bundle shape is the shared SDK/documentation fixture and should be
185
+ * reused by downstream repositories instead of rebuilding inline `Bundle`
186
+ * examples for `upsertRelatedPersonAndPoll(...)`.
187
+ */
188
+ export declare const EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD: {
189
+ readonly thid: "relatedperson-upsert-example-001";
190
+ readonly body: {
191
+ readonly resourceType: "Bundle";
192
+ readonly type: "batch";
193
+ readonly entry: readonly [{
194
+ readonly resource: {
195
+ readonly resourceType: "RelatedPerson";
196
+ readonly id: "grandfather-001";
197
+ readonly patient: {
198
+ readonly reference: "did:web:api.acme.org:individual:123";
199
+ };
200
+ readonly relationship: readonly [{
201
+ readonly text: "Grandfather";
202
+ }];
203
+ readonly name: readonly [{
204
+ readonly text: "Jose Example";
205
+ }];
206
+ };
207
+ }];
208
+ };
209
+ };
210
+ /** @deprecated Use `EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD`. */
4
211
  export declare const EXAMPLE_RELATED_PERSON_PAYLOAD: {
212
+ readonly thid: "relatedperson-upsert-example-001";
213
+ readonly body: {
214
+ readonly resourceType: "Bundle";
215
+ readonly type: "batch";
216
+ readonly entry: readonly [{
217
+ readonly resource: {
218
+ readonly resourceType: "RelatedPerson";
219
+ readonly id: "grandfather-001";
220
+ readonly patient: {
221
+ readonly reference: "did:web:api.acme.org:individual:123";
222
+ };
223
+ readonly relationship: readonly [{
224
+ readonly text: "Grandfather";
225
+ }];
226
+ readonly name: readonly [{
227
+ readonly text: "Jose Example";
228
+ }];
229
+ };
230
+ }];
231
+ };
232
+ };
233
+ /**
234
+ * Legacy JSON:API-style shell still referenced by older pass-through tests.
235
+ */
236
+ export declare const EXAMPLE_RELATED_PERSON_BATCH_DATA_PAYLOAD: {
5
237
  readonly body: {
6
238
  readonly data: readonly [{
7
239
  readonly type: "RelatedPerson";
8
240
  }];
9
241
  };
10
242
  };
243
+ /**
244
+ * FHIR-shaped example used to demonstrate identifier-first operational
245
+ * normalization before claims-first processing.
246
+ */
247
+ export declare const EXAMPLE_RELATED_PERSON_FHIR_RESOURCE: {
248
+ readonly resourceType: "RelatedPerson";
249
+ readonly id: "related-person-internal-001";
250
+ readonly identifier: readonly [{
251
+ readonly value: "rel-001";
252
+ }];
253
+ readonly active: true;
254
+ readonly patient: {
255
+ readonly reference: "did:web:api.acme.org:individual:123";
256
+ };
257
+ readonly relationship: readonly [{
258
+ readonly coding: readonly [{
259
+ readonly code: string;
260
+ readonly system: "http://terminology.hl7.org/CodeSystem/v3-RoleCode";
261
+ }];
262
+ }];
263
+ readonly telecom: readonly [{
264
+ readonly value: "mailto:parent.guardian@example.org";
265
+ }];
266
+ };
267
+ export declare const EXAMPLE_RELATED_PERSON_DISABLE_SEARCH_PARAMS: {
268
+ readonly identifier: "rel-001";
269
+ };
270
+ export declare const EXAMPLE_RELATED_PERSON_LIST_RECORD_ACTIVE: {
271
+ readonly id: "related-person-internal-001";
272
+ readonly meta: {
273
+ readonly status: "active";
274
+ };
275
+ readonly resource: {
276
+ readonly resourceType: "RelatedPerson";
277
+ readonly id: "related-person-internal-001";
278
+ readonly meta: {
279
+ readonly claims: {
280
+ readonly '@context': "org.hl7.fhir.api";
281
+ readonly "RelatedPerson.identifier": "rel-001";
282
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
283
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
284
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
285
+ readonly "RelatedPerson.name": "Jose Example";
286
+ readonly "RelatedPerson.active": "true";
287
+ };
288
+ };
289
+ };
290
+ };
291
+ export declare const EXAMPLE_RELATED_PERSON_LIST_RECORD_INACTIVE: {
292
+ readonly id: "related-person-internal-002";
293
+ readonly meta: {
294
+ readonly status: "inactive";
295
+ };
296
+ readonly resource: {
297
+ readonly resourceType: "RelatedPerson";
298
+ readonly id: "related-person-internal-002";
299
+ readonly meta: {
300
+ readonly claims: {
301
+ readonly '@context': "org.hl7.fhir.api";
302
+ readonly "RelatedPerson.identifier": "urn:uuid:related-person-002";
303
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
304
+ readonly "RelatedPerson.telecom": "mailto:caregiver.two@example.org";
305
+ readonly "RelatedPerson.relationship": "http://terminology.hl7.org/CodeSystem/v3-RoleCode|NMTH";
306
+ readonly "RelatedPerson.name": "Maria Example";
307
+ readonly "RelatedPerson.active": "false";
308
+ };
309
+ };
310
+ };
311
+ };
312
+ export declare const EXAMPLE_RELATED_PERSON_LIST_RESPONSE_BODY: {
313
+ readonly body: {
314
+ readonly data: readonly [{
315
+ readonly id: "related-person-internal-001";
316
+ readonly meta: {
317
+ readonly status: "active";
318
+ };
319
+ readonly resource: {
320
+ readonly resourceType: "RelatedPerson";
321
+ readonly id: "related-person-internal-001";
322
+ readonly meta: {
323
+ readonly claims: {
324
+ readonly '@context': "org.hl7.fhir.api";
325
+ readonly "RelatedPerson.identifier": "rel-001";
326
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
327
+ readonly "RelatedPerson.telecom": "mailto:parent.guardian@example.org";
328
+ readonly "RelatedPerson.relationship": "v3-RoleCode|RESPRSN";
329
+ readonly "RelatedPerson.name": "Jose Example";
330
+ readonly "RelatedPerson.active": "true";
331
+ };
332
+ };
333
+ };
334
+ }, {
335
+ readonly id: "related-person-internal-002";
336
+ readonly meta: {
337
+ readonly status: "inactive";
338
+ };
339
+ readonly resource: {
340
+ readonly resourceType: "RelatedPerson";
341
+ readonly id: "related-person-internal-002";
342
+ readonly meta: {
343
+ readonly claims: {
344
+ readonly '@context': "org.hl7.fhir.api";
345
+ readonly "RelatedPerson.identifier": "urn:uuid:related-person-002";
346
+ readonly "RelatedPerson.patient": "did:web:api.acme.org:individual:123";
347
+ readonly "RelatedPerson.telecom": "mailto:caregiver.two@example.org";
348
+ readonly "RelatedPerson.relationship": "http://terminology.hl7.org/CodeSystem/v3-RoleCode|NMTH";
349
+ readonly "RelatedPerson.name": "Maria Example";
350
+ readonly "RelatedPerson.active": "false";
351
+ };
352
+ };
353
+ };
354
+ }];
355
+ };
356
+ };
357
+ export declare const EXAMPLE_RELATED_PERSON_INACTIVE_STATUS: "inactive";
358
+ export declare const EXAMPLE_RELATED_PERSON_PURGED_STATUS: "purged";
@@ -1,13 +1,195 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { RelatedPersonClaim } from '../models/interoperable-claims/related-person-claims.js';
3
+ import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
4
+ import { HL7_CODING_SYSTEM_V3_ROLE_CODE } from '../constants/hl7-roles.js';
5
+ import { EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API, EXAMPLE_EMAIL_RELATED_PERSON, EXAMPLE_RELATED_PERSON_ACTIVE_NAME, EXAMPLE_RELATED_PERSON_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_EMAIL, EXAMPLE_RELATED_PERSON_INACTIVE_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_NAME, EXAMPLE_RELATED_PERSON_INACTIVE_RELATIONSHIP, EXAMPLE_RELATED_PERSON_ROLE, EXAMPLE_SUBJECT_DID, } from './shared.js';
6
+ import { createInteroperableResourceOperationEditor, InteroperableOperationMethods, buildInteroperableSearchPath, InteroperableLifecycleStatuses, } from '../utils/interoperable-resource-operation.js';
7
+ import { LifecycleRequestType } from '../constants/lifecycle.js';
2
8
  /**
3
9
  * Examples for related-person / family-member flows.
4
10
  */
5
- export const EXAMPLE_RELATED_PERSON_PAYLOAD = {
11
+ export const EXAMPLE_RELATED_PERSON_RESOURCE_TYPE = ResourceTypesFhirR4.RelatedPerson;
12
+ export const EXAMPLE_RELATED_PERSON_DISABLE_REQUEST_TYPE = LifecycleRequestType.RelatedPersonDisable;
13
+ export const EXAMPLE_RELATED_PERSON_PURGE_REQUEST_TYPE = LifecycleRequestType.RelatedPersonPurge;
14
+ export const EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID = 'related-person-internal-001';
15
+ export const EXAMPLE_RELATED_PERSON_SEARCH_URL = buildInteroperableSearchPath(EXAMPLE_RELATED_PERSON_RESOURCE_TYPE);
16
+ export const EXAMPLE_RELATED_PERSON_DISPLAY_NAME = EXAMPLE_RELATED_PERSON_ACTIVE_NAME;
17
+ /**
18
+ * Minimal semantic input used by SDK helpers to disable one subject-side
19
+ * relationship record through the identifier-first lifecycle contract.
20
+ */
21
+ export const EXAMPLE_RELATED_PERSON_DISABLE_INPUT = {
22
+ memberClaims: {
23
+ '@context': EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API,
24
+ [RelatedPersonClaim.Identifier]: EXAMPLE_RELATED_PERSON_IDENTIFIER,
25
+ [RelatedPersonClaim.Patient]: EXAMPLE_SUBJECT_DID,
26
+ [RelatedPersonClaim.Telecom]: `mailto:${EXAMPLE_EMAIL_RELATED_PERSON}`,
27
+ [RelatedPersonClaim.Relationship]: EXAMPLE_RELATED_PERSON_ROLE,
28
+ },
29
+ resourceId: EXAMPLE_RELATED_PERSON_IDENTIFIER,
30
+ };
31
+ /**
32
+ * Canonical lifecycle resource emitted by the shared identifier-first disable
33
+ * contract after the FHIR/business identifier has been normalized.
34
+ */
35
+ export const EXAMPLE_RELATED_PERSON_DISABLE_LIFECYCLE_RESOURCE = createInteroperableResourceOperationEditor()
36
+ .setResourceType(EXAMPLE_RELATED_PERSON_RESOURCE_TYPE)
37
+ .setIdentifierClaimKey(RelatedPersonClaim.Identifier)
38
+ .setBusinessIdentifier(EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims[RelatedPersonClaim.Identifier])
39
+ .setClaims({ ...EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims })
40
+ .setLifecycleStatus(InteroperableLifecycleStatuses.Inactive)
41
+ .buildLifecycleResource();
42
+ /**
43
+ * Shared operational bundle entry for `disableIndividualMember(...)`.
44
+ *
45
+ * Downstream SDK tests can assert against this fixture directly instead of
46
+ * rebuilding the lifecycle resource shape inline.
47
+ */
48
+ export const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_ENTRY = {
49
+ request: { method: InteroperableOperationMethods.Post },
50
+ meta: { claims: { ...EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims } },
51
+ resource: {
52
+ ...EXAMPLE_RELATED_PERSON_DISABLE_LIFECYCLE_RESOURCE,
53
+ id: EXAMPLE_RELATED_PERSON_DISABLE_INPUT.resourceId,
54
+ },
55
+ };
56
+ /**
57
+ * Full shared disable payload used by runtime/documentation examples.
58
+ */
59
+ export const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_PAYLOAD = {
60
+ thid: 'relatedperson-disable-example-001',
61
+ body: {
62
+ resourceType: 'Bundle',
63
+ type: 'batch',
64
+ entry: [EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_ENTRY],
65
+ },
66
+ };
67
+ export const EXAMPLE_RELATED_PERSON_PURGE_LIFECYCLE_RESOURCE = createInteroperableResourceOperationEditor()
68
+ .setResourceType(EXAMPLE_RELATED_PERSON_RESOURCE_TYPE)
69
+ .setIdentifierClaimKey(RelatedPersonClaim.Identifier)
70
+ .setBusinessIdentifier(EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims[RelatedPersonClaim.Identifier])
71
+ .setClaims({ ...EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims })
72
+ .setLifecycleStatus(InteroperableLifecycleStatuses.Purged)
73
+ .buildLifecycleResource();
74
+ export const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_ENTRY = {
75
+ type: EXAMPLE_RELATED_PERSON_PURGE_REQUEST_TYPE,
76
+ request: { method: InteroperableOperationMethods.Post },
77
+ meta: { claims: { ...EXAMPLE_RELATED_PERSON_DISABLE_INPUT.memberClaims } },
78
+ resource: {
79
+ ...EXAMPLE_RELATED_PERSON_PURGE_LIFECYCLE_RESOURCE,
80
+ id: EXAMPLE_RELATED_PERSON_DISABLE_INPUT.resourceId,
81
+ },
82
+ };
83
+ export const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_PAYLOAD = {
84
+ thid: 'relatedperson-purge-example-001',
85
+ body: {
86
+ resourceType: 'Bundle',
87
+ type: 'batch',
88
+ entry: [EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_ENTRY],
89
+ },
90
+ };
91
+ /**
92
+ * Canonical upsert payload for subject-side relationship examples.
93
+ *
94
+ * This bundle shape is the shared SDK/documentation fixture and should be
95
+ * reused by downstream repositories instead of rebuilding inline `Bundle`
96
+ * examples for `upsertRelatedPersonAndPoll(...)`.
97
+ */
98
+ export const EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD = {
99
+ thid: 'relatedperson-upsert-example-001',
100
+ body: {
101
+ resourceType: 'Bundle',
102
+ type: 'batch',
103
+ entry: [{
104
+ resource: {
105
+ resourceType: EXAMPLE_RELATED_PERSON_RESOURCE_TYPE,
106
+ id: 'grandfather-001',
107
+ patient: { reference: EXAMPLE_SUBJECT_DID },
108
+ relationship: [{ text: 'Grandfather' }],
109
+ name: [{ text: EXAMPLE_RELATED_PERSON_DISPLAY_NAME }],
110
+ },
111
+ }],
112
+ },
113
+ };
114
+ /** @deprecated Use `EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD`. */
115
+ export const EXAMPLE_RELATED_PERSON_PAYLOAD = EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD;
116
+ /**
117
+ * Legacy JSON:API-style shell still referenced by older pass-through tests.
118
+ */
119
+ export const EXAMPLE_RELATED_PERSON_BATCH_DATA_PAYLOAD = {
6
120
  body: {
7
121
  data: [
8
122
  {
9
- type: 'RelatedPerson',
123
+ type: EXAMPLE_RELATED_PERSON_RESOURCE_TYPE,
124
+ },
125
+ ],
126
+ },
127
+ };
128
+ /**
129
+ * FHIR-shaped example used to demonstrate identifier-first operational
130
+ * normalization before claims-first processing.
131
+ */
132
+ export const EXAMPLE_RELATED_PERSON_FHIR_RESOURCE = {
133
+ resourceType: EXAMPLE_RELATED_PERSON_RESOURCE_TYPE,
134
+ id: EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID,
135
+ identifier: [{ value: EXAMPLE_RELATED_PERSON_IDENTIFIER }],
136
+ active: true,
137
+ patient: { reference: EXAMPLE_SUBJECT_DID },
138
+ relationship: [{ coding: [{ code: EXAMPLE_RELATED_PERSON_ROLE.split('|')[1], system: HL7_CODING_SYSTEM_V3_ROLE_CODE }] }],
139
+ telecom: [{ value: `mailto:${EXAMPLE_EMAIL_RELATED_PERSON}` }],
140
+ };
141
+ export const EXAMPLE_RELATED_PERSON_DISABLE_SEARCH_PARAMS = {
142
+ identifier: EXAMPLE_RELATED_PERSON_IDENTIFIER,
143
+ };
144
+ export const EXAMPLE_RELATED_PERSON_LIST_RECORD_ACTIVE = {
145
+ id: EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID,
146
+ meta: {
147
+ status: 'active',
148
+ },
149
+ resource: {
150
+ resourceType: EXAMPLE_RELATED_PERSON_RESOURCE_TYPE,
151
+ id: EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID,
152
+ meta: {
153
+ claims: {
154
+ '@context': EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API,
155
+ [RelatedPersonClaim.Identifier]: EXAMPLE_RELATED_PERSON_IDENTIFIER,
156
+ [RelatedPersonClaim.Patient]: EXAMPLE_SUBJECT_DID,
157
+ [RelatedPersonClaim.Telecom]: `mailto:${EXAMPLE_EMAIL_RELATED_PERSON}`,
158
+ [RelatedPersonClaim.Relationship]: EXAMPLE_RELATED_PERSON_ROLE,
159
+ [RelatedPersonClaim.Name]: EXAMPLE_RELATED_PERSON_DISPLAY_NAME,
160
+ [RelatedPersonClaim.Active]: 'true',
10
161
  },
162
+ },
163
+ },
164
+ };
165
+ export const EXAMPLE_RELATED_PERSON_LIST_RECORD_INACTIVE = {
166
+ id: 'related-person-internal-002',
167
+ meta: {
168
+ status: 'inactive',
169
+ },
170
+ resource: {
171
+ resourceType: EXAMPLE_RELATED_PERSON_RESOURCE_TYPE,
172
+ id: 'related-person-internal-002',
173
+ meta: {
174
+ claims: {
175
+ '@context': EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API,
176
+ [RelatedPersonClaim.Identifier]: EXAMPLE_RELATED_PERSON_INACTIVE_IDENTIFIER,
177
+ [RelatedPersonClaim.Patient]: EXAMPLE_SUBJECT_DID,
178
+ [RelatedPersonClaim.Telecom]: `mailto:${EXAMPLE_RELATED_PERSON_INACTIVE_EMAIL}`,
179
+ [RelatedPersonClaim.Relationship]: EXAMPLE_RELATED_PERSON_INACTIVE_RELATIONSHIP,
180
+ [RelatedPersonClaim.Name]: EXAMPLE_RELATED_PERSON_INACTIVE_NAME,
181
+ [RelatedPersonClaim.Active]: 'false',
182
+ },
183
+ },
184
+ },
185
+ };
186
+ export const EXAMPLE_RELATED_PERSON_LIST_RESPONSE_BODY = {
187
+ body: {
188
+ data: [
189
+ EXAMPLE_RELATED_PERSON_LIST_RECORD_ACTIVE,
190
+ EXAMPLE_RELATED_PERSON_LIST_RECORD_INACTIVE,
11
191
  ],
12
192
  },
13
193
  };
194
+ export const EXAMPLE_RELATED_PERSON_INACTIVE_STATUS = InteroperableLifecycleStatuses.Inactive;
195
+ export const EXAMPLE_RELATED_PERSON_PURGED_STATUS = InteroperableLifecycleStatuses.Purged;