@reyaxyz/risk-sdk 0.1.4 → 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/dist/clients/modules/geofencing/index.js.map +1 -1
- package/dist/clients/modules/geofencing/types.js.map +1 -1
- package/dist/types/clients/modules/geofencing/index.d.ts.map +1 -1
- package/dist/types/clients/modules/geofencing/types.d.ts +0 -34
- package/dist/types/clients/modules/geofencing/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/clients/modules/geofencing/index.ts +2 -2
- package/src/clients/modules/geofencing/types.ts +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/geofencing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/geofencing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAqD;AAErD,gDAA0B;AAO1B;IAA8C,oCAAU;IAItD,0BAAY,YAAoB,EAAE,IAAY,EAAE,UAA0B;QACxE,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAHlB,WAAK,GAAgB,EAAE,CAAC,CAAC,oCAAoC;QAInE,KAAI,CAAC,YAAY,GAAG,YAAY,CAAC;;IACnC,CAAC;IAEK,yCAAc,GAApB,UACE,MAA4B;;;;;;wBAGtB,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;wBAClD,IAAI,YAAY,EAAE,CAAC;4BACjB,wCAAwC;4BACxC,sBAAO;oCACL,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG;iCAChC,EAAC;wBACJ,CAAC;wBAGK,GAAG,GAAG,4BAAqB,MAAM,CAAC,SAAS,oBAAU,IAAI,CAAC,YAAY,CAAE,CAAC;wBAC9D,qBAAM,eAAK,CAAC,GAAG,CAAS,GAAG,CAAC,EAAA;;wBAAvC,QAAQ,GAAG,SAA4B;wBACvC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC;wBAE7B,6CAA6C;wBAC7C,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;wBAEtC,sBAAO;gCACL,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG;6BAC1B,EAAC;;;;KACH;IACH,uBAAC;AAAD,CAAC,AAjCD,CAA8C,mBAAU,GAiCvD","sourcesContent":["import { RestClient, IpInfo } from '@reyaxyz/common';\nimport { CheckIPAddressParams, CheckIPAddressResult } from './types';\nimport axios from 'axios';\n\n// Define a cache interface\ninterface IpInfoCache {\n [key: string]: IpInfo;\n}\n\nexport default class GeofencingClient extends RestClient {\n readonly ipInfoApiKey: string;\n private cache: IpInfoCache = {}; // Cache for storing IP info results\n\n constructor(ipInfoApiKey: string, host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n this.ipInfoApiKey = ipInfoApiKey;\n }\n\n async checkIPAddress(\n params: CheckIPAddressParams,\n ): Promise<CheckIPAddressResult> {\n // Check if we already have the result in cache\n const cachedResult = this.cache[params.ipAddress];\n if (cachedResult) {\n // Return the cached result if available\n return {\n isVpn: cachedResult.privacy.vpn,\n };\n }\n\n // If the result is not in cache, make a request to ipinfo\n const url = `https://ipinfo.io/${params.ipAddress}?token=${this.ipInfoApiKey}`;\n const response = await axios.get<IpInfo>(url);\n const ipInfo = response.data;\n\n // Store the result in cache before returning\n this.cache[params.ipAddress] = ipInfo;\n\n return {\n isVpn: ipInfo.privacy.vpn,\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/geofencing/types.ts"],"names":[],"mappings":"","sourcesContent":["export type CheckIPAddressParams = {\n ipAddress: string;\n};\n\nexport type CheckIPAddressResult = {\n isVpn: boolean;\n};\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/geofencing/types.ts"],"names":[],"mappings":"","sourcesContent":["export type CheckIPAddressParams = {\n ipAddress: string;\n};\n\nexport type CheckIPAddressResult = {\n isVpn: boolean;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/geofencing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/geofencing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQrE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU;IACtD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,KAAK,CAAmB;gBAEpB,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAKpE,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;CAsBjC"}
|
|
@@ -4,38 +4,4 @@ export type CheckIPAddressParams = {
|
|
|
4
4
|
export type CheckIPAddressResult = {
|
|
5
5
|
isVpn: boolean;
|
|
6
6
|
};
|
|
7
|
-
export type IpInfo = {
|
|
8
|
-
ip: string;
|
|
9
|
-
hostname: string;
|
|
10
|
-
city: string;
|
|
11
|
-
region: string;
|
|
12
|
-
country: string;
|
|
13
|
-
loc: string;
|
|
14
|
-
org: string;
|
|
15
|
-
postal: string;
|
|
16
|
-
timezone: string;
|
|
17
|
-
privacy: {
|
|
18
|
-
vpn: boolean;
|
|
19
|
-
proxy: boolean;
|
|
20
|
-
tor: boolean;
|
|
21
|
-
relay: boolean;
|
|
22
|
-
hosting: boolean;
|
|
23
|
-
service: string;
|
|
24
|
-
};
|
|
25
|
-
countryCode: string;
|
|
26
|
-
countryFlag: {
|
|
27
|
-
emoji: string;
|
|
28
|
-
unicode: string;
|
|
29
|
-
};
|
|
30
|
-
countryFlagURL: string;
|
|
31
|
-
countryCurrency: {
|
|
32
|
-
code: string;
|
|
33
|
-
symbol: string;
|
|
34
|
-
};
|
|
35
|
-
continent: {
|
|
36
|
-
code: string;
|
|
37
|
-
name: string;
|
|
38
|
-
};
|
|
39
|
-
isEU: boolean;
|
|
40
|
-
};
|
|
41
7
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/geofencing/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/geofencing/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/risk-sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@reyaxyz/common": "0.
|
|
36
|
+
"@reyaxyz/common": "0.64.1",
|
|
37
37
|
"axios": "^1.6.2"
|
|
38
38
|
},
|
|
39
39
|
"packageManager": "pnpm@8.10.4",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "be61ef3e7742653a7ca98b984f95881e3337a8b8"
|
|
41
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { CheckIPAddressParams, CheckIPAddressResult
|
|
1
|
+
import { RestClient, IpInfo } from '@reyaxyz/common';
|
|
2
|
+
import { CheckIPAddressParams, CheckIPAddressResult } from './types';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
|
|
5
5
|
// Define a cache interface
|
|
@@ -5,38 +5,3 @@ export type CheckIPAddressParams = {
|
|
|
5
5
|
export type CheckIPAddressResult = {
|
|
6
6
|
isVpn: boolean;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
export type IpInfo = {
|
|
10
|
-
ip: string;
|
|
11
|
-
hostname: string;
|
|
12
|
-
city: string;
|
|
13
|
-
region: string;
|
|
14
|
-
country: string;
|
|
15
|
-
loc: string;
|
|
16
|
-
org: string;
|
|
17
|
-
postal: string;
|
|
18
|
-
timezone: string;
|
|
19
|
-
privacy: {
|
|
20
|
-
vpn: boolean;
|
|
21
|
-
proxy: boolean;
|
|
22
|
-
tor: boolean;
|
|
23
|
-
relay: boolean;
|
|
24
|
-
hosting: boolean;
|
|
25
|
-
service: string;
|
|
26
|
-
};
|
|
27
|
-
countryCode: string;
|
|
28
|
-
countryFlag: {
|
|
29
|
-
emoji: string;
|
|
30
|
-
unicode: string;
|
|
31
|
-
};
|
|
32
|
-
countryFlagURL: string;
|
|
33
|
-
countryCurrency: {
|
|
34
|
-
code: string;
|
|
35
|
-
symbol: string;
|
|
36
|
-
};
|
|
37
|
-
continent: {
|
|
38
|
-
code: string;
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
isEU: boolean;
|
|
42
|
-
};
|