gdc-common-utils-ts 2.0.18 → 2.1.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 +0 -1
- package/dist/examples/bundle-didcomm-payload.d.ts +11 -0
- package/dist/examples/bundle-didcomm-payload.js +13 -0
- package/dist/examples/communication-attached-bundle-session.js +2 -1
- package/dist/examples/communication-didcomm-payload.d.ts +35 -0
- package/dist/examples/communication-didcomm-payload.js +38 -0
- package/dist/examples/index.d.ts +4 -0
- package/dist/examples/index.js +4 -0
- package/dist/examples/profile-manager-mem.d.ts +45 -0
- package/dist/examples/profile-manager-mem.js +29 -0
- package/dist/examples/shared.d.ts +1 -0
- package/dist/examples/shared.js +1 -0
- package/dist/examples/wallet-mem.d.ts +38 -0
- package/dist/examples/wallet-mem.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/IProfileOutboxRepository.d.ts +36 -0
- package/dist/interfaces/IProfileOutboxRepository.js +2 -0
- package/dist/interfaces/IWallet.d.ts +74 -0
- package/dist/interfaces/IWallet.js +2 -0
- package/dist/interfaces/IWalletQueue.d.ts +30 -0
- package/dist/interfaces/IWalletQueue.js +2 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.js +8 -0
- package/dist/models/communication-attached-bundle-session.d.ts +193 -0
- package/dist/models/communication-attached-bundle-session.js +34 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +1 -2
- package/dist/models/interoperable-claims/diagnostic-report-claims.js +1 -2
- package/dist/models/profile-manager.d.ts +85 -0
- package/dist/models/profile-manager.js +2 -0
- package/dist/models/wallet.d.ts +59 -0
- package/dist/models/wallet.js +22 -0
- package/dist/utils/backend-message-manager-mem.d.ts +67 -0
- package/dist/utils/backend-message-manager-mem.js +227 -0
- package/dist/utils/bundle-didcomm-payload.d.ts +29 -0
- package/dist/utils/bundle-didcomm-payload.js +48 -0
- package/dist/utils/communication-attached-bundle-session-helpers.d.ts +54 -0
- package/dist/utils/communication-attached-bundle-session-helpers.js +517 -0
- package/dist/utils/communication-attached-bundle-session.d.ts +59 -302
- package/dist/utils/communication-attached-bundle-session.js +114 -839
- package/dist/utils/communication-consent-access-editor.d.ts +85 -0
- package/dist/utils/communication-consent-access-editor.js +244 -0
- package/dist/utils/communication-didcomm-payload.d.ts +33 -0
- package/dist/utils/communication-didcomm-payload.js +75 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/profile-manager-mem.d.ts +69 -0
- package/dist/utils/profile-manager-mem.js +79 -0
- package/dist/utils/profile-outbox-memory-repository.d.ts +34 -0
- package/dist/utils/profile-outbox-memory-repository.js +57 -0
- package/dist/utils/wallet-mem.d.ts +93 -0
- package/dist/utils/wallet-mem.js +277 -0
- package/dist/utils/wallet-memory-queue.d.ts +32 -0
- package/dist/utils/wallet-memory-queue.js +82 -0
- package/package.json +1 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { HealthcareCanonicalSectionFamily, HealthcareRoleFamily } from '../constants/healthcare';
|
|
2
|
+
import type { BundleEntry, BundleJsonApi, BundleRequest } from './bundle';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime strictness used by `CommunicationAttachedBundleSession`.
|
|
5
|
+
*/
|
|
6
|
+
export type CommunicationAttachedBundleSessionMode = 'strict' | 'normalize';
|
|
7
|
+
/**
|
|
8
|
+
* Constructor options for `CommunicationAttachedBundleSession`.
|
|
9
|
+
*/
|
|
10
|
+
export type CommunicationAttachedBundleSessionOptions = Readonly<{
|
|
11
|
+
communicationClaims?: Record<string, unknown>;
|
|
12
|
+
initialBundle?: BundleJsonApi<BundleEntry>;
|
|
13
|
+
mode?: CommunicationAttachedBundleSessionMode;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Canonical `@context` for outer `Communication` claim payloads.
|
|
17
|
+
*
|
|
18
|
+
* Rationale:
|
|
19
|
+
* - the outer container is materialized as one FHIR `Communication` resource
|
|
20
|
+
* - the inner `resource.meta.claims` rows stay version-agnostic and therefore
|
|
21
|
+
* use `FHIR_API`
|
|
22
|
+
*/
|
|
23
|
+
export declare const CommunicationAttachmentClaimsContext: "org.hl7.fhir.r4";
|
|
24
|
+
/**
|
|
25
|
+
* Canonical `@context` for bundle entry `resource.meta.claims`.
|
|
26
|
+
*
|
|
27
|
+
* These claims are intended to stay version-agnostic across FHIR releases.
|
|
28
|
+
*/
|
|
29
|
+
export declare const BundleEntryClaimsContext: "org.hl7.fhir.api";
|
|
30
|
+
/**
|
|
31
|
+
* Selector for reopening one active bundle entry.
|
|
32
|
+
*
|
|
33
|
+
* Prefer `position` for bundle-array addressing. `index` is kept only as a
|
|
34
|
+
* backward-compatible alias during migration.
|
|
35
|
+
*/
|
|
36
|
+
export type ActiveEntrySelection = Readonly<{
|
|
37
|
+
position?: number;
|
|
38
|
+
/** @deprecated Prefer `position`. */
|
|
39
|
+
index?: number;
|
|
40
|
+
fullUrl?: string;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Generic upsert contract for one bundle entry stored in memory.
|
|
44
|
+
*/
|
|
45
|
+
export type UpsertEntryInput = Readonly<{
|
|
46
|
+
resourceType: string;
|
|
47
|
+
claims: Record<string, unknown>;
|
|
48
|
+
type?: string;
|
|
49
|
+
fullUrl?: string;
|
|
50
|
+
request?: BundleRequest;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Reusable resource-specific upsert contract used by typed session helpers.
|
|
54
|
+
*/
|
|
55
|
+
export type UpsertClaimsResourceEntryInput<TClaims extends object = Record<string, unknown>> = Readonly<{
|
|
56
|
+
claims: TClaims;
|
|
57
|
+
type?: string;
|
|
58
|
+
fullUrl?: string;
|
|
59
|
+
request?: BundleRequest;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Input for adding one linked `DocumentReference` to the current active entry.
|
|
63
|
+
*/
|
|
64
|
+
export type AddContainedDocumentToActiveEntryInput = Readonly<{
|
|
65
|
+
identifier?: string;
|
|
66
|
+
fullUrl?: string;
|
|
67
|
+
claims?: Record<string, unknown>;
|
|
68
|
+
attachmentContentType?: string;
|
|
69
|
+
attachmentDataBase64?: string;
|
|
70
|
+
attachmentUrl?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
date?: string;
|
|
73
|
+
language?: string;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Canonical target kinds for consent access editing.
|
|
77
|
+
*/
|
|
78
|
+
export declare const ConsentEditorTargetKinds: Readonly<{
|
|
79
|
+
readonly Section: "section";
|
|
80
|
+
readonly ResourceType: "resource-type";
|
|
81
|
+
}>;
|
|
82
|
+
export type ConsentEditorTargetKind = typeof ConsentEditorTargetKinds[keyof typeof ConsentEditorTargetKinds];
|
|
83
|
+
/**
|
|
84
|
+
* Canonical operation scope codes for consent access editing.
|
|
85
|
+
*/
|
|
86
|
+
export declare const ConsentEditorScopeCodes: Readonly<{
|
|
87
|
+
readonly Search: "s";
|
|
88
|
+
readonly Read: "r";
|
|
89
|
+
readonly Create: "c";
|
|
90
|
+
readonly Update: "u";
|
|
91
|
+
readonly Delete: "d";
|
|
92
|
+
}>;
|
|
93
|
+
export type ConsentEditorScopeCode = typeof ConsentEditorScopeCodes[keyof typeof ConsentEditorScopeCodes];
|
|
94
|
+
/**
|
|
95
|
+
* One classified scope attached to a consent target.
|
|
96
|
+
*/
|
|
97
|
+
export type ConsentEditorClassifiedScope = Readonly<{
|
|
98
|
+
code: ConsentEditorScopeCode;
|
|
99
|
+
display?: string;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* One classified target entry shown to consent-editing callers.
|
|
103
|
+
*/
|
|
104
|
+
export type ConsentEditorClassifiedTarget = Readonly<{
|
|
105
|
+
target: Readonly<{
|
|
106
|
+
kind: ConsentEditorTargetKind;
|
|
107
|
+
code: string;
|
|
108
|
+
display?: string;
|
|
109
|
+
sectionFamily?: HealthcareCanonicalSectionFamily;
|
|
110
|
+
}>;
|
|
111
|
+
scopes: readonly ConsentEditorClassifiedScope[];
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Classified actor role resolved from canonical healthcare role catalogs.
|
|
115
|
+
*/
|
|
116
|
+
export type ConsentEditorClassifiedActorRole = Readonly<{
|
|
117
|
+
codingSystem: string;
|
|
118
|
+
code: string;
|
|
119
|
+
display?: string;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Role kind used in consent role classification.
|
|
123
|
+
*
|
|
124
|
+
* The underlying catalog still comes from `HealthcareRoleFamily`, but this
|
|
125
|
+
* editor-level view intentionally names the field `kind` instead of `family`
|
|
126
|
+
* to avoid leaking `individual-organization` terminology into generic consent
|
|
127
|
+
* editing flows.
|
|
128
|
+
*/
|
|
129
|
+
export type ConsentEditorClassifiedRoleKind = HealthcareRoleFamily;
|
|
130
|
+
/**
|
|
131
|
+
* Classified role entry exposed by the consent editor.
|
|
132
|
+
*/
|
|
133
|
+
export type ConsentEditorClassifiedRole = Readonly<{
|
|
134
|
+
kind?: ConsentEditorClassifiedRoleKind;
|
|
135
|
+
codingSystem: string;
|
|
136
|
+
code: string;
|
|
137
|
+
display?: string;
|
|
138
|
+
definition?: string;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Role buckets exposed by the consent editor.
|
|
142
|
+
*/
|
|
143
|
+
export type ConsentEditorClassifiedRoles = Readonly<{
|
|
144
|
+
professional: readonly ConsentEditorClassifiedRole[];
|
|
145
|
+
relationship: readonly ConsentEditorClassifiedRole[];
|
|
146
|
+
legalRepresentative: readonly ConsentEditorClassifiedRole[];
|
|
147
|
+
other: readonly ConsentEditorClassifiedRole[];
|
|
148
|
+
}>;
|
|
149
|
+
export type ConsentEditorClassifiedDepartment = Readonly<{
|
|
150
|
+
code: string;
|
|
151
|
+
display?: string;
|
|
152
|
+
}>;
|
|
153
|
+
export type ConsentEditorClassifiedLocation = Readonly<{
|
|
154
|
+
code: string;
|
|
155
|
+
display?: string;
|
|
156
|
+
}>;
|
|
157
|
+
export type ConsentEditorClassifiedOrganization = Readonly<{
|
|
158
|
+
domain: string;
|
|
159
|
+
display?: string;
|
|
160
|
+
departments: readonly ConsentEditorClassifiedDepartment[];
|
|
161
|
+
locations: readonly ConsentEditorClassifiedLocation[];
|
|
162
|
+
}>;
|
|
163
|
+
export type ConsentEditorClassifiedJurisdiction = Readonly<{
|
|
164
|
+
code: string;
|
|
165
|
+
display?: string;
|
|
166
|
+
}>;
|
|
167
|
+
export type ConsentEditorClassifiedUser = Readonly<{
|
|
168
|
+
email?: string;
|
|
169
|
+
phone?: string;
|
|
170
|
+
role?: ConsentEditorClassifiedActorRole;
|
|
171
|
+
}>;
|
|
172
|
+
export type ConsentEditorClassifiedActors = Readonly<{
|
|
173
|
+
jurisdictions: readonly ConsentEditorClassifiedJurisdiction[];
|
|
174
|
+
organizations: readonly ConsentEditorClassifiedOrganization[];
|
|
175
|
+
users: readonly ConsentEditorClassifiedUser[];
|
|
176
|
+
}>;
|
|
177
|
+
export type ConsentEditorClassifiedPurpose = Readonly<{
|
|
178
|
+
code: string;
|
|
179
|
+
display?: string;
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* Normalized consent view model exposed by the editor.
|
|
183
|
+
*/
|
|
184
|
+
export type ConsentViewModel = Readonly<{
|
|
185
|
+
fullUrl?: string;
|
|
186
|
+
identifier: string;
|
|
187
|
+
subject: string;
|
|
188
|
+
decision: string;
|
|
189
|
+
classifiedActors: ConsentEditorClassifiedActors;
|
|
190
|
+
classifiedRoles: ConsentEditorClassifiedRoles;
|
|
191
|
+
classifiedPurposes: readonly ConsentEditorClassifiedPurpose[];
|
|
192
|
+
classifiedTargets: readonly ConsentEditorClassifiedTarget[];
|
|
193
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
|
|
2
|
+
import { Format } from '../constants/Schemas.js';
|
|
3
|
+
/**
|
|
4
|
+
* Canonical `@context` for outer `Communication` claim payloads.
|
|
5
|
+
*
|
|
6
|
+
* Rationale:
|
|
7
|
+
* - the outer container is materialized as one FHIR `Communication` resource
|
|
8
|
+
* - the inner `resource.meta.claims` rows stay version-agnostic and therefore
|
|
9
|
+
* use `FHIR_API`
|
|
10
|
+
*/
|
|
11
|
+
export const CommunicationAttachmentClaimsContext = Format.FHIR_R4;
|
|
12
|
+
/**
|
|
13
|
+
* Canonical `@context` for bundle entry `resource.meta.claims`.
|
|
14
|
+
*
|
|
15
|
+
* These claims are intended to stay version-agnostic across FHIR releases.
|
|
16
|
+
*/
|
|
17
|
+
export const BundleEntryClaimsContext = Format.FHIR_API;
|
|
18
|
+
/**
|
|
19
|
+
* Canonical target kinds for consent access editing.
|
|
20
|
+
*/
|
|
21
|
+
export const ConsentEditorTargetKinds = Object.freeze({
|
|
22
|
+
Section: 'section',
|
|
23
|
+
ResourceType: 'resource-type',
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Canonical operation scope codes for consent access editing.
|
|
27
|
+
*/
|
|
28
|
+
export const ConsentEditorScopeCodes = Object.freeze({
|
|
29
|
+
Search: 's',
|
|
30
|
+
Read: 'r',
|
|
31
|
+
Create: 'c',
|
|
32
|
+
Update: 'u',
|
|
33
|
+
Delete: 'd',
|
|
34
|
+
});
|
package/dist/models/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './comm';
|
|
|
6
6
|
export * from './clinical-sections';
|
|
7
7
|
export * from './clinical-sections.en';
|
|
8
8
|
export * from './clinical-workbook-summary';
|
|
9
|
+
export * from './communication-attached-bundle-session';
|
|
9
10
|
export * from './confidential-job';
|
|
10
11
|
export * from './confidential-message';
|
|
11
12
|
export * from './confidential-storage';
|
|
@@ -36,6 +37,7 @@ export * from './oidc4ida.electronicRecord.model';
|
|
|
36
37
|
export * from './oidc4ida.evidence.model';
|
|
37
38
|
export * from './openid-device';
|
|
38
39
|
export * from './permission-templates';
|
|
40
|
+
export * from './profile-manager';
|
|
39
41
|
export * from './operation-outcome';
|
|
40
42
|
export * from './params';
|
|
41
43
|
export * from './permission-templates';
|
|
@@ -44,3 +46,4 @@ export * from './relationship-access';
|
|
|
44
46
|
export * from './response';
|
|
45
47
|
export * from './urlPath';
|
|
46
48
|
export * from './verifiable-credential';
|
|
49
|
+
export * from './wallet';
|
package/dist/models/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './comm.js';
|
|
|
6
6
|
export * from './clinical-sections.js';
|
|
7
7
|
export * from './clinical-sections.en.js';
|
|
8
8
|
export * from './clinical-workbook-summary.js';
|
|
9
|
+
export * from './communication-attached-bundle-session.js';
|
|
9
10
|
export * from './confidential-job.js';
|
|
10
11
|
export * from './confidential-message.js';
|
|
11
12
|
export * from './confidential-storage.js';
|
|
@@ -36,6 +37,7 @@ export * from './oidc4ida.electronicRecord.model.js';
|
|
|
36
37
|
export * from './oidc4ida.evidence.model.js';
|
|
37
38
|
export * from './openid-device.js';
|
|
38
39
|
export * from './permission-templates.js';
|
|
40
|
+
export * from './profile-manager.js';
|
|
39
41
|
export * from './operation-outcome.js';
|
|
40
42
|
export * from './params.js';
|
|
41
43
|
export * from './permission-templates.js';
|
|
@@ -44,3 +46,4 @@ export * from './relationship-access.js';
|
|
|
44
46
|
export * from './response.js';
|
|
45
47
|
export * from './urlPath.js';
|
|
46
48
|
export * from './verifiable-credential.js';
|
|
49
|
+
export * from './wallet.js';
|
|
@@ -91,6 +91,5 @@ export declare const DiagnosticReportSearchParamToClaimKey: Record<DiagnosticRep
|
|
|
91
91
|
*
|
|
92
92
|
* Keep `DiagnosticReport` paused at the typing/mapping layer until:
|
|
93
93
|
* 1. `claims-helpers-diagnostic-report.ts` exists
|
|
94
|
-
* 2.
|
|
95
|
-
* 3. GW Core readers/tests consume the same shared claim keys
|
|
94
|
+
* 2. GW Core readers/tests consume the same shared claim keys
|
|
96
95
|
*/
|
|
@@ -100,6 +100,5 @@ export const DiagnosticReportSearchParamToClaimKey = {
|
|
|
100
100
|
*
|
|
101
101
|
* Keep `DiagnosticReport` paused at the typing/mapping layer until:
|
|
102
102
|
* 1. `claims-helpers-diagnostic-report.ts` exists
|
|
103
|
-
* 2.
|
|
104
|
-
* 3. GW Core readers/tests consume the same shared claim keys
|
|
103
|
+
* 2. GW Core readers/tests consume the same shared claim keys
|
|
105
104
|
*/
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { WalletMessagePriority, WalletQueuedMessage } from './wallet';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal local profile descriptor for memory-backed wallet/runtime tests.
|
|
4
|
+
*
|
|
5
|
+
* This stays intentionally below actor-specific SDK facades.
|
|
6
|
+
*/
|
|
7
|
+
export type ProfileManagerMemProfile = Readonly<{
|
|
8
|
+
profileId: string;
|
|
9
|
+
displayName?: string;
|
|
10
|
+
did: string;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Result returned by one backend message transport after submitting one local
|
|
14
|
+
* queued message envelope.
|
|
15
|
+
*/
|
|
16
|
+
export type BackendMessageTransportSubmitResult = Readonly<{
|
|
17
|
+
accepted: boolean;
|
|
18
|
+
retryable?: boolean;
|
|
19
|
+
errorMessage?: string;
|
|
20
|
+
responseEnvelope?: string;
|
|
21
|
+
locationUrl?: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Result returned by one backend message poll operation after a previous
|
|
25
|
+
* transport submit accepted the request asynchronously.
|
|
26
|
+
*/
|
|
27
|
+
export type BackendMessageTransportPollResult = Readonly<{
|
|
28
|
+
pending: boolean;
|
|
29
|
+
completed?: boolean;
|
|
30
|
+
retryable?: boolean;
|
|
31
|
+
errorMessage?: string;
|
|
32
|
+
responseEnvelope?: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Pluggable submit-only transport used by the low-level backend message manager.
|
|
36
|
+
*/
|
|
37
|
+
export type BackendMessageTransport = Readonly<{
|
|
38
|
+
submit(input: Readonly<{
|
|
39
|
+
message: WalletQueuedMessage;
|
|
40
|
+
envelope: string;
|
|
41
|
+
}>): Promise<BackendMessageTransportSubmitResult>;
|
|
42
|
+
poll?(input: Readonly<{
|
|
43
|
+
message: ProfileOutboxMessageRecord;
|
|
44
|
+
}>): Promise<BackendMessageTransportPollResult>;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* One decoded inbound response associated with one DIDComm thread.
|
|
48
|
+
*/
|
|
49
|
+
export type BackendMessageResponseRecord = Readonly<{
|
|
50
|
+
thid: string;
|
|
51
|
+
receivedAt: string;
|
|
52
|
+
content: Record<string, unknown>;
|
|
53
|
+
meta: Record<string, unknown>;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Immutable historical record written after one profile message is submitted.
|
|
57
|
+
*
|
|
58
|
+
* It complements the mutable queue state by preserving:
|
|
59
|
+
* - the final submitted envelope
|
|
60
|
+
* - the last known queue status at submission time
|
|
61
|
+
* - the optional decoded response thread reference
|
|
62
|
+
*/
|
|
63
|
+
export type ProfileOutboxMessageRecord = Readonly<{
|
|
64
|
+
id: string;
|
|
65
|
+
thid?: string;
|
|
66
|
+
messageType?: string;
|
|
67
|
+
priority: string;
|
|
68
|
+
status: string;
|
|
69
|
+
transportStatus?: 'submitted' | 'completed' | 'failed';
|
|
70
|
+
recordedAt: string;
|
|
71
|
+
payload: Record<string, unknown>;
|
|
72
|
+
envelope: string;
|
|
73
|
+
responseThid?: string;
|
|
74
|
+
locationUrl?: string;
|
|
75
|
+
pollCount?: number;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Input used by `BackendMessageManagerMem` and `ProfileManagerMem` to queue one
|
|
79
|
+
* outbound business payload.
|
|
80
|
+
*/
|
|
81
|
+
export type QueueProfileMessageInput = Readonly<{
|
|
82
|
+
payload: Record<string, unknown>;
|
|
83
|
+
priority?: WalletMessagePriority;
|
|
84
|
+
recipientEncryptionJwk: Record<string, unknown>;
|
|
85
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { JWK } from './jwk';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical priority levels for wallet-managed outbound messages.
|
|
4
|
+
*
|
|
5
|
+
* Ordering rule:
|
|
6
|
+
* - `emergency` is always processed before all other priorities
|
|
7
|
+
* - for the same priority level, insertion order must be preserved
|
|
8
|
+
*/
|
|
9
|
+
export declare const WalletMessagePriorities: Readonly<{
|
|
10
|
+
readonly Emergency: "emergency";
|
|
11
|
+
readonly High: "high";
|
|
12
|
+
readonly Normal: "normal";
|
|
13
|
+
readonly Low: "low";
|
|
14
|
+
}>;
|
|
15
|
+
export type WalletMessagePriority = typeof WalletMessagePriorities[keyof typeof WalletMessagePriorities];
|
|
16
|
+
/**
|
|
17
|
+
* Lifecycle states for one local wallet queue/outbox message.
|
|
18
|
+
*/
|
|
19
|
+
export declare const WalletQueueStatuses: Readonly<{
|
|
20
|
+
readonly Pending: "pending";
|
|
21
|
+
readonly Delivered: "delivered";
|
|
22
|
+
readonly Failed: "failed";
|
|
23
|
+
}>;
|
|
24
|
+
export type WalletQueueStatus = typeof WalletQueueStatuses[keyof typeof WalletQueueStatuses];
|
|
25
|
+
/**
|
|
26
|
+
* One message tracked by the local wallet queue or outbox.
|
|
27
|
+
*/
|
|
28
|
+
export type WalletQueuedMessage = Readonly<{
|
|
29
|
+
id: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
priority: WalletMessagePriority;
|
|
32
|
+
status: WalletQueueStatus;
|
|
33
|
+
sequence: number;
|
|
34
|
+
payload: Record<string, unknown>;
|
|
35
|
+
thid?: string;
|
|
36
|
+
messageType?: string;
|
|
37
|
+
deliveredAt?: string;
|
|
38
|
+
errorMessage?: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Input accepted by wallet-local queue implementations when creating one
|
|
42
|
+
* queued outbound message.
|
|
43
|
+
*/
|
|
44
|
+
export type WalletEnqueueMessageInput = Readonly<{
|
|
45
|
+
payload: Record<string, unknown>;
|
|
46
|
+
priority?: WalletMessagePriority;
|
|
47
|
+
thid?: string;
|
|
48
|
+
messageType?: string;
|
|
49
|
+
id?: string;
|
|
50
|
+
createdAt?: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Public summary of one wallet-managed entity key set.
|
|
54
|
+
*/
|
|
55
|
+
export type WalletManagedEntityDescriptor = Readonly<{
|
|
56
|
+
entityId: string;
|
|
57
|
+
signingJwk: JWK;
|
|
58
|
+
encryptionJwk: JWK;
|
|
59
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
|
|
2
|
+
/**
|
|
3
|
+
* Canonical priority levels for wallet-managed outbound messages.
|
|
4
|
+
*
|
|
5
|
+
* Ordering rule:
|
|
6
|
+
* - `emergency` is always processed before all other priorities
|
|
7
|
+
* - for the same priority level, insertion order must be preserved
|
|
8
|
+
*/
|
|
9
|
+
export const WalletMessagePriorities = Object.freeze({
|
|
10
|
+
Emergency: 'emergency',
|
|
11
|
+
High: 'high',
|
|
12
|
+
Normal: 'normal',
|
|
13
|
+
Low: 'low',
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Lifecycle states for one local wallet queue/outbox message.
|
|
17
|
+
*/
|
|
18
|
+
export const WalletQueueStatuses = Object.freeze({
|
|
19
|
+
Pending: 'pending',
|
|
20
|
+
Delivered: 'delivered',
|
|
21
|
+
Failed: 'failed',
|
|
22
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { IWallet } from '../interfaces/IWallet';
|
|
2
|
+
import type { IProfileOutboxRepository } from '../interfaces/IProfileOutboxRepository';
|
|
3
|
+
import type { BackendMessageResponseRecord, BackendMessageTransport, ProfileOutboxMessageRecord, QueueProfileMessageInput } from '../models/profile-manager';
|
|
4
|
+
import { type WalletQueuedMessage } from '../models/wallet';
|
|
5
|
+
export type BackendMessageManagerMemOptions = Readonly<{
|
|
6
|
+
wallet: IWallet;
|
|
7
|
+
entityId: string;
|
|
8
|
+
transport: BackendMessageTransport;
|
|
9
|
+
outboxRepository: IProfileOutboxRepository;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Memory-backed backend message manager that:
|
|
13
|
+
* - queues outbound payloads through `WalletMem`
|
|
14
|
+
* - packs the next pending message as DIDComm-like JWS+JWE
|
|
15
|
+
* - submits it through an injected transport
|
|
16
|
+
* - unwraps the response and indexes it by `thid`
|
|
17
|
+
*
|
|
18
|
+
* This is the lowest reusable BFF/proxy slice before actor-specific SDK
|
|
19
|
+
* facades appear.
|
|
20
|
+
*/
|
|
21
|
+
export declare class BackendMessageManagerMem {
|
|
22
|
+
private readonly wallet;
|
|
23
|
+
private readonly entityId;
|
|
24
|
+
private readonly transport;
|
|
25
|
+
private readonly outboxRepository;
|
|
26
|
+
private readonly responsesByThread;
|
|
27
|
+
constructor(options: BackendMessageManagerMemOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Queues one outbound business payload for later submission.
|
|
30
|
+
*/
|
|
31
|
+
queueMessage(input: QueueProfileMessageInput): Promise<WalletQueuedMessage>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns queued messages in current priority/FIFO processing order.
|
|
34
|
+
*/
|
|
35
|
+
listQueuedMessages(): Promise<WalletQueuedMessage[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Submits the next pending message through the injected transport and stores
|
|
38
|
+
* the decoded response by `thid` when one response envelope is returned.
|
|
39
|
+
*/
|
|
40
|
+
submitNextPendingMessage(recipientEncryptionJwk: Record<string, unknown>): Promise<{
|
|
41
|
+
message: WalletQueuedMessage;
|
|
42
|
+
response?: BackendMessageResponseRecord;
|
|
43
|
+
pending?: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the latest decoded response for one DIDComm thread.
|
|
47
|
+
*/
|
|
48
|
+
getResponseByThreadId(thid: string): BackendMessageResponseRecord | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Lists submitted message history records preserved by the outbox repository.
|
|
51
|
+
*/
|
|
52
|
+
listOutboxHistory(): Promise<ProfileOutboxMessageRecord[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Polls one previously submitted asynchronous message by id.
|
|
55
|
+
*/
|
|
56
|
+
pollSubmittedMessage(messageId: string): Promise<{
|
|
57
|
+
pending: boolean;
|
|
58
|
+
response?: BackendMessageResponseRecord;
|
|
59
|
+
record: ProfileOutboxMessageRecord;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Reads one decoded response by thread id, first from memory and then from the repository.
|
|
63
|
+
*/
|
|
64
|
+
readResponseByThreadId(thid: string): Promise<BackendMessageResponseRecord | undefined>;
|
|
65
|
+
private persistMessageRecord;
|
|
66
|
+
private requireOutboxRecord;
|
|
67
|
+
}
|