gdc-common-utils-ts 1.5.1 → 1.7.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.
Files changed (64) hide show
  1. package/README.md +36 -4
  2. package/dist/constants/index.d.ts +2 -0
  3. package/dist/constants/index.js +2 -0
  4. package/dist/constants/schemaorg.d.ts +2 -0
  5. package/dist/constants/schemaorg.js +2 -0
  6. package/dist/constants/service-capabilities.d.ts +53 -0
  7. package/dist/constants/service-capabilities.js +72 -0
  8. package/dist/constants/verifiable-credentials.d.ts +34 -0
  9. package/dist/constants/verifiable-credentials.js +42 -0
  10. package/dist/examples/api-flow-examples.d.ts +2 -0
  11. package/dist/examples/api-flow-examples.js +2 -0
  12. package/dist/examples/consent-access.d.ts +19 -127
  13. package/dist/examples/consent-access.js +42 -25
  14. package/dist/examples/contract-examples.d.ts +2 -0
  15. package/dist/examples/contract-examples.js +2 -0
  16. package/dist/examples/frontend-session.d.ts +0 -4
  17. package/dist/examples/frontend-session.js +13 -7
  18. package/dist/examples/ica-activation-proof.d.ts +55 -0
  19. package/dist/examples/ica-activation-proof.js +67 -0
  20. package/dist/examples/index.d.ts +3 -0
  21. package/dist/examples/index.js +3 -0
  22. package/dist/examples/individual-controller.d.ts +4 -15
  23. package/dist/examples/individual-controller.js +17 -31
  24. package/dist/examples/lifecycle.d.ts +505 -0
  25. package/dist/examples/lifecycle.js +291 -0
  26. package/dist/examples/organization-controller.d.ts +7 -2
  27. package/dist/examples/organization-controller.js +19 -10
  28. package/dist/examples/professional.d.ts +9 -2
  29. package/dist/examples/professional.js +24 -12
  30. package/dist/examples/relationship-access.d.ts +11 -0
  31. package/dist/examples/relationship-access.js +96 -0
  32. package/dist/examples/shared.d.ts +95 -7
  33. package/dist/examples/shared.js +85 -31
  34. package/dist/models/consent-rule.d.ts +1 -0
  35. package/dist/models/consent-rule.js +1 -0
  36. package/dist/models/index.d.ts +1 -0
  37. package/dist/models/index.js +1 -0
  38. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +1 -0
  39. package/dist/models/interoperable-claims/communication-claims.d.ts +14 -0
  40. package/dist/models/interoperable-claims/communication-claims.js +15 -0
  41. package/dist/models/interoperable-claims/condition-claims.js +1 -0
  42. package/dist/models/interoperable-claims/device-use-statement-claims.js +1 -0
  43. package/dist/models/interoperable-claims/document-reference-claims.js +1 -0
  44. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  45. package/dist/models/interoperable-claims/medication-statement-claims.js +18 -0
  46. package/dist/models/relationship-access.d.ts +160 -0
  47. package/dist/models/relationship-access.js +21 -0
  48. package/dist/utils/activation-policy.d.ts +8 -3
  49. package/dist/utils/activation-policy.js +26 -12
  50. package/dist/utils/activation-request.d.ts +42 -0
  51. package/dist/utils/activation-request.js +42 -0
  52. package/dist/utils/clinical-resource-converters.js +70 -64
  53. package/dist/utils/communication-document-reference.js +10 -4
  54. package/dist/utils/communication-fhir-r4.js +40 -34
  55. package/dist/utils/communication-identity.d.ts +25 -15
  56. package/dist/utils/communication-identity.js +23 -13
  57. package/dist/utils/consent.d.ts +1 -1
  58. package/dist/utils/consent.js +21 -20
  59. package/dist/utils/index.d.ts +1 -0
  60. package/dist/utils/index.js +1 -0
  61. package/dist/utils/individual-form-pdf.d.ts +55 -0
  62. package/dist/utils/individual-form-pdf.js +191 -0
  63. package/dist/utils/vp-token.js +8 -6
  64. package/package.json +1 -1
@@ -7,8 +7,10 @@
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';
13
14
  export * from './related-person.js';
14
15
  export * from './frontend-session.js';
16
+ export * from './lifecycle.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
- export const EXAMPLE_PROFILE_PROVIDER_DID = 'did:web:provider.example.org';
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: ' profile-1 ',
8
- email: ' user@example.com ',
13
+ profileId: ` ${EXAMPLE_PROFILE_ID} `,
14
+ email: ` ${EXAMPLE_PROFILE_EMAIL} `,
9
15
  role: ' controller ',
10
- providerDid: ' did:web:org.example ',
16
+ providerDid: ` ${EXAMPLE_PROFILE_ORGANIZATION_DID} `,
11
17
  appType: 'Family',
12
18
  };
13
19
  export const EXAMPLE_PROFILE_REGISTRY_ENTRY = {
14
- id: 'profile-1',
15
- email: 'user@example.com',
20
+ id: EXAMPLE_PROFILE_ID,
21
+ email: EXAMPLE_PROFILE_EMAIL,
16
22
  role: 'controller',
17
- providerDid: 'did:web:org.example',
23
+ providerDid: EXAMPLE_PROFILE_ORGANIZATION_DID,
18
24
  };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Shared synthetic ICA activation-proof fixtures reused by docs/tests.
3
+ *
4
+ * Contract note:
5
+ * - issuer/holder/audience DIDs, VC subtype names, and representative binding
6
+ * fields must be imported from this module instead of re-hardcoded inline
7
+ * - the representative `hasCredential.material` shape below reflects the
8
+ * current `activation-policy` helper contract; if ICA finalizes a different
9
+ * VC shape, update this module first and then the dependent helpers/tests
10
+ */
11
+ export declare const EXAMPLE_ICA_VP_ISSUER_DID: "did:web:controller.example.org";
12
+ export declare const EXAMPLE_ICA_VP_AUDIENCE_DID: "did:web:host.example.com";
13
+ export declare const EXAMPLE_ICA_VP_HOLDER_DID: "did:web:controller.example.org";
14
+ export declare const EXAMPLE_ICA_ORGANIZATION_DID: "did:web:org.example.org";
15
+ export declare const EXAMPLE_ICA_REPRESENTATIVE_DID: "did:web:rep.example.org";
16
+ export declare const EXAMPLE_ICA_ORGANIZATION_TAX_ID: "ESB00112233";
17
+ export declare const EXAMPLE_ICA_REPRESENTATIVE_ROLE_CODE: "RESPRSN";
18
+ export declare const EXAMPLE_ICA_REPRESENTATIVE_BINDING_MATERIAL: "controller-sig-kid";
19
+ export declare const EXAMPLE_ICA_ORGANIZATION_CREDENTIAL: Readonly<{
20
+ '@context': string[];
21
+ type: ("VerifiableCredential" | "OrganizationCredential")[];
22
+ credentialSubject: {
23
+ id: "did:web:org.example.org";
24
+ taxID: "ESB00112233";
25
+ };
26
+ }>;
27
+ export declare const EXAMPLE_ICA_LEGAL_REPRESENTATIVE_CREDENTIAL: Readonly<{
28
+ '@context': string[];
29
+ type: ("VerifiableCredential" | "LegalRepresentativeCredential")[];
30
+ credentialSubject: {
31
+ id: "did:web:rep.example.org";
32
+ memberOf: {
33
+ taxID: "ESB00112233";
34
+ };
35
+ hasOccupation: {
36
+ identifier: {
37
+ value: "RESPRSN";
38
+ };
39
+ };
40
+ hasCredential: {
41
+ material: "controller-sig-kid";
42
+ };
43
+ };
44
+ }>;
45
+ export declare const EXAMPLE_ICA_ACTIVATION_VP_PAYLOAD: Readonly<{
46
+ iss: "did:web:controller.example.org";
47
+ sub: "did:web:controller.example.org";
48
+ aud: "did:web:host.example.com";
49
+ vp: {
50
+ '@context': "https://www.w3.org/2018/credentials/v1"[];
51
+ type: "VerifiablePresentation"[];
52
+ holder: "did:web:controller.example.org";
53
+ verifiableCredential: string[];
54
+ };
55
+ }>;
@@ -0,0 +1,67 @@
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
+ import { ActivationCredentialTypes, W3cCredentialContexts, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
4
+ /**
5
+ * Shared synthetic ICA activation-proof fixtures reused by docs/tests.
6
+ *
7
+ * Contract note:
8
+ * - issuer/holder/audience DIDs, VC subtype names, and representative binding
9
+ * fields must be imported from this module instead of re-hardcoded inline
10
+ * - the representative `hasCredential.material` shape below reflects the
11
+ * current `activation-policy` helper contract; if ICA finalizes a different
12
+ * VC shape, update this module first and then the dependent helpers/tests
13
+ */
14
+ export const EXAMPLE_ICA_VP_ISSUER_DID = 'did:web:controller.example.org';
15
+ export const EXAMPLE_ICA_VP_AUDIENCE_DID = 'did:web:host.example.com';
16
+ export const EXAMPLE_ICA_VP_HOLDER_DID = EXAMPLE_ICA_VP_ISSUER_DID;
17
+ export const EXAMPLE_ICA_ORGANIZATION_DID = 'did:web:org.example.org';
18
+ export const EXAMPLE_ICA_REPRESENTATIVE_DID = 'did:web:rep.example.org';
19
+ export const EXAMPLE_ICA_ORGANIZATION_TAX_ID = 'ESB00112233';
20
+ export const EXAMPLE_ICA_REPRESENTATIVE_ROLE_CODE = 'RESPRSN';
21
+ export const EXAMPLE_ICA_REPRESENTATIVE_BINDING_MATERIAL = 'controller-sig-kid';
22
+ export const EXAMPLE_ICA_ORGANIZATION_CREDENTIAL = Object.freeze({
23
+ '@context': [W3cCredentialContexts.V2, 'https://schema.org'],
24
+ type: [
25
+ W3cCredentialTypes.VerifiableCredential,
26
+ ActivationCredentialTypes.OrganizationCredential,
27
+ ],
28
+ credentialSubject: {
29
+ id: EXAMPLE_ICA_ORGANIZATION_DID,
30
+ taxID: EXAMPLE_ICA_ORGANIZATION_TAX_ID,
31
+ },
32
+ });
33
+ export const EXAMPLE_ICA_LEGAL_REPRESENTATIVE_CREDENTIAL = Object.freeze({
34
+ '@context': [W3cCredentialContexts.V2, 'https://schema.org'],
35
+ type: [
36
+ W3cCredentialTypes.VerifiableCredential,
37
+ ActivationCredentialTypes.LegalRepresentativeCredential,
38
+ ],
39
+ credentialSubject: {
40
+ id: EXAMPLE_ICA_REPRESENTATIVE_DID,
41
+ memberOf: {
42
+ taxID: EXAMPLE_ICA_ORGANIZATION_TAX_ID,
43
+ },
44
+ hasOccupation: {
45
+ identifier: {
46
+ value: EXAMPLE_ICA_REPRESENTATIVE_ROLE_CODE,
47
+ },
48
+ },
49
+ hasCredential: {
50
+ material: EXAMPLE_ICA_REPRESENTATIVE_BINDING_MATERIAL,
51
+ },
52
+ },
53
+ });
54
+ export const EXAMPLE_ICA_ACTIVATION_VP_PAYLOAD = Object.freeze({
55
+ iss: EXAMPLE_ICA_VP_ISSUER_DID,
56
+ sub: EXAMPLE_ICA_VP_ISSUER_DID,
57
+ aud: EXAMPLE_ICA_VP_AUDIENCE_DID,
58
+ vp: {
59
+ '@context': [W3cCredentialContexts.V1],
60
+ type: [W3cCredentialTypes.VerifiablePresentation],
61
+ holder: EXAMPLE_ICA_VP_HOLDER_DID,
62
+ verifiableCredential: [
63
+ JSON.stringify(EXAMPLE_ICA_ORGANIZATION_CREDENTIAL),
64
+ JSON.stringify(EXAMPLE_ICA_LEGAL_REPRESENTATIVE_CREDENTIAL),
65
+ ],
66
+ },
67
+ });
@@ -1,9 +1,12 @@
1
1
  export * from './shared';
2
+ export * from './ica-activation-proof';
2
3
  export * from './organization-controller';
3
4
  export * from './individual-controller';
4
5
  export * from './professional';
5
6
  export * from './related-person';
6
7
  export * from './consent-access';
8
+ export * from './relationship-access';
7
9
  export * from './frontend-session';
10
+ export * from './lifecycle';
8
11
  export * from './api-flow-examples';
9
12
  export * from './contract-examples';
@@ -1,9 +1,12 @@
1
1
  export * from './shared.js';
2
+ export * from './ica-activation-proof.js';
2
3
  export * from './organization-controller.js';
3
4
  export * from './individual-controller.js';
4
5
  export * from './professional.js';
5
6
  export * from './related-person.js';
6
7
  export * from './consent-access.js';
8
+ export * from './relationship-access.js';
7
9
  export * from './frontend-session.js';
10
+ export * from './lifecycle.js';
8
11
  export * from './api-flow-examples.js';
9
12
  export * from './contract-examples.js';
@@ -13,6 +13,7 @@
13
13
  * - legal organization controller/representative examples belong instead to
14
14
  * organization activation and VC/member semantics, not to `owner.*` claims
15
15
  */
16
+ import type { ExampleClinicalBundleSearchInput, ExampleLatestIpsSearchInput } from './shared';
16
17
  export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT: {
17
18
  readonly alternateName: "ana";
18
19
  readonly controllerEmail: "ana.parent@example.org";
@@ -65,7 +66,7 @@ export declare const EXAMPLE_LIVE_CONSENT_GRANT_INPUT: {
65
66
  };
66
67
  readonly actorRole: "ISCO-08|2211";
67
68
  readonly purpose: "TREAT";
68
- readonly actions: readonly ["LOINC|48765-2"];
69
+ readonly actions: readonly [string];
69
70
  };
70
71
  export declare const EXAMPLE_CONSENT_GRANT_RESPONSE: {
71
72
  readonly submit: {
@@ -95,17 +96,5 @@ export declare const EXAMPLE_DIGITAL_TWIN_COMPOSITION_INPUT: {
95
96
  };
96
97
  readonly format: "api";
97
98
  };
98
- export declare const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT: {
99
- readonly subject: "did:web:api.acme.org:individual:123";
100
- readonly section: readonly ["LOINC|60591-5", "LOINC|48765-2"];
101
- readonly includedTypes: readonly ["Composition", "DocumentReference"];
102
- readonly date: {
103
- readonly start: "2026-01-01";
104
- readonly end: "2026-12-31";
105
- };
106
- readonly code: "LOINC|11450-4";
107
- readonly author: "did:web:api.acme.org:professional:1";
108
- };
109
- export declare const EXAMPLE_LATEST_IPS_SEARCH_INPUT: {
110
- readonly subject: "did:web:api.acme.org:individual:123";
111
- };
99
+ export declare const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT: ExampleClinicalBundleSearchInput;
100
+ export declare const EXAMPLE_LATEST_IPS_SEARCH_INPUT: ExampleLatestIpsSearchInput;
@@ -1,22 +1,8 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- /**
3
- * Examples for individual-controller and subject-index bootstrap flows.
4
- *
5
- * CORE canonical examples in this file avoid phone-specific subject/controller
6
- * fields unless the flow truly requires them. Telephone-driven notification or
7
- * consent targeting is treated as an extension concern (for example UNID GW),
8
- * not a CORE GW contract requirement.
9
- *
10
- * Semantic split:
11
- *
12
- * - these examples model the human controller as owner of the individual
13
- * subject-index organization
14
- * - legal organization controller/representative examples belong instead to
15
- * organization activation and VC/member semantics, not to `owner.*` claims
16
- */
2
+ import { EXAMPLE_API_ORGANIZATION_DID, EXAMPLE_CLINICAL_CODE_PROBLEM, EXAMPLE_CLINICAL_DATE_RANGE, EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_GENERIC_SUBJECT_DID, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_HEALTHCARE_JURISDICTION, EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT, EXAMPLE_PRACTITIONER_DID, EXAMPLE_PROFESSIONAL_DID, EXAMPLE_SUBJECT_DID, } from './shared.js';
17
3
  export const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT = {
18
4
  alternateName: 'ana',
19
- controllerEmail: 'ana.parent@example.org',
5
+ controllerEmail: EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL,
20
6
  timeoutSeconds: 7,
21
7
  intervalSeconds: 2,
22
8
  };
@@ -36,18 +22,18 @@ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_ORDER_RESPONSE = {
36
22
  poll: { status: 200, body: {}, attempts: 1 },
37
23
  };
38
24
  export const EXAMPLE_CONSENT_GRANT_INPUT = {
39
- actor: 'did:web:practitioner.example,ES',
40
- actorRole: 'physician',
41
- purpose: 'TREAT',
25
+ actor: `${EXAMPLE_PRACTITIONER_DID},${EXAMPLE_HEALTHCARE_JURISDICTION}`,
26
+ actorRole: EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT,
27
+ purpose: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
42
28
  actions: ['read'],
43
- subjectDid: 'did:web:subject.example',
29
+ subjectDid: EXAMPLE_GENERIC_SUBJECT_DID,
44
30
  };
45
31
  export const EXAMPLE_LIVE_CONSENT_GRANT_INPUT = {
46
- subjectDid: 'did:web:api.acme.org:individual:123',
47
- actor: { identifier: 'did:web:api.acme.org' },
48
- actorRole: 'ISCO-08|2211',
49
- purpose: 'TREAT',
50
- actions: ['LOINC|48765-2'],
32
+ subjectDid: EXAMPLE_SUBJECT_DID,
33
+ actor: { identifier: EXAMPLE_API_ORGANIZATION_DID },
34
+ actorRole: EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN,
35
+ purpose: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
36
+ actions: [EXAMPLE_CLINICAL_SECTION_ALLERGIES],
51
37
  };
52
38
  export const EXAMPLE_CONSENT_GRANT_RESPONSE = {
53
39
  submit: { status: 202, body: {} },
@@ -73,13 +59,13 @@ export const EXAMPLE_DIGITAL_TWIN_COMPOSITION_INPUT = {
73
59
  format: 'api',
74
60
  };
75
61
  export const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT = {
76
- subject: 'did:web:api.acme.org:individual:123',
77
- section: ['LOINC|60591-5', 'LOINC|48765-2'],
62
+ subject: EXAMPLE_SUBJECT_DID,
63
+ section: [EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY, EXAMPLE_CLINICAL_SECTION_ALLERGIES],
78
64
  includedTypes: ['Composition', 'DocumentReference'],
79
- date: { start: '2026-01-01', end: '2026-12-31' },
80
- code: 'LOINC|11450-4',
81
- author: 'did:web:api.acme.org:professional:1',
65
+ date: EXAMPLE_CLINICAL_DATE_RANGE,
66
+ code: EXAMPLE_CLINICAL_CODE_PROBLEM,
67
+ author: EXAMPLE_PROFESSIONAL_DID,
82
68
  };
83
69
  export const EXAMPLE_LATEST_IPS_SEARCH_INPUT = {
84
- subject: 'did:web:api.acme.org:individual:123',
70
+ subject: EXAMPLE_SUBJECT_DID,
85
71
  };