gdc-sdk-node-ts 2.6.3 → 2.6.4
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.
|
@@ -36,6 +36,8 @@ export type OrganizationEmployeeProvisioningDeps = Readonly<{
|
|
|
36
36
|
* returns the exact GW activation credential.
|
|
37
37
|
*/
|
|
38
38
|
export declare function provisionOrganizationEmployeeWithDeps(routeContext: RouteContext, input: OrganizationEmployeeProvisioningInput, deps: OrganizationEmployeeProvisioningDeps): Promise<OrganizationEmployeeProvisioningResult>;
|
|
39
|
+
/** Reads the technical employee id that must own the subsequently issued seat. */
|
|
40
|
+
export declare function readEmployeeResourceId(value: unknown): string | undefined;
|
|
39
41
|
/** Reads the effective positive installation allowance returned by `License/_issue`. */
|
|
40
42
|
export declare function readEmployeeLicenseMaxDevices(value: unknown): number | undefined;
|
|
41
43
|
/**
|
|
@@ -29,7 +29,14 @@ export async function provisionOrganizationEmployeeWithDeps(routeContext, input,
|
|
|
29
29
|
throw new Error('provisionOrganizationEmployee: employee creation still requires a licence after Order confirmation.');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const employeeResourceId = readEmployeeResourceId(employee.poll.body);
|
|
33
|
+
if (!employeeResourceId) {
|
|
34
|
+
throw new Error('provisionOrganizationEmployee: GW response did not contain the created employee resource id.');
|
|
35
|
+
}
|
|
36
|
+
const license = await deps.issueLicense(routeContext, {
|
|
37
|
+
...input.invitation,
|
|
38
|
+
subjectId: employeeResourceId,
|
|
39
|
+
});
|
|
33
40
|
assertSuccessfulEmployeeOperation('licence issue', license);
|
|
34
41
|
const activationCode = readEmployeeActivationCode(license.poll.body);
|
|
35
42
|
if (!activationCode) {
|
|
@@ -44,6 +51,19 @@ export async function provisionOrganizationEmployeeWithDeps(routeContext, input,
|
|
|
44
51
|
...(maxDevices ? { maxDevices } : {}),
|
|
45
52
|
};
|
|
46
53
|
}
|
|
54
|
+
/** Reads the technical employee id that must own the subsequently issued seat. */
|
|
55
|
+
export function readEmployeeResourceId(value) {
|
|
56
|
+
for (const candidate of nestedRecords(value)) {
|
|
57
|
+
const response = record(candidate.response);
|
|
58
|
+
const status = parseHttpStatus(response?.status);
|
|
59
|
+
if (status !== undefined && (status < 200 || status >= 300))
|
|
60
|
+
continue;
|
|
61
|
+
const resourceId = String(record(candidate.resource)?.id || '').trim();
|
|
62
|
+
if (resourceId)
|
|
63
|
+
return resourceId;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
47
67
|
/** Reads the effective positive installation allowance returned by `License/_issue`. */
|
|
48
68
|
export function readEmployeeLicenseMaxDevices(value) {
|
|
49
69
|
for (const candidate of nestedRecords(value)) {
|
|
@@ -33,6 +33,8 @@ export type OrganizationEmployeeLicenseInvitationInput = {
|
|
|
33
33
|
email: string;
|
|
34
34
|
role: string;
|
|
35
35
|
subjectDid: string;
|
|
36
|
+
/** Technical employee resource id returned by Employee creation. */
|
|
37
|
+
subjectId?: string;
|
|
36
38
|
type?: DeviceAppType;
|
|
37
39
|
requestThid?: string;
|
|
38
40
|
pollOptions?: {
|
|
@@ -70,19 +70,23 @@ export async function issueOrganizationEmployeeLicenseWithDeps(routeCtx, input,
|
|
|
70
70
|
const email = String(input.email || '').trim().toLowerCase();
|
|
71
71
|
const role = String(input.role || '').trim();
|
|
72
72
|
const subjectDid = String(input.subjectDid || '').trim();
|
|
73
|
+
const subjectId = String(input.subjectId || '').trim();
|
|
73
74
|
if (!email)
|
|
74
75
|
throw new Error('issueOrganizationEmployeeLicense: email is required.');
|
|
75
76
|
if (!role)
|
|
76
77
|
throw new Error('issueOrganizationEmployeeLicense: role is required.');
|
|
77
78
|
if (!subjectDid)
|
|
78
79
|
throw new Error('issueOrganizationEmployeeLicense: subjectDid is required.');
|
|
80
|
+
if (!subjectId)
|
|
81
|
+
throw new Error('issueOrganizationEmployeeLicense: subjectId is required.');
|
|
79
82
|
const entry = buildLicenseIssueEntry({
|
|
80
83
|
email,
|
|
81
84
|
role,
|
|
82
85
|
userClass: DeviceUserClasses.Employee,
|
|
83
86
|
type: input.type || DeviceAppTypes.Web,
|
|
87
|
+
subjectId,
|
|
88
|
+
subjectDid,
|
|
84
89
|
});
|
|
85
|
-
entry.meta.subjectDid = subjectDid;
|
|
86
90
|
return deps.submitAndPoll(deps.identityLicenseIssuePath(routeCtx), deps.identityLicenseIssuePollPath(routeCtx), {
|
|
87
91
|
thid: input.requestThid || `employee-license-issue-${createRuntimeUuid()}`,
|
|
88
92
|
body: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-node-ts",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"description": "Next-generation Node runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test:e2e:live-gw:clean": "bash ./scripts/run-live-gw-clean.sh"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"gdc-common-utils-ts": "2.7.
|
|
41
|
+
"gdc-common-utils-ts": "2.7.3",
|
|
42
42
|
"gdc-sdk-core-ts": "2.4.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|