@dalmore/api-contracts 1.0.8 → 1.0.9
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/index.mjs
CHANGED
|
@@ -5,10 +5,6 @@ import { z } from 'zod';
|
|
|
5
5
|
import { HttpStatus } from '@nestjs/common';
|
|
6
6
|
import parsePhoneNumberFromString from 'libphonenumber-js';
|
|
7
7
|
import { ok, err } from 'neverthrow';
|
|
8
|
-
import 'bcrypt';
|
|
9
|
-
import 'crypto';
|
|
10
|
-
import 'currency-codes';
|
|
11
|
-
import 'typeorm';
|
|
12
8
|
|
|
13
9
|
// src/contracts/clients/index.ts
|
|
14
10
|
extendZodWithOpenApi(z);
|
|
@@ -985,10 +981,10 @@ var LogContextZod = z.object({
|
|
|
985
981
|
"internal-error": {
|
|
986
982
|
status: HttpStatus.INTERNAL_SERVER_ERROR}
|
|
987
983
|
});
|
|
988
|
-
var SortOrder = /* @__PURE__ */ ((
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
return
|
|
984
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
985
|
+
SortOrder2["ASC"] = "ASC";
|
|
986
|
+
SortOrder2["DESC"] = "DESC";
|
|
987
|
+
return SortOrder2;
|
|
992
988
|
})(SortOrder || {});
|
|
993
989
|
var AMLProvider = /* @__PURE__ */ ((AMLProvider2) => {
|
|
994
990
|
AMLProvider2["COMPLY_ADVANTAGE"] = "ComplyAdvantage";
|
|
@@ -1939,9 +1935,9 @@ BLACK_LIST_COUNTRIES.map((c18) => c18.code);
|
|
|
1939
1935
|
var PhoneZodSchema = z.string().nullable().transform((phone) => {
|
|
1940
1936
|
if (phone === null || phone === "") return ok(null);
|
|
1941
1937
|
let result;
|
|
1942
|
-
for (const
|
|
1938
|
+
for (const code of CountryCodes) {
|
|
1943
1939
|
if (result && result.isOk()) break;
|
|
1944
|
-
result = normalizePhoneNumber(phone,
|
|
1940
|
+
result = normalizePhoneNumber(phone, code);
|
|
1945
1941
|
}
|
|
1946
1942
|
return result;
|
|
1947
1943
|
}).refine((result) => result.isOk(), { message: "phone is not valid" }).transform((result) => {
|
|
@@ -2215,7 +2211,7 @@ var isBase64 = (v) => {
|
|
|
2215
2211
|
}
|
|
2216
2212
|
try {
|
|
2217
2213
|
return btoa(atob(v)) === v;
|
|
2218
|
-
} catch (
|
|
2214
|
+
} catch (err2) {
|
|
2219
2215
|
return false;
|
|
2220
2216
|
}
|
|
2221
2217
|
};
|
|
@@ -9958,89 +9954,12 @@ var assetsContract = c4.router(
|
|
|
9958
9954
|
pathPrefix: "assets"
|
|
9959
9955
|
}
|
|
9960
9956
|
);
|
|
9961
|
-
var ComplyAdvantageStatus = /* @__PURE__ */ ((ComplyAdvantageStatus2) => {
|
|
9962
|
-
ComplyAdvantageStatus2["FALSE_POSITIVE"] = "false_positive";
|
|
9963
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE"] = "true_positive";
|
|
9964
|
-
ComplyAdvantageStatus2["POTENTIAL_MATCH"] = "potential_match";
|
|
9965
|
-
ComplyAdvantageStatus2["NO_MATCH"] = "no_match";
|
|
9966
|
-
ComplyAdvantageStatus2["UNKNOWN"] = "unknown";
|
|
9967
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE_APPROVE"] = "true_positive_approve";
|
|
9968
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE_REJECT"] = "true_positive_reject";
|
|
9969
|
-
return ComplyAdvantageStatus2;
|
|
9970
|
-
})(ComplyAdvantageStatus || {});
|
|
9971
|
-
z.object({
|
|
9972
|
-
status: z.enum(["success", "failure"]),
|
|
9973
|
-
content: z.object({
|
|
9974
|
-
data: z.object({
|
|
9975
|
-
match_status: z.nativeEnum(ComplyAdvantageStatus)
|
|
9976
|
-
})
|
|
9977
|
-
}),
|
|
9978
|
-
message: z.string().optional()
|
|
9979
|
-
});
|
|
9980
|
-
|
|
9981
|
-
// src/common/helpers/index.ts
|
|
9982
|
-
var authHeader = {
|
|
9983
|
-
Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
|
|
9984
|
-
};
|
|
9985
|
-
var generateCurlExample = (method, path, options) => {
|
|
9986
|
-
const baseUrl = "https://dalmore-client-portal-api-prod.onrender.com/api/v1";
|
|
9987
|
-
let curl = `curl -X ${method.toUpperCase()} '${baseUrl}${path}`;
|
|
9988
|
-
if (options.query) {
|
|
9989
|
-
const queryString = new URLSearchParams(options.query).toString();
|
|
9990
|
-
curl += `?${queryString}`;
|
|
9991
|
-
}
|
|
9992
|
-
curl += "'";
|
|
9993
|
-
if (options.headers) {
|
|
9994
|
-
Object.entries(options.headers).forEach(([key, value]) => {
|
|
9995
|
-
curl += ` \\
|
|
9996
|
-
--header '${key}: ${value}'`;
|
|
9997
|
-
});
|
|
9998
|
-
}
|
|
9999
|
-
if (options.body) {
|
|
10000
|
-
curl += ` \\
|
|
10001
|
-
--header 'Content-Type: application/json'`;
|
|
10002
|
-
curl += ` \\
|
|
10003
|
-
--data '${JSON.stringify(options.body)}'`;
|
|
10004
|
-
}
|
|
10005
|
-
if (options.formData) {
|
|
10006
|
-
Object.entries(options.formData).forEach(([key, value]) => {
|
|
10007
|
-
curl += ` \\
|
|
10008
|
-
--form '${key}=${value}'`;
|
|
10009
|
-
});
|
|
10010
|
-
}
|
|
10011
|
-
return curl;
|
|
10012
|
-
};
|
|
10013
|
-
var generateApiDescription = (summary, method, path, options) => {
|
|
10014
|
-
const curlExample = generateCurlExample(method, path, options);
|
|
10015
|
-
return `${summary}
|
|
10016
|
-
|
|
10017
|
-
### Example curl request
|
|
10018
|
-
|
|
10019
|
-
\`\`\`bash
|
|
10020
|
-
${curlExample}
|
|
10021
|
-
\`\`\``;
|
|
10022
|
-
};
|
|
10023
|
-
|
|
10024
|
-
// src/contracts/clients/files/index.ts
|
|
10025
9957
|
var c5 = initContract();
|
|
10026
9958
|
var filesContract = c5.router(
|
|
10027
9959
|
{
|
|
10028
9960
|
postFile: {
|
|
10029
9961
|
summary: "Upload a file",
|
|
10030
|
-
description:
|
|
10031
|
-
"Upload a file to the system. CLIENT portal only supports uploads to INDIVIDUALS.",
|
|
10032
|
-
"POST",
|
|
10033
|
-
"/files",
|
|
10034
|
-
{
|
|
10035
|
-
query: {
|
|
10036
|
-
name: "test",
|
|
10037
|
-
category: "application",
|
|
10038
|
-
targetId: "individual_01j5tkg6k2fygr0x06fegt27aj"
|
|
10039
|
-
},
|
|
10040
|
-
headers: authHeader,
|
|
10041
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' }
|
|
10042
|
-
}
|
|
10043
|
-
),
|
|
9962
|
+
description: "Upload a file to the system. CLIENT portal only supports uploads to INDIVIDUALS.",
|
|
10044
9963
|
method: "POST",
|
|
10045
9964
|
path: "",
|
|
10046
9965
|
query: ClientPostFileQueryParams,
|
|
@@ -10656,20 +10575,7 @@ var filesPublicContract = c12.router(
|
|
|
10656
10575
|
{
|
|
10657
10576
|
postFilePublic: {
|
|
10658
10577
|
summary: "Upload a public file",
|
|
10659
|
-
description:
|
|
10660
|
-
"Upload a public file to the system.",
|
|
10661
|
-
"POST",
|
|
10662
|
-
"/files-public",
|
|
10663
|
-
{
|
|
10664
|
-
query: {
|
|
10665
|
-
name: "test",
|
|
10666
|
-
category: "application",
|
|
10667
|
-
targetId: "trade_01j5tkg6k2fygr0x06fegt27aj"
|
|
10668
|
-
},
|
|
10669
|
-
headers: authHeader,
|
|
10670
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' }
|
|
10671
|
-
}
|
|
10672
|
-
),
|
|
10578
|
+
description: "Upload a public file to the system.",
|
|
10673
10579
|
method: "POST",
|
|
10674
10580
|
path: "",
|
|
10675
10581
|
query: PostFileQueryParams,
|
package/package.json
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
UnprocessableError,
|
|
17
17
|
} from '../../../common/types';
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import { authHeader, generateApiDescription } from '../../../common/helpers';
|
|
20
19
|
|
|
21
20
|
const c = initContract();
|
|
22
21
|
|
|
@@ -24,20 +23,8 @@ export const filesContract = c.router(
|
|
|
24
23
|
{
|
|
25
24
|
postFile: {
|
|
26
25
|
summary: 'Upload a file',
|
|
27
|
-
description:
|
|
26
|
+
description:
|
|
28
27
|
'Upload a file to the system. CLIENT portal only supports uploads to INDIVIDUALS.',
|
|
29
|
-
'POST',
|
|
30
|
-
'/files',
|
|
31
|
-
{
|
|
32
|
-
query: {
|
|
33
|
-
name: 'test',
|
|
34
|
-
category: 'application',
|
|
35
|
-
targetId: 'individual_01j5tkg6k2fygr0x06fegt27aj',
|
|
36
|
-
},
|
|
37
|
-
headers: authHeader,
|
|
38
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' },
|
|
39
|
-
},
|
|
40
|
-
),
|
|
41
28
|
method: 'POST',
|
|
42
29
|
path: '',
|
|
43
30
|
query: ClientPostFileQueryParams,
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
UnprocessableError,
|
|
17
17
|
} from '../../../common/types';
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import { authHeader, generateApiDescription } from '../../../common/helpers';
|
|
20
19
|
|
|
21
20
|
const c = initContract();
|
|
22
21
|
|
|
@@ -24,20 +23,7 @@ export const filesPublicContract = c.router(
|
|
|
24
23
|
{
|
|
25
24
|
postFilePublic: {
|
|
26
25
|
summary: 'Upload a public file',
|
|
27
|
-
description:
|
|
28
|
-
'Upload a public file to the system.',
|
|
29
|
-
'POST',
|
|
30
|
-
'/files-public',
|
|
31
|
-
{
|
|
32
|
-
query: {
|
|
33
|
-
name: 'test',
|
|
34
|
-
category: 'application',
|
|
35
|
-
targetId: 'trade_01j5tkg6k2fygr0x06fegt27aj',
|
|
36
|
-
},
|
|
37
|
-
headers: authHeader,
|
|
38
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' },
|
|
39
|
-
},
|
|
40
|
-
),
|
|
26
|
+
description: 'Upload a public file to the system.',
|
|
41
27
|
method: 'POST',
|
|
42
28
|
path: '',
|
|
43
29
|
query: PostFileQueryParams,
|