@sphereon/ssi-sdk.geolocation-store 0.33.1-next.2 → 0.33.1-next.68

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 ADDED
@@ -0,0 +1,344 @@
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
+ $ref: '#/components/schemas/Pick<GeolocationStoreArgs,"storeId">'
33
+ },
34
+ 'Pick<GeolocationStoreArgs,"storeId">': {
35
+ type: "object",
36
+ properties: {
37
+ storeId: {
38
+ type: "string"
39
+ }
40
+ },
41
+ required: ["storeId"],
42
+ additionalProperties: false
43
+ },
44
+ GeolocationStoreLocationResult: {
45
+ $ref: "#/components/schemas/IKeyValueStore<GeolocationStoreLocation>"
46
+ },
47
+ "IKeyValueStore<GeolocationStoreLocation>": {
48
+ type: "object",
49
+ additionalProperties: false,
50
+ description: "A Key Value store is responsible for managing Values identified by keys."
51
+ },
52
+ GeolocationStoreArgs: {
53
+ type: "object",
54
+ properties: {
55
+ ipOrHostname: {
56
+ type: "string"
57
+ },
58
+ storeId: {
59
+ type: "string"
60
+ },
61
+ namespace: {
62
+ type: "string"
63
+ }
64
+ },
65
+ required: ["ipOrHostname", "storeId", "namespace"],
66
+ additionalProperties: false
67
+ },
68
+ GeolocationStoreLocationResultOrUndefined: {
69
+ anyOf: [
70
+ {
71
+ $ref: "#/components/schemas/GeolocationStoreLocation"
72
+ },
73
+ {
74
+ not: {}
75
+ }
76
+ ]
77
+ },
78
+ GeolocationStoreLocation: {
79
+ type: "object",
80
+ properties: {
81
+ continent: {
82
+ type: "string"
83
+ },
84
+ country: {
85
+ type: "string"
86
+ }
87
+ },
88
+ additionalProperties: false
89
+ },
90
+ GeolocationStoreLocationPersistArgs: {
91
+ type: "object",
92
+ additionalProperties: false,
93
+ properties: {
94
+ locationArgs: {
95
+ $ref: "#/components/schemas/GeolocationStoreLocation"
96
+ },
97
+ ipOrHostname: {
98
+ type: "string"
99
+ },
100
+ overwriteExisting: {
101
+ type: "boolean"
102
+ },
103
+ validation: {
104
+ type: "boolean"
105
+ },
106
+ ttl: {
107
+ type: "number"
108
+ },
109
+ storeId: {
110
+ type: "string"
111
+ },
112
+ namespace: {
113
+ type: "string"
114
+ }
115
+ },
116
+ required: ["ipOrHostname", "locationArgs"]
117
+ },
118
+ GeolocationStoreLocationResultIValueData: {
119
+ $ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
120
+ },
121
+ "IValueData<GeolocationStoreLocation>": {
122
+ type: "object",
123
+ properties: {
124
+ value: {
125
+ $ref: "#/components/schemas/GeolocationStoreLocation"
126
+ },
127
+ expires: {
128
+ type: "number"
129
+ }
130
+ },
131
+ additionalProperties: false,
132
+ description: "This is how the store will actually store the value. It contains an optional `expires` property, which indicates when the value would expire"
133
+ }
134
+ },
135
+ methods: {
136
+ geolocationStoreClearAllLocations: {
137
+ description: "",
138
+ arguments: {
139
+ $ref: "#/components/schemas/GeolocationStoreClearAllLocationsArgs"
140
+ },
141
+ returnType: {
142
+ type: "boolean"
143
+ }
144
+ },
145
+ geolocationStoreDefaultLocationStore: {
146
+ description: "",
147
+ arguments: {
148
+ type: "object"
149
+ },
150
+ returnType: {
151
+ $ref: "#/components/schemas/GeolocationStoreLocationResult"
152
+ }
153
+ },
154
+ geolocationStoreGetLocation: {
155
+ description: "",
156
+ arguments: {
157
+ $ref: "#/components/schemas/GeolocationStoreArgs"
158
+ },
159
+ returnType: {
160
+ $ref: "#/components/schemas/GeolocationStoreLocationResultOrUndefined"
161
+ }
162
+ },
163
+ geolocationStoreHasLocation: {
164
+ description: "",
165
+ arguments: {
166
+ $ref: "#/components/schemas/GeolocationStoreArgs"
167
+ },
168
+ returnType: {
169
+ type: "boolean"
170
+ }
171
+ },
172
+ geolocationStorePersistLocation: {
173
+ description: "",
174
+ arguments: {
175
+ $ref: "#/components/schemas/GeolocationStoreLocationPersistArgs"
176
+ },
177
+ returnType: {
178
+ $ref: "#/components/schemas/GeolocationStoreLocationResultIValueData"
179
+ }
180
+ },
181
+ geolocationStoreRemoveLocation: {
182
+ description: "",
183
+ arguments: {
184
+ $ref: "#/components/schemas/GeolocationStoreArgs"
185
+ },
186
+ returnType: {
187
+ type: "boolean"
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+ };
194
+ }
195
+ });
196
+
197
+ // src/index.ts
198
+ var index_exports = {};
199
+ __export(index_exports, {
200
+ GeolocationStore: () => GeolocationStore,
201
+ geolocationStoreMethods: () => geolocationStoreMethods,
202
+ schema: () => schema
203
+ });
204
+ module.exports = __toCommonJS(index_exports);
205
+
206
+ // src/agent/GeolocationStore.ts
207
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.kv-store-temp");
208
+ var geolocationStoreMethods = [
209
+ "geolocationStorePersistLocation",
210
+ "geolocationStoreHasLocation",
211
+ "geolocationStoreRemoveLocation",
212
+ "geolocationStoreClearAllLocations",
213
+ "geolocationStoreGetLocation",
214
+ "geolocationStoreDefaultLocationStore"
215
+ ];
216
+ var GeolocationStore = class {
217
+ static {
218
+ __name(this, "GeolocationStore");
219
+ }
220
+ schema = schema.IAnomalyDetectionStore;
221
+ defaultStoreId;
222
+ defaultNamespace;
223
+ _dnsLookupStore;
224
+ methods = {
225
+ geolocationStorePersistLocation: this.geolocationStorePersistLocation.bind(this),
226
+ geolocationStoreHasLocation: this.geolocationStoreHasLocation.bind(this),
227
+ geolocationStoreRemoveLocation: this.geolocationStoreRemoveLocation.bind(this),
228
+ geolocationStoreClearAllLocations: this.geolocationStoreClearAllLocations.bind(this),
229
+ geolocationStoreGetLocation: this.geolocationStoreGetLocation.bind(this),
230
+ geolocationStoreDefaultLocationStore: this.geolocationStoreDefaultLocationStore.bind(this)
231
+ };
232
+ constructor(args) {
233
+ this.defaultStoreId = args?.defaultStoreId ?? "_default";
234
+ this.defaultNamespace = args?.defaultNamespace ?? "anomaly-detection";
235
+ if (args?.dnsLookupStore !== void 0 && args?.dnsLookupStore !== null && args.dnsLookupStore instanceof Map) {
236
+ this._dnsLookupStore = args.dnsLookupStore;
237
+ } else {
238
+ this._dnsLookupStore = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new import_ssi_sdk.KeyValueStore({
239
+ namespace: this.defaultNamespace,
240
+ store: /* @__PURE__ */ new Map()
241
+ }));
242
+ }
243
+ }
244
+ async geolocationStorePersistLocation(args) {
245
+ const storeId = this.storeIdStr(args);
246
+ const namespace = this.namespaceStr(args);
247
+ const { ipOrHostname, locationArgs, ttl } = args;
248
+ if (args?.validation !== false) {
249
+ }
250
+ const existing = await this.store({
251
+ stores: this._dnsLookupStore,
252
+ storeId
253
+ }).getAsValueData(this.prefix({
254
+ namespace,
255
+ ipOrHostname
256
+ }));
257
+ if (!existing.value || existing.value && args?.overwriteExisting !== false) {
258
+ return await this.store({
259
+ stores: this._dnsLookupStore,
260
+ storeId
261
+ }).set(this.prefix({
262
+ namespace,
263
+ ipOrHostname
264
+ }), locationArgs, ttl);
265
+ }
266
+ return existing;
267
+ }
268
+ async geolocationStoreHasLocation(args) {
269
+ const { storeId, namespace, ipOrHostname } = {
270
+ ...args
271
+ };
272
+ return this.store({
273
+ stores: this._dnsLookupStore,
274
+ storeId
275
+ }).has(this.prefix({
276
+ namespace,
277
+ ipOrHostname
278
+ }));
279
+ }
280
+ async geolocationStoreRemoveLocation(args) {
281
+ const { storeId, namespace, ipOrHostname } = {
282
+ ...args
283
+ };
284
+ return this.store({
285
+ stores: this._dnsLookupStore,
286
+ storeId
287
+ }).delete(this.prefix({
288
+ namespace,
289
+ ipOrHostname
290
+ }));
291
+ }
292
+ async geolocationStoreClearAllLocations(args) {
293
+ const { storeId } = {
294
+ ...args
295
+ };
296
+ return await this.store({
297
+ stores: this._dnsLookupStore,
298
+ storeId
299
+ }).clear().then(() => true);
300
+ }
301
+ async geolocationStoreGetLocation(args) {
302
+ const { storeId, namespace, ipOrHostname } = {
303
+ ...args
304
+ };
305
+ return this.store({
306
+ stores: this._dnsLookupStore,
307
+ storeId
308
+ }).get(this.prefix({
309
+ namespace,
310
+ ipOrHostname
311
+ }));
312
+ }
313
+ store(args) {
314
+ const storeId = this.storeIdStr({
315
+ storeId: args.storeId
316
+ });
317
+ const store = args.stores.get(storeId);
318
+ if (!store) {
319
+ throw Error(`Could not get geolocation store: ${storeId}`);
320
+ }
321
+ return store;
322
+ }
323
+ storeIdStr({ storeId }) {
324
+ return storeId ?? this.defaultStoreId;
325
+ }
326
+ geolocationStoreDefaultLocationStore() {
327
+ return Promise.resolve(this.store({
328
+ stores: this._dnsLookupStore,
329
+ storeId: this.defaultStoreId
330
+ }));
331
+ }
332
+ namespaceStr({ namespace }) {
333
+ return namespace ?? this.defaultNamespace;
334
+ }
335
+ prefix({ namespace, ipOrHostname }) {
336
+ return `${this.namespaceStr({
337
+ namespace
338
+ })}:${ipOrHostname}`;
339
+ }
340
+ };
341
+
342
+ // src/index.ts
343
+ var schema = require_plugin_schema();
344
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/GeolocationStore.ts"],"sourcesContent":["{\n \"IGeolocationStore\": {\n \"components\": {\n \"schemas\": {\n \"GeolocationStoreClearAllLocationsArgs\": {\n \"$ref\": \"#/components/schemas/Pick<GeolocationStoreArgs,\\\"storeId\\\">\"\n },\n \"Pick<GeolocationStoreArgs,\\\"storeId\\\">\": {\n \"type\": \"object\",\n \"properties\": {\n \"storeId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"storeId\"],\n \"additionalProperties\": false\n },\n \"GeolocationStoreLocationResult\": {\n \"$ref\": \"#/components/schemas/IKeyValueStore<GeolocationStoreLocation>\"\n },\n \"IKeyValueStore<GeolocationStoreLocation>\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\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\": [\"ipOrHostname\", \"storeId\", \"namespace\"],\n \"additionalProperties\": false\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 \"additionalProperties\": false\n },\n \"GeolocationStoreLocationPersistArgs\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\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\": [\"ipOrHostname\", \"locationArgs\"]\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 \"additionalProperties\": false,\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","/**\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,YACV;AAAA,YACA,wCAA0C;AAAA,cACxC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,SAAW;AAAA,kBACT,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY,CAAC,SAAS;AAAA,cACtB,sBAAwB;AAAA,YAC1B;AAAA,YACA,gCAAkC;AAAA,cAChC,MAAQ;AAAA,YACV;AAAA,YACA,4CAA4C;AAAA,cAC1C,MAAQ;AAAA,cACR,sBAAwB;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,sBAAwB;AAAA,cACtB,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D,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;;;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"]}
@@ -1,80 +1,69 @@
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 { }
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 };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,69 @@
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
+
1
64
  /**
2
65
  * @public
3
66
  */
4
67
  declare const schema: any;
5
- export { schema };
6
- export { GeolocationStore, geolocationStoreMethods } from './agent/GeolocationStore';
7
- export * from './types/IGeolocationStore';
8
- //# sourceMappingURL=index.d.ts.map
68
+
69
+ export { GeolocationStore, type GeolocationStoreArgs, type GeolocationStoreClearAllLocationsArgs, type GeolocationStoreLocation, type GeolocationStoreLocationPersistArgs, type GeolocationStoreLocationResult, type GeolocationStoreLocationResultIValueData, type GeolocationStoreLocationResultOrUndefined, type GeolocationStorePersistArgs, type IGeolocationStore, geolocationStoreMethods, schema };