gdc-common-utils-ts 2.5.10 → 2.5.12
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/dist/constants/fhir-code-systems.d.ts +1 -0
- package/dist/constants/fhir-code-systems.js +1 -0
- package/dist/constants/schemaorg.d.ts +2 -0
- package/dist/constants/schemaorg.js +2 -0
- package/dist/constants/vital-signs.d.ts +6 -0
- package/dist/constants/vital-signs.js +1 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +1 -0
- package/dist/examples/license.d.ts +14 -0
- package/dist/examples/license.js +15 -1
- package/dist/examples/organization-role-license.d.ts +16 -0
- package/dist/examples/organization-role-license.js +37 -0
- package/dist/examples/shared.d.ts +23 -0
- package/dist/examples/shared.js +23 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/organization-role-license.d.ts +45 -0
- package/dist/models/organization-role-license.js +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/organization-role-license.d.ts +41 -0
- package/dist/utils/organization-role-license.js +99 -0
- package/dist/utils/organization-test-network-credential.d.ts +5 -1
- package/dist/utils/organization-test-network-credential.js +2 -0
- package/package.json +3 -2
|
@@ -10,4 +10,5 @@ export declare const FhirCodeSystems: Readonly<{
|
|
|
10
10
|
readonly Ucum: "http://unitsofmeasure.org";
|
|
11
11
|
readonly CommunicationCategory: "http://terminology.hl7.org/CodeSystem/communication-category";
|
|
12
12
|
readonly ObservationCategory: "http://terminology.hl7.org/CodeSystem/observation-category";
|
|
13
|
+
readonly EventTiming: "http://hl7.org/fhir/event-timing";
|
|
13
14
|
}>;
|
|
@@ -10,4 +10,5 @@ export const FhirCodeSystems = Object.freeze({
|
|
|
10
10
|
Ucum: 'http://unitsofmeasure.org',
|
|
11
11
|
CommunicationCategory: 'http://terminology.hl7.org/CodeSystem/communication-category',
|
|
12
12
|
ObservationCategory: 'http://terminology.hl7.org/CodeSystem/observation-category',
|
|
13
|
+
EventTiming: 'http://hl7.org/fhir/event-timing',
|
|
13
14
|
});
|
|
@@ -141,6 +141,8 @@ export declare enum ClaimsIndividualProductSchemaorg {
|
|
|
141
141
|
}
|
|
142
142
|
export declare enum ClaimsOrderSchemaorg {
|
|
143
143
|
acceptedOfferIdentifier = "org.schema.Order.acceptedOffer.identifier",
|
|
144
|
+
/** Schema.org Order.confirmationNumber; used for a customer-supplied order confirmation code. */
|
|
145
|
+
confirmationNumber = "org.schema.Order.confirmationNumber",
|
|
144
146
|
partOfInvoice = "org.schema.Order.partOfInvoice",
|
|
145
147
|
paymentMethod = "org.schema.Order.paymentMethod",
|
|
146
148
|
paymentUrl = "org.schema.Order.paymentUrl",
|
|
@@ -148,6 +148,8 @@ export var ClaimsIndividualProductSchemaorg;
|
|
|
148
148
|
export var ClaimsOrderSchemaorg;
|
|
149
149
|
(function (ClaimsOrderSchemaorg) {
|
|
150
150
|
ClaimsOrderSchemaorg["acceptedOfferIdentifier"] = "org.schema.Order.acceptedOffer.identifier";
|
|
151
|
+
/** Schema.org Order.confirmationNumber; used for a customer-supplied order confirmation code. */
|
|
152
|
+
ClaimsOrderSchemaorg["confirmationNumber"] = "org.schema.Order.confirmationNumber";
|
|
151
153
|
ClaimsOrderSchemaorg["partOfInvoice"] = "org.schema.Order.partOfInvoice";
|
|
152
154
|
ClaimsOrderSchemaorg["paymentMethod"] = "org.schema.Order.paymentMethod";
|
|
153
155
|
ClaimsOrderSchemaorg["paymentUrl"] = "org.schema.Order.paymentUrl";
|
|
@@ -4,6 +4,12 @@ export type { CodingDescriptor } from './observation-category';
|
|
|
4
4
|
* Canonical LOINC descriptors for the currently supported Vital Signs.
|
|
5
5
|
*/
|
|
6
6
|
export declare const VitalSignsCodes: Readonly<{
|
|
7
|
+
readonly BodyWeight: Readonly<{
|
|
8
|
+
system: string;
|
|
9
|
+
code: string;
|
|
10
|
+
display?: string;
|
|
11
|
+
claim: string;
|
|
12
|
+
}>;
|
|
7
13
|
readonly HeartRate: Readonly<{
|
|
8
14
|
system: string;
|
|
9
15
|
code: string;
|
|
@@ -12,6 +12,7 @@ function defineCoding(system, code, display) {
|
|
|
12
12
|
* Canonical LOINC descriptors for the currently supported Vital Signs.
|
|
13
13
|
*/
|
|
14
14
|
export const VitalSignsCodes = Object.freeze({
|
|
15
|
+
BodyWeight: defineCoding(FhirCodeSystems.Loinc, '29463-7', 'Body weight'),
|
|
15
16
|
HeartRate: defineCoding(FhirCodeSystems.Loinc, '8867-4', 'Heart rate'),
|
|
16
17
|
BloodPressure: defineCoding(FhirCodeSystems.Loinc, '85354-9', 'Blood pressure panel'),
|
|
17
18
|
SystolicBloodPressure: defineCoding(FhirCodeSystems.Loinc, '8480-6', 'Systolic blood pressure'),
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './individual-controller';
|
|
|
9
9
|
export * from './professional';
|
|
10
10
|
export * from './employee';
|
|
11
11
|
export * from './license';
|
|
12
|
+
export * from './organization-role-license';
|
|
12
13
|
export * from './invoice';
|
|
13
14
|
export * from './inter-tenant-access-contract';
|
|
14
15
|
export * from './subject-identity-binding';
|
package/dist/examples/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './individual-controller.js';
|
|
|
9
9
|
export * from './professional.js';
|
|
10
10
|
export * from './employee.js';
|
|
11
11
|
export * from './license.js';
|
|
12
|
+
export * from './organization-role-license.js';
|
|
12
13
|
export * from './invoice.js';
|
|
13
14
|
export * from './inter-tenant-access-contract.js';
|
|
14
15
|
export * from './subject-identity-binding.js';
|
|
@@ -78,6 +78,20 @@ export declare const EXAMPLE_LICENSE_AVAILABLE_RECORD: Readonly<{
|
|
|
78
78
|
readonly "org.schema.Person.hasOccupation.identifier.value": "ISCO-08|2211";
|
|
79
79
|
};
|
|
80
80
|
}>;
|
|
81
|
+
/** Complete stored device-license fixture for manager and repository tests. */
|
|
82
|
+
export declare const EXAMPLE_DEVICE_LICENSE_AVAILABLE: Readonly<{
|
|
83
|
+
readonly id: "8a8a5e1b-0d8e-4a7c-8c39-3b8034440009";
|
|
84
|
+
readonly tenantId: "acme-id";
|
|
85
|
+
readonly orderId: "invoice-001";
|
|
86
|
+
readonly userClass: "employee";
|
|
87
|
+
readonly userCategory: "ISCO-08|2211";
|
|
88
|
+
readonly type: "mobile";
|
|
89
|
+
readonly status: "available";
|
|
90
|
+
readonly plan: "default";
|
|
91
|
+
readonly renewalCycle: "12m";
|
|
92
|
+
readonly reactivationEnabled: false;
|
|
93
|
+
readonly exp: 1893456000;
|
|
94
|
+
}>;
|
|
81
95
|
export declare const EXAMPLE_LICENSE_LIST_RESPONSE_BODY: Readonly<{
|
|
82
96
|
readonly data: readonly [{
|
|
83
97
|
readonly meta: {
|
package/dist/examples/license.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DeviceAppTypes, DeviceBindingStatuses, DeviceUserClasses } from '../con
|
|
|
2
2
|
import { ClaimsOrderSchemaorg, ClaimsIndividualProductSchemaorg, ClaimsOfferSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
|
|
3
3
|
import { buildLicenseIssueClaims, buildLicensePurchaseClaims, LicenseClaimContext, LicenseCategories, LicenseStatuses, } from '../utils/license.js';
|
|
4
4
|
import { createLicenseOfferOrderEditor } from '../utils/license-offer-order.js';
|
|
5
|
-
import { EXAMPLE_LICENSE_ACCEPTED_OFFER_ID, EXAMPLE_LICENSE_AMOUNT, EXAMPLE_LICENSE_CHECKOUT_URL, EXAMPLE_LICENSE_CURRENCY, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_EMPLOYEE_ACTIVATION_CODE, EXAMPLE_EMPLOYEE_DEVICE_CLIENT_ID_PRIMARY, EXAMPLE_EMPLOYEE_DEVICE_CLIENT_ID_SECONDARY, EXAMPLE_EMPLOYEE_DEVICE_INSTANCE_ID_PRIMARY, EXAMPLE_EMPLOYEE_DEVICE_INSTANCE_ID_SECONDARY, EXAMPLE_EMPLOYEE_DEVICE_MODEL_PRIMARY, EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER, EXAMPLE_LICENSE_INVOICE_ID, EXAMPLE_LICENSE_OFFER_ID, EXAMPLE_LICENSE_PLAN_DEFAULT, EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE, EXAMPLE_LICENSE_PAYMENT_URL, EXAMPLE_LICENSE_RENEWAL_CYCLE_YEARLY, EXAMPLE_LICENSE_PLAN_NAME, EXAMPLE_LICENSE_SEAT_UUID_ACTIVE, EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE, EXAMPLE_LICENSE_SEAT_UUID_SECONDARY, EXAMPLE_LICENSE_SKU, EXAMPLE_LICENSE_SUBJECT_ID_ACTIVE, EXAMPLE_LICENSE_SUBJECT_ID_AVAILABLE, } from './shared.js';
|
|
5
|
+
import { EXAMPLE_LICENSE_ACCEPTED_OFFER_ID, EXAMPLE_LICENSE_AMOUNT, EXAMPLE_LICENSE_CHECKOUT_URL, EXAMPLE_LICENSE_CURRENCY, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_EMPLOYEE_ACTIVATION_CODE, EXAMPLE_EMPLOYEE_DEVICE_CLIENT_ID_PRIMARY, EXAMPLE_EMPLOYEE_DEVICE_CLIENT_ID_SECONDARY, EXAMPLE_EMPLOYEE_DEVICE_INSTANCE_ID_PRIMARY, EXAMPLE_EMPLOYEE_DEVICE_INSTANCE_ID_SECONDARY, EXAMPLE_EMPLOYEE_DEVICE_MODEL_PRIMARY, EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER, EXAMPLE_LICENSE_INVOICE_ID, EXAMPLE_LICENSE_OFFER_ID, EXAMPLE_LICENSE_PLAN_DEFAULT, EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE, EXAMPLE_LICENSE_PAYMENT_URL, EXAMPLE_LICENSE_RENEWAL_CYCLE_YEARLY, EXAMPLE_LICENSE_PLAN_NAME, EXAMPLE_LICENSE_SEAT_UUID_ACTIVE, EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE, EXAMPLE_LICENSE_SEAT_UUID_SECONDARY, EXAMPLE_LICENSE_SKU, EXAMPLE_LICENSE_SUBJECT_ID_ACTIVE, EXAMPLE_LICENSE_SUBJECT_ID_AVAILABLE, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
|
|
6
6
|
import { DEFAULT_LICENSE_DEVICE_ALLOWANCE } from '../utils/license.js';
|
|
7
7
|
import { EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE } from './employee.js';
|
|
8
8
|
export const EXAMPLE_EMPLOYEE_DEVICE_BINDINGS = Object.freeze([
|
|
@@ -70,6 +70,20 @@ export const EXAMPLE_LICENSE_AVAILABLE_RECORD = Object.freeze({
|
|
|
70
70
|
[ClaimsIndividualProductSchemaorg.serialNumber]: EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE,
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
|
+
/** Complete stored device-license fixture for manager and repository tests. */
|
|
74
|
+
export const EXAMPLE_DEVICE_LICENSE_AVAILABLE = Object.freeze({
|
|
75
|
+
id: EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE,
|
|
76
|
+
tenantId: EXAMPLE_TENANT_IDENTIFIER,
|
|
77
|
+
orderId: EXAMPLE_LICENSE_INVOICE_ID,
|
|
78
|
+
userClass: DeviceUserClasses.Employee,
|
|
79
|
+
userCategory: EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER,
|
|
80
|
+
type: DeviceAppTypes.Mobile,
|
|
81
|
+
status: LicenseStatuses.Available,
|
|
82
|
+
plan: EXAMPLE_LICENSE_PLAN_DEFAULT,
|
|
83
|
+
renewalCycle: EXAMPLE_LICENSE_RENEWAL_CYCLE_YEARLY,
|
|
84
|
+
reactivationEnabled: false,
|
|
85
|
+
exp: 1_893_456_000,
|
|
86
|
+
});
|
|
73
87
|
export const EXAMPLE_LICENSE_LIST_RESPONSE_BODY = Object.freeze({
|
|
74
88
|
data: [
|
|
75
89
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OrganizationRoleLicense } from '../models/organization-role-license';
|
|
2
|
+
import { type OrganizationRoleLicenseIdentity } from '../utils/organization-role-license';
|
|
3
|
+
/** Reusable synthetic identity for role-licence contract and consumer tests. */
|
|
4
|
+
export declare const EXAMPLE_ORGANIZATION_ROLE_LICENSE_IDENTITY: OrganizationRoleLicenseIdentity;
|
|
5
|
+
/** Reusable catch-all plus exact-override policy example. */
|
|
6
|
+
export declare const EXAMPLE_ORGANIZATION_ROLE_LICENSE_POLICIES: readonly (Readonly<{
|
|
7
|
+
sector: "";
|
|
8
|
+
active: true;
|
|
9
|
+
maxDevices: null;
|
|
10
|
+
}> | Readonly<{
|
|
11
|
+
sector: "animal-care";
|
|
12
|
+
active: false;
|
|
13
|
+
maxDevices: 2;
|
|
14
|
+
}>)[];
|
|
15
|
+
/** Public ledger fixture: no clear contact or tenant-local employee UUID. */
|
|
16
|
+
export declare const EXAMPLE_ORGANIZATION_ROLE_LICENSE: OrganizationRoleLicense;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { buildStableActorIdentifier } from '../utils/actor-identifier.js';
|
|
3
|
+
import { buildOrganizationRoleLicenseId, } from '../utils/organization-role-license.js';
|
|
4
|
+
/** Reusable synthetic identity for role-licence contract and consumer tests. */
|
|
5
|
+
export const EXAMPLE_ORGANIZATION_ROLE_LICENSE_IDENTITY = Object.freeze({
|
|
6
|
+
jurisdiction: 'es',
|
|
7
|
+
organizationId: 'urn:org:TAX:ES-B12345678',
|
|
8
|
+
stableContactIdentifier: buildStableActorIdentifier({
|
|
9
|
+
contactKind: 'email',
|
|
10
|
+
contact: 'professional@example.org',
|
|
11
|
+
}),
|
|
12
|
+
licensedRole: 'RESPRSN',
|
|
13
|
+
});
|
|
14
|
+
/** Reusable catch-all plus exact-override policy example. */
|
|
15
|
+
export const EXAMPLE_ORGANIZATION_ROLE_LICENSE_POLICIES = Object.freeze([
|
|
16
|
+
Object.freeze({ sector: '', active: true, maxDevices: null }),
|
|
17
|
+
Object.freeze({ sector: 'animal-care', active: false, maxDevices: 2 }),
|
|
18
|
+
]);
|
|
19
|
+
/** Public ledger fixture: no clear contact or tenant-local employee UUID. */
|
|
20
|
+
export const EXAMPLE_ORGANIZATION_ROLE_LICENSE = Object.freeze({
|
|
21
|
+
id: buildOrganizationRoleLicenseId(EXAMPLE_ORGANIZATION_ROLE_LICENSE_IDENTITY),
|
|
22
|
+
...EXAMPLE_ORGANIZATION_ROLE_LICENSE_IDENTITY,
|
|
23
|
+
status: 'active',
|
|
24
|
+
data: [...EXAMPLE_ORGANIZATION_ROLE_LICENSE_POLICIES],
|
|
25
|
+
devices: [
|
|
26
|
+
Object.freeze({
|
|
27
|
+
clientId: 'example-client-health-1',
|
|
28
|
+
clientInstanceId: 'example-installation-health-1',
|
|
29
|
+
sector: 'health-care',
|
|
30
|
+
host: 'https://gw.example.org',
|
|
31
|
+
status: 'active',
|
|
32
|
+
activatedAt: 1_700_000_000,
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
createdAt: 1_700_000_000,
|
|
36
|
+
updatedAt: 1_700_000_000,
|
|
37
|
+
});
|
|
@@ -296,9 +296,14 @@ export declare const EXAMPLE_LICENSE_CURRENCY: "EUR";
|
|
|
296
296
|
export declare const EXAMPLE_LICENSE_PLAN_NAME: "Family starter";
|
|
297
297
|
export declare const EXAMPLE_LICENSE_SKU: "FAM-START";
|
|
298
298
|
export declare const EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE: "invoice";
|
|
299
|
+
export declare const EXAMPLE_LICENSE_PAYMENT_METHOD_STRIPE: "Stripe";
|
|
299
300
|
export declare const EXAMPLE_LICENSE_CHECKOUT_URL: "https://pay.example/offer-001";
|
|
300
301
|
export declare const EXAMPLE_LICENSE_PAYMENT_URL: "https://pay.example/invoice-001";
|
|
301
302
|
export declare const EXAMPLE_LICENSE_INVOICE_ID: "invoice-001";
|
|
303
|
+
export declare const EXAMPLE_POSTAL_ACTIVATION_CODE: "EXAMPLE-ACTIVATION-001";
|
|
304
|
+
export declare const EXAMPLE_POSTAL_ACTIVATION_CODE_INVALID: "EXAMPLE-ACTIVATION-INVALID";
|
|
305
|
+
export declare const EXAMPLE_POSTAL_ACTIVATION_PEPPER: "example-host-pepper";
|
|
306
|
+
export declare const EXAMPLE_POSTAL_ACTIVATION_SALT: "example-base64url-salt";
|
|
302
307
|
export declare const EXAMPLE_INVOICE_DATE: "2026-06-11T10:00:00Z";
|
|
303
308
|
export declare const EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_CODE: "08412345678903";
|
|
304
309
|
export declare const EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_NAME: "Sterile saline bottle 500 mL";
|
|
@@ -347,6 +352,24 @@ export declare const EXAMPLE_VITAL_SIGN_VALUE_DIASTOLIC: 78;
|
|
|
347
352
|
export declare const EXAMPLE_VITAL_SIGN_VALUE_BODY_TEMPERATURE: 37.1;
|
|
348
353
|
export declare const EXAMPLE_VITAL_SIGN_UNIT_BEATS_PER_MINUTE: "/min";
|
|
349
354
|
export declare const EXAMPLE_OBSERVATION_CATEGORY_VITAL_SIGNS: "http://terminology.hl7.org/CodeSystem/observation-category|vital-signs";
|
|
355
|
+
/** Reusable LOINC Coding for body-weight Observation examples and metadata. */
|
|
356
|
+
export declare const EXAMPLE_OBSERVATION_BODY_WEIGHT_CODING: Readonly<{
|
|
357
|
+
system: "http://loinc.org";
|
|
358
|
+
code: "29463-7";
|
|
359
|
+
display: "Body weight";
|
|
360
|
+
}>;
|
|
361
|
+
/** Reusable SNOMED CT Coding for anxiety Observation examples and metadata. */
|
|
362
|
+
export declare const EXAMPLE_OBSERVATION_ANXIETY_CODING: Readonly<{
|
|
363
|
+
system: "http://snomed.info/sct";
|
|
364
|
+
code: "48694002";
|
|
365
|
+
display: "Anxiety";
|
|
366
|
+
}>;
|
|
367
|
+
/** Reusable FHIR event-timing Coding for a night-time event. */
|
|
368
|
+
export declare const EXAMPLE_OBSERVATION_EVENT_TIMING_NIGHT_CODING: Readonly<{
|
|
369
|
+
system: "http://hl7.org/fhir/event-timing";
|
|
370
|
+
code: "NIGHT";
|
|
371
|
+
display: "Night";
|
|
372
|
+
}>;
|
|
350
373
|
export declare const EXAMPLE_VITAL_SIGN_CODE_HEART_RATE: "8867-4";
|
|
351
374
|
export declare const EXAMPLE_VITAL_SIGN_CODE_BODY_TEMPERATURE: "8310-5";
|
|
352
375
|
export declare const EXAMPLE_VITAL_SIGN_CODE_BLOOD_PRESSURE_PANEL: "85354-9";
|
package/dist/examples/shared.js
CHANGED
|
@@ -338,9 +338,14 @@ export const EXAMPLE_LICENSE_CURRENCY = 'EUR';
|
|
|
338
338
|
export const EXAMPLE_LICENSE_PLAN_NAME = 'Family starter';
|
|
339
339
|
export const EXAMPLE_LICENSE_SKU = 'FAM-START';
|
|
340
340
|
export const EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE = 'invoice';
|
|
341
|
+
export const EXAMPLE_LICENSE_PAYMENT_METHOD_STRIPE = 'Stripe';
|
|
341
342
|
export const EXAMPLE_LICENSE_CHECKOUT_URL = 'https://pay.example/offer-001';
|
|
342
343
|
export const EXAMPLE_LICENSE_PAYMENT_URL = 'https://pay.example/invoice-001';
|
|
343
344
|
export const EXAMPLE_LICENSE_INVOICE_ID = 'invoice-001';
|
|
345
|
+
export const EXAMPLE_POSTAL_ACTIVATION_CODE = 'EXAMPLE-ACTIVATION-001';
|
|
346
|
+
export const EXAMPLE_POSTAL_ACTIVATION_CODE_INVALID = 'EXAMPLE-ACTIVATION-INVALID';
|
|
347
|
+
export const EXAMPLE_POSTAL_ACTIVATION_PEPPER = 'example-host-pepper';
|
|
348
|
+
export const EXAMPLE_POSTAL_ACTIVATION_SALT = 'example-base64url-salt';
|
|
344
349
|
export const EXAMPLE_INVOICE_DATE = '2026-06-11T10:00:00Z';
|
|
345
350
|
export const EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_CODE = '08412345678903';
|
|
346
351
|
export const EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_NAME = 'Sterile saline bottle 500 mL';
|
|
@@ -389,6 +394,24 @@ export const EXAMPLE_VITAL_SIGN_VALUE_DIASTOLIC = 78;
|
|
|
389
394
|
export const EXAMPLE_VITAL_SIGN_VALUE_BODY_TEMPERATURE = 37.1;
|
|
390
395
|
export const EXAMPLE_VITAL_SIGN_UNIT_BEATS_PER_MINUTE = '/min';
|
|
391
396
|
export const EXAMPLE_OBSERVATION_CATEGORY_VITAL_SIGNS = 'http://terminology.hl7.org/CodeSystem/observation-category|vital-signs';
|
|
397
|
+
/** Reusable LOINC Coding for body-weight Observation examples and metadata. */
|
|
398
|
+
export const EXAMPLE_OBSERVATION_BODY_WEIGHT_CODING = Object.freeze({
|
|
399
|
+
system: FhirCodeSystems.Loinc,
|
|
400
|
+
code: '29463-7',
|
|
401
|
+
display: 'Body weight',
|
|
402
|
+
});
|
|
403
|
+
/** Reusable SNOMED CT Coding for anxiety Observation examples and metadata. */
|
|
404
|
+
export const EXAMPLE_OBSERVATION_ANXIETY_CODING = Object.freeze({
|
|
405
|
+
system: FhirCodeSystems.SnomedCt,
|
|
406
|
+
code: '48694002',
|
|
407
|
+
display: 'Anxiety',
|
|
408
|
+
});
|
|
409
|
+
/** Reusable FHIR event-timing Coding for a night-time event. */
|
|
410
|
+
export const EXAMPLE_OBSERVATION_EVENT_TIMING_NIGHT_CODING = Object.freeze({
|
|
411
|
+
system: FhirCodeSystems.EventTiming,
|
|
412
|
+
code: 'NIGHT',
|
|
413
|
+
display: 'Night',
|
|
414
|
+
});
|
|
392
415
|
export const EXAMPLE_VITAL_SIGN_CODE_HEART_RATE = '8867-4';
|
|
393
416
|
export const EXAMPLE_VITAL_SIGN_CODE_BODY_TEMPERATURE = '8310-5';
|
|
394
417
|
export const EXAMPLE_VITAL_SIGN_CODE_BLOOD_PRESSURE_PANEL = '85354-9';
|
package/dist/models/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './dataspace-discovery';
|
|
|
19
19
|
export * from './dataspace-discovery-defaults';
|
|
20
20
|
export * from './dataspace-protocol';
|
|
21
21
|
export * from './device-license';
|
|
22
|
+
export * from './organization-role-license';
|
|
22
23
|
export * from './organization-employee-lifecycle';
|
|
23
24
|
export * from './did';
|
|
24
25
|
export * from './fhir-documents';
|
package/dist/models/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from './dataspace-discovery.js';
|
|
|
19
19
|
export * from './dataspace-discovery-defaults.js';
|
|
20
20
|
export * from './dataspace-protocol.js';
|
|
21
21
|
export * from './device-license.js';
|
|
22
|
+
export * from './organization-role-license.js';
|
|
22
23
|
export * from './organization-employee-lifecycle.js';
|
|
23
24
|
export * from './did.js';
|
|
24
25
|
export * from './fhir-documents.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DeviceBindingStatus } from '../constants/device';
|
|
2
|
+
/** Lifecycle of one organization-owned, role-bearing licence assignment. */
|
|
3
|
+
export type OrganizationRoleLicenseStatus = 'active' | 'revoked';
|
|
4
|
+
/**
|
|
5
|
+
* Contractual policy for one sector.
|
|
6
|
+
*
|
|
7
|
+
* `sector: ""` is the catch-all policy. An exact sector entry overrides it.
|
|
8
|
+
* `maxDevices: null` delegates the numeric limit to the GW/portal policy; it
|
|
9
|
+
* does not mean an unlimited number of installations.
|
|
10
|
+
*/
|
|
11
|
+
export interface OrganizationRoleLicenseSectorPolicy {
|
|
12
|
+
sector: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
maxDevices: number | null;
|
|
15
|
+
}
|
|
16
|
+
/** One concrete DCR installation registered against the licence. */
|
|
17
|
+
export interface OrganizationRoleLicenseDevice {
|
|
18
|
+
clientId: string;
|
|
19
|
+
clientInstanceId: string;
|
|
20
|
+
sector: string;
|
|
21
|
+
host: string;
|
|
22
|
+
status: DeviceBindingStatus;
|
|
23
|
+
activatedAt: number;
|
|
24
|
+
revokedAt?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Public ledger projection of one licence assigned by an organization.
|
|
28
|
+
*
|
|
29
|
+
* The stable contact is a one-way `urn:multibase:` identifier. Clear email,
|
|
30
|
+
* telephone, tenant-local employee UUIDs, payment details and application
|
|
31
|
+
* permissions must never be written to this asset.
|
|
32
|
+
*/
|
|
33
|
+
export interface OrganizationRoleLicense {
|
|
34
|
+
id: string;
|
|
35
|
+
organizationId: string;
|
|
36
|
+
jurisdiction: string;
|
|
37
|
+
stableContactIdentifier: string;
|
|
38
|
+
licensedRole: string;
|
|
39
|
+
status: OrganizationRoleLicenseStatus;
|
|
40
|
+
data: OrganizationRoleLicenseSectorPolicy[];
|
|
41
|
+
devices: OrganizationRoleLicenseDevice[];
|
|
42
|
+
createdAt: number;
|
|
43
|
+
updatedAt: number;
|
|
44
|
+
revokedAt?: number;
|
|
45
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export * from './organization-test-network-credential';
|
|
|
88
88
|
export * from './test-network-organization-credentials';
|
|
89
89
|
export * from './local-terminology-provider';
|
|
90
90
|
export * from './license';
|
|
91
|
+
export * from './organization-role-license';
|
|
91
92
|
export * from './license-commercial-search';
|
|
92
93
|
export * from './license-list-search';
|
|
93
94
|
export * from './license-offer-order';
|
package/dist/utils/index.js
CHANGED
|
@@ -88,6 +88,7 @@ export * from './organization-test-network-credential.js';
|
|
|
88
88
|
export * from './test-network-organization-credentials.js';
|
|
89
89
|
export * from './local-terminology-provider.js';
|
|
90
90
|
export * from './license.js';
|
|
91
|
+
export * from './organization-role-license.js';
|
|
91
92
|
export * from './license-commercial-search.js';
|
|
92
93
|
export * from './license-list-search.js';
|
|
93
94
|
export * from './license-offer-order.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { OrganizationRoleLicense, OrganizationRoleLicenseDevice, OrganizationRoleLicenseSectorPolicy } from '../models/organization-role-license';
|
|
2
|
+
export type OrganizationRoleLicenseIdentity = Readonly<{
|
|
3
|
+
jurisdiction: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
stableContactIdentifier: string;
|
|
6
|
+
licensedRole: string;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Builds the exact, compact licence preimage agreed across portals and hosts.
|
|
10
|
+
* The preimage is hashed before persistence and is never itself a ledger key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildOrganizationRoleLicensePreimage(identity: OrganizationRoleLicenseIdentity): string;
|
|
13
|
+
/** SHA3-384 multihash identifier for organization + contact + licensed role. */
|
|
14
|
+
export declare function buildOrganizationRoleLicenseId(identity: OrganizationRoleLicenseIdentity): string;
|
|
15
|
+
/** Validates and de-duplicates sector policies while preserving input order. */
|
|
16
|
+
export declare function normalizeOrganizationRoleLicensePolicies(policies: readonly OrganizationRoleLicenseSectorPolicy[]): OrganizationRoleLicenseSectorPolicy[];
|
|
17
|
+
/** Exact sector policy wins; the empty-sector catch-all is only a fallback. */
|
|
18
|
+
export declare function resolveOrganizationRoleLicensePolicy(policies: readonly OrganizationRoleLicenseSectorPolicy[], sector: string): OrganizationRoleLicenseSectorPolicy | undefined;
|
|
19
|
+
/** Returns the contractual limit or the positive GW/portal default. */
|
|
20
|
+
export declare function resolveOrganizationRoleLicenseMaxDevices(policy: OrganizationRoleLicenseSectorPolicy, defaultMaxDevices: number): number;
|
|
21
|
+
/** Checks global status plus the resolved exact/catch-all sector policy. */
|
|
22
|
+
export declare function organizationRoleLicenseAllowsSector(license: Readonly<{
|
|
23
|
+
status: OrganizationRoleLicense['status'];
|
|
24
|
+
data: readonly OrganizationRoleLicenseSectorPolicy[];
|
|
25
|
+
}>, sector: string): boolean;
|
|
26
|
+
/** Active DCR installations are counted per concrete sector, across hosts/apps. */
|
|
27
|
+
export declare function countActiveOrganizationRoleLicenseDevices(devices: readonly OrganizationRoleLicenseDevice[], sector: string): number;
|
|
28
|
+
/**
|
|
29
|
+
* Deterministic DCR admission decision. Re-registering the same active client
|
|
30
|
+
* is idempotent and does not consume an additional device slot.
|
|
31
|
+
*/
|
|
32
|
+
export declare function organizationRoleLicenseAllowsDevice(license: Readonly<{
|
|
33
|
+
status: OrganizationRoleLicense['status'];
|
|
34
|
+
data: readonly OrganizationRoleLicenseSectorPolicy[];
|
|
35
|
+
devices: readonly OrganizationRoleLicenseDevice[];
|
|
36
|
+
}>, input: Readonly<{
|
|
37
|
+
sector: string;
|
|
38
|
+
clientId: string;
|
|
39
|
+
clientInstanceId: string;
|
|
40
|
+
defaultMaxDevices: number;
|
|
41
|
+
}>): boolean;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { encodeMultibaseSha3 } from './multibasehash.js';
|
|
3
|
+
function required(value, label) {
|
|
4
|
+
const normalized = String(value || '').trim();
|
|
5
|
+
if (!normalized)
|
|
6
|
+
throw new TypeError(`${label} is required.`);
|
|
7
|
+
return normalized;
|
|
8
|
+
}
|
|
9
|
+
function normalizedSector(value) {
|
|
10
|
+
return String(value || '').trim().toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
function validateStableContactIdentifier(value) {
|
|
13
|
+
const normalized = required(value, 'stableContactIdentifier');
|
|
14
|
+
if (!/^urn:multibase:z[1-9A-HJ-NP-Za-km-z]+$/.test(normalized)) {
|
|
15
|
+
throw new TypeError('stableContactIdentifier must be a canonical urn:multibase value.');
|
|
16
|
+
}
|
|
17
|
+
return normalized;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the exact, compact licence preimage agreed across portals and hosts.
|
|
21
|
+
* The preimage is hashed before persistence and is never itself a ledger key.
|
|
22
|
+
*/
|
|
23
|
+
export function buildOrganizationRoleLicensePreimage(identity) {
|
|
24
|
+
const jurisdiction = required(identity.jurisdiction, 'jurisdiction').toLowerCase();
|
|
25
|
+
const organizationId = required(identity.organizationId, 'organizationId');
|
|
26
|
+
const stableContactIdentifier = validateStableContactIdentifier(identity.stableContactIdentifier);
|
|
27
|
+
const licensedRole = required(identity.licensedRole, 'licensedRole');
|
|
28
|
+
return `urn:cds-${jurisdiction}:${organizationId}:${stableContactIdentifier}:${licensedRole}`;
|
|
29
|
+
}
|
|
30
|
+
/** SHA3-384 multihash identifier for organization + contact + licensed role. */
|
|
31
|
+
export function buildOrganizationRoleLicenseId(identity) {
|
|
32
|
+
return `urn:multibase:${encodeMultibaseSha3(buildOrganizationRoleLicensePreimage(identity), 384)}`;
|
|
33
|
+
}
|
|
34
|
+
/** Validates and de-duplicates sector policies while preserving input order. */
|
|
35
|
+
export function normalizeOrganizationRoleLicensePolicies(policies) {
|
|
36
|
+
if (!Array.isArray(policies) || policies.length === 0) {
|
|
37
|
+
throw new TypeError('At least one licence sector policy is required.');
|
|
38
|
+
}
|
|
39
|
+
const seen = new Set();
|
|
40
|
+
return policies.map((policy) => {
|
|
41
|
+
const sector = normalizedSector(policy.sector);
|
|
42
|
+
if (seen.has(sector))
|
|
43
|
+
throw new TypeError(`Duplicate licence sector policy: ${sector || '<all>'}.`);
|
|
44
|
+
seen.add(sector);
|
|
45
|
+
if (policy.maxDevices !== null
|
|
46
|
+
&& (!Number.isInteger(policy.maxDevices) || policy.maxDevices < 1)) {
|
|
47
|
+
throw new TypeError('maxDevices must be null or a positive integer.');
|
|
48
|
+
}
|
|
49
|
+
return { sector, active: Boolean(policy.active), maxDevices: policy.maxDevices };
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Exact sector policy wins; the empty-sector catch-all is only a fallback. */
|
|
53
|
+
export function resolveOrganizationRoleLicensePolicy(policies, sector) {
|
|
54
|
+
const requested = required(sector, 'sector').toLowerCase();
|
|
55
|
+
return policies.find((policy) => normalizedSector(policy.sector) === requested)
|
|
56
|
+
?? policies.find((policy) => normalizedSector(policy.sector) === '');
|
|
57
|
+
}
|
|
58
|
+
/** Returns the contractual limit or the positive GW/portal default. */
|
|
59
|
+
export function resolveOrganizationRoleLicenseMaxDevices(policy, defaultMaxDevices) {
|
|
60
|
+
if (policy.maxDevices !== null)
|
|
61
|
+
return policy.maxDevices;
|
|
62
|
+
if (!Number.isInteger(defaultMaxDevices) || defaultMaxDevices < 1) {
|
|
63
|
+
throw new TypeError('defaultMaxDevices must be a positive integer.');
|
|
64
|
+
}
|
|
65
|
+
return defaultMaxDevices;
|
|
66
|
+
}
|
|
67
|
+
/** Checks global status plus the resolved exact/catch-all sector policy. */
|
|
68
|
+
export function organizationRoleLicenseAllowsSector(license, sector) {
|
|
69
|
+
if (license.status !== 'active')
|
|
70
|
+
return false;
|
|
71
|
+
return resolveOrganizationRoleLicensePolicy(license.data, sector)?.active === true;
|
|
72
|
+
}
|
|
73
|
+
/** Active DCR installations are counted per concrete sector, across hosts/apps. */
|
|
74
|
+
export function countActiveOrganizationRoleLicenseDevices(devices, sector) {
|
|
75
|
+
const requested = required(sector, 'sector').toLowerCase();
|
|
76
|
+
return devices.filter((device) => device.status === 'active'
|
|
77
|
+
&& normalizedSector(device.sector) === requested).length;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Deterministic DCR admission decision. Re-registering the same active client
|
|
81
|
+
* is idempotent and does not consume an additional device slot.
|
|
82
|
+
*/
|
|
83
|
+
export function organizationRoleLicenseAllowsDevice(license, input) {
|
|
84
|
+
const sector = required(input.sector, 'sector').toLowerCase();
|
|
85
|
+
const clientId = required(input.clientId, 'clientId');
|
|
86
|
+
const clientInstanceId = required(input.clientInstanceId, 'clientInstanceId');
|
|
87
|
+
if (!organizationRoleLicenseAllowsSector(license, sector))
|
|
88
|
+
return false;
|
|
89
|
+
if (license.devices.some((device) => device.status === 'active'
|
|
90
|
+
&& device.clientId === clientId
|
|
91
|
+
&& device.clientInstanceId === clientInstanceId
|
|
92
|
+
&& normalizedSector(device.sector) === sector))
|
|
93
|
+
return true;
|
|
94
|
+
const policy = resolveOrganizationRoleLicensePolicy(license.data, sector);
|
|
95
|
+
if (!policy)
|
|
96
|
+
return false;
|
|
97
|
+
return countActiveOrganizationRoleLicenseDevices(license.devices, sector)
|
|
98
|
+
< resolveOrganizationRoleLicenseMaxDevices(policy, input.defaultMaxDevices);
|
|
99
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { VerifiableCredentialV2 } from '../models/verifiable-credential';
|
|
2
|
+
/** Canonical protected-code algorithm used by postal activation bindings. */
|
|
3
|
+
export declare const POSTAL_ACTIVATION_CODE_BINDING_ALGORITHM: "scrypt-v1";
|
|
2
4
|
/** Lifecycle for a separate postal-address verification credential. */
|
|
3
5
|
export declare const PostalActivationLicenseStatuses: Readonly<{
|
|
4
6
|
readonly Issued: "issued";
|
|
@@ -22,7 +24,7 @@ export type PostalActivationLicenseBinding = Readonly<{
|
|
|
22
24
|
controllerKeyMaterial: string;
|
|
23
25
|
postalAddressHash: string;
|
|
24
26
|
protectedCode: Readonly<{
|
|
25
|
-
algorithm:
|
|
27
|
+
algorithm: typeof POSTAL_ACTIVATION_CODE_BINDING_ALGORITHM;
|
|
26
28
|
salt: string;
|
|
27
29
|
digest: string;
|
|
28
30
|
}>;
|
|
@@ -34,6 +36,8 @@ export type PostalActivationLicenseBinding = Readonly<{
|
|
|
34
36
|
deliveredAt?: string;
|
|
35
37
|
redeemedAt?: string;
|
|
36
38
|
}>;
|
|
39
|
+
/** Reusable protected-code slice stored in encrypted host registration state. */
|
|
40
|
+
export type PostalActivationCodeBinding = PostalActivationLicenseBinding['protectedCode'];
|
|
37
41
|
/** Input for the credential returned out-of-band to the applicant controller. */
|
|
38
42
|
export type OrganizationTestNetworkCredentialInput = Readonly<{
|
|
39
43
|
issuerDid: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ContractCredentialTypes, W3cCredentialContexts, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
|
|
2
|
+
/** Canonical protected-code algorithm used by postal activation bindings. */
|
|
3
|
+
export const POSTAL_ACTIVATION_CODE_BINDING_ALGORITHM = 'scrypt-v1';
|
|
2
4
|
/** Lifecycle for a separate postal-address verification credential. */
|
|
3
5
|
export const PostalActivationLicenseStatuses = Object.freeze({
|
|
4
6
|
Issued: 'issued',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-common-utils-ts",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"verify:dist": "node scripts/verify-dist-syntax.mjs",
|
|
25
25
|
"check:product-neutrality": "node scripts/check-product-neutrality.mjs",
|
|
26
26
|
"prepack": "npm run verify:dist",
|
|
27
|
-
"prepublishOnly": "npm run check:product-neutrality && npm run typecheck && npm test -- --watchman=false && npm run build"
|
|
27
|
+
"prepublishOnly": "npm run check:product-neutrality && npm run typecheck && npm test -- --watchman=false && npm run build",
|
|
28
|
+
"prepare": "npm run build"
|
|
28
29
|
},
|
|
29
30
|
"main": "./dist/index.js",
|
|
30
31
|
"types": "./dist/index.d.ts",
|