gdc-sdk-node-ts 2.9.9 → 2.9.10
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
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,11 @@ 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.
|
|
33
|
+
*/
|
|
34
|
+
controllerAssignmentIdentifier: string;
|
|
30
35
|
}>;
|
|
31
36
|
type ConfirmIndividualOrganizationOrderDeps = {
|
|
32
37
|
input: IndividualOrganizationConfirmOrderInput;
|
|
@@ -46,4 +51,11 @@ export declare function confirmIndividualOrganizationOrderWithDeps(deps: Confirm
|
|
|
46
51
|
* this reader directly; it remains public for response-adapter compatibility.
|
|
47
52
|
*/
|
|
48
53
|
export declare function readIndividualOrganizationActivationCode(responseBody: unknown): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Reads the principal owner/controller assignment that GW creates during the
|
|
56
|
+
* same Order transition as the individual controller licence. This is a
|
|
57
|
+
* projection from the returned RelatedPerson `resource.meta.claims`; it is not
|
|
58
|
+
* an Order claim and callers must not pre-create or search for it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readIndividualOrganizationControllerAssignmentIdentifier(responseBody: unknown): string | undefined;
|
|
49
61
|
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,11 @@ 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 { ...order, activationCode, controllerAssignmentIdentifier };
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Reads the opaque controller activation code from a completed individual
|
|
@@ -51,6 +55,20 @@ export function readIndividualOrganizationActivationCode(responseBody) {
|
|
|
51
55
|
const claims = extractPrimaryClaims(responseBody);
|
|
52
56
|
return String(claims['org.schema.IndividualProduct.serialNumber'] || '').trim() || undefined;
|
|
53
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads the principal owner/controller assignment that GW creates during the
|
|
60
|
+
* same Order transition as the individual controller licence. This is a
|
|
61
|
+
* projection from the returned RelatedPerson `resource.meta.claims`; it is not
|
|
62
|
+
* an Order claim and callers must not pre-create or search for it.
|
|
63
|
+
*/
|
|
64
|
+
export function readIndividualOrganizationControllerAssignmentIdentifier(responseBody) {
|
|
65
|
+
const expectedRelationship = `${HL7_CODING_SYSTEM_V3_ROLE_CODE}|${HealthcareActorRoleCodes.Controller}`;
|
|
66
|
+
return readRelatedPersonListRecords(responseBody)
|
|
67
|
+
.find((record) => record.identifier
|
|
68
|
+
&& record.relationship === expectedRelationship
|
|
69
|
+
&& record.active !== 'false')
|
|
70
|
+
?.identifier;
|
|
71
|
+
}
|
|
54
72
|
function createRuntimeUuid() {
|
|
55
73
|
const fromCrypto = globalThis.crypto?.randomUUID?.();
|
|
56
74
|
if (fromCrypto) {
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { VerifiableCredentialV2 } from 'gdc-common-utils-ts/models/verifiable-credential';
|
|
2
|
-
import type { IWallet, WalletExecutionContext, WalletKeySelection } from 'gdc-sdk-core-ts';
|
|
3
|
-
/** Input required to add one human-authorizer proof to the out-of-band VC. */
|
|
4
|
-
export type SignOrganizationRegistrationAuthorizationInput = Readonly<{
|
|
5
|
-
credential: VerifiableCredentialV2;
|
|
6
|
-
wallet: IWallet;
|
|
7
|
-
context: WalletExecutionContext;
|
|
8
|
-
key: WalletKeySelection;
|
|
9
|
-
verificationMethod: string;
|
|
10
|
-
createdAt?: string;
|
|
11
|
-
}>;
|
|
12
|
-
/**
|
|
13
|
-
* Adds one detached JWS proof made by the already-unlocked professional
|
|
14
|
-
* profile. The browser never receives the private key or clear wallet seed.
|
|
15
|
-
*/
|
|
16
|
-
export declare function signOrganizationRegistrationAuthorizationCredential(input: SignOrganizationRegistrationAuthorizationInput): Promise<VerifiableCredentialV2>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { canonicalizeOrganizationRegistrationAuthorizationCredential, } from 'gdc-common-utils-ts/utils/organization-registration-authorization';
|
|
2
|
-
/**
|
|
3
|
-
* Adds one detached JWS proof made by the already-unlocked professional
|
|
4
|
-
* profile. The browser never receives the private key or clear wallet seed.
|
|
5
|
-
*/
|
|
6
|
-
export async function signOrganizationRegistrationAuthorizationCredential(input) {
|
|
7
|
-
if (!input.wallet.signDetachedJws) {
|
|
8
|
-
throw new Error('Wallet does not support detached organization authorization proofs.');
|
|
9
|
-
}
|
|
10
|
-
const verificationMethod = String(input.verificationMethod || '').trim();
|
|
11
|
-
if (!verificationMethod)
|
|
12
|
-
throw new Error('Organization authorization proof requires verificationMethod.');
|
|
13
|
-
const payload = canonicalizeOrganizationRegistrationAuthorizationCredential(input.credential);
|
|
14
|
-
const jws = await input.wallet.signDetachedJws(input.context, {
|
|
15
|
-
payload,
|
|
16
|
-
header: { typ: 'application/vc+ld+json' },
|
|
17
|
-
key: input.key,
|
|
18
|
-
});
|
|
19
|
-
const existingProofs = Array.isArray(input.credential.proof)
|
|
20
|
-
? input.credential.proof
|
|
21
|
-
: input.credential.proof
|
|
22
|
-
? [input.credential.proof]
|
|
23
|
-
: [];
|
|
24
|
-
return {
|
|
25
|
-
...input.credential,
|
|
26
|
-
proof: [...existingProofs, {
|
|
27
|
-
type: 'JsonWebSignature2020',
|
|
28
|
-
created: input.createdAt || new Date().toISOString(),
|
|
29
|
-
proofPurpose: 'contractAgreement',
|
|
30
|
-
verificationMethod,
|
|
31
|
-
jws,
|
|
32
|
-
}],
|
|
33
|
-
};
|
|
34
|
-
}
|