dataconv-client-sdk-ts 0.2.0 → 0.2.1
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 +1 -4
- package/package.json +6 -1
- package/.github/copilot-instructions.md +0 -104
- package/__mocks__/gdc-common-utils-ts/utils/didcomm.ts +0 -39
- package/jest.config.js +0 -16
- package/src/DataConvClient.ts +0 -567
- package/src/__tests__/DataConvClient.test.ts +0 -608
- package/src/client/constants.ts +0 -8
- package/src/client/helpers.ts +0 -127
- package/src/client/message.ts +0 -139
- package/src/index.ts +0 -39
- package/src/types.ts +0 -302
- package/tsconfig.json +0 -21
package/README.md
CHANGED
|
@@ -41,7 +41,6 @@ import { DataConvClient } from 'dataconv-client-sdk-ts';
|
|
|
41
41
|
|
|
42
42
|
const client = new DataConvClient({
|
|
43
43
|
issuerDid: 'did:web:clinic.example:employee:...',
|
|
44
|
-
alternateName: 'clinic-demo',
|
|
45
44
|
tenantId: 'VATES-B00000000',
|
|
46
45
|
jurisdiction: 'ES',
|
|
47
46
|
sector: 'onehealth-research',
|
|
@@ -144,7 +143,6 @@ const httpClient = axios.create({
|
|
|
144
143
|
|
|
145
144
|
const client = new DataConvClient({
|
|
146
145
|
issuerDid: activatedOrganizationDid,
|
|
147
|
-
alternateName: tenantAlternateName,
|
|
148
146
|
tenantId: tenantAlternateName,
|
|
149
147
|
jurisdiction: 'ES',
|
|
150
148
|
httpClient,
|
|
@@ -159,7 +157,6 @@ It also works with `fetch`:
|
|
|
159
157
|
```ts
|
|
160
158
|
const client = new DataConvClient({
|
|
161
159
|
issuerDid: activatedOrganizationDid,
|
|
162
|
-
alternateName: tenantAlternateName,
|
|
163
160
|
tenantId: tenantAlternateName,
|
|
164
161
|
jurisdiction: 'ES',
|
|
165
162
|
fetch,
|
|
@@ -169,7 +166,7 @@ const client = new DataConvClient({
|
|
|
169
166
|
|
|
170
167
|
## Notes
|
|
171
168
|
|
|
172
|
-
- For configuration and conversion calls, the operational tenant identifier should be `tenantId`, typically the organization's VAT/taxId.
|
|
169
|
+
- For configuration and conversion calls, the operational tenant identifier should be `tenantId`, typically the organization's VAT/taxId.
|
|
173
170
|
- `sector` is variable and is part of the public route for config, digital twin, and search.
|
|
174
171
|
- `patchConversion()` defaults to `Composition/_patch`.
|
|
175
172
|
- `batchPromotion()` defaults to `Patient/_batch`.
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataconv-client-sdk-ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "TypeScript SDK for adapter-ingestion-py preconversion APIs via DIDComm and multipart upload.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
8
13
|
"scripts": {
|
|
9
14
|
"build": "tsc",
|
|
10
15
|
"test": "DATACONV_BASE_URL=http://localhost:8080 jest",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<!-- Use this file to provide workspace-specific custom instructions to Copilot. For more details, visit https://code.visualstudio.com/docs/copilot/copilot-customization#_use-a-githubcopilotinstructionsmd-file -->
|
|
2
|
-
- [x] Verify that the copilot-instructions.md file in the .github directory is created.
|
|
3
|
-
|
|
4
|
-
- [x] Clarify Project Requirements
|
|
5
|
-
<!-- Ask for project type, language, and frameworks if not specified. Skip if already provided. -->
|
|
6
|
-
|
|
7
|
-
- [x] Scaffold the Project
|
|
8
|
-
<!--
|
|
9
|
-
Ensure that the previous step has been marked as completed.
|
|
10
|
-
Call project setup tool with projectType parameter.
|
|
11
|
-
Run scaffolding command to create project files and folders.
|
|
12
|
-
Use '.' as the working directory.
|
|
13
|
-
If no appropriate projectType is available, search documentation using available tools.
|
|
14
|
-
Otherwise, create the project structure manually using available file creation tools.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
- [x] Customize the Project
|
|
18
|
-
<!--
|
|
19
|
-
Verify that all previous steps have been completed successfully and you have marked the step as completed.
|
|
20
|
-
Develop a plan to modify codebase according to user requirements.
|
|
21
|
-
Apply modifications using appropriate tools and user-provided references.
|
|
22
|
-
Skip this step for "Hello World" projects.
|
|
23
|
-
-->
|
|
24
|
-
|
|
25
|
-
- [ ] Install Required Extensions
|
|
26
|
-
<!-- ONLY install extensions provided mentioned in the get_project_setup_info. Skip this step otherwise and mark as completed. -->
|
|
27
|
-
|
|
28
|
-
- [x] Compile the Project
|
|
29
|
-
<!--
|
|
30
|
-
Verify that all previous steps have been completed.
|
|
31
|
-
Install any missing dependencies.
|
|
32
|
-
Run diagnostics and resolve any issues.
|
|
33
|
-
Check for markdown files in project folder for relevant instructions on how to do this.
|
|
34
|
-
-->
|
|
35
|
-
|
|
36
|
-
- [ ] Create and Run Task
|
|
37
|
-
<!--
|
|
38
|
-
Verify that all previous steps have been completed.
|
|
39
|
-
Check https://code.visualstudio.com/docs/debugtest/tasks to determine if the project needs a task. If so, use the create_and_run_task to create and launch a task based on package.json, README.md, and project structure.
|
|
40
|
-
Skip this step otherwise.
|
|
41
|
-
-->
|
|
42
|
-
|
|
43
|
-
- [ ] Launch the Project
|
|
44
|
-
<!--
|
|
45
|
-
Verify that all previous steps have been completed.
|
|
46
|
-
Prompt user for debug mode, launch only if confirmed.
|
|
47
|
-
-->
|
|
48
|
-
|
|
49
|
-
- [x] Ensure Documentation is Complete
|
|
50
|
-
<!--
|
|
51
|
-
Verify that all previous steps have been completed.
|
|
52
|
-
Verify that README.md and the copilot-instructions.md file in the .github directory exists and contains current project information.
|
|
53
|
-
Clean up the copilot-instructions.md file in the .github directory by removing all HTML comments.
|
|
54
|
-
-->
|
|
55
|
-
|
|
56
|
-
<!--
|
|
57
|
-
## Execution Guidelines
|
|
58
|
-
PROGRESS TRACKING:
|
|
59
|
-
- If any tools are available to manage the above todo list, use it to track progress through this checklist.
|
|
60
|
-
- After completing each step, mark it complete and add a summary.
|
|
61
|
-
- Read current todo list status before starting each new step.
|
|
62
|
-
|
|
63
|
-
COMMUNICATION RULES:
|
|
64
|
-
- Avoid verbose explanations or printing full command outputs.
|
|
65
|
-
- If a step is skipped, state that briefly (e.g. "No extensions needed").
|
|
66
|
-
- Do not explain project structure unless asked.
|
|
67
|
-
- Keep explanations concise and focused.
|
|
68
|
-
|
|
69
|
-
DEVELOPMENT RULES:
|
|
70
|
-
- Use '.' as the working directory unless user specifies otherwise.
|
|
71
|
-
- Avoid adding media or external links unless explicitly requested.
|
|
72
|
-
- Use placeholders only with a note that they should be replaced.
|
|
73
|
-
- Use VS Code API tool only for VS Code extension projects.
|
|
74
|
-
- Once the project is created, it is already opened in Visual Studio Code—do not suggest commands to open this project in vscode.
|
|
75
|
-
- If the project setup information has additional rules, follow them strictly.
|
|
76
|
-
|
|
77
|
-
FOLDER CREATION RULES:
|
|
78
|
-
- Always use the current directory as the project root.
|
|
79
|
-
- If you are running any terminal commands, use the '.' argument to ensure that the current working directory is used ALWAYS.
|
|
80
|
-
- Do not create a new folder unless the user explicitly requests it besides a .vscode folder for a tasks.json file.
|
|
81
|
-
- If any of the scaffolding commands mention that the folder name is not correct, let the user know to create a new folder with the correct name and then reopen it again in vscode.
|
|
82
|
-
|
|
83
|
-
EXTENSION INSTALLATION RULES:
|
|
84
|
-
- Only install extension specified by the get_project_setup_info tool. DO NOT INSTALL any other extensions.
|
|
85
|
-
|
|
86
|
-
PROJECT CONTENT RULES:
|
|
87
|
-
- If the user has not specified project details, assume they want a "Hello World" project as a starting point.
|
|
88
|
-
- Avoid adding links of any type (URLs, files, folders, etc.) or integrations that are not explicitly required.
|
|
89
|
-
- Avoid generating images, videos, or any other media files unless explicitly requested.
|
|
90
|
-
- If a feature is assumed but not confirmed, prompt the user for clarification before including it.
|
|
91
|
-
- If you are working on a VS Code extension, use the VS Code API tool with a query to find relevant VS Code API references and samples related to that query.
|
|
92
|
-
|
|
93
|
-
TASK COMPLETION RULES:
|
|
94
|
-
- Your task is complete when:
|
|
95
|
-
- Project is successfully scaffolded and compiled without errors
|
|
96
|
-
- copilot-instructions.md file in the .github directory exists
|
|
97
|
-
- README.md file exists and is up to date
|
|
98
|
-
- User is provided with clear instructions to debug/launch the project
|
|
99
|
-
|
|
100
|
-
Before starting a new task in the above plan, update progress in the plan.
|
|
101
|
-
-->
|
|
102
|
-
- Work through each checklist item systematically.
|
|
103
|
-
- Keep communication concise and focused.
|
|
104
|
-
- Follow development best practices.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export class DidCommMessage {
|
|
2
|
-
id = 'mock';
|
|
3
|
-
type = '';
|
|
4
|
-
body: any = {};
|
|
5
|
-
attachments?: any[];
|
|
6
|
-
thid?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type DidCommAttachment = {
|
|
10
|
-
id: string;
|
|
11
|
-
media_type: string;
|
|
12
|
-
data: any;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function prepareDidCommRequest(type: string, body: any = {}, attachments: any[] = []): DidCommMessage {
|
|
16
|
-
const message = new DidCommMessage();
|
|
17
|
-
message.type = type;
|
|
18
|
-
message.body = body;
|
|
19
|
-
message.attachments = attachments;
|
|
20
|
-
message.thid = message.id;
|
|
21
|
-
return message;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function includeVpTokenInMessage(message: DidCommMessage, vpToken: string): void {
|
|
25
|
-
message.body.vp_token = vpToken;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function includeFileInMessage(message: DidCommMessage, fileBytes: Uint8Array, mediaType: string, id: string): void {
|
|
29
|
-
if (!message.attachments) message.attachments = [];
|
|
30
|
-
message.attachments.push({ id, media_type: mediaType, data: { base64: Buffer.from(fileBytes).toString('base64') } });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getThidFromMessage(message: DidCommMessage): string {
|
|
34
|
-
return message.thid || message.id;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function getDataResults(response: DidCommMessage): any[] {
|
|
38
|
-
return response.body?.data || [];
|
|
39
|
-
}
|
package/jest.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
export default {
|
|
3
|
-
preset: 'ts-jest/presets/default-esm',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
-
moduleNameMapper: {
|
|
7
|
-
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
8
|
-
},
|
|
9
|
-
globals: {
|
|
10
|
-
'ts-jest': {
|
|
11
|
-
tsconfig: 'tsconfig.json',
|
|
12
|
-
useESM: true
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
transformIgnorePatterns: ['/node_modules/(?!gdc-common-utils-ts)'],
|
|
16
|
-
};
|