gdc-sdk-node-ts 2.1.1 → 2.2.2

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 (43) hide show
  1. package/README.md +11 -5
  2. package/dist/backend-profile-workspace.d.ts +48 -0
  3. package/dist/backend-profile-workspace.js +91 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/individual-controller-backend-runtime.d.ts +6 -1
  7. package/dist/individual-controller-backend-runtime.js +7 -0
  8. package/dist/node-runtime-client.d.ts +18 -27
  9. package/dist/node-runtime-client.js +230 -461
  10. package/dist/orchestration/client-port.d.ts +4 -2
  11. package/dist/orchestration/individual-controller-sdk.d.ts +42 -9
  12. package/dist/orchestration/individual-controller-sdk.js +48 -8
  13. package/dist/orchestration/individual-member-sdk.d.ts +25 -0
  14. package/dist/orchestration/individual-member-sdk.js +29 -0
  15. package/dist/orchestration/personal-sdk.d.ts +3 -1
  16. package/dist/orchestration/personal-sdk.js +4 -0
  17. package/dist/orchestration/professional-sdk.d.ts +36 -1
  18. package/dist/orchestration/professional-sdk.js +43 -0
  19. package/dist/professional-backend-runtime.d.ts +6 -1
  20. package/dist/professional-backend-runtime.js +7 -0
  21. package/dist/profile-workspace.d.ts +12 -0
  22. package/dist/profile-workspace.js +15 -0
  23. package/dist/resource-operations.d.ts +82 -25
  24. package/dist/resource-operations.js +190 -3
  25. package/dist/runtime-client-paths.d.ts +81 -0
  26. package/dist/runtime-client-paths.js +95 -0
  27. package/dist/runtime-consent.d.ts +7 -0
  28. package/dist/runtime-consent.js +21 -0
  29. package/dist/runtime-host-submission.d.ts +62 -0
  30. package/dist/runtime-host-submission.js +82 -0
  31. package/dist/runtime-http-trace.d.ts +4 -0
  32. package/dist/runtime-http-trace.js +44 -0
  33. package/dist/runtime-message.d.ts +10 -0
  34. package/dist/runtime-message.js +19 -0
  35. package/dist/runtime-paths.d.ts +12 -0
  36. package/dist/runtime-paths.js +41 -0
  37. package/dist/runtime-route-context.d.ts +20 -0
  38. package/dist/runtime-route-context.js +68 -0
  39. package/dist/runtime-transport.d.ts +22 -0
  40. package/dist/runtime-transport.js +91 -0
  41. package/dist/smart-token.d.ts +8 -29
  42. package/dist/smart-token.js +28 -3
  43. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- import { IndividualOrganizationLifecycleEditor } from 'gdc-common-utils-ts';
2
1
  import type { LicenseOfferSearchState, LicenseOrderSearchState } from 'gdc-common-utils-ts/utils/license-commercial-search';
3
2
  import type { LicenseListSearchState } from 'gdc-common-utils-ts/utils/license-list-search';
4
- import type { BundleSearchQuery, CommunicationInput, DateRange, EmployeeSearchValue } from 'gdc-sdk-core-ts';
3
+ import type { BundleSearchQuery, CommunicationInput, DateRange, EmployeeSearchValue, IndividualOrganizationLifecycleInput } from 'gdc-sdk-core-ts';
4
+ import type { BundleEntry, BundleJsonApi } from 'gdc-common-utils-ts/models/bundle';
5
5
  import type { SubmitAndPollResult } from './orchestration/client-port.js';
6
6
  import type { RouteContext } from './individual-onboarding.js';
7
7
  export type OrganizationEmployeeCreationInput = {
@@ -116,34 +116,18 @@ export type LicenseOrderRuntimeSearchInput = {
116
116
  * - disable is `individual/org.schema/Organization/_disable`
117
117
  * - purge is `individual/org.schema/Organization/_purge`
118
118
  */
119
- export type IndividualOrganizationLifecycleInput = {
120
- /**
121
- * Canonical claims used by GW CORE to locate the hosted individual/family
122
- * registration.
123
- */
124
- organizationClaims?: Record<string, unknown>;
125
- /**
126
- * Preferred high-level shared editor for lifecycle callers that want to
127
- * avoid assembling raw claims inline.
128
- */
129
- organizationEditor?: IndividualOrganizationLifecycleEditor;
130
- /**
131
- * Optional canonical resource id when already known by the caller.
132
- */
133
- resourceId?: string;
134
- dataType?: string;
135
- };
136
119
  /**
137
- * Forward-looking locator payload for a future individual-member lifecycle contract.
120
+ * Current locator payload for individual-member / caregiver lifecycle
121
+ * operations backed by `RelatedPerson`.
138
122
  *
139
- * Current GW CORE does not yet expose a stable lifecycle contract for
140
- * `RelatedPerson` / individual-member records. The Node SDK keeps this type so
141
- * controller-only methods and TDD can be prepared without fabricating backend behavior.
123
+ * Current runtime behavior:
124
+ * - disable uses `RelatedPerson/_batch` with identifier-first lifecycle
125
+ * resource semantics
126
+ * - purge uses explicit `RelatedPerson/_purge`
142
127
  */
143
128
  export type IndividualMemberLifecycleInput = {
144
129
  /**
145
- * Canonical claims expected to locate the member/caregiver relationship once
146
- * GW CORE exposes the lifecycle contract.
130
+ * Canonical claims used to locate the member/caregiver relationship.
147
131
  */
148
132
  memberClaims: Record<string, unknown>;
149
133
  resourceId?: string;
@@ -177,6 +161,53 @@ export type CommunicationIngestionInput = {
177
161
  intervalMs?: number;
178
162
  };
179
163
  };
164
+ export type BlockchainArtifactRegistrationInput = {
165
+ subject: string;
166
+ resource?: Record<string, unknown>;
167
+ contentDataBase64?: string;
168
+ contentType?: string;
169
+ identifier?: string;
170
+ title?: string;
171
+ description?: string;
172
+ date?: string;
173
+ location?: string;
174
+ language?: string;
175
+ requestThid?: string;
176
+ pollOptions?: {
177
+ timeoutMs?: number;
178
+ intervalMs?: number;
179
+ };
180
+ };
181
+ export type BlockchainArtifactSearchSelectionInput = Readonly<{
182
+ subject: string;
183
+ searchResponse: unknown;
184
+ selectedResourceIds?: readonly string[];
185
+ }>;
186
+ export type BlockchainArtifactSearchSelectionResult = Readonly<{
187
+ availableResourceIds: readonly string[];
188
+ anchoredResourceIds: readonly string[];
189
+ unanchoredResourceIds: readonly string[];
190
+ selectedResourceIds: readonly string[];
191
+ missingResourceIds: readonly string[];
192
+ returnedCount: number;
193
+ totalCount: number;
194
+ bundle: BundleJsonApi<BundleEntry>;
195
+ }>;
196
+ export type VitalSignBatchCommunicationFromSearchResponseInput = Readonly<{
197
+ subject: string;
198
+ searchResponse: unknown;
199
+ selectedResourceIds?: readonly string[];
200
+ sender?: string;
201
+ recipient?: string | string[];
202
+ sent?: string;
203
+ status?: string;
204
+ noteText?: string;
205
+ requestThid?: string;
206
+ pollOptions?: {
207
+ timeoutMs?: number;
208
+ intervalMs?: number;
209
+ };
210
+ }>;
180
211
  /**
181
212
  * Runtime participant query for `Communication/_search`.
182
213
  *
@@ -549,11 +580,37 @@ export declare function searchClinicalBundleWithDeps(routeCtx: RouteContext, inp
549
580
  intervalMs?: number;
550
581
  }) => Promise<SubmitAndPollResult>;
551
582
  }): Promise<SubmitAndPollResult>;
583
+ /**
584
+ * Builds one Communication-ready ingestion payload from a paginated search
585
+ * response that already selected the day batches to be anchored.
586
+ *
587
+ * The search response is normalized into a `Bundle.type=batch` attachment,
588
+ * and the resulting `Communication` is ready for `ingestCommunication...`.
589
+ */
590
+ export declare function buildVitalSignBatchCommunicationFromSearchResponse(input: VitalSignBatchCommunicationFromSearchResponseInput): CommunicationIngestionInput;
591
+ /**
592
+ * Builds one blockchain-ready batch bundle from a paginated search response.
593
+ *
594
+ * The helper keeps the original search result as the source of truth and only
595
+ * projects the selected `resource.id` values into a `Bundle.type=batch`
596
+ * payload for subsequent communication/registration.
597
+ */
598
+ export declare function buildBlockchainArtifactBundleFromSearchResponse(input: BlockchainArtifactSearchSelectionInput): BlockchainArtifactSearchSelectionResult;
552
599
  export declare function searchLatestIpsWithDeps(routeCtx: RouteContext, input: Omit<ClinicalBundleSearchInput, 'includedTypes' | 'section'> & {
553
600
  section?: string | string[];
554
601
  }, deps: {
555
602
  searchClinicalBundle: (routeCtx: RouteContext, input: ClinicalBundleSearchInput) => Promise<SubmitAndPollResult>;
556
603
  }): Promise<SubmitAndPollResult>;
604
+ export declare function registerBlockchainArtifactAndUpdateIndexWithDeps(routeCtx: RouteContext, input: BlockchainArtifactRegistrationInput, deps: {
605
+ individualDocumentReferenceBatchPath: (ctx: RouteContext) => string;
606
+ individualDocumentReferencePollPath: (ctx: RouteContext) => string;
607
+ submitAndPoll: (submitPath: string, pollPath: string, payload: {
608
+ thid?: string;
609
+ } & Record<string, unknown>, pollOptions?: {
610
+ timeoutMs?: number;
611
+ intervalMs?: number;
612
+ }) => Promise<SubmitAndPollResult>;
613
+ }): Promise<SubmitAndPollResult>;
557
614
  export declare function grantProfessionalAccessWithDeps(routeCtx: RouteContext, input: GrantProfessionalAccessInput, deps: {
558
615
  buildConsentClaimsWithCid: (input: GrantProfessionalAccessInput, options?: {
559
616
  consentIdentifierFactory: () => string;
@@ -2,7 +2,8 @@
2
2
  import { HealthcareBasicSections, ResourceTypesFhirR4 } from 'gdc-common-utils-ts/constants';
3
3
  import { Format } from 'gdc-common-utils-ts/constants/Schemas';
4
4
  import { RelatedPersonClaim } from 'gdc-common-utils-ts/models/interoperable-claims/related-person-claims';
5
- import { buildCommunicationParticipantSearchBundle, createInteroperableResourceOperationEditor, IndividualOrganizationLifecycleEditor, LicenseOfferSearchEditor, LicenseOrderSearchEditor, InteroperableLifecycleStatuses, LicenseListSearchEditor, } from 'gdc-common-utils-ts';
5
+ import { buildCommunicationParticipantSearchBundle, buildBlockchainArtifactDocumentReference, BundleQuery, createInteroperableResourceOperationEditor, IndividualOrganizationLifecycleEditor, LicenseOfferSearchEditor, LicenseOrderSearchEditor, InteroperableLifecycleStatuses, LicenseListSearchEditor, } from 'gdc-common-utils-ts';
6
+ import { addFhirResourceToCommunication, createCommunicationResource, } from 'gdc-sdk-core-ts';
6
7
  import { GwCoreLifecycleRequestMethod, GwCoreLifecycleRequestType, GwCoreLifecycleTodo, } from './constants/lifecycle.js';
7
8
  import { buildEmployeeBatchEntry, buildEmployeeSearchBundle, ConsentClaims, } from 'gdc-sdk-core-ts';
8
9
  export async function createOrganizationEmployeeWithDeps(routeCtx, input, options, deps) {
@@ -125,6 +126,7 @@ export async function disableIndividualOrganizationWithDeps(routeCtx, input, opt
125
126
  routeCtx,
126
127
  requestType: input.dataType || GwCoreLifecycleRequestType.IndividualOrganizationDisable,
127
128
  organizationClaims: input.organizationClaims,
129
+ individualEditor: input.individualEditor,
128
130
  organizationEditor: input.organizationEditor,
129
131
  resourceId: input.resourceId,
130
132
  thidPrefix: 'individual-organization-disable',
@@ -136,6 +138,7 @@ export async function purgeIndividualOrganizationWithDeps(routeCtx, input, optio
136
138
  routeCtx,
137
139
  requestType: input.dataType || GwCoreLifecycleRequestType.IndividualOrganizationPurge,
138
140
  organizationClaims: input.organizationClaims,
141
+ individualEditor: input.individualEditor,
139
142
  organizationEditor: input.organizationEditor,
140
143
  resourceId: input.resourceId,
141
144
  thidPrefix: 'individual-organization-purge',
@@ -321,6 +324,117 @@ export async function searchClinicalBundleWithDeps(routeCtx, input, deps) {
321
324
  };
322
325
  return deps.submitAndPoll(deps.bundleSearchPath(routeCtx), deps.bundleSearchPollPath(routeCtx), payload, input.pollOptions);
323
326
  }
327
+ /**
328
+ * Builds one Communication-ready ingestion payload from a paginated search
329
+ * response that already selected the day batches to be anchored.
330
+ *
331
+ * The search response is normalized into a `Bundle.type=batch` attachment,
332
+ * and the resulting `Communication` is ready for `ingestCommunication...`.
333
+ */
334
+ export function buildVitalSignBatchCommunicationFromSearchResponse(input) {
335
+ const selection = buildBlockchainArtifactBundleFromSearchResponse({
336
+ subject: input.subject,
337
+ searchResponse: input.searchResponse,
338
+ selectedResourceIds: input.selectedResourceIds,
339
+ });
340
+ const communication = addFhirResourceToCommunication(createCommunicationResource({
341
+ subject: input.subject,
342
+ sender: input.sender,
343
+ recipient: input.recipient,
344
+ sent: input.sent,
345
+ status: input.status || 'completed',
346
+ noteText: input.noteText || `Selected ${selection.selectedResourceIds.length} vital-sign batch item(s) for blockchain anchoring.`,
347
+ claims: {
348
+ 'Communication.vital-sign-batch-selection.subject': input.subject,
349
+ 'Communication.vital-sign-batch-selection.selected-count': selection.selectedResourceIds.length,
350
+ 'Communication.vital-sign-batch-selection.unanchored-count': selection.unanchoredResourceIds.length,
351
+ 'Communication.vital-sign-batch-selection.selected-ids': selection.selectedResourceIds.join(','),
352
+ 'Communication.vital-sign-batch-selection.missing-ids': selection.missingResourceIds.join(','),
353
+ },
354
+ }), selection.bundle, {
355
+ attachmentContentType: 'application/fhir+json',
356
+ attachmentTitle: 'vital-sign-batch-selection.json',
357
+ });
358
+ return {
359
+ communicationPayload: communication,
360
+ pathFormatSegment: 'org.hl7.fhir.r4',
361
+ pollOptions: input.pollOptions,
362
+ autoConvertClaimsToFhirR4: false,
363
+ };
364
+ }
365
+ /**
366
+ * Builds one blockchain-ready batch bundle from a paginated search response.
367
+ *
368
+ * The helper keeps the original search result as the source of truth and only
369
+ * projects the selected `resource.id` values into a `Bundle.type=batch`
370
+ * payload for subsequent communication/registration.
371
+ */
372
+ export function buildBlockchainArtifactBundleFromSearchResponse(input) {
373
+ const bundle = normalizeBundleLike(input.searchResponse);
374
+ const query = new BundleQuery(bundle);
375
+ const availableResourceIds = query.getResourceIds();
376
+ const availableEntries = query.getResourceEntriesByIds(availableResourceIds);
377
+ const anchoredResourceIds = availableEntries
378
+ .filter((entry) => hasAuditTxId(entry))
379
+ .map((entry, index) => resolveBundleEntryStableId(entry, index));
380
+ const unanchoredResourceIds = availableResourceIds.filter((resourceId) => !anchoredResourceIds.includes(resourceId));
381
+ const requestedResourceIds = normalizeIdList(input.selectedResourceIds);
382
+ const selectedResourceIds = requestedResourceIds.length > 0
383
+ ? requestedResourceIds.filter((resourceId) => availableResourceIds.includes(resourceId))
384
+ : unanchoredResourceIds;
385
+ const missingResourceIds = requestedResourceIds.filter((resourceId) => !availableResourceIds.includes(resourceId));
386
+ if (requestedResourceIds.length > 0 && selectedResourceIds.length === 0) {
387
+ throw new Error('buildBlockchainArtifactBundleFromSearchResponse could not match any selected resource ids.');
388
+ }
389
+ const selectedEntries = query.getResourceEntriesByIds(selectedResourceIds);
390
+ const artifactEntries = selectedEntries.map((entry, index) => {
391
+ const resource = entry.resource && typeof entry.resource === 'object' ? entry.resource : undefined;
392
+ if (!resource) {
393
+ throw new Error(`buildBlockchainArtifactBundleFromSearchResponse requires resource data for selected entry at index ${index}.`);
394
+ }
395
+ const logicalIdentifier = asTrimmedString(resource.id || entry.id || entry.fullUrl || selectedResourceIds[index]);
396
+ const artifact = buildBlockchainArtifactDocumentReference({
397
+ subject: input.subject,
398
+ resource,
399
+ identifier: logicalIdentifier || undefined,
400
+ title: `${asTrimmedString(resource.resourceType) || 'resource'}.json`,
401
+ });
402
+ return {
403
+ type: 'DocumentReference',
404
+ meta: { claims: artifact.documentReference.meta?.claims || {} },
405
+ resource: artifact.documentReference,
406
+ request: {
407
+ method: 'POST',
408
+ url: 'individual/org.hl7.fhir.r4/DocumentReference/_batch',
409
+ },
410
+ };
411
+ });
412
+ return {
413
+ availableResourceIds,
414
+ anchoredResourceIds,
415
+ unanchoredResourceIds,
416
+ selectedResourceIds,
417
+ missingResourceIds,
418
+ returnedCount: query.getResourceIds().length,
419
+ totalCount: typeof bundle.total === 'number'
420
+ ? Number(bundle.total)
421
+ : query.getResourceIds().length,
422
+ bundle: {
423
+ resourceType: 'Bundle',
424
+ type: 'batch',
425
+ meta: {
426
+ claims: {
427
+ 'BlockchainArtifactSelection.subject': input.subject,
428
+ 'BlockchainArtifactSelection.availableCount': availableResourceIds.length,
429
+ 'BlockchainArtifactSelection.selectedCount': selectedResourceIds.length,
430
+ 'BlockchainArtifactSelection.missingCount': missingResourceIds.length,
431
+ 'BlockchainArtifactSelection.selectedResourceIds': selectedResourceIds.join(','),
432
+ },
433
+ },
434
+ data: artifactEntries,
435
+ },
436
+ };
437
+ }
324
438
  export async function searchLatestIpsWithDeps(routeCtx, input, deps) {
325
439
  return deps.searchClinicalBundle(routeCtx, {
326
440
  ...input,
@@ -328,6 +442,78 @@ export async function searchLatestIpsWithDeps(routeCtx, input, deps) {
328
442
  includedTypes: ['Composition', 'DocumentReference'],
329
443
  });
330
444
  }
445
+ export async function registerBlockchainArtifactAndUpdateIndexWithDeps(routeCtx, input, deps) {
446
+ const artifact = buildBlockchainArtifactDocumentReference({
447
+ subject: input.subject,
448
+ resource: input.resource,
449
+ contentDataBase64: input.contentDataBase64,
450
+ contentType: input.contentType,
451
+ identifier: input.identifier,
452
+ title: input.title,
453
+ description: input.description,
454
+ date: input.date,
455
+ location: input.location,
456
+ language: input.language,
457
+ });
458
+ const payload = {
459
+ thid: input.requestThid || `blockchain-artifact-${createRuntimeUuid()}`,
460
+ body: {
461
+ resourceType: 'Bundle',
462
+ type: 'batch',
463
+ data: [{
464
+ type: 'DocumentReference',
465
+ meta: { claims: artifact.documentReference.meta?.claims || {} },
466
+ resource: artifact.documentReference,
467
+ request: {
468
+ method: 'POST',
469
+ url: 'individual/org.hl7.fhir.r4/DocumentReference/_batch',
470
+ },
471
+ }],
472
+ },
473
+ };
474
+ return deps.submitAndPoll(deps.individualDocumentReferenceBatchPath(routeCtx), deps.individualDocumentReferencePollPath(routeCtx), payload, input.pollOptions);
475
+ }
476
+ function normalizeBundleLike(value) {
477
+ const root = value && typeof value === 'object' ? value : {};
478
+ const body = root.body && typeof root.body === 'object' ? root.body : root;
479
+ const resourceType = asTrimmedString(body.resourceType) || 'Bundle';
480
+ const type = asTrimmedString(body.type) || 'batch';
481
+ const data = Array.isArray(body.data)
482
+ ? body.data
483
+ : (Array.isArray(body.entry) ? body.entry : []);
484
+ return {
485
+ ...(typeof body.id === 'string' ? { id: asTrimmedString(body.id) || undefined } : {}),
486
+ resourceType: resourceType,
487
+ type,
488
+ total: typeof body.total === 'number' ? body.total : undefined,
489
+ meta: body.meta && typeof body.meta === 'object' ? body.meta : undefined,
490
+ data: data,
491
+ };
492
+ }
493
+ function normalizeIdList(value) {
494
+ return [...(value || [])]
495
+ .map((item) => asTrimmedString(item))
496
+ .filter(Boolean);
497
+ }
498
+ function asTrimmedString(value) {
499
+ if (value === undefined || value === null) {
500
+ return '';
501
+ }
502
+ return String(value).trim();
503
+ }
504
+ function resolveBundleEntryStableId(entry, index) {
505
+ const resource = entry.resource && typeof entry.resource === 'object' ? entry.resource : {};
506
+ return asTrimmedString(resource.id || entry.id || entry.fullUrl || `entry-${index}`);
507
+ }
508
+ function hasAuditTxId(entry) {
509
+ const entryAudit = entry && typeof entry === 'object' ? entry.audit : undefined;
510
+ const entryMeta = entry && typeof entry === 'object' ? entry.meta : undefined;
511
+ const resource = entry.resource && typeof entry.resource === 'object' ? entry.resource : {};
512
+ const resourceMeta = resource.meta && typeof resource.meta === 'object' ? resource.meta : {};
513
+ const audit = [entryAudit, entryMeta && typeof entryMeta === 'object' ? entryMeta.audit : undefined, resourceMeta.audit]
514
+ .find((candidate) => candidate && typeof candidate === 'object');
515
+ return Boolean(asTrimmedString(audit?.txId));
516
+ }
331
517
  export async function grantProfessionalAccessWithDeps(routeCtx, input, deps) {
332
518
  const built = deps.buildConsentClaimsWithCid({
333
519
  subjectDid: input.subjectDid,
@@ -438,8 +624,9 @@ function buildEmployeeLifecyclePayload(input) {
438
624
  };
439
625
  }
440
626
  function buildIndividualOrganizationLifecyclePayload(input) {
441
- const payload = input.organizationEditor
442
- ? new IndividualOrganizationLifecycleEditor(input.organizationEditor.getState())
627
+ const editor = input.individualEditor || input.organizationEditor;
628
+ const payload = editor
629
+ ? new IndividualOrganizationLifecycleEditor(editor.getState())
443
630
  : new IndividualOrganizationLifecycleEditor().setClaims(input.organizationClaims || {});
444
631
  payload
445
632
  .setRequestType(input.requestType)
@@ -0,0 +1,81 @@
1
+ import type { HostRouteContext } from './host-onboarding.js';
2
+ import type { RouteContext } from './individual-onboarding.js';
3
+ export declare class RuntimeClientPaths {
4
+ private readonly defaultCtx?;
5
+ private readonly warningState;
6
+ constructor(defaultCtx?: RouteContext);
7
+ requireRouteContext(ctx?: RouteContext): RouteContext;
8
+ routeCtxFromInput(input: {
9
+ serviceProviderDid?: string;
10
+ tenantId?: string;
11
+ jurisdiction?: string;
12
+ sector?: string;
13
+ }): RouteContext;
14
+ requireHostRouteContext(ctx?: HostRouteContext): HostRouteContext;
15
+ v1Path(ctx: RouteContext | undefined, section: string, format: string, resourceType: string, action: string): string;
16
+ hostRegistryPath(ctx: HostRouteContext | undefined, resourceType: string, action: string): string;
17
+ hostRegistryOrganizationTransactionPath(ctx?: HostRouteContext): string;
18
+ hostRegistryOrganizationTransactionPollPath(ctx?: HostRouteContext): string;
19
+ hostRegistryOrganizationIssuePath(ctx?: HostRouteContext): string;
20
+ hostRegistryOrganizationIssuePollPath(ctx?: HostRouteContext): string;
21
+ hostRegistryOrganizationActivatePath(ctx?: HostRouteContext): string;
22
+ hostRegistryOrganizationActivatePollPath(ctx?: HostRouteContext): string;
23
+ hostRegistryOrganizationDisablePath(ctx?: HostRouteContext): string;
24
+ hostRegistryOrganizationDisablePollPath(ctx?: HostRouteContext): string;
25
+ hostRegistryOrganizationPurgePath(ctx?: HostRouteContext): string;
26
+ hostRegistryOrganizationPurgePollPath(ctx?: HostRouteContext): string;
27
+ hostRegistryOrderBatchPath(ctx?: HostRouteContext): string;
28
+ hostRegistryOrderPollPath(ctx?: HostRouteContext): string;
29
+ employeeBatchPath(ctx?: RouteContext): string;
30
+ employeePollPath(ctx?: RouteContext): string;
31
+ employeeSearchPath(ctx?: RouteContext): string;
32
+ employeeSearchPollPath(ctx?: RouteContext): string;
33
+ organizationLicenseSearchPath(ctx?: RouteContext): string;
34
+ organizationLicenseSearchPollPath(ctx?: RouteContext): string;
35
+ organizationDidBindingPath(ctx?: RouteContext): string;
36
+ organizationDidBindingPollPath(ctx?: RouteContext): string;
37
+ organizationLicenseOfferSearchPath(ctx?: RouteContext): string;
38
+ organizationLicenseOfferSearchPollPath(ctx?: RouteContext): string;
39
+ organizationLicenseOrderSearchPath(ctx?: RouteContext): string;
40
+ organizationLicenseOrderSearchPollPath(ctx?: RouteContext): string;
41
+ employeePurgePath(ctx?: RouteContext): string;
42
+ employeePurgePollPath(ctx?: RouteContext): string;
43
+ individualFamilyOrganizationBatchPath(ctx?: RouteContext): string;
44
+ individualFamilyOrganizationPollPath(ctx?: RouteContext): string;
45
+ individualFamilyOrganizationSearchPath(ctx?: RouteContext): string;
46
+ individualFamilyOrganizationSearchPollPath(ctx?: RouteContext): string;
47
+ individualFamilyOrganizationTransactionPath(ctx?: RouteContext): string;
48
+ individualFamilyOrganizationTransactionPollPath(ctx?: RouteContext): string;
49
+ individualFamilyOrganizationDisablePath(ctx?: RouteContext): string;
50
+ individualFamilyOrganizationDisablePollPath(ctx?: RouteContext): string;
51
+ individualFamilyOrganizationPurgePath(ctx?: RouteContext): string;
52
+ individualFamilyOrganizationPurgePollPath(ctx?: RouteContext): string;
53
+ individualLicenseSearchPath(ctx?: RouteContext): string;
54
+ individualLicenseSearchPollPath(ctx?: RouteContext): string;
55
+ individualLicenseOfferSearchPath(ctx?: RouteContext): string;
56
+ individualLicenseOfferSearchPollPath(ctx?: RouteContext): string;
57
+ individualLicenseOrderSearchPath(ctx?: RouteContext): string;
58
+ individualLicenseOrderSearchPollPath(ctx?: RouteContext): string;
59
+ individualFamilyOrderBatchPath(ctx?: RouteContext): string;
60
+ individualFamilyOrderPollPath(ctx?: RouteContext): string;
61
+ individualRelatedPersonBatchPath(ctx?: RouteContext): string;
62
+ individualRelatedPersonPollPath(ctx?: RouteContext): string;
63
+ individualRelatedPersonPurgePath(ctx?: RouteContext): string;
64
+ individualRelatedPersonPurgePollPath(ctx?: RouteContext): string;
65
+ individualConsentR4BatchPath(ctx: RouteContext): string;
66
+ individualConsentR4PollPath(ctx: RouteContext): string;
67
+ individualCommunicationBatchPath(ctx: RouteContext, format: 'org.hl7.fhir.api' | 'org.hl7.fhir.r4'): string;
68
+ individualCommunicationPollPath(ctx: RouteContext, format: 'org.hl7.fhir.api' | 'org.hl7.fhir.r4'): string;
69
+ individualCommunicationSearchPath(ctx: RouteContext): string;
70
+ individualCommunicationSearchPollPath(ctx: RouteContext): string;
71
+ individualDocumentReferenceBatchPath(ctx: RouteContext): string;
72
+ individualDocumentReferencePollPath(ctx: RouteContext): string;
73
+ individualBundleSearchPath(ctx: RouteContext): string;
74
+ individualBundleSearchPollPath(ctx: RouteContext): string;
75
+ identityTokenExchangePath(ctx: RouteContext): string;
76
+ identityTokenExchangePollPath(ctx: RouteContext): string;
77
+ identityDeviceDcrPath(ctx: RouteContext): string;
78
+ identityDeviceDcrPollPath(ctx: RouteContext): string;
79
+ identityOpenIdSmartTokenPath(ctx: RouteContext): string;
80
+ identityOpenIdSmartTokenPollPath(ctx: RouteContext): string;
81
+ }
@@ -0,0 +1,95 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { GwCoreLifecycleAction } from './constants/lifecycle.js';
3
+ import { buildHostRegistryPath, buildIdentityDeviceDcrPath, buildIdentityDeviceDcrPollPath, buildIdentityOpenIdSmartTokenPath, buildIdentityOpenIdSmartTokenPollPath, buildIdentityTokenExchangePath, buildIdentityTokenExchangePollPath, buildOrganizationDidBindingPath, buildOrganizationDidBindingPollPath, buildV1Path, } from './runtime-paths.js';
4
+ import { requireHostRouteContext, requireRouteContext, routeCtxFromInput, } from './runtime-route-context.js';
5
+ export class RuntimeClientPaths {
6
+ constructor(defaultCtx) {
7
+ this.warningState = {
8
+ warnedDefaultHostNetwork: false,
9
+ };
10
+ this.defaultCtx = defaultCtx;
11
+ }
12
+ requireRouteContext(ctx) {
13
+ return requireRouteContext(ctx, this.defaultCtx);
14
+ }
15
+ routeCtxFromInput(input) {
16
+ return routeCtxFromInput(input, this.defaultCtx);
17
+ }
18
+ requireHostRouteContext(ctx) {
19
+ return requireHostRouteContext(ctx, {
20
+ defaultJurisdiction: this.defaultCtx?.jurisdiction,
21
+ warningState: this.warningState,
22
+ warn: (message) => console.warn(message),
23
+ });
24
+ }
25
+ v1Path(ctx, section, format, resourceType, action) {
26
+ return buildV1Path(this.requireRouteContext(ctx), section, format, resourceType, action);
27
+ }
28
+ hostRegistryPath(ctx, resourceType, action) {
29
+ return buildHostRegistryPath(this.requireHostRouteContext(ctx), resourceType, action);
30
+ }
31
+ hostRegistryOrganizationTransactionPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.Transaction); }
32
+ hostRegistryOrganizationTransactionPollPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.TransactionResponse); }
33
+ hostRegistryOrganizationIssuePath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.Issue); }
34
+ hostRegistryOrganizationIssuePollPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.IssueResponse); }
35
+ hostRegistryOrganizationActivatePath(ctx) { return this.hostRegistryPath(ctx, 'Organization', '_activate'); }
36
+ hostRegistryOrganizationActivatePollPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', '_activate-response'); }
37
+ hostRegistryOrganizationDisablePath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.Disable); }
38
+ hostRegistryOrganizationDisablePollPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', `${GwCoreLifecycleAction.Disable}-response`); }
39
+ hostRegistryOrganizationPurgePath(ctx) { return this.hostRegistryPath(ctx, 'Organization', GwCoreLifecycleAction.Purge); }
40
+ hostRegistryOrganizationPurgePollPath(ctx) { return this.hostRegistryPath(ctx, 'Organization', `${GwCoreLifecycleAction.Purge}-response`); }
41
+ hostRegistryOrderBatchPath(ctx) { return this.hostRegistryPath(ctx, 'Order', '_batch'); }
42
+ hostRegistryOrderPollPath(ctx) { return this.hostRegistryPath(ctx, 'Order', '_batch-response'); }
43
+ employeeBatchPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', GwCoreLifecycleAction.Batch); }
44
+ employeePollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', GwCoreLifecycleAction.BatchResponse); }
45
+ employeeSearchPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', '_search'); }
46
+ employeeSearchPollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', '_search-response'); }
47
+ organizationLicenseSearchPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'License', '_search'); }
48
+ organizationLicenseSearchPollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'License', '_search-response'); }
49
+ organizationDidBindingPath(ctx) { return buildOrganizationDidBindingPath(this.requireRouteContext(ctx)); }
50
+ organizationDidBindingPollPath(ctx) { return buildOrganizationDidBindingPollPath(this.requireRouteContext(ctx)); }
51
+ organizationLicenseOfferSearchPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Offer', '_search'); }
52
+ organizationLicenseOfferSearchPollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Offer', '_search-response'); }
53
+ organizationLicenseOrderSearchPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Order', '_search'); }
54
+ organizationLicenseOrderSearchPollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Order', '_search-response'); }
55
+ employeePurgePath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', GwCoreLifecycleAction.Purge); }
56
+ employeePurgePollPath(ctx) { return this.v1Path(ctx, 'entity', 'org.schema', 'Employee', `${GwCoreLifecycleAction.Purge}-response`); }
57
+ individualFamilyOrganizationBatchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.Batch); }
58
+ individualFamilyOrganizationPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.BatchResponse); }
59
+ individualFamilyOrganizationSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', '_search'); }
60
+ individualFamilyOrganizationSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', '_search-response'); }
61
+ individualFamilyOrganizationTransactionPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.Transaction); }
62
+ individualFamilyOrganizationTransactionPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.TransactionResponse); }
63
+ individualFamilyOrganizationDisablePath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.Disable); }
64
+ individualFamilyOrganizationDisablePollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', `${GwCoreLifecycleAction.Disable}-response`); }
65
+ individualFamilyOrganizationPurgePath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', GwCoreLifecycleAction.Purge); }
66
+ individualFamilyOrganizationPurgePollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Organization', `${GwCoreLifecycleAction.Purge}-response`); }
67
+ individualLicenseSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'License', '_search'); }
68
+ individualLicenseSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'License', '_search-response'); }
69
+ individualLicenseOfferSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Offer', '_search'); }
70
+ individualLicenseOfferSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Offer', '_search-response'); }
71
+ individualLicenseOrderSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Order', '_search'); }
72
+ individualLicenseOrderSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Order', '_search-response'); }
73
+ individualFamilyOrderBatchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Order', '_batch'); }
74
+ individualFamilyOrderPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.schema', 'Order', '_batch-response'); }
75
+ individualRelatedPersonBatchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'RelatedPerson', '_batch'); }
76
+ individualRelatedPersonPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'RelatedPerson', '_batch-response'); }
77
+ individualRelatedPersonPurgePath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'RelatedPerson', '_purge'); }
78
+ individualRelatedPersonPurgePollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'RelatedPerson', '_purge-response'); }
79
+ individualConsentR4BatchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Consent', '_batch'); }
80
+ individualConsentR4PollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Consent', '_batch-response'); }
81
+ individualCommunicationBatchPath(ctx, format) { return this.v1Path(ctx, 'individual', format, 'Communication', '_batch'); }
82
+ individualCommunicationPollPath(ctx, format) { return this.v1Path(ctx, 'individual', format, 'Communication', '_batch-response'); }
83
+ individualCommunicationSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Communication', '_search'); }
84
+ individualCommunicationSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Communication', '_search-response'); }
85
+ individualDocumentReferenceBatchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'DocumentReference', '_batch'); }
86
+ individualDocumentReferencePollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'DocumentReference', '_batch-response'); }
87
+ individualBundleSearchPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Bundle', '_search'); }
88
+ individualBundleSearchPollPath(ctx) { return this.v1Path(ctx, 'individual', 'org.hl7.fhir.r4', 'Bundle', '_search-response'); }
89
+ identityTokenExchangePath(ctx) { return buildIdentityTokenExchangePath(ctx); }
90
+ identityTokenExchangePollPath(ctx) { return buildIdentityTokenExchangePollPath(ctx); }
91
+ identityDeviceDcrPath(ctx) { return buildIdentityDeviceDcrPath(ctx); }
92
+ identityDeviceDcrPollPath(ctx) { return buildIdentityDeviceDcrPollPath(ctx); }
93
+ identityOpenIdSmartTokenPath(ctx) { return buildIdentityOpenIdSmartTokenPath(ctx); }
94
+ identityOpenIdSmartTokenPollPath(ctx) { return buildIdentityOpenIdSmartTokenPollPath(ctx); }
95
+ }
@@ -0,0 +1,7 @@
1
+ import type { GrantProfessionalAccessInput } from './resource-operations.js';
2
+ export declare function buildGrantProfessionalAccessClaimsWithCid(input: GrantProfessionalAccessInput, createRuntimeUuid: () => string): {
3
+ actorIdentifier: string;
4
+ subjectIdentifier: string;
5
+ consentClaims: Record<string, unknown>;
6
+ claimsCid?: string;
7
+ };
@@ -0,0 +1,21 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { buildConsentClaimsSimpleWithCid } from 'gdc-common-utils-ts/utils/consent';
3
+ export function buildGrantProfessionalAccessClaimsWithCid(input, createRuntimeUuid) {
4
+ return buildConsentClaimsSimpleWithCid({
5
+ subjectDid: input.subjectDid,
6
+ subjectPhone: input.subjectPhone,
7
+ subjectGivenName: input.subjectGivenName,
8
+ actor: input.actorId ?? input.actor ?? '',
9
+ actorRole: String(input?.actorRole || ''),
10
+ purpose: String(input?.purpose || ''),
11
+ actions: Array.isArray(input?.actions) ? input.actions : [],
12
+ consentIdentifier: input.consentIdentifier,
13
+ consentDate: input.consentDate,
14
+ decision: input.decision,
15
+ attachmentContentType: input.attachmentContentType,
16
+ attachmentBase64: input.attachmentBase64,
17
+ }, {
18
+ errorPrefix: 'grantProfessionalAccess:',
19
+ consentIdentifierFactory: () => `urn:uuid:${createRuntimeUuid()}`,
20
+ });
21
+ }
@@ -0,0 +1,62 @@
1
+ import type { OrganizationDidBindingInput } from 'gdc-sdk-core-ts';
2
+ import type { OrganizationActivationDraft } from 'gdc-sdk-core-ts';
3
+ import { buildLegalOrganizationVerificationGatewayRequestBundle } from 'gdc-sdk-core-ts';
4
+ import type { HostRouteContext } from './host-onboarding.js';
5
+ import type { NodeLegalOrganizationVerificationTransactionInput, NodeOrganizationActivationInput, NodeOrganizationDidBindingInput, PollOptions, SubmitAndPollResult, SubmitPayload } from './orchestration/client-port.js';
6
+ import type { RouteContext } from './individual-onboarding.js';
7
+ type SubmitAndPollMethod = (submitPath: string, pollPath: string, payload: SubmitPayload, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
8
+ export declare function submitLegalOrganizationVerificationTransactionWithDeps(input: {
9
+ hostCtx: HostRouteContext;
10
+ verificationInput: NodeLegalOrganizationVerificationTransactionInput;
11
+ pollOptions?: PollOptions;
12
+ createRuntimeUuid: () => string;
13
+ wrapBundleAsGatewayTransactionMessage: (input: {
14
+ thid: string;
15
+ jti: string;
16
+ hostCtx: HostRouteContext;
17
+ bundle: ReturnType<typeof buildLegalOrganizationVerificationGatewayRequestBundle>;
18
+ }) => SubmitPayload;
19
+ submitPath: (ctx: HostRouteContext) => string;
20
+ pollPath: (ctx: HostRouteContext) => string;
21
+ submitAndPoll: SubmitAndPollMethod;
22
+ }): Promise<SubmitAndPollResult>;
23
+ export declare function submitLegalOrganizationIssueWithDeps(input: {
24
+ hostCtx: HostRouteContext;
25
+ verificationInput: NodeLegalOrganizationVerificationTransactionInput;
26
+ pollOptions?: PollOptions;
27
+ createRuntimeUuid: () => string;
28
+ wrapBundleAsGatewayTransactionMessage: (input: {
29
+ thid: string;
30
+ jti: string;
31
+ hostCtx: HostRouteContext;
32
+ bundle: ReturnType<typeof buildLegalOrganizationVerificationGatewayRequestBundle>;
33
+ }) => SubmitPayload;
34
+ submitPath: (ctx: HostRouteContext) => string;
35
+ pollPath: (ctx: HostRouteContext) => string;
36
+ submitAndPoll: SubmitAndPollMethod;
37
+ }): Promise<SubmitAndPollResult>;
38
+ export declare function submitOrganizationDidBindingWithDeps(input: {
39
+ routeCtx: RouteContext;
40
+ bindingInput: NodeOrganizationDidBindingInput | OrganizationDidBindingInput;
41
+ pollOptions?: PollOptions;
42
+ createRuntimeUuid: () => string;
43
+ organizationDidBindingPath: (ctx: RouteContext) => string;
44
+ organizationDidBindingPollPath: (ctx: RouteContext) => string;
45
+ submitAndPoll: SubmitAndPollMethod;
46
+ }): Promise<SubmitAndPollResult>;
47
+ export declare function activateOrganizationInGatewayFromIcaProofWithDeps(input: {
48
+ hostCtx: HostRouteContext;
49
+ activationInput: NodeOrganizationActivationInput;
50
+ pollOptions?: PollOptions;
51
+ createRuntimeUuid: () => string;
52
+ activationDraftFactory: (input: {
53
+ vpToken: string;
54
+ controller?: NodeOrganizationActivationInput['controller'];
55
+ service?: NodeOrganizationActivationInput['service'];
56
+ additionalClaims?: NodeOrganizationActivationInput['additionalClaims'];
57
+ }) => OrganizationActivationDraft;
58
+ submitPath: (ctx: HostRouteContext) => string;
59
+ pollPath: (ctx: HostRouteContext) => string;
60
+ submitAndPoll: SubmitAndPollMethod;
61
+ }): Promise<SubmitAndPollResult>;
62
+ export {};