dataspace-client-sdk-node 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +13 -14
  2. package/docs/API.md +14 -13
  3. package/docs/DEVELOPER_USE_CASES.md +4 -12
  4. package/package.json +1 -1
  5. package/src/types.ts +8 -0
  6. package/TODO_PROMPT_NEXT_STEPS.md +0 -185
  7. package/artifacts/update-smart-wallet.js +0 -1016
  8. package/dist/builders.d.ts +0 -12
  9. package/dist/builders.js +0 -17
  10. package/dist/client.d.ts +0 -453
  11. package/dist/client.js +0 -1755
  12. package/dist/consent/pdfSignatureVerification.d.ts +0 -18
  13. package/dist/consent/pdfSignatureVerification.js +0 -23
  14. package/dist/index.d.ts +0 -5
  15. package/dist/index.js +0 -9
  16. package/dist/sdk/dataspace-wallet-sdk-node/MultiWalletClient.d.ts +0 -9
  17. package/dist/sdk/dataspace-wallet-sdk-node/MultiWalletClient.js +0 -21
  18. package/dist/sdk/dataspace-wallet-sdk-node/WalletClient.d.ts +0 -26
  19. package/dist/sdk/dataspace-wallet-sdk-node/WalletClient.js +0 -36
  20. package/dist/sdk/dataspace-wallet-sdk-node/index.d.ts +0 -6
  21. package/dist/sdk/dataspace-wallet-sdk-node/index.js +0 -6
  22. package/dist/sdk/dataspace-wallet-sdk-node/provider.d.ts +0 -24
  23. package/dist/sdk/dataspace-wallet-sdk-node/provider.js +0 -1
  24. package/dist/sdk/dataspace-wallet-sdk-node/providers/memory-provider.d.ts +0 -41
  25. package/dist/sdk/dataspace-wallet-sdk-node/providers/memory-provider.js +0 -216
  26. package/dist/sdk/dataspace-wallet-sdk-node/providers/seed-provider.d.ts +0 -22
  27. package/dist/sdk/dataspace-wallet-sdk-node/providers/seed-provider.js +0 -28
  28. package/dist/sdk/dataspace-wallet-sdk-node/types.d.ts +0 -51
  29. package/dist/sdk/dataspace-wallet-sdk-node/types.js +0 -1
  30. package/dist/types.d.ts +0 -556
  31. package/dist/types.js +0 -1
  32. package/dist/vp-token.d.ts +0 -37
  33. package/dist/vp-token.js +0 -56
@@ -1,12 +0,0 @@
1
- import type { DidcommPlainMessage } from './types.js';
2
- export declare function createDidcommPlainMessage(input: {
3
- iss: string;
4
- aud: string;
5
- body: Record<string, unknown>;
6
- type?: string;
7
- jti?: string;
8
- thid?: string;
9
- }): DidcommPlainMessage;
10
- export declare function buildAsyncPollRequest(thid: string): {
11
- thid: string;
12
- };
package/dist/builders.js DELETED
@@ -1,17 +0,0 @@
1
- export function createDidcommPlainMessage(input) {
2
- const random = Math.random().toString(36).slice(2, 10);
3
- const now = Date.now();
4
- const thid = input.thid ?? `thid-${now}-${random}`;
5
- const jti = input.jti ?? `jti-${now}-${random}`;
6
- return {
7
- jti,
8
- thid,
9
- iss: input.iss,
10
- aud: input.aud,
11
- type: input.type ?? 'application/api+json',
12
- body: input.body,
13
- };
14
- }
15
- export function buildAsyncPollRequest(thid) {
16
- return { thid };
17
- }
package/dist/client.d.ts DELETED
@@ -1,453 +0,0 @@
1
- import type { AsyncPollRequest, BackendPkceAuthOptions, BackendPkceAuthResult, BackendSmartAuthOptions, BackendSmartAuthResult, ClientOptions, CreatePhoneReminderTasksInput, GrantProfessionalAccessSimpleInput, GrantProfessionalAccessSimpleResult, DigitalTwinGenerationInput, EmployeeDeviceActivationInput, EndpointSelector, EmployeeDeviceActivationSimpleInput, EmployeeDeviceActivationResult, FamilyOrganizationSummary, GatewayOrganizationActivationInput, GatewayOrganizationActivationSimpleInput, HostRouteContext, IpsOrFhirImportInput, MedicationOverlapCheckInput, MedicationRegistrationInput, OrganizationEmployeeCreationInput, PollOptions, PollResult, OfferPreview, OfferInfo, RouteContext, SmartTokenExchangeInput, SmartTokenExchangeResult, SmartTokenRequestSimpleInput, LegalOrganizationOrderSimpleInput, SubjectOrganizationBootstrapInput, SubjectOrganizationBootstrapResult, IndividualOrganizationBootstrapSimpleInput, IndividualOrganizationBootstrapSimpleResult, IndividualOrganizationStartSimpleResult, IndividualOrganizationConfirmOrderSimpleInput, SubmitAndPollResult, SubmitResponse, V1Action, V1Section } from './types.js';
2
- import type { WalletProvider } from './sdk/dataspace-wallet-sdk-node/provider.js';
3
- import type { PublicJwk, WalletContext } from './sdk/dataspace-wallet-sdk-node/types.js';
4
- export declare class DataspaceNodeClient {
5
- private readonly baseUrl;
6
- private readonly bearerToken?;
7
- private readonly defaultHeaders;
8
- private readonly wallet?;
9
- private defaultCtx?;
10
- private defaultTimeoutMs?;
11
- private defaultIntervalMs?;
12
- private readonly _tokenCache;
13
- constructor(options: ClientOptions);
14
- getWallet(): WalletProvider | undefined;
15
- /**
16
- * Set default route context for subsequent calls.
17
- */
18
- setContext(ctx: RouteContext): this;
19
- /**
20
- * Preferred alias for organization/tenant integration context.
21
- */
22
- setContextOrg(ctx: RouteContext): this;
23
- setTenantId(tenantId: string): this;
24
- setJurisdiction(jurisdiction: string): this;
25
- setSector(sector: string): this;
26
- setDefaultTimeoutSeconds(seconds: number): this;
27
- setDefaultIntervalSeconds(seconds: number): this;
28
- /**
29
- * Builds a deterministic endpoint id for token cache and auth/session reuse.
30
- * If `providerDid` is provided, returns a full DID service id:
31
- * did:web:...#section:format:resourceType:action
32
- * Otherwise returns the canonical fragment without '#':
33
- * section:format:resourceType:action
34
- */
35
- getEndpointId(selector: EndpointSelector, providerDid?: string): string;
36
- private resolveSimplePollOptions;
37
- private requireRouteContext;
38
- private requireHostRouteContext;
39
- /**
40
- * Generic GW v1 tenant route builder.
41
- * Use this for any section/format/resourceType/action combination not covered
42
- * by a dedicated convenience method.
43
- *
44
- * Pattern: `/{tenantId}/cds-{jurisdiction}/v1/{sector}/{section}/{format}/{resourceType}/{action}`
45
- *
46
- * @example
47
- * client.v1Path(ctx, 'individual', 'org.schema', 'Organization', '_batch')
48
- * // → /acme/cds-ES/v1/health-care/individual/org.schema/Organization/_batch
49
- */
50
- v1Path(ctx: RouteContext | undefined, section: V1Section, format: string, resourceType: string, action: V1Action): string;
51
- /**
52
- * Generic tenant-scoped identity route builder.
53
- * Pattern: `/{prefix}/cds-{jurisdiction}/v1/{sector}/{tenantId}/identity/auth/{action}`
54
- *
55
- * The `prefix` is service-specific: `host` for GW, `publisher` for DataConv, `ica` for ICA.
56
- * Dedicated path methods in this SDK use `host` (GW convention).
57
- */
58
- tenantIdentityPath(ctx: RouteContext | undefined, prefix: string, action: string): string;
59
- /**
60
- * Generic host registry route builder (tenant-agnostic, `host/` prefix).
61
- * Use for controller-level registry operations (Organization activate, Order, etc.).
62
- *
63
- * Pattern: `/host/cds-{jurisdiction}/v1/{sector}/registry/org.schema/{resourceType}/{action}`
64
- */
65
- hostRegistryPath(ctx: HostRouteContext | undefined, resourceType: string, action: V1Action): string;
66
- /** Submit path: host registry Organization batch (controller-level org registration). */
67
- hostRegistryOrganizationBatchPath(ctx?: HostRouteContext): string;
68
- /** Poll path: host registry Organization batch. Pair with `hostRegistryOrganizationBatchPath`. */
69
- hostRegistryOrganizationPollPath(ctx?: HostRouteContext): string;
70
- /** Submit path: activate a tenant Organization in the GW registry using a VC from ICA. */
71
- hostRegistryOrganizationActivatePath(ctx?: HostRouteContext): string;
72
- /** Poll path: `_activate` response. Pair with `hostRegistryOrganizationActivatePath`. */
73
- hostRegistryOrganizationActivatePollPath(ctx?: HostRouteContext): string;
74
- /** Submit path: host registry Order batch (controller-level order submission). */
75
- hostRegistryOrderBatchPath(ctx?: HostRouteContext): string;
76
- /** Poll path: host registry Order batch. Pair with `hostRegistryOrderBatchPath`. */
77
- hostRegistryOrderPollPath(ctx?: HostRouteContext): string;
78
- /**
79
- * Submit path: individual/family Organization onboarding (`org.schema/Organization/_batch`).
80
- * Use for `family-registration/_create-or-resume` DIDComm payloads.
81
- */
82
- individualFamilyOrganizationBatchPath(ctx?: RouteContext): string;
83
- /** Poll path: individual/family Organization. Pair with `individualFamilyOrganizationBatchPath`. */
84
- individualFamilyOrganizationPollPath(ctx?: RouteContext): string;
85
- /** Submit path: individual/family Organization search (`org.schema/Organization/_search`). */
86
- individualFamilyOrganizationSearchPath(ctx?: RouteContext): string;
87
- /** Poll path: individual/family Organization search. Pair with `individualFamilyOrganizationSearchPath`. */
88
- individualFamilyOrganizationSearchPollPath(ctx?: RouteContext): string;
89
- /** Submit path: individual/family Order batch (`org.schema/Order/_batch`). */
90
- individualFamilyOrderBatchPath(ctx?: RouteContext): string;
91
- /** Poll path: individual/family Order. Pair with `individualFamilyOrderBatchPath`. */
92
- individualFamilyOrderPollPath(ctx?: RouteContext): string;
93
- /** Submit path: individual RelatedPerson (FHIR R4 API, `org.hl7.fhir.api/RelatedPerson/_batch`). */
94
- individualRelatedPersonBatchPath(ctx: RouteContext): string;
95
- /** Poll path: individual RelatedPerson. Pair with `individualRelatedPersonBatchPath`. */
96
- individualRelatedPersonPollPath(ctx: RouteContext): string;
97
- /** Submit path: individual Observation (FHIR R4 API, `org.hl7.fhir.api/Observation/_batch`). */
98
- individualObservationBatchPath(ctx: RouteContext): string;
99
- /** Poll path: individual Observation. Pair with `individualObservationBatchPath`. */
100
- individualObservationPollPath(ctx: RouteContext): string;
101
- /** Submit path: individual Communication (FHIR R4, `org.hl7.fhir.r4/Communication/_batch`). */
102
- individualCommunicationBatchPath(ctx: RouteContext): string;
103
- /** Poll path: individual Communication. Pair with `individualCommunicationBatchPath`. */
104
- individualCommunicationPollPath(ctx: RouteContext): string;
105
- /** Submit path: individual Task (FHIR R4 API, `org.hl7.fhir.api/Task/_batch`). */
106
- individualTaskBatchPath(ctx: RouteContext): string;
107
- /** Poll path: individual Task. Pair with `individualTaskBatchPath`. */
108
- individualTaskPollPath(ctx: RouteContext): string;
109
- /** Submit path: entity Employee (`entity/org.schema/Employee/_batch`). */
110
- employeeBatchPath(ctx?: RouteContext): string;
111
- /** Poll path: entity Employee. Pair with `employeeBatchPath`. */
112
- employeePollPath(ctx?: RouteContext): string;
113
- /** Submit path: individual Person legacy format (`individual/org.schema/Person/_batch`). Use for older flows; prefer Organization for family onboarding. */
114
- individualLegacyPersonBatchPath(ctx: RouteContext): string;
115
- /** Submit path: individual Consent (FHIR R4, `org.hl7.fhir.r4/Consent/_batch`). */
116
- individualConsentR4BatchPath(ctx: RouteContext): string;
117
- /** Poll path: individual Consent R4. Pair with `individualConsentR4BatchPath`. */
118
- individualConsentR4PollPath(ctx: RouteContext): string;
119
- /** Submit path: individual Composition (FHIR R4, `org.hl7.fhir.r4/Composition/_batch`). */
120
- individualCompositionR4BatchPath(ctx: RouteContext): string;
121
- /** Poll path: individual Composition R4. Pair with `individualCompositionR4BatchPath`. */
122
- individualCompositionR4PollPath(ctx: RouteContext): string;
123
- /** Submit path: digital twin Composition (FHIR API format, `digitaltwin/org.hl7.fhir.api/Composition/_batch`). */
124
- digitalTwinCompositionApiBatchPath(ctx: RouteContext): string;
125
- /** Poll path: digital twin Composition API. Pair with `digitalTwinCompositionApiBatchPath`. */
126
- digitalTwinCompositionApiPollPath(ctx: RouteContext): string;
127
- /** Submit path: digital twin Composition (FHIR R4 format, `digitaltwin/org.hl7.fhir.r4/Composition/_batch`). */
128
- digitalTwinCompositionR4BatchPath(ctx: RouteContext): string;
129
- /** Poll path: digital twin Composition R4. Pair with `digitalTwinCompositionR4BatchPath`. */
130
- digitalTwinCompositionR4PollPath(ctx: RouteContext): string;
131
- /**
132
- * Submit path: identity DCR step — binds API key to service public JWK.
133
- * Used internally by `authenticateBackendPkceAndExchange` (step 1 of identity-exchange.v1).
134
- */
135
- identityDeviceDcrPath(ctx?: RouteContext): string;
136
- /** Poll path: identity DCR. Pair with `identityDeviceDcrPath`. */
137
- identityDeviceDcrPollPath(ctx?: RouteContext): string;
138
- /**
139
- * Submit path: identity token exchange — id_token → SMART bearer.
140
- * Used internally by `authenticateBackendPkceAndExchange` (step 4 of identity-exchange.v1).
141
- */
142
- identityTokenExchangePath(ctx?: RouteContext): string;
143
- /** Poll path: identity token exchange. Pair with `identityTokenExchangePath`. */
144
- identityTokenExchangePollPath(ctx?: RouteContext): string;
145
- /** Submit path: identity license issue (`identity/auth/_issue`). */
146
- identityLicenseIssuePath(ctx?: RouteContext): string;
147
- /**
148
- * Submit path: SMART token step — code + code_verifier → id_token.
149
- * Used internally by `authenticateBackendPkceAndExchange` (step 3 of identity-exchange.v1).
150
- */
151
- identitySmartTokenPath(ctx: RouteContext): string;
152
- /** Poll path: SMART token. Pair with `identitySmartTokenPath`. */
153
- identitySmartTokenPollPath(ctx: RouteContext): string;
154
- /** Submit path: Firebase custom token exchange (end-user device flow, NOT B2B). */
155
- identityFirebaseCustomPath(ctx: RouteContext): string;
156
- /** Poll path: Firebase custom token. Pair with `identityFirebaseCustomPath`. */
157
- identityFirebaseCustomPollPath(ctx: RouteContext): string;
158
- /**
159
- * Submit path: identity PKCE code step — sends S256 code_challenge.
160
- * Used internally by `authenticateBackendPkceAndExchange` (step 2 of identity-exchange.v1).
161
- */
162
- identityCodePath(ctx: RouteContext): string;
163
- /** Poll path: identity PKCE code. Pair with `identityCodePath`. */
164
- identityCodePollPath(ctx: RouteContext): string;
165
- /** Submit path: UHC debug task call-start (`individual/{format}/Task/_call-start`). For telephony integration testing. */
166
- taskDebugCallStartPath(ctx: RouteContext, format?: string): string;
167
- /** Path: UHC debug task logs (`individual/{format}/Task/_logs`). Retrieve async task execution logs. */
168
- taskDebugLogsPath(ctx: RouteContext, format?: string): string;
169
- /**
170
- * Submit path: DataConversion file upload.
171
- * Pattern: `/{tenantId}/cds-{jurisdiction}/v1/{sector}/conversion/{softwareId}/{sourceFormat}/_upload`
172
- * Use with `uploadConversionFile` to send a file (e.g. XLSX) for async processing.
173
- */
174
- conversionUploadPath(ctx: RouteContext, softwareId: string, sourceFormat: string): string;
175
- /** Poll path: DataConversion upload. Pair with `conversionUploadPath`. */
176
- conversionUploadPollPath(ctx: RouteContext, softwareId: string, sourceFormat: string): string;
177
- /**
178
- * Orchestrates the full identity-exchange.v1 backend auth flow:
179
- * DCR binding → PKCE code → token → SMART bearer exchange.
180
- *
181
- * Equivalent to Python connector_sdk `authenticate_backend_pkce_and_exchange`.
182
- * Results are cached in memory; re-runs automatically on expiry.
183
- */
184
- authenticateBackendPkceAndExchange(options: BackendPkceAuthOptions): Promise<BackendPkceAuthResult>;
185
- /**
186
- * Returns the cached SMART bearer for the given endpointId if still valid (>30s remaining).
187
- * Returns `undefined` if not cached or expired.
188
- */
189
- getCachedBearerToken(tokenCacheKey: string): string | undefined;
190
- /**
191
- * smart-backend.v1: obtain an OAuth2 backend token using client_credentials + private_key_jwt.
192
- */
193
- authenticateBackendSmartStandard(options: BackendSmartAuthOptions): Promise<BackendSmartAuthResult>;
194
- /**
195
- * Exchange token payload against gateway token endpoint and cache the result.
196
- */
197
- requestSmartToken(input: SmartTokenExchangeInput): Promise<SmartTokenExchangeResult>;
198
- /**
199
- * Friendly wrapper for SMART token request via GW identity/auth token-exchange route.
200
- * Uses one object, seconds-based polling, and constructor ctx fallback.
201
- */
202
- requestSmartTokenSimple(input: SmartTokenRequestSimpleInput): Promise<SmartTokenExchangeResult>;
203
- private _pkceS256Challenge;
204
- private _buildAuthDIDCommRequest;
205
- private resolveControllerPublicJwk;
206
- private resolveStandardTokenUrl;
207
- private resolveSmartAuthPublicJwk;
208
- private signSmartBackendClientAssertion;
209
- private preferredJwtAlg;
210
- /**
211
- * POST a DIDComm bundle payload.
212
- * This is the preferred high-level method for DIDComm submission of
213
- * FHIR/API bundles (batch, transaction, message, etc.).
214
- *
215
- * Returns immediately with the HTTP response — pair with `pollUntilComplete` or use `submitAndPoll`.
216
- */
217
- submitBundle(path: string, payload: {
218
- thid?: string;
219
- } & Record<string, unknown>, options?: {
220
- mode?: 'plain' | 'strict';
221
- recipientEncryptionJwk?: PublicJwk;
222
- walletContext?: WalletContext;
223
- }): Promise<SubmitResponse>;
224
- /**
225
- * @deprecated Use `submitBundle` instead.
226
- *
227
- * POST a DIDComm plaintext payload to a batch submit path.
228
- * Use this for all `_batch` routes (family registration, observations, tasks, etc.).
229
- * Content-Type: `application/didcomm-plaintext+json`.
230
- *
231
- * Returns immediately with the HTTP response — pair with `pollUntilComplete` or use `submitAndPoll`.
232
- */
233
- submitBatch(path: string, payload: unknown): Promise<SubmitResponse>;
234
- /**
235
- * Sign and encrypt a DIDComm payload (nested JWS-in-JWE) and POST to the given path.
236
- * Content-Type: `application/didcomm-encrypted+json`.
237
- *
238
- * Flow: `payload JSON → ES384 compact JWS → RSA-OAEP-256/A256GCM compact JWE → POST`
239
- *
240
- * Requires a wallet provider and the recipient's RSA encryption JWK
241
- * (e.g. from GW `.well-known/jwks.json` where `use === 'enc'`).
242
- */
243
- submitBatchEncrypted(path: string, payload: {
244
- thid?: string;
245
- } & Record<string, unknown>, recipientEncryptionJwk: PublicJwk, walletContext: WalletContext): Promise<SubmitResponse>;
246
- /**
247
- * POST a plain JSON payload.
248
- * Use for non-DIDComm routes (e.g. token exchange body, API key management).
249
- * Content-Type: `application/json`.
250
- */
251
- postJson(path: string, payload: unknown): Promise<SubmitResponse>;
252
- /**
253
- * Legacy JSON submit for non-bundle payloads (openid/token/resource JSON bodies).
254
- * Keeps JSON flows explicit and semantically separated from DIDComm bundle flows.
255
- */
256
- submitLegacyJson(path: string, payload: unknown): Promise<SubmitResponse>;
257
- /**
258
- * POST a multipart/form-data payload.
259
- * Use for file upload endpoints. Prefer `uploadConversionFile` for DataConversion uploads.
260
- */
261
- postFormData(path: string, formData: FormData): Promise<SubmitResponse>;
262
- /**
263
- * Upload a file to a DataConversion endpoint.
264
- * Wraps `postFormData` with sensible defaults for file field naming and multipart encoding.
265
- *
266
- * @param params.path - Use `conversionUploadPath(ctx, softwareId, sourceFormat)`.
267
- * @param params.fileName - File name including extension (e.g. `data.xlsx`).
268
- * @param params.fileContent - File bytes (Blob, Buffer, Uint8Array, or ArrayBuffer).
269
- * @param params.fileFieldName - Form field name for the file. Defaults to `'file'`.
270
- * @param params.fields - Additional form string fields to include.
271
- */
272
- uploadConversionFile(params: {
273
- path: string;
274
- fileName: string;
275
- fileContent: Blob | Buffer | Uint8Array | ArrayBuffer;
276
- fileFieldName?: string;
277
- fields?: Record<string, string>;
278
- }): Promise<SubmitResponse>;
279
- /**
280
- * Single poll attempt against a `_batch-response` or `_*-response` path.
281
- * Returns HTTP 202 while the job is still processing, 200 (or other) when done.
282
- * Prefer `pollUntilComplete` for automatic retry loops.
283
- */
284
- pollBatchResponse(path: string, request: AsyncPollRequest): Promise<{
285
- status: number;
286
- body: unknown;
287
- retryAfterMs?: number;
288
- }>;
289
- /**
290
- * Submit a DIDComm batch payload and poll until the async job completes.
291
- * Convenience wrapper around `submitBatch` + `pollUntilComplete`.
292
- *
293
- * Requires `payload.thid` to be set (used as the poll correlation key).
294
- * Use `createDidcommPlainMessage` from `builders.ts` to build the payload with a `thid`.
295
- *
296
- * @example
297
- * const result = await client.submitAndPoll(
298
- * client.individualFamilyOrganizationBatchPath(ctx),
299
- * client.individualFamilyOrganizationPollPath(ctx),
300
- * payload,
301
- * { timeoutMs: 30_000, intervalMs: 2_000 },
302
- * );
303
- * // result.poll.status === 200 on success
304
- */
305
- submitAndPoll(submitPath: string, pollPath: string, payload: {
306
- thid?: string;
307
- } & Record<string, unknown>, options?: PollOptions): Promise<SubmitAndPollResult>;
308
- /**
309
- * Create scheduled phone reminder Task entries through canonical Task `_batch` routes.
310
- * This high-level helper accepts business parameters and internally builds flat
311
- * FHIR-style claims under `resource.meta.claims`.
312
- *
313
- * `description` is the Task title.
314
- * `reminderSummary` is the contextual summary of what the reminder refers to
315
- * (appointment, medication schedule, or another event), mapped to `based-on-display`.
316
- */
317
- createPhoneReminderTasks(ctx: RouteContext | undefined, input: CreatePhoneReminderTasksInput, options?: PollOptions): Promise<SubmitAndPollResult>;
318
- /** Endpoint path for medication overlap pre-check (planned GW contract). */
319
- individualMedicationOverlapCheckPath(ctx: RouteContext): string;
320
- /**
321
- * Pre-create overlap check for medication intake schedules.
322
- * TODO: Requires GW endpoint implementation (`MedicationStatement/_overlap-check`).
323
- */
324
- checkMedicationScheduleOverlap(ctx: RouteContext, input: MedicationOverlapCheckInput): Promise<SubmitResponse>;
325
- /**
326
- * High-level helper for medication reminder creation.
327
- * This creates one Task per explicit intake time and delegates reminder execution to GW daemon.
328
- * TODO: recurring interval expansion + overlap policy should be finalized in GW endpoint contract.
329
- */
330
- createMedicationReminderTasks(ctx: RouteContext, input: MedicationRegistrationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
331
- /**
332
- * Search for an existing family Organization registration by phone + usualname.
333
- * Submits to `individual/org.schema/Organization/_search`, polls for the result, and
334
- * parses the bundle entry into a `FamilyOrganizationSummary`.
335
- *
336
- * Returns `null` when no matching registration exists.
337
- */
338
- searchFamilyOrganization(ctx: RouteContext | undefined, filters: {
339
- controllerPhone: string;
340
- usualname: string;
341
- birthDate?: string;
342
- }, options?: PollOptions): Promise<FamilyOrganizationSummary | null>;
343
- /**
344
- * Activate tenant organization in GW from ICA-derived proof.
345
- */
346
- activateOrganizationInGatewayFromIcaProof(ctx: HostRouteContext | undefined, input: GatewayOrganizationActivationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
347
- /**
348
- * Friendly wrapper for legal organization activation.
349
- * Accepts one object and seconds-based polling options for integrator ergonomics.
350
- */
351
- activateOrganizationInGatewaySimple(input: GatewayOrganizationActivationSimpleInput): Promise<SubmitAndPollResult>;
352
- /**
353
- * Friendly wrapper for legal organization Order confirmation.
354
- * Accepts one object and builds payload/paths internally.
355
- */
356
- confirmLegalOrganizationOrderSimple(input: LegalOrganizationOrderSimpleInput): Promise<SubmitAndPollResult>;
357
- /**
358
- * Normalize GW async response into DIDComm message body.
359
- *
360
- * Transport note:
361
- * - GW poll responses are HTTP JSON envelopes
362
- * - business payload lives inside DIDComm `body`
363
- *
364
- * This helper abstracts envelope differences so consumers do not depend on
365
- * raw `poll.body.body` paths.
366
- */
367
- getDidcommMessageBodyFromResponse(result: SubmitAndPollResult | PollResult | unknown): Record<string, unknown> | undefined;
368
- /**
369
- * Return first DIDComm business entry from a submit/poll result.
370
- */
371
- getFirstDidcommDataEntryFromResponse(result: SubmitAndPollResult | PollResult | unknown): Record<string, unknown> | undefined;
372
- /**
373
- * Extract `org.schema.Offer.identifier` from a submit/poll result.
374
- *
375
- * This helper normalizes canonical and legacy claim locations.
376
- */
377
- getOfferIdFromResponse(result: SubmitAndPollResult | PollResult | unknown): string | undefined;
378
- /**
379
- * Extract a UI-ready Offer preview from activation/registration responses.
380
- */
381
- getOfferPreviewFromResponse(result: SubmitAndPollResult | PollResult | unknown): OfferPreview;
382
- /**
383
- * Alias of `getOfferPreviewFromResponse` with business naming.
384
- */
385
- getOfferInfoFromResponse(result: SubmitAndPollResult | PollResult | unknown): OfferInfo;
386
- /**
387
- * Extract activation code from response payload or claims.
388
- * Supports common response shapes used in onboarding and license issuance flows.
389
- */
390
- getActivationCodeFromResponse(result: SubmitAndPollResult | PollResult | unknown): string | undefined;
391
- /**
392
- * Throws when first DIDComm entry contains a business-level error status.
393
- */
394
- assertFirstDidcommEntrySuccess(result: SubmitAndPollResult | PollResult | unknown, contextLabel: string): void;
395
- /**
396
- * Activate employee/member device by activation code exchange + DCR registration.
397
- *
398
- * Step 1. Exchange activation code using user id_token to obtain an initial access token.
399
- * Step 2. Register device keys through Device/_dcr authorized by that initial token.
400
- */
401
- activateEmployeeDeviceWithActivationCode(ctx: RouteContext | undefined, input: EmployeeDeviceActivationInput): Promise<EmployeeDeviceActivationResult>;
402
- /**
403
- * Friendly wrapper for employee/member device activation.
404
- * Uses one object, seconds-based polling, and constructor ctx fallback.
405
- */
406
- activateEmployeeDeviceWithActivationCodeSimple(input: EmployeeDeviceActivationSimpleInput): Promise<EmployeeDeviceActivationResult>;
407
- /**
408
- * UC 5.3 wrapper: create organization employee in entity Employee batch route.
409
- */
410
- createOrganizationEmployee(ctx: RouteContext | undefined, input: OrganizationEmployeeCreationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
411
- /**
412
- * UC 5.1 wrapper: bootstrap subject organization context via registration + optional order confirmation.
413
- */
414
- bootstrapSubjectOrganizationIndex(ctx: RouteContext | undefined, input: SubjectOrganizationBootstrapInput): Promise<SubjectOrganizationBootstrapResult>;
415
- /**
416
- * Friendly wrapper (recommended step 1): register individual organization and return Offer.
417
- */
418
- startIndividualOrganizationSimple(input: IndividualOrganizationBootstrapSimpleInput): Promise<IndividualOrganizationStartSimpleResult>;
419
- /**
420
- * Friendly wrapper (recommended step 2): confirm individual/family order from accepted offerId.
421
- */
422
- confirmIndividualOrganizationOrderSimple(input: IndividualOrganizationConfirmOrderSimpleInput): Promise<SubmitAndPollResult>;
423
- /**
424
- * Friendly wrapper (provisional): register + auto-confirm individual order.
425
- * Prefer `startIndividualOrganizationSimple` + `confirmIndividualOrganizationOrderSimple`.
426
- */
427
- bootstrapIndividualOrganizationSimple(input: IndividualOrganizationBootstrapSimpleInput): Promise<IndividualOrganizationBootstrapSimpleResult>;
428
- /**
429
- * UC 5.5 wrapper: import IPS/FHIR composition and update subject index context.
430
- */
431
- importIpsOrFhirAndUpdateIndex(ctx: RouteContext | undefined, input: IpsOrFhirImportInput): Promise<SubmitAndPollResult>;
432
- /**
433
- * UC 5.6 consent helper from minimal frontend fields.
434
- * Builds canonical Consent claims and submits/polls the Consent batch.
435
- */
436
- grantProfessionalAccessSimple(ctx: RouteContext | undefined, input: GrantProfessionalAccessSimpleInput): Promise<GrantProfessionalAccessSimpleResult>;
437
- /**
438
- * UC 5.7 wrapper: generate digital twin composition from subject data.
439
- */
440
- generateDigitalTwinFromSubjectData(ctx: RouteContext | undefined, input: DigitalTwinGenerationInput): Promise<SubmitAndPollResult>;
441
- /**
442
- * Poll a `_*-response` path repeatedly until the status is no longer 202.
443
- * Default: 60s timeout, 2s interval.
444
- * Throws if timeout is exceeded.
445
- *
446
- * @param path - Poll path (e.g. `individualFamilyOrganizationPollPath(ctx)`).
447
- * @param request - Must include `thid` matching the original submit payload.
448
- * @param options - `timeoutMs` (default 60000) and `intervalMs` (default 2000).
449
- */
450
- pollUntilComplete(path: string, request: AsyncPollRequest, options?: PollOptions): Promise<PollResult>;
451
- private doPost;
452
- private parseResponseBody;
453
- }