@sphereon/ssi-sdk.geolocation-store 0.33.1-feature.vcdm2.tsup.31 → 0.33.1-next.2

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.
@@ -0,0 +1,30 @@
1
+ import { IAgentPlugin } from '@veramo/core';
2
+ import { GeolocationStoreLocation, IGeolocationStore } from '../index';
3
+ import { IKeyValueStore } from '@sphereon/ssi-sdk.kv-store-temp';
4
+ export declare const geolocationStoreMethods: Array<string>;
5
+ /**
6
+ * {@inheritDoc IGeolocationStore}
7
+ */
8
+ export declare class GeolocationStore implements IAgentPlugin {
9
+ readonly schema: any;
10
+ private readonly defaultStoreId;
11
+ private readonly defaultNamespace;
12
+ private readonly _dnsLookupStore;
13
+ readonly methods: IGeolocationStore;
14
+ constructor(args: {
15
+ defaultStoreId?: string;
16
+ defaultNamespace?: string;
17
+ dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>;
18
+ });
19
+ private geolocationStorePersistLocation;
20
+ private geolocationStoreHasLocation;
21
+ private geolocationStoreRemoveLocation;
22
+ private geolocationStoreClearAllLocations;
23
+ private geolocationStoreGetLocation;
24
+ private store;
25
+ private storeIdStr;
26
+ private geolocationStoreDefaultLocationStore;
27
+ private namespaceStr;
28
+ private prefix;
29
+ }
30
+ //# sourceMappingURL=GeolocationStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeolocationStore.d.ts","sourceRoot":"","sources":["../../src/agent/GeolocationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAGL,wBAAwB,EAKxB,iBAAiB,EAElB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,cAAc,EAAiC,MAAM,iCAAiC,CAAA;AAE/F,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAOjD,CAAA;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,MAAM,MAAgC;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuD;IAEvF,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAOlC;gBAEW,IAAI,EAAE;QAChB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAA;KAClH;YAiBa,+BAA+B;YA2B/B,2BAA2B;YAK3B,8BAA8B;YAK9B,iCAAiC;YAOjC,2BAA2B;IAQzC,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,oCAAoC;IAI5C,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,MAAM;CAGf"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GeolocationStore = exports.geolocationStoreMethods = void 0;
13
+ const index_1 = require("../index");
14
+ const ssi_sdk_kv_store_temp_1 = require("@sphereon/ssi-sdk.kv-store-temp");
15
+ exports.geolocationStoreMethods = [
16
+ 'geolocationStorePersistLocation',
17
+ 'geolocationStoreHasLocation',
18
+ 'geolocationStoreRemoveLocation',
19
+ 'geolocationStoreClearAllLocations',
20
+ 'geolocationStoreGetLocation',
21
+ 'geolocationStoreDefaultLocationStore',
22
+ ];
23
+ /**
24
+ * {@inheritDoc IGeolocationStore}
25
+ */
26
+ class GeolocationStore {
27
+ constructor(args) {
28
+ var _a, _b;
29
+ this.schema = index_1.schema.IAnomalyDetectionStore;
30
+ this.methods = {
31
+ geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),
32
+ geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),
33
+ geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),
34
+ geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),
35
+ geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),
36
+ geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this),
37
+ };
38
+ this.defaultStoreId = (_a = args === null || args === void 0 ? void 0 : args.defaultStoreId) !== null && _a !== void 0 ? _a : '_default';
39
+ this.defaultNamespace = (_b = args === null || args === void 0 ? void 0 : args.defaultNamespace) !== null && _b !== void 0 ? _b : 'anomaly-detection';
40
+ if ((args === null || args === void 0 ? void 0 : args.dnsLookupStore) !== undefined && (args === null || args === void 0 ? void 0 : args.dnsLookupStore) !== null && args.dnsLookupStore instanceof Map) {
41
+ this._dnsLookupStore = args.dnsLookupStore;
42
+ }
43
+ else {
44
+ this._dnsLookupStore = new Map().set(this.defaultStoreId, new ssi_sdk_kv_store_temp_1.KeyValueStore({
45
+ namespace: this.defaultNamespace,
46
+ store: new Map(),
47
+ }));
48
+ }
49
+ }
50
+ geolocationStorePersistLocation(args) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const storeId = this.storeIdStr(args);
53
+ const namespace = this.namespaceStr(args);
54
+ const { ipOrHostname, locationArgs, ttl } = args;
55
+ if ((args === null || args === void 0 ? void 0 : args.validation) !== false) {
56
+ // TODO
57
+ }
58
+ const existing = yield this.store({ stores: this._dnsLookupStore, storeId }).getAsValueData(this.prefix({
59
+ namespace,
60
+ ipOrHostname,
61
+ }));
62
+ if (!existing.value || (existing.value && (args === null || args === void 0 ? void 0 : args.overwriteExisting) !== false)) {
63
+ return yield this.store({ stores: this._dnsLookupStore, storeId }).set(this.prefix({
64
+ namespace,
65
+ ipOrHostname,
66
+ }), locationArgs, ttl);
67
+ }
68
+ return existing;
69
+ });
70
+ }
71
+ geolocationStoreHasLocation(args) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const { storeId, namespace, ipOrHostname } = Object.assign({}, args);
74
+ return this.store({ stores: this._dnsLookupStore, storeId }).has(this.prefix({ namespace, ipOrHostname }));
75
+ });
76
+ }
77
+ geolocationStoreRemoveLocation(args) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const { storeId, namespace, ipOrHostname } = Object.assign({}, args);
80
+ return this.store({ stores: this._dnsLookupStore, storeId }).delete(this.prefix({ namespace, ipOrHostname }));
81
+ });
82
+ }
83
+ geolocationStoreClearAllLocations(args) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const { storeId } = Object.assign({}, args);
86
+ return yield this.store({ stores: this._dnsLookupStore, storeId })
87
+ .clear()
88
+ .then(() => true);
89
+ });
90
+ }
91
+ geolocationStoreGetLocation(args) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const { storeId, namespace, ipOrHostname } = Object.assign({}, args);
94
+ return this.store({
95
+ stores: this._dnsLookupStore,
96
+ storeId,
97
+ }).get(this.prefix({ namespace, ipOrHostname }));
98
+ });
99
+ }
100
+ store(args) {
101
+ const storeId = this.storeIdStr({ storeId: args.storeId });
102
+ const store = args.stores.get(storeId);
103
+ if (!store) {
104
+ throw Error(`Could not get geolocation store: ${storeId}`);
105
+ }
106
+ return store;
107
+ }
108
+ storeIdStr({ storeId }) {
109
+ return storeId !== null && storeId !== void 0 ? storeId : this.defaultStoreId;
110
+ }
111
+ geolocationStoreDefaultLocationStore() {
112
+ return Promise.resolve(this.store({ stores: this._dnsLookupStore, storeId: this.defaultStoreId }));
113
+ }
114
+ namespaceStr({ namespace }) {
115
+ return namespace !== null && namespace !== void 0 ? namespace : this.defaultNamespace;
116
+ }
117
+ prefix({ namespace, ipOrHostname }) {
118
+ return `${this.namespaceStr({ namespace })}:${ipOrHostname}`;
119
+ }
120
+ }
121
+ exports.GeolocationStore = GeolocationStore;
122
+ //# sourceMappingURL=GeolocationStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeolocationStore.js","sourceRoot":"","sources":["../../src/agent/GeolocationStore.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAUiB;AAEjB,2EAA+F;AAElF,QAAA,uBAAuB,GAAkB;IACpD,iCAAiC;IACjC,6BAA6B;IAC7B,gCAAgC;IAChC,mCAAmC;IACnC,6BAA6B;IAC7B,sCAAsC;CACvC,CAAA;AAED;;GAEG;AACH,MAAa,gBAAgB;IAe3B,YAAY,IAIX;;QAlBQ,WAAM,GAAG,cAAM,CAAC,sBAAsB,CAAA;QAKtC,YAAO,GAAsB;YACpC,+BAA+B,EAAE,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC;YAChF,2BAA2B,EAAE,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC;YACxE,8BAA8B,EAAE,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9E,iCAAiC,EAAE,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC;YACpF,2BAA2B,EAAE,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC;YACxE,oCAAoC,EAAE,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC;SAC3F,CAAA;QAOC,IAAI,CAAC,cAAc,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,mCAAI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Y,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,YAAY,EAAE,CAAA;IAC9D,CAAC;CACF;AAhHD,4CAgHC"}
package/dist/index.d.ts CHANGED
@@ -1,69 +1,8 @@
1
- import { IAgentPlugin, IPluginMethodMap } from '@veramo/core';
2
- import { IKeyValueStore, IValueData } from '@sphereon/ssi-sdk.kv-store-temp';
3
-
4
- declare const geolocationStoreMethods: Array<string>;
5
- /**
6
- * {@inheritDoc IGeolocationStore}
7
- */
8
- declare class GeolocationStore implements IAgentPlugin {
9
- readonly schema: any;
10
- private readonly defaultStoreId;
11
- private readonly defaultNamespace;
12
- private readonly _dnsLookupStore;
13
- readonly methods: IGeolocationStore;
14
- constructor(args: {
15
- defaultStoreId?: string;
16
- defaultNamespace?: string;
17
- dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>;
18
- });
19
- private geolocationStorePersistLocation;
20
- private geolocationStoreHasLocation;
21
- private geolocationStoreRemoveLocation;
22
- private geolocationStoreClearAllLocations;
23
- private geolocationStoreGetLocation;
24
- private store;
25
- private storeIdStr;
26
- private geolocationStoreDefaultLocationStore;
27
- private namespaceStr;
28
- private prefix;
29
- }
30
-
31
- interface IGeolocationStore extends IPluginMethodMap {
32
- geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult>;
33
- geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData>;
34
- geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean>;
35
- geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean>;
36
- geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean>;
37
- geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined>;
38
- }
39
- type GeolocationStoreLocation = {
40
- continent?: string;
41
- country?: string;
42
- };
43
- type GeolocationStorePersistArgs = {
44
- ipOrHostname: string;
45
- overwriteExisting?: boolean;
46
- validation?: boolean;
47
- ttl?: number;
48
- storeId?: string;
49
- namespace?: string;
50
- };
51
- type GeolocationStoreArgs = {
52
- ipOrHostname: string;
53
- storeId: string;
54
- namespace: string;
55
- };
56
- type GeolocationStoreClearAllLocationsArgs = Pick<GeolocationStoreArgs, 'storeId'>;
57
- type GeolocationStoreLocationPersistArgs = GeolocationStorePersistArgs & {
58
- locationArgs: GeolocationStoreLocation;
59
- };
60
- type GeolocationStoreLocationResult = IKeyValueStore<GeolocationStoreLocation>;
61
- type GeolocationStoreLocationResultOrUndefined = GeolocationStoreLocation | undefined;
62
- type GeolocationStoreLocationResultIValueData = IValueData<GeolocationStoreLocation>;
63
-
64
1
  /**
65
2
  * @public
66
3
  */
67
4
  declare const schema: any;
68
-
69
- export { GeolocationStore, type GeolocationStoreArgs, type GeolocationStoreClearAllLocationsArgs, type GeolocationStoreLocation, type GeolocationStoreLocationPersistArgs, type GeolocationStoreLocationResult, type GeolocationStoreLocationResultIValueData, type GeolocationStoreLocationResultOrUndefined, type GeolocationStorePersistArgs, type IGeolocationStore, geolocationStoreMethods, schema };
5
+ export { schema };
6
+ export { GeolocationStore, geolocationStoreMethods } from './agent/GeolocationStore';
7
+ export * from './types/IGeolocationStore';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
package/dist/index.js CHANGED
@@ -1,325 +1,27 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
-
8
- // plugin.schema.json
9
- var require_plugin_schema = __commonJS({
10
- "plugin.schema.json"(exports, module) {
11
- module.exports = {
12
- IGeolocationStore: {
13
- components: {
14
- schemas: {
15
- GeolocationStoreClearAllLocationsArgs: {
16
- type: "object",
17
- properties: {
18
- storeId: {
19
- type: "string"
20
- }
21
- },
22
- required: [
23
- "storeId"
24
- ],
25
- additionalProperties: false
26
- },
27
- GeolocationStoreLocationResult: {
28
- $ref: "#/components/schemas/IKeyValueStore<GeolocationStoreLocation>"
29
- },
30
- "IKeyValueStore<GeolocationStoreLocation>": {
31
- type: "object",
32
- description: "A Key Value store is responsible for managing Values identified by keys."
33
- },
34
- GeolocationStoreArgs: {
35
- type: "object",
36
- properties: {
37
- ipOrHostname: {
38
- type: "string"
39
- },
40
- storeId: {
41
- type: "string"
42
- },
43
- namespace: {
44
- type: "string"
45
- }
46
- },
47
- required: [
48
- "ipOrHostname",
49
- "storeId",
50
- "namespace"
51
- ]
52
- },
53
- GeolocationStoreLocationResultOrUndefined: {
54
- anyOf: [
55
- {
56
- $ref: "#/components/schemas/GeolocationStoreLocation"
57
- },
58
- {
59
- not: {}
60
- }
61
- ]
62
- },
63
- GeolocationStoreLocation: {
64
- type: "object",
65
- properties: {
66
- continent: {
67
- type: "string"
68
- },
69
- country: {
70
- type: "string"
71
- }
72
- }
73
- },
74
- GeolocationStoreLocationPersistArgs: {
75
- type: "object",
76
- properties: {
77
- locationArgs: {
78
- $ref: "#/components/schemas/GeolocationStoreLocation"
79
- },
80
- ipOrHostname: {
81
- type: "string"
82
- },
83
- overwriteExisting: {
84
- type: "boolean"
85
- },
86
- validation: {
87
- type: "boolean"
88
- },
89
- ttl: {
90
- type: "number"
91
- },
92
- storeId: {
93
- type: "string"
94
- },
95
- namespace: {
96
- type: "string"
97
- }
98
- },
99
- required: [
100
- "ipOrHostname",
101
- "locationArgs"
102
- ]
103
- },
104
- GeolocationStoreLocationResultIValueData: {
105
- $ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
106
- },
107
- "IValueData<GeolocationStoreLocation>": {
108
- type: "object",
109
- properties: {
110
- value: {
111
- $ref: "#/components/schemas/GeolocationStoreLocation"
112
- },
113
- expires: {
114
- type: "number"
115
- }
116
- },
117
- description: "This is how the store will actually store the value. It contains an optional `expires` property, which indicates when the value would expire"
118
- }
119
- },
120
- methods: {
121
- geolocationStoreClearAllLocations: {
122
- description: "",
123
- arguments: {
124
- $ref: "#/components/schemas/GeolocationStoreClearAllLocationsArgs"
125
- },
126
- returnType: {
127
- type: "boolean"
128
- }
129
- },
130
- geolocationStoreDefaultLocationStore: {
131
- description: "",
132
- arguments: {
133
- type: "object"
134
- },
135
- returnType: {
136
- $ref: "#/components/schemas/GeolocationStoreLocationResult"
137
- }
138
- },
139
- geolocationStoreGetLocation: {
140
- description: "",
141
- arguments: {
142
- $ref: "#/components/schemas/GeolocationStoreArgs"
143
- },
144
- returnType: {
145
- $ref: "#/components/schemas/GeolocationStoreLocationResultOrUndefined"
146
- }
147
- },
148
- geolocationStoreHasLocation: {
149
- description: "",
150
- arguments: {
151
- $ref: "#/components/schemas/GeolocationStoreArgs"
152
- },
153
- returnType: {
154
- type: "boolean"
155
- }
156
- },
157
- geolocationStorePersistLocation: {
158
- description: "",
159
- arguments: {
160
- $ref: "#/components/schemas/GeolocationStoreLocationPersistArgs"
161
- },
162
- returnType: {
163
- $ref: "#/components/schemas/GeolocationStoreLocationResultIValueData"
164
- }
165
- },
166
- geolocationStoreRemoveLocation: {
167
- description: "",
168
- arguments: {
169
- $ref: "#/components/schemas/GeolocationStoreArgs"
170
- },
171
- returnType: {
172
- type: "boolean"
173
- }
174
- }
175
- }
176
- }
177
- }
178
- };
179
- }
180
- });
181
-
182
- // src/agent/GeolocationStore.ts
183
- import { KeyValueStore } from "@sphereon/ssi-sdk.kv-store-temp";
184
- var geolocationStoreMethods = [
185
- "geolocationStorePersistLocation",
186
- "geolocationStoreHasLocation",
187
- "geolocationStoreRemoveLocation",
188
- "geolocationStoreClearAllLocations",
189
- "geolocationStoreGetLocation",
190
- "geolocationStoreDefaultLocationStore"
191
- ];
192
- var GeolocationStore = class {
193
- static {
194
- __name(this, "GeolocationStore");
195
- }
196
- schema = schema.IAnomalyDetectionStore;
197
- defaultStoreId;
198
- defaultNamespace;
199
- _dnsLookupStore;
200
- methods = {
201
- geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),
202
- geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),
203
- geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),
204
- geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),
205
- geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),
206
- geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this)
207
- };
208
- constructor(args) {
209
- this.defaultStoreId = args?.defaultStoreId ?? "_default";
210
- this.defaultNamespace = args?.defaultNamespace ?? "anomaly-detection";
211
- if (args?.dnsLookupStore !== void 0 && args?.dnsLookupStore !== null && args.dnsLookupStore instanceof Map) {
212
- this._dnsLookupStore = args.dnsLookupStore;
213
- } else {
214
- this._dnsLookupStore = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new KeyValueStore({
215
- namespace: this.defaultNamespace,
216
- store: /* @__PURE__ */ new Map()
217
- }));
218
- }
219
- }
220
- async geolocationStorePersistLocation(args) {
221
- const storeId = this.storeIdStr(args);
222
- const namespace = this.namespaceStr(args);
223
- const { ipOrHostname, locationArgs, ttl } = args;
224
- if (args?.validation !== false) {
225
- }
226
- const existing = await this.store({
227
- stores: this._dnsLookupStore,
228
- storeId
229
- }).getAsValueData(this.prefix({
230
- namespace,
231
- ipOrHostname
232
- }));
233
- if (!existing.value || existing.value && args?.overwriteExisting !== false) {
234
- return await this.store({
235
- stores: this._dnsLookupStore,
236
- storeId
237
- }).set(this.prefix({
238
- namespace,
239
- ipOrHostname
240
- }), locationArgs, ttl);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
241
7
  }
242
- return existing;
243
- }
244
- async geolocationStoreHasLocation(args) {
245
- const { storeId, namespace, ipOrHostname } = {
246
- ...args
247
- };
248
- return this.store({
249
- stores: this._dnsLookupStore,
250
- storeId
251
- }).has(this.prefix({
252
- namespace,
253
- ipOrHostname
254
- }));
255
- }
256
- async geolocationStoreRemoveLocation(args) {
257
- const { storeId, namespace, ipOrHostname } = {
258
- ...args
259
- };
260
- return this.store({
261
- stores: this._dnsLookupStore,
262
- storeId
263
- }).delete(this.prefix({
264
- namespace,
265
- ipOrHostname
266
- }));
267
- }
268
- async geolocationStoreClearAllLocations(args) {
269
- const { storeId } = {
270
- ...args
271
- };
272
- return await this.store({
273
- stores: this._dnsLookupStore,
274
- storeId
275
- }).clear().then(() => true);
276
- }
277
- async geolocationStoreGetLocation(args) {
278
- const { storeId, namespace, ipOrHostname } = {
279
- ...args
280
- };
281
- return this.store({
282
- stores: this._dnsLookupStore,
283
- storeId
284
- }).get(this.prefix({
285
- namespace,
286
- ipOrHostname
287
- }));
288
- }
289
- store(args) {
290
- const storeId = this.storeIdStr({
291
- storeId: args.storeId
292
- });
293
- const store = args.stores.get(storeId);
294
- if (!store) {
295
- throw Error(`Could not get geolocation store: ${storeId}`);
296
- }
297
- return store;
298
- }
299
- storeIdStr({ storeId }) {
300
- return storeId ?? this.defaultStoreId;
301
- }
302
- geolocationStoreDefaultLocationStore() {
303
- return Promise.resolve(this.store({
304
- stores: this._dnsLookupStore,
305
- storeId: this.defaultStoreId
306
- }));
307
- }
308
- namespaceStr({ namespace }) {
309
- return namespace ?? this.defaultNamespace;
310
- }
311
- prefix({ namespace, ipOrHostname }) {
312
- return `${this.namespaceStr({
313
- namespace
314
- })}:${ipOrHostname}`;
315
- }
316
- };
317
-
318
- // src/index.ts
319
- var schema = require_plugin_schema();
320
- export {
321
- GeolocationStore,
322
- geolocationStoreMethods,
323
- schema
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
324
15
  };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.geolocationStoreMethods = exports.GeolocationStore = exports.schema = void 0;
18
+ /**
19
+ * @public
20
+ */
21
+ const schema = require('../plugin.schema.json');
22
+ exports.schema = schema;
23
+ var GeolocationStore_1 = require("./agent/GeolocationStore");
24
+ Object.defineProperty(exports, "GeolocationStore", { enumerable: true, get: function () { return GeolocationStore_1.GeolocationStore; } });
25
+ Object.defineProperty(exports, "geolocationStoreMethods", { enumerable: true, get: function () { return GeolocationStore_1.geolocationStoreMethods; } });
26
+ __exportStar(require("./types/IGeolocationStore"), exports);
325
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/agent/GeolocationStore.ts","../src/index.ts"],"sourcesContent":["{\n \"IGeolocationStore\": {\n \"components\": {\n \"schemas\": {\n \"GeolocationStoreClearAllLocationsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"storeId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"storeId\"\n ],\n \"additionalProperties\": false\n },\n \"GeolocationStoreLocationResult\": {\n \"$ref\": \"#/components/schemas/IKeyValueStore<GeolocationStoreLocation>\"\n },\n \"IKeyValueStore<GeolocationStoreLocation>\": {\n \"type\": \"object\",\n \"description\": \"A Key Value store is responsible for managing Values identified by keys.\"\n },\n \"GeolocationStoreArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"ipOrHostname\": {\n \"type\": \"string\"\n },\n \"storeId\": {\n \"type\": \"string\"\n },\n \"namespace\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"ipOrHostname\",\n \"storeId\",\n \"namespace\"\n ]\n },\n \"GeolocationStoreLocationResultOrUndefined\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n {\n \"not\": {}\n }\n ]\n },\n \"GeolocationStoreLocation\": {\n \"type\": \"object\",\n \"properties\": {\n \"continent\": {\n \"type\": \"string\"\n },\n \"country\": {\n \"type\": \"string\"\n }\n }\n },\n \"GeolocationStoreLocationPersistArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"locationArgs\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n \"ipOrHostname\": {\n \"type\": \"string\"\n },\n \"overwriteExisting\": {\n \"type\": \"boolean\"\n },\n \"validation\": {\n \"type\": \"boolean\"\n },\n \"ttl\": {\n \"type\": \"number\"\n },\n \"storeId\": {\n \"type\": \"string\"\n },\n \"namespace\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"ipOrHostname\",\n \"locationArgs\"\n ]\n },\n \"GeolocationStoreLocationResultIValueData\": {\n \"$ref\": \"#/components/schemas/IValueData<GeolocationStoreLocation>\"\n },\n \"IValueData<GeolocationStoreLocation>\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n \"expires\": {\n \"type\": \"number\"\n }\n },\n \"description\": \"This is how the store will actually store the value. It contains an optional `expires` property, which indicates when the value would expire\"\n }\n },\n \"methods\": {\n \"geolocationStoreClearAllLocations\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreClearAllLocationsArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n },\n \"geolocationStoreDefaultLocationStore\": {\n \"description\": \"\",\n \"arguments\": {\n \"type\": \"object\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResult\"\n }\n },\n \"geolocationStoreGetLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResultOrUndefined\"\n }\n },\n \"geolocationStoreHasLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n },\n \"geolocationStorePersistLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationPersistArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResultIValueData\"\n }\n },\n \"geolocationStoreRemoveLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n }\n }\n }\n }\n}","import { IAgentPlugin } from '@veramo/core'\nimport {\n GeolocationStoreArgs,\n GeolocationStoreClearAllLocationsArgs,\n GeolocationStoreLocation,\n GeolocationStoreLocationPersistArgs,\n GeolocationStoreLocationResult,\n GeolocationStoreLocationResultIValueData,\n GeolocationStoreLocationResultOrUndefined,\n IGeolocationStore,\n schema,\n} from '../index'\n\nimport { IKeyValueStore, KeyValueStore, ValueStoreType } from '@sphereon/ssi-sdk.kv-store-temp'\n\nexport const geolocationStoreMethods: Array<string> = [\n 'geolocationStorePersistLocation',\n 'geolocationStoreHasLocation',\n 'geolocationStoreRemoveLocation',\n 'geolocationStoreClearAllLocations',\n 'geolocationStoreGetLocation',\n 'geolocationStoreDefaultLocationStore',\n]\n\n/**\n * {@inheritDoc IGeolocationStore}\n */\nexport class GeolocationStore implements IAgentPlugin {\n readonly schema = schema.IAnomalyDetectionStore\n private readonly defaultStoreId: string\n private readonly defaultNamespace: string\n private readonly _dnsLookupStore: Map<string, IKeyValueStore<GeolocationStoreLocation>>\n\n readonly methods: IGeolocationStore = {\n geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),\n geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),\n geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),\n geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),\n geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),\n geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this),\n }\n\n constructor(args: {\n defaultStoreId?: string\n defaultNamespace?: string\n dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>\n }) {\n this.defaultStoreId = args?.defaultStoreId ?? '_default'\n this.defaultNamespace = args?.defaultNamespace ?? 'anomaly-detection'\n\n if (args?.dnsLookupStore !== undefined && args?.dnsLookupStore !== null && args.dnsLookupStore instanceof Map) {\n this._dnsLookupStore = args.dnsLookupStore\n } else {\n this._dnsLookupStore = new Map().set(\n this.defaultStoreId,\n new KeyValueStore({\n namespace: this.defaultNamespace,\n store: new Map<string, GeolocationStoreLocation>(),\n }),\n )\n }\n }\n\n private async geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData> {\n const storeId = this.storeIdStr(args)\n const namespace = this.namespaceStr(args)\n const { ipOrHostname, locationArgs, ttl } = args\n\n if (args?.validation !== false) {\n // TODO\n }\n const existing = await this.store({ stores: this._dnsLookupStore, storeId }).getAsValueData(\n this.prefix({\n namespace,\n ipOrHostname,\n }),\n )\n if (!existing.value || (existing.value && args?.overwriteExisting !== false)) {\n return await this.store({ stores: this._dnsLookupStore, storeId }).set(\n this.prefix({\n namespace,\n ipOrHostname,\n }),\n locationArgs,\n ttl,\n )\n }\n return existing\n }\n\n private async geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store({ stores: this._dnsLookupStore, storeId }).has(this.prefix({ namespace, ipOrHostname }))\n }\n\n private async geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store({ stores: this._dnsLookupStore, storeId }).delete(this.prefix({ namespace, ipOrHostname }))\n }\n\n private async geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean> {\n const { storeId } = { ...args }\n return await this.store({ stores: this._dnsLookupStore, storeId })\n .clear()\n .then(() => true)\n }\n\n private async geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store<GeolocationStoreLocation>({\n stores: this._dnsLookupStore,\n storeId,\n }).get(this.prefix({ namespace, ipOrHostname }))\n }\n\n private store<T extends ValueStoreType>(args: { stores: Map<string, IKeyValueStore<T>>; storeId?: string }): IKeyValueStore<T> {\n const storeId = this.storeIdStr({ storeId: args.storeId })\n const store = args.stores.get(storeId)\n if (!store) {\n throw Error(`Could not get geolocation store: ${storeId}`)\n }\n return store\n }\n\n private storeIdStr({ storeId }: { storeId?: string }): string {\n return storeId ?? this.defaultStoreId\n }\n\n private geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult> {\n return Promise.resolve(this.store({ stores: this._dnsLookupStore, storeId: this.defaultStoreId }))\n }\n\n private namespaceStr({ namespace }: { namespace?: string }): string {\n return namespace ?? this.defaultNamespace\n }\n\n private prefix({ namespace, ipOrHostname }: { namespace?: string; ipOrHostname: string }): string {\n return `${this.namespaceStr({ namespace })}:${ipOrHostname}`\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { GeolocationStore, geolocationStoreMethods } from './agent/GeolocationStore'\nexport * from './types/IGeolocationStore'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,KAAK1B;MACbkB;IACF,CAAA,EAAGiB,IAAI,KAAKP,OAAO;MAAEZ;MAAWK;IAAa,CAAA,CAAA;EAC/C;EAEQJ,MAAgCP,MAAuF;AAC7H,UAAMQ,UAAU,KAAKC,WAAW;MAAED,SAASR,KAAKQ;IAAQ,CAAA;AACxD,UAAMD,QAAQP,KAAKgB,OAAOS,IAAIjB,OAAAA;AAC9B,QAAI,CAACD,OAAO;AACV,YAAMmB,MAAM,oCAAoClB,OAAAA,EAAS;IAC3D;AACA,WAAOD;EACT;EAEQE,WAAW,EAAED,QAAO,GAAkC;AAC5D,WAAOA,WAAW,KAAKpB;EACzB;EAEQU,uCAAgF;AACtF,WAAO6B,QAAQC,QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAK1B;MAAiBkB,SAAS,KAAKpB;IAAe,CAAA,CAAA;EACjG;EAEQsB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKjB;EAC3B;EAEQ6B,OAAO,EAAEZ,WAAWK,aAAY,GAA0D;AAChG,WAAO,GAAG,KAAKD,aAAa;MAAEJ;IAAU,CAAA,CAAA,IAAMK,YAAAA;EAChD;AACF;;;ACxIA,IAAMkB,SAASC;","names":["KeyValueStore","geolocationStoreMethods","GeolocationStore","schema","IAnomalyDetectionStore","defaultStoreId","defaultNamespace","_dnsLookupStore","methods","geolocationStorePersistLocation","bind","geolocationStoreHasLocation","geolocationStoreRemoveLocation","geolocationStoreClearAllLocations","geolocationStoreGetLocation","geolocationStoreDefaultLocationStore","constructor","args","dnsLookupStore","undefined","Map","set","KeyValueStore","namespace","store","storeId","storeIdStr","namespaceStr","ipOrHostname","locationArgs","ttl","validation","existing","stores","getAsValueData","prefix","value","overwriteExisting","has","delete","clear","then","get","Error","Promise","resolve","schema","require"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM;AACf,6DAAoF;AAA3E,oHAAA,gBAAgB,OAAA;AAAE,2HAAA,uBAAuB,OAAA;AAClD,4DAAyC"}
@@ -1,69 +1,80 @@
1
- import { IAgentPlugin, IPluginMethodMap } from '@veramo/core';
2
- import { IKeyValueStore, IValueData } from '@sphereon/ssi-sdk.kv-store-temp';
3
-
4
- declare const geolocationStoreMethods: Array<string>;
5
- /**
6
- * {@inheritDoc IGeolocationStore}
7
- */
8
- declare class GeolocationStore implements IAgentPlugin {
9
- readonly schema: any;
10
- private readonly defaultStoreId;
11
- private readonly defaultNamespace;
12
- private readonly _dnsLookupStore;
13
- readonly methods: IGeolocationStore;
14
- constructor(args: {
15
- defaultStoreId?: string;
16
- defaultNamespace?: string;
17
- dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>;
18
- });
19
- private geolocationStorePersistLocation;
20
- private geolocationStoreHasLocation;
21
- private geolocationStoreRemoveLocation;
22
- private geolocationStoreClearAllLocations;
23
- private geolocationStoreGetLocation;
24
- private store;
25
- private storeIdStr;
26
- private geolocationStoreDefaultLocationStore;
27
- private namespaceStr;
28
- private prefix;
29
- }
30
-
31
- interface IGeolocationStore extends IPluginMethodMap {
32
- geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult>;
33
- geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData>;
34
- geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean>;
35
- geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean>;
36
- geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean>;
37
- geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined>;
38
- }
39
- type GeolocationStoreLocation = {
40
- continent?: string;
41
- country?: string;
42
- };
43
- type GeolocationStorePersistArgs = {
44
- ipOrHostname: string;
45
- overwriteExisting?: boolean;
46
- validation?: boolean;
47
- ttl?: number;
48
- storeId?: string;
49
- namespace?: string;
50
- };
51
- type GeolocationStoreArgs = {
52
- ipOrHostname: string;
53
- storeId: string;
54
- namespace: string;
55
- };
56
- type GeolocationStoreClearAllLocationsArgs = Pick<GeolocationStoreArgs, 'storeId'>;
57
- type GeolocationStoreLocationPersistArgs = GeolocationStorePersistArgs & {
58
- locationArgs: GeolocationStoreLocation;
59
- };
60
- type GeolocationStoreLocationResult = IKeyValueStore<GeolocationStoreLocation>;
61
- type GeolocationStoreLocationResultOrUndefined = GeolocationStoreLocation | undefined;
62
- type GeolocationStoreLocationResultIValueData = IValueData<GeolocationStoreLocation>;
63
-
64
- /**
65
- * @public
66
- */
67
- declare const schema: any;
68
-
69
- export { GeolocationStore, type GeolocationStoreArgs, type GeolocationStoreClearAllLocationsArgs, type GeolocationStoreLocation, type GeolocationStoreLocationPersistArgs, type GeolocationStoreLocationResult, type GeolocationStoreLocationResultIValueData, type GeolocationStoreLocationResultOrUndefined, type GeolocationStorePersistArgs, type IGeolocationStore, geolocationStoreMethods, schema };
1
+ import { IAgentPlugin } from '@veramo/core';
2
+ import { IKeyValueStore } from '@sphereon/ssi-sdk.kv-store-temp';
3
+ import { IPluginMethodMap } from '@veramo/core';
4
+ import { IValueData } from '@sphereon/ssi-sdk.kv-store-temp';
5
+
6
+ /**
7
+ * {@inheritDoc IGeolocationStore}
8
+ */
9
+ export declare class GeolocationStore implements IAgentPlugin {
10
+ readonly schema: any;
11
+ private readonly defaultStoreId;
12
+ private readonly defaultNamespace;
13
+ private readonly _dnsLookupStore;
14
+ readonly methods: IGeolocationStore;
15
+ constructor(args: {
16
+ defaultStoreId?: string;
17
+ defaultNamespace?: string;
18
+ dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>;
19
+ });
20
+ private geolocationStorePersistLocation;
21
+ private geolocationStoreHasLocation;
22
+ private geolocationStoreRemoveLocation;
23
+ private geolocationStoreClearAllLocations;
24
+ private geolocationStoreGetLocation;
25
+ private store;
26
+ private storeIdStr;
27
+ private geolocationStoreDefaultLocationStore;
28
+ private namespaceStr;
29
+ private prefix;
30
+ }
31
+
32
+ export declare type GeolocationStoreArgs = {
33
+ ipOrHostname: string;
34
+ storeId: string;
35
+ namespace: string;
36
+ };
37
+
38
+ export declare type GeolocationStoreClearAllLocationsArgs = Pick<GeolocationStoreArgs, 'storeId'>;
39
+
40
+ export declare type GeolocationStoreLocation = {
41
+ continent?: string;
42
+ country?: string;
43
+ };
44
+
45
+ export declare type GeolocationStoreLocationPersistArgs = GeolocationStorePersistArgs & {
46
+ locationArgs: GeolocationStoreLocation;
47
+ };
48
+
49
+ export declare type GeolocationStoreLocationResult = IKeyValueStore<GeolocationStoreLocation>;
50
+
51
+ export declare type GeolocationStoreLocationResultIValueData = IValueData<GeolocationStoreLocation>;
52
+
53
+ export declare type GeolocationStoreLocationResultOrUndefined = GeolocationStoreLocation | undefined;
54
+
55
+ export declare const geolocationStoreMethods: Array<string>;
56
+
57
+ export declare type GeolocationStorePersistArgs = {
58
+ ipOrHostname: string;
59
+ overwriteExisting?: boolean;
60
+ validation?: boolean;
61
+ ttl?: number;
62
+ storeId?: string;
63
+ namespace?: string;
64
+ };
65
+
66
+ export declare interface IGeolocationStore extends IPluginMethodMap {
67
+ geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult>;
68
+ geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData>;
69
+ geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean>;
70
+ geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean>;
71
+ geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean>;
72
+ geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined>;
73
+ }
74
+
75
+ /**
76
+ * @public
77
+ */
78
+ export declare const schema: any;
79
+
80
+ export { }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,35 @@
1
+ import { IPluginMethodMap } from '@veramo/core';
2
+ import { IKeyValueStore, IValueData } from '@sphereon/ssi-sdk.kv-store-temp';
3
+ export interface IGeolocationStore extends IPluginMethodMap {
4
+ geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult>;
5
+ geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData>;
6
+ geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean>;
7
+ geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean>;
8
+ geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean>;
9
+ geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined>;
10
+ }
11
+ export type GeolocationStoreLocation = {
12
+ continent?: string;
13
+ country?: string;
14
+ };
15
+ export type GeolocationStorePersistArgs = {
16
+ ipOrHostname: string;
17
+ overwriteExisting?: boolean;
18
+ validation?: boolean;
19
+ ttl?: number;
20
+ storeId?: string;
21
+ namespace?: string;
22
+ };
23
+ export type GeolocationStoreArgs = {
24
+ ipOrHostname: string;
25
+ storeId: string;
26
+ namespace: string;
27
+ };
28
+ export type GeolocationStoreClearAllLocationsArgs = Pick<GeolocationStoreArgs, 'storeId'>;
29
+ export type GeolocationStoreLocationPersistArgs = GeolocationStorePersistArgs & {
30
+ locationArgs: GeolocationStoreLocation;
31
+ };
32
+ export type GeolocationStoreLocationResult = IKeyValueStore<GeolocationStoreLocation>;
33
+ export type GeolocationStoreLocationResultOrUndefined = GeolocationStoreLocation | undefined;
34
+ export type GeolocationStoreLocationResultIValueData = IValueData<GeolocationStoreLocation>;
35
+ //# sourceMappingURL=IGeolocationStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IGeolocationStore.d.ts","sourceRoot":"","sources":["../../src/types/IGeolocationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAE5E,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,oCAAoC,IAAI,OAAO,CAAC,8BAA8B,CAAC,CAAA;IAC/E,+BAA+B,CAAC,IAAI,EAAE,mCAAmC,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAA;IAC7H,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACzE,8BAA8B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5E,iCAAiC,CAAC,IAAI,EAAE,qCAAqC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChG,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,yCAAyC,CAAC,CAAA;CAC5G;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,qCAAqC,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAA;AAEzF,MAAM,MAAM,mCAAmC,GAAG,2BAA2B,GAAG;IAC9E,YAAY,EAAE,wBAAwB,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAA;AAErF,MAAM,MAAM,yCAAyC,GAAG,wBAAwB,GAAG,SAAS,CAAA;AAE5F,MAAM,MAAM,wCAAwC,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IGeolocationStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IGeolocationStore.js","sourceRoot":"","sources":["../../src/types/IGeolocationStore.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,43 +1,32 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.geolocation-store",
3
- "version": "0.33.1-feature.vcdm2.tsup.31+71b615ad",
3
+ "version": "0.33.1-next.2+6f7f40b9",
4
4
  "source": "src/index.ts",
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
- },
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
19
7
  "veramo": {
20
8
  "pluginInterfaces": {
21
9
  "IGeolocationStore": "./src/types/IGeolocationStore.ts"
22
10
  }
23
11
  },
24
12
  "scripts": {
25
- "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
13
+ "build": "tsc",
14
+ "build:clean": "tsc --build --clean && tsc --build",
26
15
  "generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
27
16
  },
28
17
  "dependencies": {
29
- "@sphereon/ssi-sdk.kv-store-temp": "^0.33.1-feature.vcdm2.tsup.31+71b615ad"
18
+ "@sphereon/ssi-sdk.kv-store-temp": "0.33.1-next.2+6f7f40b9"
30
19
  },
31
20
  "devDependencies": {
32
- "@sphereon/ssi-sdk.agent-config": "^0.33.1-feature.vcdm2.tsup.31+71b615ad",
21
+ "@sphereon/ssi-sdk.agent-config": "0.33.1-next.2+6f7f40b9",
33
22
  "@types/node": "^20.17.1",
34
23
  "@veramo/remote-client": "4.2.0",
35
24
  "@veramo/remote-server": "4.2.0",
36
- "typeorm": "^0.3.22"
25
+ "typeorm": "^0.3.21"
37
26
  },
38
27
  "files": [
39
- "dist",
40
- "src",
28
+ "dist/**/*",
29
+ "src/**/*",
41
30
  "README.md",
42
31
  "plugin.schema.json",
43
32
  "LICENSE"
@@ -56,5 +45,6 @@
56
45
  "Anomaly Detection",
57
46
  "Anomaly Detection Store"
58
47
  ],
59
- "gitHead": "71b615adbfef8ecd843edb2f3d0c58cb6453cff9"
48
+ "nx": {},
49
+ "gitHead": "6f7f40b94beb385369fede046c3912bd0c053408"
60
50
  }
package/dist/index.cjs DELETED
@@ -1,345 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
-
24
- // plugin.schema.json
25
- var require_plugin_schema = __commonJS({
26
- "plugin.schema.json"(exports, module2) {
27
- module2.exports = {
28
- IGeolocationStore: {
29
- components: {
30
- schemas: {
31
- GeolocationStoreClearAllLocationsArgs: {
32
- type: "object",
33
- properties: {
34
- storeId: {
35
- type: "string"
36
- }
37
- },
38
- required: [
39
- "storeId"
40
- ],
41
- additionalProperties: false
42
- },
43
- GeolocationStoreLocationResult: {
44
- $ref: "#/components/schemas/IKeyValueStore<GeolocationStoreLocation>"
45
- },
46
- "IKeyValueStore<GeolocationStoreLocation>": {
47
- type: "object",
48
- description: "A Key Value store is responsible for managing Values identified by keys."
49
- },
50
- GeolocationStoreArgs: {
51
- type: "object",
52
- properties: {
53
- ipOrHostname: {
54
- type: "string"
55
- },
56
- storeId: {
57
- type: "string"
58
- },
59
- namespace: {
60
- type: "string"
61
- }
62
- },
63
- required: [
64
- "ipOrHostname",
65
- "storeId",
66
- "namespace"
67
- ]
68
- },
69
- GeolocationStoreLocationResultOrUndefined: {
70
- anyOf: [
71
- {
72
- $ref: "#/components/schemas/GeolocationStoreLocation"
73
- },
74
- {
75
- not: {}
76
- }
77
- ]
78
- },
79
- GeolocationStoreLocation: {
80
- type: "object",
81
- properties: {
82
- continent: {
83
- type: "string"
84
- },
85
- country: {
86
- type: "string"
87
- }
88
- }
89
- },
90
- GeolocationStoreLocationPersistArgs: {
91
- type: "object",
92
- properties: {
93
- locationArgs: {
94
- $ref: "#/components/schemas/GeolocationStoreLocation"
95
- },
96
- ipOrHostname: {
97
- type: "string"
98
- },
99
- overwriteExisting: {
100
- type: "boolean"
101
- },
102
- validation: {
103
- type: "boolean"
104
- },
105
- ttl: {
106
- type: "number"
107
- },
108
- storeId: {
109
- type: "string"
110
- },
111
- namespace: {
112
- type: "string"
113
- }
114
- },
115
- required: [
116
- "ipOrHostname",
117
- "locationArgs"
118
- ]
119
- },
120
- GeolocationStoreLocationResultIValueData: {
121
- $ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
122
- },
123
- "IValueData<GeolocationStoreLocation>": {
124
- type: "object",
125
- properties: {
126
- value: {
127
- $ref: "#/components/schemas/GeolocationStoreLocation"
128
- },
129
- expires: {
130
- type: "number"
131
- }
132
- },
133
- description: "This is how the store will actually store the value. It contains an optional `expires` property, which indicates when the value would expire"
134
- }
135
- },
136
- methods: {
137
- geolocationStoreClearAllLocations: {
138
- description: "",
139
- arguments: {
140
- $ref: "#/components/schemas/GeolocationStoreClearAllLocationsArgs"
141
- },
142
- returnType: {
143
- type: "boolean"
144
- }
145
- },
146
- geolocationStoreDefaultLocationStore: {
147
- description: "",
148
- arguments: {
149
- type: "object"
150
- },
151
- returnType: {
152
- $ref: "#/components/schemas/GeolocationStoreLocationResult"
153
- }
154
- },
155
- geolocationStoreGetLocation: {
156
- description: "",
157
- arguments: {
158
- $ref: "#/components/schemas/GeolocationStoreArgs"
159
- },
160
- returnType: {
161
- $ref: "#/components/schemas/GeolocationStoreLocationResultOrUndefined"
162
- }
163
- },
164
- geolocationStoreHasLocation: {
165
- description: "",
166
- arguments: {
167
- $ref: "#/components/schemas/GeolocationStoreArgs"
168
- },
169
- returnType: {
170
- type: "boolean"
171
- }
172
- },
173
- geolocationStorePersistLocation: {
174
- description: "",
175
- arguments: {
176
- $ref: "#/components/schemas/GeolocationStoreLocationPersistArgs"
177
- },
178
- returnType: {
179
- $ref: "#/components/schemas/GeolocationStoreLocationResultIValueData"
180
- }
181
- },
182
- geolocationStoreRemoveLocation: {
183
- description: "",
184
- arguments: {
185
- $ref: "#/components/schemas/GeolocationStoreArgs"
186
- },
187
- returnType: {
188
- type: "boolean"
189
- }
190
- }
191
- }
192
- }
193
- }
194
- };
195
- }
196
- });
197
-
198
- // src/index.ts
199
- var index_exports = {};
200
- __export(index_exports, {
201
- GeolocationStore: () => GeolocationStore,
202
- geolocationStoreMethods: () => geolocationStoreMethods,
203
- schema: () => schema
204
- });
205
- module.exports = __toCommonJS(index_exports);
206
-
207
- // src/agent/GeolocationStore.ts
208
- var import_ssi_sdk = require("@sphereon/ssi-sdk.kv-store-temp");
209
- var geolocationStoreMethods = [
210
- "geolocationStorePersistLocation",
211
- "geolocationStoreHasLocation",
212
- "geolocationStoreRemoveLocation",
213
- "geolocationStoreClearAllLocations",
214
- "geolocationStoreGetLocation",
215
- "geolocationStoreDefaultLocationStore"
216
- ];
217
- var GeolocationStore = class {
218
- static {
219
- __name(this, "GeolocationStore");
220
- }
221
- schema = schema.IAnomalyDetectionStore;
222
- defaultStoreId;
223
- defaultNamespace;
224
- _dnsLookupStore;
225
- methods = {
226
- geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),
227
- geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),
228
- geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),
229
- geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),
230
- geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),
231
- geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this)
232
- };
233
- constructor(args) {
234
- this.defaultStoreId = args?.defaultStoreId ?? "_default";
235
- this.defaultNamespace = args?.defaultNamespace ?? "anomaly-detection";
236
- if (args?.dnsLookupStore !== void 0 && args?.dnsLookupStore !== null && args.dnsLookupStore instanceof Map) {
237
- this._dnsLookupStore = args.dnsLookupStore;
238
- } else {
239
- this._dnsLookupStore = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new import_ssi_sdk.KeyValueStore({
240
- namespace: this.defaultNamespace,
241
- store: /* @__PURE__ */ new Map()
242
- }));
243
- }
244
- }
245
- async geolocationStorePersistLocation(args) {
246
- const storeId = this.storeIdStr(args);
247
- const namespace = this.namespaceStr(args);
248
- const { ipOrHostname, locationArgs, ttl } = args;
249
- if (args?.validation !== false) {
250
- }
251
- const existing = await this.store({
252
- stores: this._dnsLookupStore,
253
- storeId
254
- }).getAsValueData(this.prefix({
255
- namespace,
256
- ipOrHostname
257
- }));
258
- if (!existing.value || existing.value && args?.overwriteExisting !== false) {
259
- return await this.store({
260
- stores: this._dnsLookupStore,
261
- storeId
262
- }).set(this.prefix({
263
- namespace,
264
- ipOrHostname
265
- }), locationArgs, ttl);
266
- }
267
- return existing;
268
- }
269
- async geolocationStoreHasLocation(args) {
270
- const { storeId, namespace, ipOrHostname } = {
271
- ...args
272
- };
273
- return this.store({
274
- stores: this._dnsLookupStore,
275
- storeId
276
- }).has(this.prefix({
277
- namespace,
278
- ipOrHostname
279
- }));
280
- }
281
- async geolocationStoreRemoveLocation(args) {
282
- const { storeId, namespace, ipOrHostname } = {
283
- ...args
284
- };
285
- return this.store({
286
- stores: this._dnsLookupStore,
287
- storeId
288
- }).delete(this.prefix({
289
- namespace,
290
- ipOrHostname
291
- }));
292
- }
293
- async geolocationStoreClearAllLocations(args) {
294
- const { storeId } = {
295
- ...args
296
- };
297
- return await this.store({
298
- stores: this._dnsLookupStore,
299
- storeId
300
- }).clear().then(() => true);
301
- }
302
- async geolocationStoreGetLocation(args) {
303
- const { storeId, namespace, ipOrHostname } = {
304
- ...args
305
- };
306
- return this.store({
307
- stores: this._dnsLookupStore,
308
- storeId
309
- }).get(this.prefix({
310
- namespace,
311
- ipOrHostname
312
- }));
313
- }
314
- store(args) {
315
- const storeId = this.storeIdStr({
316
- storeId: args.storeId
317
- });
318
- const store = args.stores.get(storeId);
319
- if (!store) {
320
- throw Error(`Could not get geolocation store: ${storeId}`);
321
- }
322
- return store;
323
- }
324
- storeIdStr({ storeId }) {
325
- return storeId ?? this.defaultStoreId;
326
- }
327
- geolocationStoreDefaultLocationStore() {
328
- return Promise.resolve(this.store({
329
- stores: this._dnsLookupStore,
330
- storeId: this.defaultStoreId
331
- }));
332
- }
333
- namespaceStr({ namespace }) {
334
- return namespace ?? this.defaultNamespace;
335
- }
336
- prefix({ namespace, ipOrHostname }) {
337
- return `${this.namespaceStr({
338
- namespace
339
- })}:${ipOrHostname}`;
340
- }
341
- };
342
-
343
- // src/index.ts
344
- var schema = require_plugin_schema();
345
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/GeolocationStore.ts"],"sourcesContent":["{\n \"IGeolocationStore\": {\n \"components\": {\n \"schemas\": {\n \"GeolocationStoreClearAllLocationsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"storeId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"storeId\"\n ],\n \"additionalProperties\": false\n },\n \"GeolocationStoreLocationResult\": {\n \"$ref\": \"#/components/schemas/IKeyValueStore<GeolocationStoreLocation>\"\n },\n \"IKeyValueStore<GeolocationStoreLocation>\": {\n \"type\": \"object\",\n \"description\": \"A Key Value store is responsible for managing Values identified by keys.\"\n },\n \"GeolocationStoreArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"ipOrHostname\": {\n \"type\": \"string\"\n },\n \"storeId\": {\n \"type\": \"string\"\n },\n \"namespace\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"ipOrHostname\",\n \"storeId\",\n \"namespace\"\n ]\n },\n \"GeolocationStoreLocationResultOrUndefined\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n {\n \"not\": {}\n }\n ]\n },\n \"GeolocationStoreLocation\": {\n \"type\": \"object\",\n \"properties\": {\n \"continent\": {\n \"type\": \"string\"\n },\n \"country\": {\n \"type\": \"string\"\n }\n }\n },\n \"GeolocationStoreLocationPersistArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"locationArgs\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n \"ipOrHostname\": {\n \"type\": \"string\"\n },\n \"overwriteExisting\": {\n \"type\": \"boolean\"\n },\n \"validation\": {\n \"type\": \"boolean\"\n },\n \"ttl\": {\n \"type\": \"number\"\n },\n \"storeId\": {\n \"type\": \"string\"\n },\n \"namespace\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"ipOrHostname\",\n \"locationArgs\"\n ]\n },\n \"GeolocationStoreLocationResultIValueData\": {\n \"$ref\": \"#/components/schemas/IValueData<GeolocationStoreLocation>\"\n },\n \"IValueData<GeolocationStoreLocation>\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocation\"\n },\n \"expires\": {\n \"type\": \"number\"\n }\n },\n \"description\": \"This is how the store will actually store the value. It contains an optional `expires` property, which indicates when the value would expire\"\n }\n },\n \"methods\": {\n \"geolocationStoreClearAllLocations\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreClearAllLocationsArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n },\n \"geolocationStoreDefaultLocationStore\": {\n \"description\": \"\",\n \"arguments\": {\n \"type\": \"object\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResult\"\n }\n },\n \"geolocationStoreGetLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResultOrUndefined\"\n }\n },\n \"geolocationStoreHasLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n },\n \"geolocationStorePersistLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationPersistArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreLocationResultIValueData\"\n }\n },\n \"geolocationStoreRemoveLocation\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeolocationStoreArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n }\n }\n }\n }\n}","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { GeolocationStore, geolocationStoreMethods } from './agent/GeolocationStore'\nexport * from './types/IGeolocationStore'\n","import { IAgentPlugin } from '@veramo/core'\nimport {\n GeolocationStoreArgs,\n GeolocationStoreClearAllLocationsArgs,\n GeolocationStoreLocation,\n GeolocationStoreLocationPersistArgs,\n GeolocationStoreLocationResult,\n GeolocationStoreLocationResultIValueData,\n GeolocationStoreLocationResultOrUndefined,\n IGeolocationStore,\n schema,\n} from '../index'\n\nimport { IKeyValueStore, KeyValueStore, ValueStoreType } from '@sphereon/ssi-sdk.kv-store-temp'\n\nexport const geolocationStoreMethods: Array<string> = [\n 'geolocationStorePersistLocation',\n 'geolocationStoreHasLocation',\n 'geolocationStoreRemoveLocation',\n 'geolocationStoreClearAllLocations',\n 'geolocationStoreGetLocation',\n 'geolocationStoreDefaultLocationStore',\n]\n\n/**\n * {@inheritDoc IGeolocationStore}\n */\nexport class GeolocationStore implements IAgentPlugin {\n readonly schema = schema.IAnomalyDetectionStore\n private readonly defaultStoreId: string\n private readonly defaultNamespace: string\n private readonly _dnsLookupStore: Map<string, IKeyValueStore<GeolocationStoreLocation>>\n\n readonly methods: IGeolocationStore = {\n geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),\n geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),\n geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),\n geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),\n geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),\n geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this),\n }\n\n constructor(args: {\n defaultStoreId?: string\n defaultNamespace?: string\n dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>\n }) {\n this.defaultStoreId = args?.defaultStoreId ?? '_default'\n this.defaultNamespace = args?.defaultNamespace ?? 'anomaly-detection'\n\n if (args?.dnsLookupStore !== undefined && args?.dnsLookupStore !== null && args.dnsLookupStore instanceof Map) {\n this._dnsLookupStore = args.dnsLookupStore\n } else {\n this._dnsLookupStore = new Map().set(\n this.defaultStoreId,\n new KeyValueStore({\n namespace: this.defaultNamespace,\n store: new Map<string, GeolocationStoreLocation>(),\n }),\n )\n }\n }\n\n private async geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData> {\n const storeId = this.storeIdStr(args)\n const namespace = this.namespaceStr(args)\n const { ipOrHostname, locationArgs, ttl } = args\n\n if (args?.validation !== false) {\n // TODO\n }\n const existing = await this.store({ stores: this._dnsLookupStore, storeId }).getAsValueData(\n this.prefix({\n namespace,\n ipOrHostname,\n }),\n )\n if (!existing.value || (existing.value && args?.overwriteExisting !== false)) {\n return await this.store({ stores: this._dnsLookupStore, storeId }).set(\n this.prefix({\n namespace,\n ipOrHostname,\n }),\n locationArgs,\n ttl,\n )\n }\n return existing\n }\n\n private async geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store({ stores: this._dnsLookupStore, storeId }).has(this.prefix({ namespace, ipOrHostname }))\n }\n\n private async geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store({ stores: this._dnsLookupStore, storeId }).delete(this.prefix({ namespace, ipOrHostname }))\n }\n\n private async geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean> {\n const { storeId } = { ...args }\n return await this.store({ stores: this._dnsLookupStore, storeId })\n .clear()\n .then(() => true)\n }\n\n private async geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined> {\n const { storeId, namespace, ipOrHostname } = { ...args }\n return this.store<GeolocationStoreLocation>({\n stores: this._dnsLookupStore,\n storeId,\n }).get(this.prefix({ namespace, ipOrHostname }))\n }\n\n private store<T extends ValueStoreType>(args: { stores: Map<string, IKeyValueStore<T>>; storeId?: string }): IKeyValueStore<T> {\n const storeId = this.storeIdStr({ storeId: args.storeId })\n const store = args.stores.get(storeId)\n if (!store) {\n throw Error(`Could not get geolocation store: ${storeId}`)\n }\n return store\n }\n\n private storeIdStr({ storeId }: { storeId?: string }): string {\n return storeId ?? this.defaultStoreId\n }\n\n private geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult> {\n return Promise.resolve(this.store({ stores: this._dnsLookupStore, storeId: this.defaultStoreId }))\n }\n\n private namespaceStr({ namespace }: { namespace?: string }): string {\n return namespace ?? this.defaultNamespace\n }\n\n private prefix({ namespace, ipOrHostname }: { namespace?: string; ipOrHostname: string }): string {\n return `${this.namespaceStr({ namespace })}:${ipOrHostname}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,gCAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,mBAAqB;AAAA,QACnB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,uCAAyC;AAAA,cACvC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,SAAW;AAAA,kBACT,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY;AAAA,gBACV;AAAA,cACF;AAAA,cACA,sBAAwB;AAAA,YAC1B;AAAA,YACA,gCAAkC;AAAA,cAChC,MAAQ;AAAA,YACV;AAAA,YACA,4CAA4C;AAAA,cAC1C,MAAQ;AAAA,cACR,aAAe;AAAA,YACjB;AAAA,YACA,sBAAwB;AAAA,cACtB,MAAQ;AAAA,c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QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAK1B;MAAiBkB,SAAS,KAAKpB;IAAe,CAAA,CAAA;EACjG;EAEQsB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKjB;EAC3B;EAEQ6B,OAAO,EAAEZ,WAAWK,aAAY,GAA0D;AAChG,WAAO,GAAG,KAAKD,aAAa;MAAEJ;IAAU,CAAA,CAAA,IAAMK,YAAAA;EAChD;AACF;;;ADxIA,IAAMkB,SAASC;","names":["module","geolocationStoreMethods","GeolocationStore","schema","IAnomalyDetectionStore","defaultStoreId","defaultNamespace","_dnsLookupStore","methods","geolocationStorePersistLocation","bind","geolocationStoreHasLocation","geolocationStoreRemoveLocation","geolocationStoreClearAllLocations","geolocationStoreGetLocation","geolocationStoreDefaultLocationStore","constructor","args","dnsLookupStore","undefined","Map","set","KeyValueStore","namespace","store","storeId","storeIdStr","namespaceStr","ipOrHostname","locationArgs","ttl","validation","existing","stores","getAsValueData","prefix","value","overwriteExisting","has","delete","clear","then","get","Error","Promise","resolve","schema","require"]}