@sphereon/ssi-sdk.geolocation-store 0.34.1-next.3 → 0.34.1-next.40
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 +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/plugin.schema.json +13 -4
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,9 @@ var require_plugin_schema = __commonJS({
|
|
|
38
38
|
type: "string"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
required: [
|
|
41
|
+
required: [
|
|
42
|
+
"storeId"
|
|
43
|
+
],
|
|
42
44
|
additionalProperties: false
|
|
43
45
|
},
|
|
44
46
|
GeolocationStoreLocationResult: {
|
|
@@ -62,7 +64,11 @@ var require_plugin_schema = __commonJS({
|
|
|
62
64
|
type: "string"
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
|
-
required: [
|
|
67
|
+
required: [
|
|
68
|
+
"ipOrHostname",
|
|
69
|
+
"storeId",
|
|
70
|
+
"namespace"
|
|
71
|
+
],
|
|
66
72
|
additionalProperties: false
|
|
67
73
|
},
|
|
68
74
|
GeolocationStoreLocationResultOrUndefined: {
|
|
@@ -113,7 +119,10 @@ var require_plugin_schema = __commonJS({
|
|
|
113
119
|
type: "string"
|
|
114
120
|
}
|
|
115
121
|
},
|
|
116
|
-
required: [
|
|
122
|
+
required: [
|
|
123
|
+
"ipOrHostname",
|
|
124
|
+
"locationArgs"
|
|
125
|
+
]
|
|
117
126
|
},
|
|
118
127
|
GeolocationStoreLocationResultIValueData: {
|
|
119
128
|
$ref: "#/components/schemas/IValueData<GeolocationStoreLocation>"
|
package/dist/index.cjs.map
CHANGED
|
@@ -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\": [\"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,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,sBAAw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,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\": [\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,cAC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D,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"]}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,9 @@ var require_plugin_schema = __commonJS({
|
|
|
22
22
|
type: "string"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
required: [
|
|
25
|
+
required: [
|
|
26
|
+
"storeId"
|
|
27
|
+
],
|
|
26
28
|
additionalProperties: false
|
|
27
29
|
},
|
|
28
30
|
GeolocationStoreLocationResult: {
|
|
@@ -46,7 +48,11 @@ var require_plugin_schema = __commonJS({
|
|
|
46
48
|
type: "string"
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
|
-
required: [
|
|
51
|
+
required: [
|
|
52
|
+
"ipOrHostname",
|
|
53
|
+
"storeId",
|
|
54
|
+
"namespace"
|
|
55
|
+
],
|
|
50
56
|
additionalProperties: false
|
|
51
57
|
},
|
|
52
58
|
GeolocationStoreLocationResultOrUndefined: {
|
|
@@ -97,7 +103,10 @@ var require_plugin_schema = __commonJS({
|
|
|
97
103
|
type: "string"
|
|
98
104
|
}
|
|
99
105
|
},
|
|
100
|
-
required: [
|
|
106
|
+
required: [
|
|
107
|
+
"ipOrHostname",
|
|
108
|
+
"locationArgs"
|
|
109
|
+
]
|
|
101
110
|
},
|
|
102
111
|
GeolocationStoreLocationResultIValueData: {
|
|
103
112
|
$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\": [\"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,YACA,qCAAuC;AAAA,cACr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zB;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"]}
|
|
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;AAAA,YACjB;AAAA,YACA,sBAAwB;AAAA,cACtB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,cAAgB;AAAA,kBACd,MAAQ;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ACtF,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.
|
|
3
|
+
"version": "0.34.1-next.40+16fd35c0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
|
|
27
|
-
"generate-plugin-schema": "
|
|
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.
|
|
30
|
+
"@sphereon/ssi-sdk.kv-store-temp": "0.34.1-next.40+16fd35c0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-next.
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-next.40+16fd35c0",
|
|
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": "
|
|
60
|
+
"gitHead": "16fd35c05f13688d8e2bbe4221d3dc3863dff176"
|
|
61
61
|
}
|
package/plugin.schema.json
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"type": "string"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"required": [
|
|
15
|
+
"required": [
|
|
16
|
+
"storeId"
|
|
17
|
+
],
|
|
16
18
|
"additionalProperties": false
|
|
17
19
|
},
|
|
18
20
|
"GeolocationStoreLocationResult": {
|
|
@@ -36,7 +38,11 @@
|
|
|
36
38
|
"type": "string"
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
|
-
"required": [
|
|
41
|
+
"required": [
|
|
42
|
+
"ipOrHostname",
|
|
43
|
+
"storeId",
|
|
44
|
+
"namespace"
|
|
45
|
+
],
|
|
40
46
|
"additionalProperties": false
|
|
41
47
|
},
|
|
42
48
|
"GeolocationStoreLocationResultOrUndefined": {
|
|
@@ -87,7 +93,10 @@
|
|
|
87
93
|
"type": "string"
|
|
88
94
|
}
|
|
89
95
|
},
|
|
90
|
-
"required": [
|
|
96
|
+
"required": [
|
|
97
|
+
"ipOrHostname",
|
|
98
|
+
"locationArgs"
|
|
99
|
+
]
|
|
91
100
|
},
|
|
92
101
|
"GeolocationStoreLocationResultIValueData": {
|
|
93
102
|
"$ref": "#/components/schemas/IValueData<GeolocationStoreLocation>"
|
|
@@ -164,4 +173,4 @@
|
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
|
-
}
|
|
176
|
+
}
|