@sphereon/ssi-sdk.anomaly-detection 0.33.1-feature.vcdm2.4 → 0.33.1-feature.vcdm2.tsup.19
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/index.cjs +8477 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +34 -4
- package/dist/index.js +8470 -7
- package/dist/index.js.map +1 -1
- package/package.json +23 -13
- package/src/agent/AnomalyDetection.ts +14 -16
- package/dist/agent/AnomalyDetection.d.ts +0 -21
- package/dist/agent/AnomalyDetection.d.ts.map +0 -1
- package/dist/agent/AnomalyDetection.js +0 -73
- package/dist/agent/AnomalyDetection.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/ssi-sdk.anomaly-detection.d.ts +0 -47
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/IAnomalyDetection.d.ts +0 -13
- package/dist/types/IAnomalyDetection.d.ts.map +0 -1
- package/dist/types/IAnomalyDetection.js +0 -2
- package/dist/types/IAnomalyDetection.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.anomaly-detection",
|
|
3
|
-
"version": "0.33.1-feature.vcdm2.
|
|
3
|
+
"version": "0.33.1-feature.vcdm2.tsup.19+db508b44",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
7
19
|
"veramo": {
|
|
8
20
|
"pluginInterfaces": {
|
|
9
21
|
"IAnomalyDetection": "./src/types/IAnomalyDetection.ts"
|
|
10
22
|
}
|
|
11
23
|
},
|
|
12
24
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"build:clean": "tsc --build --clean && tsc --build",
|
|
25
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
|
|
15
26
|
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
|
|
16
27
|
},
|
|
17
28
|
"dependencies": {
|
|
18
|
-
"@sphereon/ssi-sdk.geolocation-store": "0.33.1-feature.vcdm2.
|
|
19
|
-
"@sphereon/ssi-sdk.kv-store-temp": "0.33.1-feature.vcdm2.
|
|
29
|
+
"@sphereon/ssi-sdk.geolocation-store": "^0.33.1-feature.vcdm2.tsup.19+db508b44",
|
|
30
|
+
"@sphereon/ssi-sdk.kv-store-temp": "^0.33.1-feature.vcdm2.tsup.19+db508b44",
|
|
20
31
|
"cross-fetch": "^3.1.8",
|
|
21
32
|
"debug": "^4.3.5",
|
|
22
33
|
"dns-query": "^0.11.2",
|
|
23
34
|
"mmdb-lib": "^2.1.1",
|
|
24
|
-
"typeorm": "^0.3.
|
|
35
|
+
"typeorm": "^0.3.22"
|
|
25
36
|
},
|
|
26
37
|
"devDependencies": {
|
|
27
|
-
"@sphereon/ssi-sdk.agent-config": "0.33.1-feature.vcdm2.
|
|
38
|
+
"@sphereon/ssi-sdk.agent-config": "^0.33.1-feature.vcdm2.tsup.19+db508b44",
|
|
28
39
|
"@types/node": "^20.17.1",
|
|
29
40
|
"@veramo/remote-client": "4.2.0",
|
|
30
41
|
"@veramo/remote-server": "4.2.0"
|
|
31
42
|
},
|
|
32
43
|
"files": [
|
|
33
|
-
"dist
|
|
34
|
-
"src
|
|
44
|
+
"dist",
|
|
45
|
+
"src",
|
|
35
46
|
"README.md",
|
|
36
47
|
"plugin.schema.json",
|
|
37
48
|
"LICENSE"
|
|
@@ -49,6 +60,5 @@
|
|
|
49
60
|
"Veramo",
|
|
50
61
|
"Anomaly Detection"
|
|
51
62
|
],
|
|
52
|
-
"
|
|
53
|
-
"gitHead": "9f634bdb714061141e277508c124b08d626f6036"
|
|
63
|
+
"gitHead": "db508b447fb1f769700f1d5e7cd8196653f4f794"
|
|
54
64
|
}
|
|
@@ -12,13 +12,13 @@ export const anomalyDetectionMethods: Array<string> = ['lookupLocation']
|
|
|
12
12
|
*/
|
|
13
13
|
export class AnomalyDetection implements IAgentPlugin {
|
|
14
14
|
readonly schema = schema.IAnomalyDetection
|
|
15
|
-
private readonly db:
|
|
15
|
+
private readonly db: Uint8Array
|
|
16
16
|
private readonly dnsLookup?: DnsLookupFn
|
|
17
17
|
readonly methods: IAnomalyDetection = {
|
|
18
18
|
anomalyDetectionLookupLocation: this.anomalyDetectionLookupLocation.bind(this),
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
constructor(args: { geoIpDB:
|
|
21
|
+
constructor(args: { geoIpDB: Uint8Array; dnsLookupCallback?: DnsLookupFn }) {
|
|
22
22
|
const { geoIpDB, dnsLookupCallback } = { ...args }
|
|
23
23
|
if (geoIpDB === undefined || geoIpDB === null) {
|
|
24
24
|
throw new Error('The geoIpDB argument is required')
|
|
@@ -32,7 +32,7 @@ export class AnomalyDetection implements IAgentPlugin {
|
|
|
32
32
|
context: IRequiredContext,
|
|
33
33
|
): Promise<AnomalyDetectionLookupLocationResult> {
|
|
34
34
|
const { ipOrHostname, storeId, namespace } = { ...args }
|
|
35
|
-
const reader = new Reader<CountryResponse>(this.db)
|
|
35
|
+
const reader = new Reader<CountryResponse>(Buffer.from(this.db))
|
|
36
36
|
const ipv4Reg = '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
|
|
37
37
|
const ipv6Reg =
|
|
38
38
|
'(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'
|
|
@@ -65,25 +65,23 @@ export class AnomalyDetection implements IAgentPlugin {
|
|
|
65
65
|
return this.dnsLookup(hostname)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// Fallback to Node
|
|
69
|
-
let dns
|
|
68
|
+
// Fallback to Node dns
|
|
70
69
|
try {
|
|
71
|
-
dns =
|
|
70
|
+
const dns = await import('dns')
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
dns.lookup(hostname, (error: NodeJS.ErrnoException | null, address: string, family: number) => {
|
|
73
|
+
if (error) {
|
|
74
|
+
reject(error)
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
resolve(address)
|
|
78
|
+
})
|
|
79
|
+
})
|
|
72
80
|
} catch (e) {
|
|
73
81
|
console.error(e)
|
|
74
82
|
throw new Error(
|
|
75
83
|
`DNS resolution not available on this platform, use the dnsLookupCallback in the AnomalyDetection constructor to implement DNS resolution for your platform.\r\n${e.message}`,
|
|
76
84
|
)
|
|
77
85
|
}
|
|
78
|
-
|
|
79
|
-
return new Promise((resolve, reject) => {
|
|
80
|
-
dns.lookup(hostname, (error: NodeJS.ErrnoException | null, address: string, family: number) => {
|
|
81
|
-
if (error) {
|
|
82
|
-
reject(error)
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
resolve(address)
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
86
|
}
|
|
89
87
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
2
|
-
import { IAnomalyDetection } from '../index';
|
|
3
|
-
type DnsLookupFn = (hostname: string) => Promise<string>;
|
|
4
|
-
export declare const anomalyDetectionMethods: Array<string>;
|
|
5
|
-
/**
|
|
6
|
-
* {@inheritDoc IAnomalyDetection}
|
|
7
|
-
*/
|
|
8
|
-
export declare class AnomalyDetection implements IAgentPlugin {
|
|
9
|
-
readonly schema: any;
|
|
10
|
-
private readonly db;
|
|
11
|
-
private readonly dnsLookup?;
|
|
12
|
-
readonly methods: IAnomalyDetection;
|
|
13
|
-
constructor(args: {
|
|
14
|
-
geoIpDB: Buffer;
|
|
15
|
-
dnsLookupCallback?: DnsLookupFn;
|
|
16
|
-
});
|
|
17
|
-
private anomalyDetectionLookupLocation;
|
|
18
|
-
private resolveDns;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=AnomalyDetection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnomalyDetection.d.ts","sourceRoot":"","sources":["../../src/agent/AnomalyDetection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAA4E,iBAAiB,EAA4B,MAAM,UAAU,CAAA;AAEhJ,KAAK,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAExD,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAsB,CAAA;AAExE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,MAAM,MAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAa;IACxC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAElC;gBAEW,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,WAAW,CAAA;KAAE;YASxD,8BAA8B;YAiC9B,UAAU;CA0BzB"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config';
|
|
2
|
-
import { Reader } from 'mmdb-lib';
|
|
3
|
-
import { schema } from '../index';
|
|
4
|
-
export const anomalyDetectionMethods = ['lookupLocation'];
|
|
5
|
-
/**
|
|
6
|
-
* {@inheritDoc IAnomalyDetection}
|
|
7
|
-
*/
|
|
8
|
-
export class AnomalyDetection {
|
|
9
|
-
schema = schema.IAnomalyDetection;
|
|
10
|
-
db;
|
|
11
|
-
dnsLookup;
|
|
12
|
-
methods = {
|
|
13
|
-
anomalyDetectionLookupLocation: this.anomalyDetectionLookupLocation.bind(this),
|
|
14
|
-
};
|
|
15
|
-
constructor(args) {
|
|
16
|
-
const { geoIpDB, dnsLookupCallback } = { ...args };
|
|
17
|
-
if (geoIpDB === undefined || geoIpDB === null) {
|
|
18
|
-
throw new Error('The geoIpDB argument is required');
|
|
19
|
-
}
|
|
20
|
-
this.db = geoIpDB;
|
|
21
|
-
this.dnsLookup = dnsLookupCallback;
|
|
22
|
-
}
|
|
23
|
-
async anomalyDetectionLookupLocation(args, context) {
|
|
24
|
-
const { ipOrHostname, storeId, namespace } = { ...args };
|
|
25
|
-
const reader = new Reader(this.db);
|
|
26
|
-
const ipv4Reg = '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
|
|
27
|
-
const ipv6Reg = '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))';
|
|
28
|
-
let result;
|
|
29
|
-
if (!new RegExp(ipv4Reg).test(ipOrHostname) && !new RegExp(ipv6Reg).test(ipOrHostname)) {
|
|
30
|
-
const ip = await this.resolveDns(ipOrHostname);
|
|
31
|
-
result = reader.get(ip);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
result = reader.get(ipOrHostname);
|
|
35
|
-
}
|
|
36
|
-
const lookupResult = {
|
|
37
|
-
continent: result?.continent?.code,
|
|
38
|
-
country: result?.country?.iso_code,
|
|
39
|
-
};
|
|
40
|
-
if (contextHasPlugin(context, 'geolocationStorePersistLocation'))
|
|
41
|
-
await context.agent.geolocationStorePersistLocation({
|
|
42
|
-
namespace,
|
|
43
|
-
storeId,
|
|
44
|
-
ipOrHostname,
|
|
45
|
-
locationArgs: lookupResult,
|
|
46
|
-
});
|
|
47
|
-
return Promise.resolve(lookupResult);
|
|
48
|
-
}
|
|
49
|
-
async resolveDns(hostname) {
|
|
50
|
-
if (this.dnsLookup) {
|
|
51
|
-
return this.dnsLookup(hostname);
|
|
52
|
-
}
|
|
53
|
-
// Fallback to Node.js dns
|
|
54
|
-
let dns;
|
|
55
|
-
try {
|
|
56
|
-
dns = eval('require("dns")');
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
console.error(e);
|
|
60
|
-
throw new Error(`DNS resolution not available on this platform, use the dnsLookupCallback in the AnomalyDetection constructor to implement DNS resolution for your platform.\r\n${e.message}`);
|
|
61
|
-
}
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
dns.lookup(hostname, (error, address, family) => {
|
|
64
|
-
if (error) {
|
|
65
|
-
reject(error);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
resolve(address);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=AnomalyDetection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnomalyDetection.js","sourceRoot":"","sources":["../../src/agent/AnomalyDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEjE,OAAO,EAAmB,MAAM,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAiH,MAAM,EAAE,MAAM,UAAU,CAAA;AAIhJ,MAAM,CAAC,MAAM,uBAAuB,GAAkB,CAAC,gBAAgB,CAAC,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 -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AACpF,cAAc,2BAA2B,CAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { GeolocationStoreArgs } from '@sphereon/ssi-sdk.geolocation-store';
|
|
2
|
-
import { IAgentContext } from '@veramo/core';
|
|
3
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
4
|
-
import { IGeolocationStore } from '@sphereon/ssi-sdk.geolocation-store';
|
|
5
|
-
import { IPluginMethodMap } from '@veramo/core';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* {@inheritDoc IAnomalyDetection}
|
|
9
|
-
*/
|
|
10
|
-
export declare class AnomalyDetection implements IAgentPlugin {
|
|
11
|
-
readonly schema: any;
|
|
12
|
-
private readonly db;
|
|
13
|
-
private readonly dnsLookup?;
|
|
14
|
-
readonly methods: IAnomalyDetection;
|
|
15
|
-
constructor(args: {
|
|
16
|
-
geoIpDB: Buffer;
|
|
17
|
-
dnsLookupCallback?: DnsLookupFn;
|
|
18
|
-
});
|
|
19
|
-
private anomalyDetectionLookupLocation;
|
|
20
|
-
private resolveDns;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export declare type AnomalyDetectionLookupLocationArgs = PartialBy<GeolocationStoreArgs, 'storeId' | 'namespace'>;
|
|
24
|
-
|
|
25
|
-
export declare type AnomalyDetectionLookupLocationResult = {
|
|
26
|
-
continent?: string;
|
|
27
|
-
country?: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export declare const anomalyDetectionMethods: Array<string>;
|
|
31
|
-
|
|
32
|
-
declare type DnsLookupFn = (hostname: string) => Promise<string>;
|
|
33
|
-
|
|
34
|
-
export declare interface IAnomalyDetection extends IPluginMethodMap {
|
|
35
|
-
anomalyDetectionLookupLocation(args: AnomalyDetectionLookupLocationArgs, context: IRequiredContext): Promise<AnomalyDetectionLookupLocationResult>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export declare type IRequiredContext = IAgentContext<IGeolocationStore>;
|
|
39
|
-
|
|
40
|
-
export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
export declare const schema: any;
|
|
46
|
-
|
|
47
|
-
export { }
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.52.1"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, IPluginMethodMap } from '@veramo/core';
|
|
2
|
-
import { GeolocationStoreArgs, IGeolocationStore } from '@sphereon/ssi-sdk.geolocation-store';
|
|
3
|
-
export interface IAnomalyDetection extends IPluginMethodMap {
|
|
4
|
-
anomalyDetectionLookupLocation(args: AnomalyDetectionLookupLocationArgs, context: IRequiredContext): Promise<AnomalyDetectionLookupLocationResult>;
|
|
5
|
-
}
|
|
6
|
-
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
|
-
export type AnomalyDetectionLookupLocationArgs = PartialBy<GeolocationStoreArgs, 'storeId' | 'namespace'>;
|
|
8
|
-
export type AnomalyDetectionLookupLocationResult = {
|
|
9
|
-
continent?: string;
|
|
10
|
-
country?: string;
|
|
11
|
-
};
|
|
12
|
-
export type IRequiredContext = IAgentContext<IGeolocationStore>;
|
|
13
|
-
//# sourceMappingURL=IAnomalyDetection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAnomalyDetection.d.ts","sourceRoot":"","sources":["../../src/types/IAnomalyDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE7F,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,8BAA8B,CAAC,IAAI,EAAE,kCAAkC,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAA;CACnJ;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAE9E,MAAM,MAAM,kCAAkC,GAAG,SAAS,CAAC,oBAAoB,EAAE,SAAS,GAAG,WAAW,CAAC,CAAA;AAEzG,MAAM,MAAM,oCAAoC,GAAG;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAnomalyDetection.js","sourceRoot":"","sources":["../../src/types/IAnomalyDetection.ts"],"names":[],"mappings":""}
|