@sphereon/ssi-sdk.geolocation-store 0.34.1-next.91 → 0.36.0

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 CHANGED
@@ -38,9 +38,7 @@ var require_plugin_schema = __commonJS({
38
38
  type: "string"
39
39
  }
40
40
  },
41
- required: [
42
- "storeId"
43
- ],
41
+ required: ["storeId"],
44
42
  additionalProperties: false
45
43
  },
46
44
  GeolocationStoreLocationResult: {
@@ -64,11 +62,7 @@ var require_plugin_schema = __commonJS({
64
62
  type: "string"
65
63
  }
66
64
  },
67
- required: [
68
- "ipOrHostname",
69
- "storeId",
70
- "namespace"
71
- ],
65
+ required: ["ipOrHostname", "storeId", "namespace"],
72
66
  additionalProperties: false
73
67
  },
74
68
  GeolocationStoreLocationResultOrUndefined: {
@@ -119,10 +113,7 @@ var require_plugin_schema = __commonJS({
119
113
  type: "string"
120
114
  }
121
115
  },
122
- required: [
123
- "ipOrHostname",
124
- "locationArgs"
125
- ]
116
+ required: ["ipOrHostname", "locationArgs"]
126
117
  },
127
118
  GeolocationStoreLocationResultIValueData: {
128
119
  $ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
@@ -1 +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\": [\n \"storeId\"\n ],\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\": [\n \"ipOrHostname\",\n \"storeId\",\n \"namespace\"\n ],\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\": [\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 \"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 * @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;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,sBAAwB;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,sBAAwB;AAAA,cACtB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,cAAgB;AAAA,kBACd,MAAQ;AAAA,gBACV;AAAA,gBACA,SAAW;AAAA,kBACT,MAAQ;AAAA,gBACV;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY;AAAA,gBACV;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA,cACA,sBAAwB;AAAA,YAC1B;AAAA,YACA,2CAA6C;AAAA,cAC3C,OAAS;AAAA,gBACP;AAAA,kBACE,MAAQ;AAAA,gBACV;AAAA,gBACA;AAAA,kBACE,KAAO,CAAC;AAAA,gBACV;AAAA,cACF;AAAA,YACF;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,SAAW;AAAA,kBACT,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,MAA+D;AAC7G,UAAM,EAAEQ,QAAO,IAAK;MAAE,GAAGR;IAAK;AAC9B,WAAO,MAAM,KAAKO,MAAM;MAAES,QAAQ,KAAKzB;MAAiBiB;IAAQ,CAAA,EAC7De,MAAK,EACLC,KAAK,MAAM,IAAA;EAChB;EAEA,MAAc1B,4BAA4BE,MAAgF;AACxH,UAAM,EAAEQ,SAASF,WAAWK,aAAY,IAAK;MAAE,GAAGX;IAAK;AACvD,WAAO,KAAKO,MAAgC;MAC1CS,QAAQ,KAAKzB;MACbiB;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,KAAKnB;EACzB;EAEQU,uCAAgF;AACtF,WAAO4B,QAAQC,QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAKzB;MAAiBiB,SAAS,KAAKnB;IAAe,CAAA,CAAA;EACjG;EAEQqB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKhB;EAC3B;EAEQ4B,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","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,"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,a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;EACT;EAEQE,WAAW,EAAED,QAAO,GAAkC;AAC5D,WAAOA,WAAW,KAAKnB;EACzB;EAEQU,uCAAgF;AACtF,WAAO4B,QAAQC,QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAKzB;MAAiBiB,SAAS,KAAKnB;IAAe,CAAA,CAAA;EACjG;EAEQqB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKhB;EAC3B;EAEQ4B,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","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"]}
package/dist/index.js CHANGED
@@ -22,9 +22,7 @@ var require_plugin_schema = __commonJS({
22
22
  type: "string"
23
23
  }
24
24
  },
25
- required: [
26
- "storeId"
27
- ],
25
+ required: ["storeId"],
28
26
  additionalProperties: false
29
27
  },
30
28
  GeolocationStoreLocationResult: {
@@ -48,11 +46,7 @@ var require_plugin_schema = __commonJS({
48
46
  type: "string"
49
47
  }
50
48
  },
51
- required: [
52
- "ipOrHostname",
53
- "storeId",
54
- "namespace"
55
- ],
49
+ required: ["ipOrHostname", "storeId", "namespace"],
56
50
  additionalProperties: false
57
51
  },
58
52
  GeolocationStoreLocationResultOrUndefined: {
@@ -103,10 +97,7 @@ var require_plugin_schema = __commonJS({
103
97
  type: "string"
104
98
  }
105
99
  },
106
- required: [
107
- "ipOrHostname",
108
- "locationArgs"
109
- ]
100
+ required: ["ipOrHostname", "locationArgs"]
110
101
  },
111
102
  GeolocationStoreLocationResultIValueData: {
112
103
  $ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
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 \"$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\": [\n \"storeId\"\n ],\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\": [\n \"ipOrHostname\",\n \"storeId\",\n \"namespace\"\n ],\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\": [\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 \"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}","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'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;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;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,sBAAwB;AAAA,cACxB,aAAe;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AC3D;AACA,WAAOD;EACT;EAEQE,WAAW,EAAED,QAAO,GAAkC;AAC5D,WAAOA,WAAW,KAAKnB;EACzB;EAEQU,uCAAgF;AACtF,WAAO4B,QAAQC,QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAKzB;MAAiBiB,SAAS,KAAKnB;IAAe,CAAA,CAAA;EACjG;EAEQqB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKhB;EAC3B;EAEQ4B,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","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,"sources":["../plugin.schema.json","../src/agent/GeolocationStore.ts","../src/index.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","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'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;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,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,cAAgB;AAAA,kBACd,MAAQ;AAAA,gBACV;AAAA,gBACA,SAAW;AAAA,kBACT,MAAQ;AAAA,gBACV;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY,CAAC,gBAAgB,WAAW,WAAW;AAAA,cACnD,sBAAwB;AAAA,YAC1B;AAAA,YACA,2CAA6C;AAAA,cAC3C,OAAS;AAAA,gBACP;AAAA,kBACE,MAAQ;AAAA,gBACV;AAAA,gBACA;AAAA,kBACE,KAAO,CAAC;AAAA,gBACV;AAAA,cACF;AAAA,YACF;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,SAAW;AAAA,kBACT,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,sBAAwB;AAAA,YAC1B;AAAA,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AAM;MAAES,QAAQ,KAAKzB;MAAiBiB;IAAQ,CAAA,EAC7De,MAAK,EACLC,KAAK,MAAM,IAAA;EAChB;EAEA,MAAc1B,4BAA4BE,MAAgF;AACxH,UAAM,EAAEQ,SAASF,WAAWK,aAAY,IAAK;MAAE,GAAGX;IAAK;AACvD,WAAO,KAAKO,MAAgC;MAC1CS,QAAQ,KAAKzB;MACbiB;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,KAAKnB;EACzB;EAEQU,uCAAgF;AACtF,WAAO4B,QAAQC,QAAQ,KAAKrB,MAAM;MAAES,QAAQ,KAAKzB;MAAiBiB,SAAS,KAAKnB;IAAe,CAAA,CAAA;EACjG;EAEQqB,aAAa,EAAEJ,UAAS,GAAoC;AAClE,WAAOA,aAAa,KAAKhB;EAC3B;EAEQ4B,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","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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.geolocation-store",
3
- "version": "0.34.1-next.91+3c949810",
3
+ "version": "0.36.0",
4
4
  "source": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -27,10 +27,10 @@
27
27
  "generate-plugin-schema": "tsx ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
28
28
  },
29
29
  "dependencies": {
30
- "@sphereon/ssi-sdk.kv-store-temp": "0.34.1-next.91+3c949810"
30
+ "@sphereon/ssi-sdk.kv-store-temp": "0.36.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@sphereon/ssi-sdk.agent-config": "0.34.1-next.91+3c949810",
33
+ "@sphereon/ssi-sdk.agent-config": "0.36.0",
34
34
  "@types/node": "^20.17.1",
35
35
  "@veramo/remote-client": "4.2.0",
36
36
  "@veramo/remote-server": "4.2.0",
@@ -57,5 +57,5 @@
57
57
  "Anomaly Detection",
58
58
  "Anomaly Detection Store"
59
59
  ],
60
- "gitHead": "3c9498100ca07dfc2ba7979e7347fb9b19c47d18"
60
+ "gitHead": "f713d3a83948ef69aaa7d435700b16d5655ac863"
61
61
  }
@@ -12,9 +12,7 @@
12
12
  "type": "string"
13
13
  }
14
14
  },
15
- "required": [
16
- "storeId"
17
- ],
15
+ "required": ["storeId"],
18
16
  "additionalProperties": false
19
17
  },
20
18
  "GeolocationStoreLocationResult": {
@@ -38,11 +36,7 @@
38
36
  "type": "string"
39
37
  }
40
38
  },
41
- "required": [
42
- "ipOrHostname",
43
- "storeId",
44
- "namespace"
45
- ],
39
+ "required": ["ipOrHostname", "storeId", "namespace"],
46
40
  "additionalProperties": false
47
41
  },
48
42
  "GeolocationStoreLocationResultOrUndefined": {
@@ -93,10 +87,7 @@
93
87
  "type": "string"
94
88
  }
95
89
  },
96
- "required": [
97
- "ipOrHostname",
98
- "locationArgs"
99
- ]
90
+ "required": ["ipOrHostname", "locationArgs"]
100
91
  },
101
92
  "GeolocationStoreLocationResultIValueData": {
102
93
  "$ref": "#/components/schemas/IValueData<GeolocationStoreLocation>"
@@ -173,4 +164,4 @@
173
164
  }
174
165
  }
175
166
  }
176
- }
167
+ }