dataspace-client-sdk-node 0.1.1 → 0.2.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 (37) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +44 -1
  3. package/dist/client.d.ts +153 -33
  4. package/dist/client.js +619 -93
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/types.d.ts +112 -1
  8. package/dist/vp-token.d.ts +37 -0
  9. package/dist/vp-token.js +56 -0
  10. package/docs/API.md +19 -4
  11. package/docs/BACKEND_NODE_INTEGRATION.md +249 -0
  12. package/docs/CONTROLLER_FLOW_STEP_BY_STEP.md +283 -0
  13. package/docs/DATA_MODEL_ALIGNMENT.md +37 -13
  14. package/docs/DEVELOPER_USE_CASES.md +10 -2
  15. package/docs/E2E_LOCAL_GW_UC5.md +49 -0
  16. package/docs/ENDPOINT_ID_CATALOG.md +90 -0
  17. package/docs/LEGAL_ORGANIZATION_FLOW_STEP_BY_STEP.md +84 -0
  18. package/docs/PERSONAL_FLOW_STEP_BY_STEP.md +70 -0
  19. package/docs/PORTAL_BACKEND_INTEGRATION_HANDOVER.md +343 -0
  20. package/docs/PRACTITIONER_FLOW_STEP_BY_STEP.md +182 -0
  21. package/docs/REACT_WEB_INTEGRATION.md +72 -0
  22. package/examples/e2e-bootstrap-tenant.mjs +3 -2
  23. package/examples/e2e-individual-flow.mjs +13 -8
  24. package/examples/host-activate-and-employee.mjs +3 -2
  25. package/examples/smoke-legal-org-local.mjs +40 -0
  26. package/package.json +4 -3
  27. package/src/client.ts +784 -132
  28. package/src/index.ts +1 -0
  29. package/src/types.ts +123 -1
  30. package/src/vp-token.ts +91 -0
  31. package/tests/client.test.mjs +491 -0
  32. package/tests/fixtures/ica-vp-minimal.json +67 -0
  33. package/tests/helpers/vp-token-fixture.mjs +23 -0
  34. package/tests/live-gw-uc5.e2e.test.mjs +108 -0
  35. package/SDK_PARITY_MAP.md +0 -120
  36. package/TODO_PROMPT_NEXT_STEPS.md +0 -185
  37. package/artifacts/update-smart-wallet.js +0 -1016
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased] - 2026-05-04
6
+
7
+ ### Added
8
+ - Data model alignment guide updated for cross-service namespace consistency:
9
+ - Gateway: `/host/...` (with `auth` security model)
10
+ - ICA: `/ica/...`
11
+ - DataConv: `/publisher/...`
12
+ - Explicit integration guidance that SDK consumers should use SDK path helpers instead of manually composing host prefixes/routes.
13
+
14
+ ### Changed
15
+ - Contact identity contract for onboarding/controller flows is now documented as dual-channel:
16
+ - Email (`org.schema.Person.email`)
17
+ - Telephone (`org.schema.Person.telephone`
18
+ - Offer/Order process clarified as part of the onboarding contract even when commercial amount is zero:
19
+ - Offer extraction for UI review/acceptance
20
+ - Explicit Order acceptance using offer identifier
21
+ - Activation trust-chain contract aligned with ICA/GW:
22
+ - `_activate` uses `vp_token` in message payload (not as HTTP Bearer),
23
+ - legal representative binding relies on `org.schema.Person.memberOf.taxID` and
24
+ `org.schema.Person.hasCredential.material` for key continuity between `_verify` and `vp_token` signature.
25
+
26
+ ### Documentation
27
+ - Updated:
28
+ - `docs/DATA_MODEL_ALIGNMENT.md`
29
+ - Clarified:
30
+ - `/host` + `auth` alignment with current gateway model
31
+ - namespace symmetry with ICA (`/ica`) and DataConv (`/publisher`)
package/README.md CHANGED
@@ -6,6 +6,47 @@ Node.js SDK to consume GW/UNID async DIDComm plain endpoints.
6
6
  **[→ Data Model Alignment (GW + Chat + SDK)](docs/DATA_MODEL_ALIGNMENT.md)**
7
7
  **[→ Frontend/Backend SDK Ownership Matrix](../docs/SDK_AUTH_OWNERSHIP.md)**
8
8
  **[→ Developer Use-Case Cookbook (UC5 + additional patterns)](docs/DEVELOPER_USE_CASES.md)**
9
+ **[→ Live Local GW UC5 E2E (no mocks)](docs/E2E_LOCAL_GW_UC5.md)**
10
+ **[→ React Web Integration Guide](docs/REACT_WEB_INTEGRATION.md)**
11
+ **[→ Backend Node Integration Guide](docs/BACKEND_NODE_INTEGRATION.md)**
12
+ **[→ Portal Backend Integration Handover](docs/PORTAL_BACKEND_INTEGRATION_HANDOVER.md)**
13
+
14
+ ## Onboarding flows (split by business case)
15
+
16
+ Do not mix these two flows in the same narrative:
17
+
18
+ 1. Legal Organization Onboarding (B2B/tenant/controller)
19
+ 2. Personal Organization Onboarding (individual/family/subject)
20
+
21
+ ### 1) Legal Organization Onboarding (B2B/tenant/controller)
22
+
23
+ Canonical order when ICA proof is involved:
24
+
25
+ 1. ICA proof/verification (`_verify`, external to this SDK).
26
+ 2. GW activation in host registry: `Organization/_activate`.
27
+ 3. Offer/Order phase for legal organization onboarding (always; if amount is 0, no payment step).
28
+ 4. Device onboarding (DCR): `identity/openid/Device/_dcr`.
29
+ 5. Post-DCR token exchange / SMART authorization for protected API calls.
30
+
31
+ Node SDK helpers:
32
+ - `activateOrganizationInGatewayFromIcaProof(...)` (UC5.2)
33
+ - `activateEmployeeDeviceWithActivationCode(...)` (UC5.4)
34
+ - `authenticateBackendPkceAndExchange(...)` or `authenticateBackendSmartStandard(...)`
35
+
36
+ ### 2) Personal Organization Onboarding (individual/family/subject)
37
+
38
+ Canonical order:
39
+
40
+ 1. Personal/family registration: `individual/org.schema/Organization/_batch`.
41
+ 2. Offer acceptance/order confirmation: `individual/org.schema/Order/_batch`.
42
+ 3. Continue with consent + subject data workflows.
43
+
44
+ Node SDK helper:
45
+ - `bootstrapSubjectOrganizationIndex(...)` (UC5.1: registration + optional order confirmation)
46
+
47
+ See:
48
+ - `docs/DEVELOPER_USE_CASES.md` (UC5.1..UC5.7)
49
+ - `docs/E2E_BOOTSTRAP.md` (host activation bootstrap)
9
50
 
10
51
  ## Scope
11
52
  - Generic async batch client (`_batch` + `_batch-response`) and JSON POST helper.
@@ -255,7 +296,9 @@ Full runnable example: `examples/backend-pkce-auth.mjs`
255
296
  - `client.v1Path(ctx, section, format, resourceType, action)` for tenant routes.
256
297
  - `client.hostRegistryPath(ctx, resourceType, action)` for host registry routes.
257
298
  - Then call one of:
258
- - `submitBatch(path, didcommPayload)` for DIDComm plain submit routes,
299
+ - `submitBundle(path, didcommPayload)` for DIDComm bundle submit routes (preferred),
300
+ - `submitBatch(path, didcommPayload)` (legacy alias, kept for compatibility),
301
+ - `submitLegacyJson(path, payload)` for non-DIDComm JSON routes,
259
302
  - `pollBatchResponse(path, { thid })` / `pollUntilComplete(...)`,
260
303
  - `postJson(path, payload)` for non-batch JSON routes.
261
304
 
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AsyncPollRequest, BackendPkceAuthOptions, BackendPkceAuthResult, BackendSmartAuthOptions, BackendSmartAuthResult, ClientOptions, CreatePhoneReminderTasksInput, GrantProfessionalAccessSimpleInput, GrantProfessionalAccessSimpleResult, DigitalTwinGenerationInput, EmployeeDeviceActivationInput, EmployeeDeviceActivationResult, FamilyOrganizationSummary, GatewayOrganizationActivationInput, HostRouteContext, IpsOrFhirImportInput, MedicationOverlapCheckInput, MedicationRegistrationInput, OrganizationEmployeeCreationInput, PollOptions, PollResult, RouteContext, SmartTokenExchangeInput, SmartTokenExchangeResult, SubjectOrganizationBootstrapInput, SubjectOrganizationBootstrapResult, SubmitAndPollResult, SubmitResponse, V1Action, V1Section } from './types.js';
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
2
  import type { WalletProvider } from './sdk/dataspace-wallet-sdk-node/provider.js';
3
3
  import type { PublicJwk, WalletContext } from './sdk/dataspace-wallet-sdk-node/types.js';
4
4
  export declare class DataspaceNodeClient {
@@ -6,9 +6,36 @@ export declare class DataspaceNodeClient {
6
6
  private readonly bearerToken?;
7
7
  private readonly defaultHeaders;
8
8
  private readonly wallet?;
9
+ private defaultCtx?;
10
+ private defaultTimeoutMs?;
11
+ private defaultIntervalMs?;
9
12
  private readonly _tokenCache;
10
13
  constructor(options: ClientOptions);
11
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;
12
39
  /**
13
40
  * Generic GW v1 tenant route builder.
14
41
  * Use this for any section/format/resourceType/action combination not covered
@@ -20,7 +47,7 @@ export declare class DataspaceNodeClient {
20
47
  * client.v1Path(ctx, 'individual', 'org.schema', 'Organization', '_batch')
21
48
  * // → /acme/cds-ES/v1/health-care/individual/org.schema/Organization/_batch
22
49
  */
23
- v1Path(ctx: RouteContext, section: V1Section, format: string, resourceType: string, action: V1Action): string;
50
+ v1Path(ctx: RouteContext | undefined, section: V1Section, format: string, resourceType: string, action: V1Action): string;
24
51
  /**
25
52
  * Generic tenant-scoped identity route builder.
26
53
  * Pattern: `/{prefix}/cds-{jurisdiction}/v1/{sector}/{tenantId}/identity/auth/{action}`
@@ -28,41 +55,41 @@ export declare class DataspaceNodeClient {
28
55
  * The `prefix` is service-specific: `host` for GW, `publisher` for DataConv, `ica` for ICA.
29
56
  * Dedicated path methods in this SDK use `host` (GW convention).
30
57
  */
31
- tenantIdentityPath(ctx: RouteContext, prefix: string, action: string): string;
58
+ tenantIdentityPath(ctx: RouteContext | undefined, prefix: string, action: string): string;
32
59
  /**
33
60
  * Generic host registry route builder (tenant-agnostic, `host/` prefix).
34
61
  * Use for controller-level registry operations (Organization activate, Order, etc.).
35
62
  *
36
63
  * Pattern: `/host/cds-{jurisdiction}/v1/{sector}/registry/org.schema/{resourceType}/{action}`
37
64
  */
38
- hostRegistryPath(ctx: HostRouteContext, resourceType: string, action: V1Action): string;
65
+ hostRegistryPath(ctx: HostRouteContext | undefined, resourceType: string, action: V1Action): string;
39
66
  /** Submit path: host registry Organization batch (controller-level org registration). */
40
- hostRegistryOrganizationBatchPath(ctx: HostRouteContext): string;
67
+ hostRegistryOrganizationBatchPath(ctx?: HostRouteContext): string;
41
68
  /** Poll path: host registry Organization batch. Pair with `hostRegistryOrganizationBatchPath`. */
42
- hostRegistryOrganizationPollPath(ctx: HostRouteContext): string;
69
+ hostRegistryOrganizationPollPath(ctx?: HostRouteContext): string;
43
70
  /** Submit path: activate a tenant Organization in the GW registry using a VC from ICA. */
44
- hostRegistryOrganizationActivatePath(ctx: HostRouteContext): string;
71
+ hostRegistryOrganizationActivatePath(ctx?: HostRouteContext): string;
45
72
  /** Poll path: `_activate` response. Pair with `hostRegistryOrganizationActivatePath`. */
46
- hostRegistryOrganizationActivatePollPath(ctx: HostRouteContext): string;
73
+ hostRegistryOrganizationActivatePollPath(ctx?: HostRouteContext): string;
47
74
  /** Submit path: host registry Order batch (controller-level order submission). */
48
- hostRegistryOrderBatchPath(ctx: HostRouteContext): string;
75
+ hostRegistryOrderBatchPath(ctx?: HostRouteContext): string;
49
76
  /** Poll path: host registry Order batch. Pair with `hostRegistryOrderBatchPath`. */
50
- hostRegistryOrderPollPath(ctx: HostRouteContext): string;
77
+ hostRegistryOrderPollPath(ctx?: HostRouteContext): string;
51
78
  /**
52
79
  * Submit path: individual/family Organization onboarding (`org.schema/Organization/_batch`).
53
80
  * Use for `family-registration/_create-or-resume` DIDComm payloads.
54
81
  */
55
- individualFamilyOrganizationBatchPath(ctx: RouteContext): string;
82
+ individualFamilyOrganizationBatchPath(ctx?: RouteContext): string;
56
83
  /** Poll path: individual/family Organization. Pair with `individualFamilyOrganizationBatchPath`. */
57
- individualFamilyOrganizationPollPath(ctx: RouteContext): string;
84
+ individualFamilyOrganizationPollPath(ctx?: RouteContext): string;
58
85
  /** Submit path: individual/family Organization search (`org.schema/Organization/_search`). */
59
- individualFamilyOrganizationSearchPath(ctx: RouteContext): string;
86
+ individualFamilyOrganizationSearchPath(ctx?: RouteContext): string;
60
87
  /** Poll path: individual/family Organization search. Pair with `individualFamilyOrganizationSearchPath`. */
61
- individualFamilyOrganizationSearchPollPath(ctx: RouteContext): string;
88
+ individualFamilyOrganizationSearchPollPath(ctx?: RouteContext): string;
62
89
  /** Submit path: individual/family Order batch (`org.schema/Order/_batch`). */
63
- individualFamilyOrderBatchPath(ctx: RouteContext): string;
90
+ individualFamilyOrderBatchPath(ctx?: RouteContext): string;
64
91
  /** Poll path: individual/family Order. Pair with `individualFamilyOrderBatchPath`. */
65
- individualFamilyOrderPollPath(ctx: RouteContext): string;
92
+ individualFamilyOrderPollPath(ctx?: RouteContext): string;
66
93
  /** Submit path: individual RelatedPerson (FHIR R4 API, `org.hl7.fhir.api/RelatedPerson/_batch`). */
67
94
  individualRelatedPersonBatchPath(ctx: RouteContext): string;
68
95
  /** Poll path: individual RelatedPerson. Pair with `individualRelatedPersonBatchPath`. */
@@ -80,9 +107,9 @@ export declare class DataspaceNodeClient {
80
107
  /** Poll path: individual Task. Pair with `individualTaskBatchPath`. */
81
108
  individualTaskPollPath(ctx: RouteContext): string;
82
109
  /** Submit path: entity Employee (`entity/org.schema/Employee/_batch`). */
83
- employeeBatchPath(ctx: RouteContext): string;
110
+ employeeBatchPath(ctx?: RouteContext): string;
84
111
  /** Poll path: entity Employee. Pair with `employeeBatchPath`. */
85
- employeePollPath(ctx: RouteContext): string;
112
+ employeePollPath(ctx?: RouteContext): string;
86
113
  /** Submit path: individual Person legacy format (`individual/org.schema/Person/_batch`). Use for older flows; prefer Organization for family onboarding. */
87
114
  individualLegacyPersonBatchPath(ctx: RouteContext): string;
88
115
  /** Submit path: individual Consent (FHIR R4, `org.hl7.fhir.r4/Consent/_batch`). */
@@ -105,18 +132,18 @@ export declare class DataspaceNodeClient {
105
132
  * Submit path: identity DCR step — binds API key to service public JWK.
106
133
  * Used internally by `authenticateBackendPkceAndExchange` (step 1 of identity-exchange.v1).
107
134
  */
108
- identityDeviceDcrPath(ctx: RouteContext): string;
135
+ identityDeviceDcrPath(ctx?: RouteContext): string;
109
136
  /** Poll path: identity DCR. Pair with `identityDeviceDcrPath`. */
110
- identityDeviceDcrPollPath(ctx: RouteContext): string;
137
+ identityDeviceDcrPollPath(ctx?: RouteContext): string;
111
138
  /**
112
139
  * Submit path: identity token exchange — id_token → SMART bearer.
113
140
  * Used internally by `authenticateBackendPkceAndExchange` (step 4 of identity-exchange.v1).
114
141
  */
115
- identityTokenExchangePath(ctx: RouteContext): string;
142
+ identityTokenExchangePath(ctx?: RouteContext): string;
116
143
  /** Poll path: identity token exchange. Pair with `identityTokenExchangePath`. */
117
- identityTokenExchangePollPath(ctx: RouteContext): string;
144
+ identityTokenExchangePollPath(ctx?: RouteContext): string;
118
145
  /** Submit path: identity license issue (`identity/auth/_issue`). */
119
- identityLicenseIssuePath(ctx: RouteContext): string;
146
+ identityLicenseIssuePath(ctx?: RouteContext): string;
120
147
  /**
121
148
  * Submit path: SMART token step — code + code_verifier → id_token.
122
149
  * Used internally by `authenticateBackendPkceAndExchange` (step 3 of identity-exchange.v1).
@@ -159,7 +186,7 @@ export declare class DataspaceNodeClient {
159
186
  * Returns the cached SMART bearer for the given endpointId if still valid (>30s remaining).
160
187
  * Returns `undefined` if not cached or expired.
161
188
  */
162
- getCachedBearerToken(endpointId: string): string | undefined;
189
+ getCachedBearerToken(tokenCacheKey: string): string | undefined;
163
190
  /**
164
191
  * smart-backend.v1: obtain an OAuth2 backend token using client_credentials + private_key_jwt.
165
192
  */
@@ -168,6 +195,11 @@ export declare class DataspaceNodeClient {
168
195
  * Exchange token payload against gateway token endpoint and cache the result.
169
196
  */
170
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>;
171
203
  private _pkceS256Challenge;
172
204
  private _buildAuthDIDCommRequest;
173
205
  private resolveControllerPublicJwk;
@@ -176,6 +208,22 @@ export declare class DataspaceNodeClient {
176
208
  private signSmartBackendClientAssertion;
177
209
  private preferredJwtAlg;
178
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
+ *
179
227
  * POST a DIDComm plaintext payload to a batch submit path.
180
228
  * Use this for all `_batch` routes (family registration, observations, tasks, etc.).
181
229
  * Content-Type: `application/didcomm-plaintext+json`.
@@ -201,6 +249,11 @@ export declare class DataspaceNodeClient {
201
249
  * Content-Type: `application/json`.
202
250
  */
203
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>;
204
257
  /**
205
258
  * POST a multipart/form-data payload.
206
259
  * Use for file upload endpoints. Prefer `uploadConversionFile` for DataConversion uploads.
@@ -231,6 +284,7 @@ export declare class DataspaceNodeClient {
231
284
  pollBatchResponse(path: string, request: AsyncPollRequest): Promise<{
232
285
  status: number;
233
286
  body: unknown;
287
+ retryAfterMs?: number;
234
288
  }>;
235
289
  /**
236
290
  * Submit a DIDComm batch payload and poll until the async job completes.
@@ -260,7 +314,7 @@ export declare class DataspaceNodeClient {
260
314
  * `reminderSummary` is the contextual summary of what the reminder refers to
261
315
  * (appointment, medication schedule, or another event), mapped to `based-on-display`.
262
316
  */
263
- createPhoneReminderTasks(ctx: RouteContext, input: CreatePhoneReminderTasksInput, options?: PollOptions): Promise<SubmitAndPollResult>;
317
+ createPhoneReminderTasks(ctx: RouteContext | undefined, input: CreatePhoneReminderTasksInput, options?: PollOptions): Promise<SubmitAndPollResult>;
264
318
  /** Endpoint path for medication overlap pre-check (planned GW contract). */
265
319
  individualMedicationOverlapCheckPath(ctx: RouteContext): string;
266
320
  /**
@@ -281,7 +335,7 @@ export declare class DataspaceNodeClient {
281
335
  *
282
336
  * Returns `null` when no matching registration exists.
283
337
  */
284
- searchFamilyOrganization(ctx: RouteContext, filters: {
338
+ searchFamilyOrganization(ctx: RouteContext | undefined, filters: {
285
339
  controllerPhone: string;
286
340
  usualname: string;
287
341
  birthDate?: string;
@@ -289,35 +343,101 @@ export declare class DataspaceNodeClient {
289
343
  /**
290
344
  * Activate tenant organization in GW from ICA-derived proof.
291
345
  */
292
- activateOrganizationInGatewayFromIcaProof(ctx: HostRouteContext, input: GatewayOrganizationActivationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
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;
293
395
  /**
294
396
  * Activate employee/member device by activation code exchange + DCR registration.
295
397
  *
296
398
  * Step 1. Exchange activation code using user id_token to obtain an initial access token.
297
399
  * Step 2. Register device keys through Device/_dcr authorized by that initial token.
298
400
  */
299
- activateEmployeeDeviceWithActivationCode(ctx: RouteContext, input: EmployeeDeviceActivationInput): Promise<EmployeeDeviceActivationResult>;
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>;
300
407
  /**
301
408
  * UC 5.3 wrapper: create organization employee in entity Employee batch route.
302
409
  */
303
- createOrganizationEmployee(ctx: RouteContext, input: OrganizationEmployeeCreationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
410
+ createOrganizationEmployee(ctx: RouteContext | undefined, input: OrganizationEmployeeCreationInput, options?: PollOptions): Promise<SubmitAndPollResult>;
304
411
  /**
305
412
  * UC 5.1 wrapper: bootstrap subject organization context via registration + optional order confirmation.
306
413
  */
307
- bootstrapSubjectOrganizationIndex(ctx: RouteContext, input: SubjectOrganizationBootstrapInput): Promise<SubjectOrganizationBootstrapResult>;
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>;
308
428
  /**
309
429
  * UC 5.5 wrapper: import IPS/FHIR composition and update subject index context.
310
430
  */
311
- importIpsOrFhirAndUpdateIndex(ctx: RouteContext, input: IpsOrFhirImportInput): Promise<SubmitAndPollResult>;
431
+ importIpsOrFhirAndUpdateIndex(ctx: RouteContext | undefined, input: IpsOrFhirImportInput): Promise<SubmitAndPollResult>;
312
432
  /**
313
433
  * UC 5.6 consent helper from minimal frontend fields.
314
434
  * Builds canonical Consent claims and submits/polls the Consent batch.
315
435
  */
316
- grantProfessionalAccessSimple(ctx: RouteContext, input: GrantProfessionalAccessSimpleInput): Promise<GrantProfessionalAccessSimpleResult>;
436
+ grantProfessionalAccessSimple(ctx: RouteContext | undefined, input: GrantProfessionalAccessSimpleInput): Promise<GrantProfessionalAccessSimpleResult>;
317
437
  /**
318
438
  * UC 5.7 wrapper: generate digital twin composition from subject data.
319
439
  */
320
- generateDigitalTwinFromSubjectData(ctx: RouteContext, input: DigitalTwinGenerationInput): Promise<SubmitAndPollResult>;
440
+ generateDigitalTwinFromSubjectData(ctx: RouteContext | undefined, input: DigitalTwinGenerationInput): Promise<SubmitAndPollResult>;
321
441
  /**
322
442
  * Poll a `_*-response` path repeatedly until the status is no longer 202.
323
443
  * Default: 60s timeout, 2s interval.