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.
- package/CHANGELOG.md +31 -0
- package/README.md +44 -1
- package/dist/client.d.ts +153 -33
- package/dist/client.js +619 -93
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +112 -1
- package/dist/vp-token.d.ts +37 -0
- package/dist/vp-token.js +56 -0
- package/docs/API.md +19 -4
- package/docs/BACKEND_NODE_INTEGRATION.md +249 -0
- package/docs/CONTROLLER_FLOW_STEP_BY_STEP.md +283 -0
- package/docs/DATA_MODEL_ALIGNMENT.md +37 -13
- package/docs/DEVELOPER_USE_CASES.md +10 -2
- package/docs/E2E_LOCAL_GW_UC5.md +49 -0
- package/docs/ENDPOINT_ID_CATALOG.md +90 -0
- package/docs/LEGAL_ORGANIZATION_FLOW_STEP_BY_STEP.md +84 -0
- package/docs/PERSONAL_FLOW_STEP_BY_STEP.md +70 -0
- package/docs/PORTAL_BACKEND_INTEGRATION_HANDOVER.md +343 -0
- package/docs/PRACTITIONER_FLOW_STEP_BY_STEP.md +182 -0
- package/docs/REACT_WEB_INTEGRATION.md +72 -0
- package/examples/e2e-bootstrap-tenant.mjs +3 -2
- package/examples/e2e-individual-flow.mjs +13 -8
- package/examples/host-activate-and-employee.mjs +3 -2
- package/examples/smoke-legal-org-local.mjs +40 -0
- package/package.json +4 -3
- package/src/client.ts +784 -132
- package/src/index.ts +1 -0
- package/src/types.ts +123 -1
- package/src/vp-token.ts +91 -0
- package/tests/client.test.mjs +491 -0
- package/tests/fixtures/ica-vp-minimal.json +67 -0
- package/tests/helpers/vp-token-fixture.mjs +23 -0
- package/tests/live-gw-uc5.e2e.test.mjs +108 -0
- package/SDK_PARITY_MAP.md +0 -120
- package/TODO_PROMPT_NEXT_STEPS.md +0 -185
- package/artifacts/update-smart-wallet.js +0 -1016
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { DataspaceNodeClient, createDidcommPlainMessage } from '../dist/index.js';
|
|
2
|
+
import {
|
|
3
|
+
ClaimsOrganizationSchemaorg,
|
|
4
|
+
ClaimsPersonSchemaorg,
|
|
5
|
+
ClaimsServiceSchemaorg,
|
|
6
|
+
} from 'gdc-common-utils-ts/constants/schemaorg';
|
|
2
7
|
|
|
3
8
|
const baseUrl = process.env.BASE_URL || 'http://localhost:3000';
|
|
4
9
|
const bearerToken = process.env.AUTH_BEARER || 'demo-token';
|
|
@@ -21,14 +26,14 @@ const payload = createDidcommPlainMessage({
|
|
|
21
26
|
claims: {
|
|
22
27
|
'@context': 'org.schema',
|
|
23
28
|
'@type': 'template',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
[ClaimsOrganizationSchemaorg.addressCountry]: 'ES',
|
|
30
|
+
[ClaimsOrganizationSchemaorg.identifierType]: 'UUID',
|
|
31
|
+
[ClaimsOrganizationSchemaorg.identifierValue]: `family-${Date.now()}`,
|
|
32
|
+
[ClaimsPersonSchemaorg.email]: 'adult1@example.com',
|
|
33
|
+
[ClaimsServiceSchemaorg.category]: ctx.sector,
|
|
34
|
+
[ClaimsServiceSchemaorg.identifier]: 'did:web:api-provider.example.com',
|
|
35
|
+
[ClaimsServiceSchemaorg.serviceType]: 'http://terminology.hl7.org/CodeSystem/v3-ActReason|SRVC',
|
|
36
|
+
[ClaimsServiceSchemaorg.termsOfService]: 'https://provider.example.com/terms',
|
|
32
37
|
},
|
|
33
38
|
},
|
|
34
39
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataspaceNodeClient, createDidcommPlainMessage } from '../dist/index.js';
|
|
2
|
+
import { ClaimsPersonSchemaorg } from 'gdc-common-utils-ts/constants/schemaorg';
|
|
2
3
|
|
|
3
4
|
const baseUrl = process.env.BASE_URL || 'http://localhost:3000';
|
|
4
5
|
const bearerToken = process.env.AUTH_BEARER || 'demo-token';
|
|
@@ -56,8 +57,8 @@ const employeePayload = createDidcommPlainMessage({
|
|
|
56
57
|
meta: {
|
|
57
58
|
claims: {
|
|
58
59
|
'@context': 'org.schema',
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
[ClaimsPersonSchemaorg.email]: process.env.EMPLOYEE_EMAIL || 'doctor1@acme.org',
|
|
61
|
+
[ClaimsPersonSchemaorg.hasOccupation]: process.env.EMPLOYEE_ROLE || 'ISCO-08|2211',
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
64
|
},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DataspaceNodeClient } from '../dist/index.js';
|
|
2
|
+
|
|
3
|
+
const baseUrl = process.env.BASE_URL || 'http://127.0.0.1:3000';
|
|
4
|
+
const bearerToken = process.env.AUTH_BEARER || 'demo-token';
|
|
5
|
+
const tenantId = process.env.TENANT_ID || 'acme';
|
|
6
|
+
const jurisdiction = process.env.JURISDICTION || 'ES';
|
|
7
|
+
const sector = process.env.HOST_REGISTRY_SECTOR || 'test';
|
|
8
|
+
const vpToken = process.env.VP_TOKEN || 'demo-vp';
|
|
9
|
+
|
|
10
|
+
const client = new DataspaceNodeClient({ baseUrl, bearerToken });
|
|
11
|
+
client
|
|
12
|
+
.setContextOrg({ tenantId, jurisdiction, sector })
|
|
13
|
+
.setDefaultTimeoutSeconds(Number(process.env.TIMEOUT_SECONDS || 60))
|
|
14
|
+
.setDefaultIntervalSeconds(Number(process.env.INTERVAL_SECONDS || 2));
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const activation = await client.activateOrganizationInGatewaySimple({
|
|
18
|
+
vpToken,
|
|
19
|
+
numberOfMembers: Number(process.env.NUMBER_OF_MEMBERS || 2),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log('[activate] submit=', activation.submit.status, 'poll=', activation.poll.status);
|
|
23
|
+
|
|
24
|
+
const offerId = client.getOfferIdFromResponse(activation);
|
|
25
|
+
const offer = client.getOfferPreviewFromResponse(activation);
|
|
26
|
+
console.log('[activate] offerId=', offerId || '<missing>');
|
|
27
|
+
console.log('[activate] offerPreview=', JSON.stringify(offer));
|
|
28
|
+
|
|
29
|
+
if (!offerId) {
|
|
30
|
+
console.log('[order] skipped: no offerId in activation response');
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const order = await client.confirmLegalOrganizationOrderSimple({ offerId });
|
|
35
|
+
console.log('[order] submit=', order.submit.status, 'poll=', order.poll.status);
|
|
36
|
+
process.exit(order.poll.status === 200 ? 0 : 1);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('[smoke-legal-org-local] ERROR:', error?.message || error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataspace-client-sdk-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Node.js SDK skeleton for GW/UNID DIDComm plain batch + async polling flows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"build": "tsc -p tsconfig.json",
|
|
10
10
|
"type-check": "tsc -p tsconfig.json --noEmit",
|
|
11
11
|
"test": "npm run build && node --test tests/*.test.mjs",
|
|
12
|
-
"example:e2e-bootstrap-tenant": "npm run build && node examples/e2e-bootstrap-tenant.mjs"
|
|
12
|
+
"example:e2e-bootstrap-tenant": "npm run build && node examples/e2e-bootstrap-tenant.mjs",
|
|
13
|
+
"test:e2e:live-gw-uc5": "npm run build && RUN_LIVE_GW_E2E=1 node --test tests/live-gw-uc5.e2e.test.mjs"
|
|
13
14
|
},
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">=22"
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@noble/post-quantum": "^0.6.1",
|
|
23
|
-
"gdc-common-utils-ts": "^1.4.
|
|
24
|
+
"gdc-common-utils-ts": "^1.4.12",
|
|
24
25
|
"node-fetch": "^3.3.2"
|
|
25
26
|
}
|
|
26
27
|
}
|