@credovo/shared-types 1.0.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 +67 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +12 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @credovo/shared-types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types for the Credovo platform, used by both backend services and the frontend webapp.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### From GitHub Packages
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @credovo/shared-types --registry=https://npm.pkg.github.com
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### From npm (if published publicly)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @credovo/shared-types
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { KYCRequest, KYCResponse, KYBRequest, KYBResponse } from '@credovo/shared-types';
|
|
23
|
+
|
|
24
|
+
const kycRequest: KYCRequest = {
|
|
25
|
+
applicationId: 'app-123',
|
|
26
|
+
userId: 'user-456',
|
|
27
|
+
type: 'individual',
|
|
28
|
+
data: {
|
|
29
|
+
firstName: 'John',
|
|
30
|
+
lastName: 'Doe',
|
|
31
|
+
dateOfBirth: '1990-01-01'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Types Included
|
|
37
|
+
|
|
38
|
+
- `Application` - Application data structure
|
|
39
|
+
- `ApplicationStatus` - Application status enum
|
|
40
|
+
- `KYCRequest` / `KYCResponse` - KYC verification types
|
|
41
|
+
- `KYBRequest` / `KYBResponse` - KYB verification types
|
|
42
|
+
- `ConnectorRequest` / `ConnectorResponse` - Connector service types
|
|
43
|
+
- `Address` - Address structure
|
|
44
|
+
- `CheckResult` - Verification check results
|
|
45
|
+
- `ApiError` - API error structure
|
|
46
|
+
|
|
47
|
+
## Publishing
|
|
48
|
+
|
|
49
|
+
This package is published from the `credovo-platform` repository:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd shared/types
|
|
53
|
+
npm install
|
|
54
|
+
npm run build
|
|
55
|
+
npm publish --registry=https://npm.pkg.github.com
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or use the script:
|
|
59
|
+
|
|
60
|
+
```powershell
|
|
61
|
+
.\scripts\publish-shared-types.ps1
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Versioning
|
|
65
|
+
|
|
66
|
+
Follows semantic versioning. Update version in `package.json` before publishing.
|
|
67
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export interface Application {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
status: ApplicationStatus;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
updatedAt: Date;
|
|
7
|
+
data: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare enum ApplicationStatus {
|
|
10
|
+
PENDING = "pending",
|
|
11
|
+
IN_PROGRESS = "in_progress",
|
|
12
|
+
COMPLETED = "completed",
|
|
13
|
+
REJECTED = "rejected",
|
|
14
|
+
FAILED = "failed"
|
|
15
|
+
}
|
|
16
|
+
export interface KYCRequest {
|
|
17
|
+
applicationId: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
type: 'individual' | 'company';
|
|
20
|
+
data: {
|
|
21
|
+
firstName?: string;
|
|
22
|
+
lastName?: string;
|
|
23
|
+
dateOfBirth?: string;
|
|
24
|
+
address?: Address;
|
|
25
|
+
companyNumber?: string;
|
|
26
|
+
companyName?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface Address {
|
|
30
|
+
line1: string;
|
|
31
|
+
line2?: string;
|
|
32
|
+
city: string;
|
|
33
|
+
postcode: string;
|
|
34
|
+
country: string;
|
|
35
|
+
}
|
|
36
|
+
export interface KYCResponse {
|
|
37
|
+
applicationId: string;
|
|
38
|
+
status: 'pending' | 'approved' | 'rejected' | 'requires_review';
|
|
39
|
+
provider: string;
|
|
40
|
+
result?: {
|
|
41
|
+
score?: number;
|
|
42
|
+
checks?: CheckResult[];
|
|
43
|
+
metadata?: Record<string, any>;
|
|
44
|
+
};
|
|
45
|
+
timestamp: Date;
|
|
46
|
+
}
|
|
47
|
+
export interface CheckResult {
|
|
48
|
+
type: string;
|
|
49
|
+
status: 'pass' | 'fail' | 'warning';
|
|
50
|
+
message?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface KYBRequest {
|
|
53
|
+
applicationId: string;
|
|
54
|
+
companyNumber: string;
|
|
55
|
+
companyName?: string;
|
|
56
|
+
country?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface KYBResponse {
|
|
59
|
+
applicationId: string;
|
|
60
|
+
companyNumber: string;
|
|
61
|
+
status: 'verified' | 'pending' | 'not_found' | 'error';
|
|
62
|
+
data?: {
|
|
63
|
+
companyName: string;
|
|
64
|
+
status: string;
|
|
65
|
+
incorporationDate?: string;
|
|
66
|
+
address?: Address;
|
|
67
|
+
officers?: any[];
|
|
68
|
+
verificationLevel?: string;
|
|
69
|
+
checks?: any[];
|
|
70
|
+
metadata?: any;
|
|
71
|
+
};
|
|
72
|
+
timestamp: Date;
|
|
73
|
+
}
|
|
74
|
+
export interface ConnectorRequest {
|
|
75
|
+
provider: string;
|
|
76
|
+
endpoint: string;
|
|
77
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
78
|
+
headers?: Record<string, string>;
|
|
79
|
+
body?: any;
|
|
80
|
+
retry?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface ConnectorResponse<T = any> {
|
|
83
|
+
success: boolean;
|
|
84
|
+
data?: T;
|
|
85
|
+
error?: {
|
|
86
|
+
code: string;
|
|
87
|
+
message: string;
|
|
88
|
+
details?: any;
|
|
89
|
+
};
|
|
90
|
+
metadata?: {
|
|
91
|
+
provider: string;
|
|
92
|
+
latency: number;
|
|
93
|
+
retries?: number;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface ApiError {
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
statusCode: number;
|
|
100
|
+
details?: any;
|
|
101
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Shared types across all services
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ApplicationStatus = void 0;
|
|
5
|
+
var ApplicationStatus;
|
|
6
|
+
(function (ApplicationStatus) {
|
|
7
|
+
ApplicationStatus["PENDING"] = "pending";
|
|
8
|
+
ApplicationStatus["IN_PROGRESS"] = "in_progress";
|
|
9
|
+
ApplicationStatus["COMPLETED"] = "completed";
|
|
10
|
+
ApplicationStatus["REJECTED"] = "rejected";
|
|
11
|
+
ApplicationStatus["FAILED"] = "failed";
|
|
12
|
+
})(ApplicationStatus || (exports.ApplicationStatus = ApplicationStatus = {}));
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@credovo/shared-types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared TypeScript types for Credovo platform",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/AmanorsElliot/credovo-platform.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"credovo",
|
|
24
|
+
"types",
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "UNLICENSED",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
}
|
|
32
|
+
}
|