gdc-sdk-node-ts 2.9.9 → 2.9.11
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 +2 -2
- package/dist/individual-onboarding.d.ts +18 -0
- package/dist/individual-onboarding.js +25 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -686,8 +686,8 @@ modules below.
|
|
|
686
686
|
- types: `IndividualOrganizationBootstrapInput`, `OfferPreview`, `IndividualOrganizationStartResult`
|
|
687
687
|
- function: `registerIndividualOrganizationWithDeps(...)`
|
|
688
688
|
- [`src/individual-onboarding.ts`](src/individual-onboarding.ts)
|
|
689
|
-
- types: `RouteContext`, `IndividualOrganizationConfirmOrderInput`
|
|
690
|
-
-
|
|
689
|
+
- types: `RouteContext`, `IndividualOrganizationConfirmOrderInput`, `IndividualOrganizationOrderResult`
|
|
690
|
+
- functions: `confirmIndividualOrganizationOrderWithDeps(...)`, `readIndividualOrganizationControllerAssignmentIdentifier(...)`
|
|
691
691
|
- [`src/device-activation.ts`](src/device-activation.ts)
|
|
692
692
|
- types: `EmployeeDeviceActivationInput`, `EmployeeDeviceActivationRequestInput`, `EmployeeDeviceActivationResult`
|
|
693
693
|
- functions: `activateEmployeeDeviceWithActivationCodeWithDeps(...)`, `activateEmployeeDeviceWithActivationRequestWithDeps(...)`
|
|
@@ -27,6 +27,17 @@ export type IndividualOrganizationConfirmOrderInput = {
|
|
|
27
27
|
*/
|
|
28
28
|
export type IndividualOrganizationOrderResult = SubmitAndPollResult & Readonly<{
|
|
29
29
|
activationCode: string;
|
|
30
|
+
/**
|
|
31
|
+
* Governed `RelatedPerson.identifier` automatically materialized by GW for
|
|
32
|
+
* the principal Organization owner/controller. Current GW values use the
|
|
33
|
+
* `urn:uuid:<UUID>` form.
|
|
34
|
+
*/
|
|
35
|
+
controllerRelatedPersonIdentifier: string;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `controllerRelatedPersonIdentifier`, which states the
|
|
38
|
+
* resource represented by this identifier.
|
|
39
|
+
*/
|
|
40
|
+
controllerAssignmentIdentifier: string;
|
|
30
41
|
}>;
|
|
31
42
|
type ConfirmIndividualOrganizationOrderDeps = {
|
|
32
43
|
input: IndividualOrganizationConfirmOrderInput;
|
|
@@ -46,4 +57,11 @@ export declare function confirmIndividualOrganizationOrderWithDeps(deps: Confirm
|
|
|
46
57
|
* this reader directly; it remains public for response-adapter compatibility.
|
|
47
58
|
*/
|
|
48
59
|
export declare function readIndividualOrganizationActivationCode(responseBody: unknown): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Reads the principal owner/controller assignment that GW creates during the
|
|
62
|
+
* same Order transition as the individual controller licence. This is a
|
|
63
|
+
* projection from the returned RelatedPerson `resource.meta.claims`; it is not
|
|
64
|
+
* an Order claim and callers must not pre-create or search for it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readIndividualOrganizationControllerAssignmentIdentifier(responseBody: unknown): string | undefined;
|
|
49
67
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
import { extractPrimaryClaims } from 'gdc-common-utils-ts';
|
|
2
|
+
import { HealthcareActorRoleCodes, HL7_CODING_SYSTEM_V3_ROLE_CODE, extractPrimaryClaims, readRelatedPersonListRecords, } from 'gdc-common-utils-ts';
|
|
3
3
|
import { resolvePollOptionsFromSeconds } from './poll-options.js';
|
|
4
4
|
export async function confirmIndividualOrganizationOrderWithDeps(deps) {
|
|
5
5
|
/**
|
|
@@ -40,7 +40,16 @@ export async function confirmIndividualOrganizationOrderWithDeps(deps) {
|
|
|
40
40
|
if (!activationCode) {
|
|
41
41
|
throw new Error('confirmIndividualOrganizationOrder failed: missing controller activation code in GW Order response.');
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const controllerAssignmentIdentifier = readIndividualOrganizationControllerAssignmentIdentifier(order.poll.body);
|
|
44
|
+
if (!controllerAssignmentIdentifier) {
|
|
45
|
+
throw new Error('confirmIndividualOrganizationOrder failed: missing automatic controller RESPRSN assignment in GW Order response.');
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...order,
|
|
49
|
+
activationCode,
|
|
50
|
+
controllerRelatedPersonIdentifier: controllerAssignmentIdentifier,
|
|
51
|
+
controllerAssignmentIdentifier,
|
|
52
|
+
};
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
46
55
|
* Reads the opaque controller activation code from a completed individual
|
|
@@ -51,6 +60,20 @@ export function readIndividualOrganizationActivationCode(responseBody) {
|
|
|
51
60
|
const claims = extractPrimaryClaims(responseBody);
|
|
52
61
|
return String(claims['org.schema.IndividualProduct.serialNumber'] || '').trim() || undefined;
|
|
53
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Reads the principal owner/controller assignment that GW creates during the
|
|
65
|
+
* same Order transition as the individual controller licence. This is a
|
|
66
|
+
* projection from the returned RelatedPerson `resource.meta.claims`; it is not
|
|
67
|
+
* an Order claim and callers must not pre-create or search for it.
|
|
68
|
+
*/
|
|
69
|
+
export function readIndividualOrganizationControllerAssignmentIdentifier(responseBody) {
|
|
70
|
+
const expectedRelationship = `${HL7_CODING_SYSTEM_V3_ROLE_CODE}|${HealthcareActorRoleCodes.Controller}`;
|
|
71
|
+
return readRelatedPersonListRecords(responseBody)
|
|
72
|
+
.find((record) => record.identifier
|
|
73
|
+
&& record.relationship === expectedRelationship
|
|
74
|
+
&& record.active !== 'false')
|
|
75
|
+
?.identifier;
|
|
76
|
+
}
|
|
54
77
|
function createRuntimeUuid() {
|
|
55
78
|
const fromCrypto = globalThis.crypto?.randomUUID?.();
|
|
56
79
|
if (fromCrypto) {
|