gdc-common-utils-ts 1.6.0 → 1.8.0
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 +3 -1
- package/dist/constants/actor-session.d.ts +40 -0
- package/dist/constants/actor-session.js +40 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/service-capabilities.d.ts +53 -0
- package/dist/constants/service-capabilities.js +72 -0
- package/dist/constants/verifiable-credentials.d.ts +34 -0
- package/dist/constants/verifiable-credentials.js +42 -0
- package/dist/examples/api-flow-examples.d.ts +1 -0
- package/dist/examples/api-flow-examples.js +1 -0
- package/dist/examples/consent-access.d.ts +12 -128
- package/dist/examples/consent-access.js +27 -18
- package/dist/examples/contract-examples.d.ts +1 -0
- package/dist/examples/contract-examples.js +1 -0
- package/dist/examples/frontend-session.d.ts +0 -4
- package/dist/examples/frontend-session.js +13 -7
- package/dist/examples/ica-activation-proof.d.ts +55 -0
- package/dist/examples/ica-activation-proof.js +67 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +1 -0
- package/dist/examples/individual-controller.d.ts +19 -15
- package/dist/examples/individual-controller.js +16 -31
- package/dist/examples/lifecycle.d.ts +6 -4
- package/dist/examples/lifecycle.js +9 -7
- package/dist/examples/organization-controller.d.ts +5 -0
- package/dist/examples/organization-controller.js +17 -8
- package/dist/examples/professional.js +8 -7
- package/dist/examples/relationship-access.js +2 -2
- package/dist/examples/shared.d.ts +61 -7
- package/dist/examples/shared.js +55 -7
- package/dist/models/actor-session.d.ts +9 -0
- package/dist/models/actor-session.js +3 -0
- package/dist/models/consent-rule.d.ts +1 -0
- package/dist/models/consent-rule.js +1 -0
- package/dist/models/did.d.ts +2 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/interoperable-claims/allergy-intolerance-claims.js +1 -0
- package/dist/models/interoperable-claims/communication-claims.d.ts +14 -0
- package/dist/models/interoperable-claims/communication-claims.js +15 -0
- package/dist/models/interoperable-claims/condition-claims.js +1 -0
- package/dist/models/interoperable-claims/device-use-statement-claims.js +1 -0
- package/dist/models/interoperable-claims/document-reference-claims.js +1 -0
- package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
- package/dist/models/interoperable-claims/medication-statement-claims.js +18 -0
- package/dist/utils/activation-policy.d.ts +8 -3
- package/dist/utils/activation-policy.js +26 -12
- package/dist/utils/clinical-resource-converters.js +70 -64
- package/dist/utils/communication-document-reference.js +10 -4
- package/dist/utils/communication-fhir-r4.js +40 -34
- package/dist/utils/communication-identity.d.ts +22 -3
- package/dist/utils/communication-identity.js +8 -1
- package/dist/utils/consent.d.ts +1 -1
- package/dist/utils/consent.js +21 -20
- package/dist/utils/did-resolution.d.ts +2 -1
- package/dist/utils/did-resolution.js +6 -5
- package/dist/utils/vp-token.js +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,8 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
131
131
|
### Communication / document utilities
|
|
132
132
|
|
|
133
133
|
- [`initializeCommunicationIdentity(...)`](src/utils/communication-identity.ts)
|
|
134
|
+
- bootstraps the technical communication profile identity for a device/app/channel runtime
|
|
135
|
+
- do not teach its `entityId` as if it were the legal organization id
|
|
134
136
|
- Derives the technical ML-DSA/ML-KEM communication identity for a device, portal, or app profile and returns JOSE header templates for `meta.jws.protected` and `meta.jwe.header`.
|
|
135
137
|
- Uses explicit `seedMaterial` for deterministic derivation. Without `seedMaterial`, it defaults to random generation. `mode = deterministic` requires `seedMaterial`.
|
|
136
138
|
- [`buildOrganizationDidWeb(...)`, `buildProfessionalDidWeb(...)`, `buildIndividualDidWeb(...)`](src/utils/did.ts)
|
|
@@ -208,7 +210,7 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
208
210
|
- Shared route contexts, controller binding fragments, and reusable helper builders.
|
|
209
211
|
- `tenantId` is modeled as an identifier-like route token (`acme-id`), not as a friendly alternate name.
|
|
210
212
|
- [`docs/LIFECYCLE_101.md`](docs/LIFECYCLE_101.md)
|
|
211
|
-
- Copy/paste lifecycle guide
|
|
213
|
+
- Copy/paste lifecycle `101` guide with semantic rules and reusable placeholders.
|
|
212
214
|
|
|
213
215
|
## Documentation Naming Rules
|
|
214
216
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical actor-kind vocabulary shared across SDK packages.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ActorKinds: Readonly<{
|
|
5
|
+
readonly HostOnboarding: "host_onboarding";
|
|
6
|
+
readonly OrganizationController: "organization_controller";
|
|
7
|
+
readonly OrganizationEmployee: "organization_employee";
|
|
8
|
+
readonly IndividualController: "individual_controller";
|
|
9
|
+
readonly IndividualMember: "individual_member";
|
|
10
|
+
readonly Professional: "professional";
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Canonical capability vocabulary shared across SDK packages.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ActorCapabilities: Readonly<{
|
|
16
|
+
readonly HostActivateOrganization: "host.activate_organization";
|
|
17
|
+
readonly HostConfirmOrder: "host.confirm_order";
|
|
18
|
+
readonly OrganizationCreateEmployee: "organization.create_employee";
|
|
19
|
+
readonly OrganizationDisableEmployee: "organization.disable_employee";
|
|
20
|
+
readonly OrganizationPurgeEmployee: "organization.purge_employee";
|
|
21
|
+
readonly OrganizationActivateDevice: "organization.activate_device";
|
|
22
|
+
readonly OrganizationIssueActivationCode: "organization.issue_activation_code";
|
|
23
|
+
readonly OrganizationRequestSmartToken: "organization.request_smart_token";
|
|
24
|
+
readonly IndividualBootstrap: "individual.bootstrap";
|
|
25
|
+
readonly IndividualDisable: "individual.disable";
|
|
26
|
+
readonly IndividualPurge: "individual.purge";
|
|
27
|
+
readonly IndividualImportIps: "individual.import_ips";
|
|
28
|
+
readonly IndividualGenerateDigitalTwin: "individual.generate_digital_twin";
|
|
29
|
+
readonly IndividualIngestCommunication: "individual.ingest_communication";
|
|
30
|
+
readonly IndividualUpsertRelatedPerson: "individual.upsert_related_person";
|
|
31
|
+
readonly IndividualMemberDisable: "individual_member.disable";
|
|
32
|
+
readonly IndividualMemberPurge: "individual_member.purge";
|
|
33
|
+
readonly ConsentGrantProfessionalAccess: "consent.grant_professional_access";
|
|
34
|
+
readonly ProfessionalMedication: "professional.medication";
|
|
35
|
+
readonly ProfessionalAppointment: "professional.appointment";
|
|
36
|
+
readonly ProfessionalRequestSmartToken: "professional.request_smart_token";
|
|
37
|
+
readonly TokenRequestSmart: "token.request_smart";
|
|
38
|
+
}>;
|
|
39
|
+
export type ActorKindsValue = typeof ActorKinds[keyof typeof ActorKinds];
|
|
40
|
+
export type ActorCapabilitiesValue = typeof ActorCapabilities[keyof typeof ActorCapabilities];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
+
/**
|
|
4
|
+
* Canonical actor-kind vocabulary shared across SDK packages.
|
|
5
|
+
*/
|
|
6
|
+
export const ActorKinds = Object.freeze({
|
|
7
|
+
HostOnboarding: 'host_onboarding',
|
|
8
|
+
OrganizationController: 'organization_controller',
|
|
9
|
+
OrganizationEmployee: 'organization_employee',
|
|
10
|
+
IndividualController: 'individual_controller',
|
|
11
|
+
IndividualMember: 'individual_member',
|
|
12
|
+
Professional: 'professional',
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Canonical capability vocabulary shared across SDK packages.
|
|
16
|
+
*/
|
|
17
|
+
export const ActorCapabilities = Object.freeze({
|
|
18
|
+
HostActivateOrganization: 'host.activate_organization',
|
|
19
|
+
HostConfirmOrder: 'host.confirm_order',
|
|
20
|
+
OrganizationCreateEmployee: 'organization.create_employee',
|
|
21
|
+
OrganizationDisableEmployee: 'organization.disable_employee',
|
|
22
|
+
OrganizationPurgeEmployee: 'organization.purge_employee',
|
|
23
|
+
OrganizationActivateDevice: 'organization.activate_device',
|
|
24
|
+
OrganizationIssueActivationCode: 'organization.issue_activation_code',
|
|
25
|
+
OrganizationRequestSmartToken: 'organization.request_smart_token',
|
|
26
|
+
IndividualBootstrap: 'individual.bootstrap',
|
|
27
|
+
IndividualDisable: 'individual.disable',
|
|
28
|
+
IndividualPurge: 'individual.purge',
|
|
29
|
+
IndividualImportIps: 'individual.import_ips',
|
|
30
|
+
IndividualGenerateDigitalTwin: 'individual.generate_digital_twin',
|
|
31
|
+
IndividualIngestCommunication: 'individual.ingest_communication',
|
|
32
|
+
IndividualUpsertRelatedPerson: 'individual.upsert_related_person',
|
|
33
|
+
IndividualMemberDisable: 'individual_member.disable',
|
|
34
|
+
IndividualMemberPurge: 'individual_member.purge',
|
|
35
|
+
ConsentGrantProfessionalAccess: 'consent.grant_professional_access',
|
|
36
|
+
ProfessionalMedication: 'professional.medication',
|
|
37
|
+
ProfessionalAppointment: 'professional.appointment',
|
|
38
|
+
ProfessionalRequestSmartToken: 'professional.request_smart_token',
|
|
39
|
+
TokenRequestSmart: 'token.request_smart',
|
|
40
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './actor-session';
|
|
1
2
|
export * from './communication';
|
|
2
3
|
export * from './cryptography';
|
|
3
4
|
export * from './device';
|
|
@@ -12,3 +13,5 @@ export * from './vital-signs';
|
|
|
12
13
|
export * from './network';
|
|
13
14
|
export * from './sectors';
|
|
14
15
|
export * from './smart';
|
|
16
|
+
export * from './service-capabilities';
|
|
17
|
+
export * from './verifiable-credentials';
|
package/dist/constants/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './actor-session.js';
|
|
1
2
|
export * from './communication.js';
|
|
2
3
|
export * from './cryptography.js';
|
|
3
4
|
export * from './device.js';
|
|
@@ -12,3 +13,5 @@ export * from './vital-signs.js';
|
|
|
12
13
|
export * from './network.js';
|
|
13
14
|
export * from './sectors.js';
|
|
14
15
|
export * from './smart.js';
|
|
16
|
+
export * from './service-capabilities.js';
|
|
17
|
+
export * from './verifiable-credentials.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical capability families persisted through
|
|
3
|
+
* `org.schema.Service.serviceType`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ServiceCapabilityFamily: {
|
|
6
|
+
readonly Indexing: "indexing";
|
|
7
|
+
readonly DigitalTwin: "digitaltwin";
|
|
8
|
+
};
|
|
9
|
+
export type ServiceCapabilityFamilyValue = typeof ServiceCapabilityFamily[keyof typeof ServiceCapabilityFamily];
|
|
10
|
+
/**
|
|
11
|
+
* Canonical capability tokens currently documented for tenant activation.
|
|
12
|
+
*
|
|
13
|
+
* The family prefix is the stable part of the contract. Suffixes such as
|
|
14
|
+
* `.rs` and `.cruds` can evolve independently across runtimes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ServiceCapabilityToken: {
|
|
17
|
+
readonly IndexingReadSearch: "indexing.rs";
|
|
18
|
+
readonly IndexingCruds: "indexing.cruds";
|
|
19
|
+
readonly DigitalTwinReadSearch: "digitaltwin.rs";
|
|
20
|
+
readonly DigitalTwinCruds: "digitaltwin.cruds";
|
|
21
|
+
};
|
|
22
|
+
export type ServiceCapabilityTokenValue = typeof ServiceCapabilityToken[keyof typeof ServiceCapabilityToken];
|
|
23
|
+
/**
|
|
24
|
+
* SDK-facing capability names.
|
|
25
|
+
*
|
|
26
|
+
* These names are intentionally more explicit than the persisted claim tokens:
|
|
27
|
+
* - `Provider` maps to write/manage capability (`*.cruds`)
|
|
28
|
+
* - `Reader` maps to read/search capability (`*.rs`)
|
|
29
|
+
*/
|
|
30
|
+
export declare const ServiceCapability: {
|
|
31
|
+
readonly IndexingProvider: "indexing.cruds";
|
|
32
|
+
readonly IndexingReader: "indexing.rs";
|
|
33
|
+
readonly DigitalTwinProvider: "digitaltwin.cruds";
|
|
34
|
+
readonly DigitalTwinReader: "digitaltwin.rs";
|
|
35
|
+
};
|
|
36
|
+
export type ServiceCapabilityValue = typeof ServiceCapability[keyof typeof ServiceCapability];
|
|
37
|
+
/**
|
|
38
|
+
* Parses the CSV stored in `org.schema.Service.serviceType`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseServiceCapabilityTokens(value: unknown): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Serializes capability tokens into the canonical CSV claim format.
|
|
43
|
+
*/
|
|
44
|
+
export declare function serializeServiceCapabilityTokens(values: ReadonlyArray<string | undefined | null>): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the capability family prefix from a token.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getServiceCapabilityFamily(value: string | undefined): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether the claim contains at least one capability from the requested
|
|
51
|
+
* family.
|
|
52
|
+
*/
|
|
53
|
+
export declare function hasServiceCapabilityFamily(value: unknown, family: ServiceCapabilityFamilyValue | string): boolean;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
+
/**
|
|
4
|
+
* Canonical capability families persisted through
|
|
5
|
+
* `org.schema.Service.serviceType`.
|
|
6
|
+
*/
|
|
7
|
+
export const ServiceCapabilityFamily = {
|
|
8
|
+
Indexing: 'indexing',
|
|
9
|
+
DigitalTwin: 'digitaltwin',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Canonical capability tokens currently documented for tenant activation.
|
|
13
|
+
*
|
|
14
|
+
* The family prefix is the stable part of the contract. Suffixes such as
|
|
15
|
+
* `.rs` and `.cruds` can evolve independently across runtimes.
|
|
16
|
+
*/
|
|
17
|
+
export const ServiceCapabilityToken = {
|
|
18
|
+
IndexingReadSearch: 'indexing.rs',
|
|
19
|
+
IndexingCruds: 'indexing.cruds',
|
|
20
|
+
DigitalTwinReadSearch: 'digitaltwin.rs',
|
|
21
|
+
DigitalTwinCruds: 'digitaltwin.cruds',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* SDK-facing capability names.
|
|
25
|
+
*
|
|
26
|
+
* These names are intentionally more explicit than the persisted claim tokens:
|
|
27
|
+
* - `Provider` maps to write/manage capability (`*.cruds`)
|
|
28
|
+
* - `Reader` maps to read/search capability (`*.rs`)
|
|
29
|
+
*/
|
|
30
|
+
export const ServiceCapability = {
|
|
31
|
+
IndexingProvider: ServiceCapabilityToken.IndexingCruds,
|
|
32
|
+
IndexingReader: ServiceCapabilityToken.IndexingReadSearch,
|
|
33
|
+
DigitalTwinProvider: ServiceCapabilityToken.DigitalTwinCruds,
|
|
34
|
+
DigitalTwinReader: ServiceCapabilityToken.DigitalTwinReadSearch,
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parses the CSV stored in `org.schema.Service.serviceType`.
|
|
38
|
+
*/
|
|
39
|
+
export function parseServiceCapabilityTokens(value) {
|
|
40
|
+
return Array.from(new Set(String(value || '')
|
|
41
|
+
.split(',')
|
|
42
|
+
.map((item) => item.trim())
|
|
43
|
+
.filter(Boolean)));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Serializes capability tokens into the canonical CSV claim format.
|
|
47
|
+
*/
|
|
48
|
+
export function serializeServiceCapabilityTokens(values) {
|
|
49
|
+
const normalized = Array.from(new Set(values
|
|
50
|
+
.map((item) => String(item || '').trim())
|
|
51
|
+
.filter(Boolean)));
|
|
52
|
+
return normalized.length ? normalized.join(',') : undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the capability family prefix from a token.
|
|
56
|
+
*/
|
|
57
|
+
export function getServiceCapabilityFamily(value) {
|
|
58
|
+
const normalized = String(value || '').trim().toLowerCase();
|
|
59
|
+
if (!normalized)
|
|
60
|
+
return undefined;
|
|
61
|
+
return normalized.split('.')[0] || undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether the claim contains at least one capability from the requested
|
|
65
|
+
* family.
|
|
66
|
+
*/
|
|
67
|
+
export function hasServiceCapabilityFamily(value, family) {
|
|
68
|
+
const normalizedFamily = String(family || '').trim().toLowerCase();
|
|
69
|
+
if (!normalizedFamily)
|
|
70
|
+
return false;
|
|
71
|
+
return parseServiceCapabilityTokens(value).some((item) => getServiceCapabilityFamily(item) === normalizedFamily);
|
|
72
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical W3C credential contexts reused by activation/VP helpers and tests.
|
|
3
|
+
*
|
|
4
|
+
* Keep these values centralized so examples and unit suites do not re-hardcode
|
|
5
|
+
* W3C context URLs inline.
|
|
6
|
+
*/
|
|
7
|
+
export declare const W3cCredentialContexts: Readonly<{
|
|
8
|
+
V1: "https://www.w3.org/2018/credentials/v1";
|
|
9
|
+
V2: "https://www.w3.org/ns/credentials/v2";
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Canonical W3C credential and presentation base types.
|
|
13
|
+
*/
|
|
14
|
+
export declare const W3cCredentialTypes: Readonly<{
|
|
15
|
+
VerifiableCredential: "VerifiableCredential";
|
|
16
|
+
VerifiablePresentation: "VerifiablePresentation";
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Canonical activation VC subtype names currently accepted by CORE helpers.
|
|
20
|
+
*
|
|
21
|
+
* Notes:
|
|
22
|
+
* - `LegalOrganizationCredential` and `PersonCredential` remain accepted as
|
|
23
|
+
* compatibility aliases while ICA/GW contracts converge.
|
|
24
|
+
* - Example/test code must import these constants instead of re-hardcoding the
|
|
25
|
+
* subtype strings inline.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ActivationCredentialTypes: Readonly<{
|
|
28
|
+
OrganizationCredential: "OrganizationCredential";
|
|
29
|
+
LegalOrganizationCredential: "LegalOrganizationCredential";
|
|
30
|
+
LegalRepresentativeCredential: "LegalRepresentativeCredential";
|
|
31
|
+
PersonCredential: "PersonCredential";
|
|
32
|
+
}>;
|
|
33
|
+
export declare const ORGANIZATION_ACTIVATION_VC_TYPES: readonly ("OrganizationCredential" | "LegalOrganizationCredential")[];
|
|
34
|
+
export declare const REPRESENTATIVE_ACTIVATION_VC_TYPES: readonly ("LegalRepresentativeCredential" | "PersonCredential")[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
+
/**
|
|
4
|
+
* Canonical W3C credential contexts reused by activation/VP helpers and tests.
|
|
5
|
+
*
|
|
6
|
+
* Keep these values centralized so examples and unit suites do not re-hardcode
|
|
7
|
+
* W3C context URLs inline.
|
|
8
|
+
*/
|
|
9
|
+
export const W3cCredentialContexts = Object.freeze({
|
|
10
|
+
V1: 'https://www.w3.org/2018/credentials/v1',
|
|
11
|
+
V2: 'https://www.w3.org/ns/credentials/v2',
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Canonical W3C credential and presentation base types.
|
|
15
|
+
*/
|
|
16
|
+
export const W3cCredentialTypes = Object.freeze({
|
|
17
|
+
VerifiableCredential: 'VerifiableCredential',
|
|
18
|
+
VerifiablePresentation: 'VerifiablePresentation',
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Canonical activation VC subtype names currently accepted by CORE helpers.
|
|
22
|
+
*
|
|
23
|
+
* Notes:
|
|
24
|
+
* - `LegalOrganizationCredential` and `PersonCredential` remain accepted as
|
|
25
|
+
* compatibility aliases while ICA/GW contracts converge.
|
|
26
|
+
* - Example/test code must import these constants instead of re-hardcoding the
|
|
27
|
+
* subtype strings inline.
|
|
28
|
+
*/
|
|
29
|
+
export const ActivationCredentialTypes = Object.freeze({
|
|
30
|
+
OrganizationCredential: 'OrganizationCredential',
|
|
31
|
+
LegalOrganizationCredential: 'LegalOrganizationCredential',
|
|
32
|
+
LegalRepresentativeCredential: 'LegalRepresentativeCredential',
|
|
33
|
+
PersonCredential: 'PersonCredential',
|
|
34
|
+
});
|
|
35
|
+
export const ORGANIZATION_ACTIVATION_VC_TYPES = Object.freeze([
|
|
36
|
+
ActivationCredentialTypes.OrganizationCredential,
|
|
37
|
+
ActivationCredentialTypes.LegalOrganizationCredential,
|
|
38
|
+
]);
|
|
39
|
+
export const REPRESENTATIVE_ACTIVATION_VC_TYPES = Object.freeze([
|
|
40
|
+
ActivationCredentialTypes.LegalRepresentativeCredential,
|
|
41
|
+
ActivationCredentialTypes.PersonCredential,
|
|
42
|
+
]);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* while preserving a stable migration target for older imports.
|
|
8
8
|
*/
|
|
9
9
|
export * from './shared.js';
|
|
10
|
+
export * from './ica-activation-proof.js';
|
|
10
11
|
export * from './organization-controller.js';
|
|
11
12
|
export * from './individual-controller.js';
|
|
12
13
|
export * from './professional.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ClaimConsent, type ConsentRule } from '../models/consent-rule';
|
|
2
|
+
import { EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_EMAIL_RELATED_PERSON } from './shared';
|
|
1
3
|
export declare const EXAMPLE_INDIVIDUAL_DID_WEB: "did:web:api.acme.org:individual:123";
|
|
2
4
|
export declare const EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB: "did:web:hospital.acme.org";
|
|
3
|
-
export
|
|
4
|
-
export declare const EXAMPLE_EMAIL_RELATED_PERSON: "parent.guardian@example.org";
|
|
5
|
+
export { EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_EMAIL_RELATED_PERSON };
|
|
5
6
|
export declare const EXAMPLE_CONSENT_ACCESS_JURISDICTION: "ES";
|
|
6
7
|
/**
|
|
7
8
|
* Legacy compatibility aliases kept so older docs/tests/imports continue to work
|
|
@@ -12,132 +13,15 @@ export declare const EXAMPLE_CONSENT_ACCESS_PROVIDER_DID: "did:web:hospital.acme
|
|
|
12
13
|
export declare const EXAMPLE_CONSENT_ACCESS_PROVIDER_EMAIL: "doctor.oncall@example.org";
|
|
13
14
|
export declare const EXAMPLE_CONSENT_ACCESS_RELATED_PERSON_EMAIL: "parent.guardian@example.org";
|
|
14
15
|
export declare const EXAMPLE_CONSENT_ACCESS_RULES: Readonly<{
|
|
15
|
-
physicianByEmailContinuousCare:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly 'Consent.actor-role': string;
|
|
25
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
26
|
-
readonly 'Consent.purpose': string;
|
|
27
|
-
readonly 'Consent.action': string;
|
|
28
|
-
};
|
|
29
|
-
physicianByEmailEmergency: {
|
|
30
|
-
readonly 'Consent.date': "2026-05-20";
|
|
31
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
32
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
33
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
34
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
35
|
-
readonly 'Consent.identifier': string;
|
|
36
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
37
|
-
readonly 'Consent.actor-identifier': string;
|
|
38
|
-
readonly 'Consent.actor-role': string;
|
|
39
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
40
|
-
readonly 'Consent.purpose': string;
|
|
41
|
-
readonly 'Consent.action': string;
|
|
42
|
-
};
|
|
43
|
-
physicianByOrganizationContinuousCare: {
|
|
44
|
-
readonly 'Consent.date': "2026-05-20";
|
|
45
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
46
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
47
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
48
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
49
|
-
readonly 'Consent.identifier': string;
|
|
50
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
51
|
-
readonly 'Consent.actor-identifier': string;
|
|
52
|
-
readonly 'Consent.actor-role': string;
|
|
53
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
54
|
-
readonly 'Consent.purpose': string;
|
|
55
|
-
readonly 'Consent.action': string;
|
|
56
|
-
};
|
|
57
|
-
physicianByJurisdictionEmergency: {
|
|
58
|
-
readonly 'Consent.date': "2026-05-20";
|
|
59
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
60
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
61
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
62
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
63
|
-
readonly 'Consent.identifier': string;
|
|
64
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
65
|
-
readonly 'Consent.actor-identifier': string;
|
|
66
|
-
readonly 'Consent.actor-role': string;
|
|
67
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
68
|
-
readonly 'Consent.purpose': string;
|
|
69
|
-
readonly 'Consent.action': string;
|
|
70
|
-
};
|
|
71
|
-
nurseByOrganization: {
|
|
72
|
-
readonly 'Consent.date': "2026-05-20";
|
|
73
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
74
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
75
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
76
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
77
|
-
readonly 'Consent.identifier': string;
|
|
78
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
79
|
-
readonly 'Consent.actor-identifier': string;
|
|
80
|
-
readonly 'Consent.actor-role': string;
|
|
81
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
82
|
-
readonly 'Consent.purpose': string;
|
|
83
|
-
readonly 'Consent.action': string;
|
|
84
|
-
};
|
|
85
|
-
paramedicByJurisdiction: {
|
|
86
|
-
readonly 'Consent.date': "2026-05-20";
|
|
87
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
88
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
89
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
90
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
91
|
-
readonly 'Consent.identifier': string;
|
|
92
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
93
|
-
readonly 'Consent.actor-identifier': string;
|
|
94
|
-
readonly 'Consent.actor-role': string;
|
|
95
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
96
|
-
readonly 'Consent.purpose': string;
|
|
97
|
-
readonly 'Consent.action': string;
|
|
98
|
-
};
|
|
99
|
-
directPhysicianDenyInsideAllowedOrganization: {
|
|
100
|
-
readonly 'Consent.date': "2026-05-20";
|
|
101
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
102
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
103
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
104
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
105
|
-
readonly 'Consent.identifier': string;
|
|
106
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
107
|
-
readonly 'Consent.actor-identifier': string;
|
|
108
|
-
readonly 'Consent.actor-role': string;
|
|
109
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
110
|
-
readonly 'Consent.purpose': string;
|
|
111
|
-
readonly 'Consent.action': string;
|
|
112
|
-
};
|
|
113
|
-
relatedPersonByEmail: {
|
|
114
|
-
readonly 'Consent.date': "2026-05-20";
|
|
115
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
116
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
117
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
118
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
119
|
-
readonly 'Consent.identifier': string;
|
|
120
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
121
|
-
readonly 'Consent.actor-identifier': string;
|
|
122
|
-
readonly 'Consent.actor-role': string;
|
|
123
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
124
|
-
readonly 'Consent.purpose': string;
|
|
125
|
-
readonly 'Consent.action': string;
|
|
126
|
-
};
|
|
127
|
-
revokedPhysicianEmailConsent: {
|
|
128
|
-
readonly 'Consent.date': "2026-05-20";
|
|
129
|
-
readonly 'Consent.period-end'?: string | undefined;
|
|
130
|
-
readonly 'Consent.period-start'?: string | undefined;
|
|
131
|
-
readonly 'Consent.resourceType'?: string | undefined;
|
|
132
|
-
readonly '@context': "org.hl7.fhir.api";
|
|
133
|
-
readonly 'Consent.identifier': string;
|
|
134
|
-
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
135
|
-
readonly 'Consent.actor-identifier': string;
|
|
136
|
-
readonly 'Consent.actor-role': string;
|
|
137
|
-
readonly 'Consent.decision': "permit" | "deny";
|
|
138
|
-
readonly 'Consent.purpose': string;
|
|
139
|
-
readonly 'Consent.action': string;
|
|
140
|
-
};
|
|
16
|
+
physicianByEmailContinuousCare: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
17
|
+
physicianByEmailEmergency: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
18
|
+
physicianByOrganizationContinuousCare: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
19
|
+
physicianByJurisdictionEmergency: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
20
|
+
nurseByOrganization: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
21
|
+
paramedicByJurisdiction: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
22
|
+
directPhysicianDenyInsideAllowedOrganization: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
23
|
+
relatedPersonByEmail: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
24
|
+
revokedPhysicianEmailConsent: ConsentRule & Partial<Record<ClaimConsent.resourceType, string>>;
|
|
141
25
|
}>;
|
|
142
26
|
export declare const EXAMPLE_CONSENT_PHONE_EXTENSION_PENDING: Readonly<{
|
|
143
27
|
target: "tel:+34600111222";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
import { HealthcareActorRoles, HealthcareBasicSections, HealthcareConsentPurposes, } from '../constants/healthcare.js';
|
|
3
|
+
import { ClaimConsent } from '../models/consent-rule.js';
|
|
3
4
|
import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export
|
|
8
|
-
export const EXAMPLE_CONSENT_ACCESS_JURISDICTION =
|
|
5
|
+
import { EXAMPLE_CONSENT_DATE, EXAMPLE_CONSENT_PERIOD_END, EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_EMAIL_RELATED_PERSON, EXAMPLE_HEALTHCARE_JURISDICTION, EXAMPLE_PROVIDER_ORGANIZATION_DID, EXAMPLE_RELATED_PERSON_ROLE, EXAMPLE_SUBJECT_DID, } from './shared.js';
|
|
6
|
+
export const EXAMPLE_INDIVIDUAL_DID_WEB = EXAMPLE_SUBJECT_DID;
|
|
7
|
+
export const EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB = EXAMPLE_PROVIDER_ORGANIZATION_DID;
|
|
8
|
+
export { EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_EMAIL_RELATED_PERSON };
|
|
9
|
+
export const EXAMPLE_CONSENT_ACCESS_JURISDICTION = EXAMPLE_HEALTHCARE_JURISDICTION;
|
|
9
10
|
/**
|
|
10
11
|
* Legacy compatibility aliases kept so older docs/tests/imports continue to work
|
|
11
12
|
* while the canonical variable names converge.
|
|
@@ -14,20 +15,28 @@ export const EXAMPLE_CONSENT_ACCESS_SUBJECT = EXAMPLE_INDIVIDUAL_DID_WEB;
|
|
|
14
15
|
export const EXAMPLE_CONSENT_ACCESS_PROVIDER_DID = EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB;
|
|
15
16
|
export const EXAMPLE_CONSENT_ACCESS_PROVIDER_EMAIL = EXAMPLE_EMAIL_PROFESSIONAL;
|
|
16
17
|
export const EXAMPLE_CONSENT_ACCESS_RELATED_PERSON_EMAIL = EXAMPLE_EMAIL_RELATED_PERSON;
|
|
18
|
+
/**
|
|
19
|
+
* Consent example builder used by docs/tests.
|
|
20
|
+
*
|
|
21
|
+
* Contract note:
|
|
22
|
+
* repeated actor identifiers, dates, jurisdictions, role fixtures, and
|
|
23
|
+
* canonical consent claim keys must be imported, never re-hardcoded inline in
|
|
24
|
+
* each example rule.
|
|
25
|
+
*/
|
|
17
26
|
function buildRule(input) {
|
|
18
27
|
return {
|
|
19
28
|
'@context': 'org.hl7.fhir.api',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...(input.resourceTypes?.length ? {
|
|
28
|
-
...(input.periodStart ? {
|
|
29
|
-
...(input.periodEnd ? {
|
|
30
|
-
|
|
29
|
+
[ClaimConsent.identifier]: input.identifier,
|
|
30
|
+
[ClaimConsent.subject]: EXAMPLE_INDIVIDUAL_DID_WEB,
|
|
31
|
+
[ClaimConsent.actorIdentifier]: input.actorIdentifier,
|
|
32
|
+
[ClaimConsent.actorRole]: input.actorRole,
|
|
33
|
+
[ClaimConsent.decision]: input.decision || 'permit',
|
|
34
|
+
[ClaimConsent.purpose]: input.purpose,
|
|
35
|
+
[ClaimConsent.action]: input.actions.join(','),
|
|
36
|
+
...(input.resourceTypes?.length ? { [ClaimConsent.resourceType]: input.resourceTypes.join(',') } : {}),
|
|
37
|
+
...(input.periodStart ? { [ClaimConsent.periodStart]: input.periodStart } : {}),
|
|
38
|
+
...(input.periodEnd ? { [ClaimConsent.periodEnd]: input.periodEnd } : {}),
|
|
39
|
+
[ClaimConsent.date]: EXAMPLE_CONSENT_DATE,
|
|
31
40
|
};
|
|
32
41
|
}
|
|
33
42
|
export const EXAMPLE_CONSENT_ACCESS_RULES = Object.freeze({
|
|
@@ -91,7 +100,7 @@ export const EXAMPLE_CONSENT_ACCESS_RULES = Object.freeze({
|
|
|
91
100
|
relatedPersonByEmail: buildRule({
|
|
92
101
|
identifier: 'urn:uuid:consent-related-person-email',
|
|
93
102
|
actorIdentifier: EXAMPLE_EMAIL_RELATED_PERSON,
|
|
94
|
-
actorRole:
|
|
103
|
+
actorRole: EXAMPLE_RELATED_PERSON_ROLE,
|
|
95
104
|
purpose: HealthcareConsentPurposes.Treatment,
|
|
96
105
|
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
97
106
|
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.DocumentReference],
|
|
@@ -102,7 +111,7 @@ export const EXAMPLE_CONSENT_ACCESS_RULES = Object.freeze({
|
|
|
102
111
|
actorRole: HealthcareActorRoles.Physician,
|
|
103
112
|
purpose: HealthcareConsentPurposes.EmergencyTreatment,
|
|
104
113
|
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
105
|
-
periodEnd:
|
|
114
|
+
periodEnd: EXAMPLE_CONSENT_PERIOD_END,
|
|
106
115
|
}),
|
|
107
116
|
});
|
|
108
117
|
export const EXAMPLE_CONSENT_PHONE_EXTENSION_PENDING = Object.freeze({
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* breaking while the examples are reorganized by flow/case of use.
|
|
7
7
|
*/
|
|
8
8
|
export * from './shared';
|
|
9
|
+
export * from './ica-activation-proof';
|
|
9
10
|
export * from './organization-controller';
|
|
10
11
|
export * from './individual-controller';
|
|
11
12
|
export * from './professional';
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* breaking while the examples are reorganized by flow/case of use.
|
|
8
8
|
*/
|
|
9
9
|
export * from './shared.js';
|
|
10
|
+
export * from './ica-activation-proof.js';
|
|
10
11
|
export * from './organization-controller.js';
|
|
11
12
|
export * from './individual-controller.js';
|
|
12
13
|
export * from './professional.js';
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Examples for frontend session/profile bootstrap flows.
|
|
3
|
-
*/
|
|
4
|
-
export declare const EXAMPLE_PROFILE_PROVIDER_DID = "did:web:provider.example.org";
|
|
5
1
|
export declare const EXAMPLE_PROFILE_SESSION_INPUT: {
|
|
6
2
|
readonly profileId: " profile-1 ";
|
|
7
3
|
readonly email: " user@example.com ";
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
/**
|
|
3
3
|
* Examples for frontend session/profile bootstrap flows.
|
|
4
|
+
*
|
|
5
|
+
* Note:
|
|
6
|
+
*
|
|
7
|
+
* - profile/provider identifiers in this file are synthetic fixtures imported
|
|
8
|
+
* from `./shared`
|
|
9
|
+
* - do not inline DID/email/profile literals directly in frontend examples
|
|
4
10
|
*/
|
|
5
|
-
|
|
11
|
+
import { EXAMPLE_PROFILE_EMAIL, EXAMPLE_PROFILE_ID, EXAMPLE_PROFILE_ORGANIZATION_DID, } from './shared.js';
|
|
6
12
|
export const EXAMPLE_PROFILE_SESSION_INPUT = {
|
|
7
|
-
profileId:
|
|
8
|
-
email:
|
|
13
|
+
profileId: ` ${EXAMPLE_PROFILE_ID} `,
|
|
14
|
+
email: ` ${EXAMPLE_PROFILE_EMAIL} `,
|
|
9
15
|
role: ' controller ',
|
|
10
|
-
providerDid:
|
|
16
|
+
providerDid: ` ${EXAMPLE_PROFILE_ORGANIZATION_DID} `,
|
|
11
17
|
appType: 'Family',
|
|
12
18
|
};
|
|
13
19
|
export const EXAMPLE_PROFILE_REGISTRY_ENTRY = {
|
|
14
|
-
id:
|
|
15
|
-
email:
|
|
20
|
+
id: EXAMPLE_PROFILE_ID,
|
|
21
|
+
email: EXAMPLE_PROFILE_EMAIL,
|
|
16
22
|
role: 'controller',
|
|
17
|
-
providerDid:
|
|
23
|
+
providerDid: EXAMPLE_PROFILE_ORGANIZATION_DID,
|
|
18
24
|
};
|