@twin.org/verifiable-storage-service 0.9.2-next.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ export class VerifiableStorageService {
23
23
  /**
24
24
  * Create a new instance of VerifiableStorageService.
25
25
  * @param options The options for the service.
26
- * @throws {GeneralError} If no connectors are registered.
26
+ * @throws GeneralError If no connectors are registered.
27
27
  */
28
28
  constructor(options) {
29
29
  const names = VerifiableStorageConnectorFactory.names();
@@ -1 +1 @@
1
- {"version":3,"file":"verifiableStorageService.js","sourceRoot":"","sources":["../../src/verifiableStorageService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EACN,iCAAiC,EAGjC,MAAM,qCAAqC,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,YAAY,CAAC;IAE1D;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;;OAIG;IACH,YAAY,OAAqD;QAChE,MAAM,KAAK,GAAG,iCAAiC,CAAC,KAAK,EAAE,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,MAAM,CAClB,IAAgB,E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AAC,mBAAmB,EAAE,KAAK,wBAAwB,CAAC,UAAU,EAAE,CAAC;YACzE,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBAChF,SAAS,EAAE,wBAAwB,CAAC,UAAU;gBAC9C,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,iCAAiC,CAAC,GAAG,CAC3C,KAAK,CAAC,eAAe,EAAE,CACvB,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tVerifiableStorageConnectorFactory,\n\ttype IVerifiableStorageComponent,\n\ttype IVerifiableStorageConnector\n} from \"@twin.org/verifiable-storage-models\";\nimport type { IVerifiableStorageServiceConstructorOptions } from \"./models/IVerifiableStorageServiceConstructorOptions.js\";\n\n/**\n * Service for performing Verifiable Storage operations to a connector.\n */\nexport class VerifiableStorageService implements IVerifiableStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerifiableStorageService>();\n\n\t/**\n\t * The namespace supported by the verifiableStorage service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"verifiable\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of VerifiableStorageService.\n\t * @param options The options for the service.\n\t * @throws {GeneralError} If no connectors are registered.\n\t */\n\tconstructor(options?: IVerifiableStorageServiceConstructorOptions) {\n\t\tconst names = VerifiableStorageConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn VerifiableStorageService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a verifiable storage item.\n\t * @param data The data for the verifiable storage item.\n\t * @param allowList The list of identities that are allowed to modify the item.\n\t * @param options Additional options for creating the item.\n\t * @param options.maxAllowListSize The maximum size of the allow list.\n\t * @param namespace The namespace to use for the connector to use.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The id of the created verifiable storage item.\n\t */\n\tpublic async create(\n\t\tdata: Uint8Array,\n\t\tallowList?: string[],\n\t\toptions?: {\n\t\t\tmaxAllowListSize?: number;\n\t\t},\n\t\tnamespace?: string,\n\t\tcontroller?: string\n\t): Promise<{\n\t\tid: string;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tGuards.uint8Array(VerifiableStorageService.CLASS_NAME, nameof(data), data);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst verifiableStorageConnector =\n\t\t\t\tVerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(connectorNamespace);\n\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.create(\n\t\t\t\tcontroller,\n\t\t\t\tdata,\n\t\t\t\tallowList,\n\t\t\t\toptions\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"createFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update an item in verifiable storage.\n\t * @param id The id of the item to update.\n\t * @param data The data to store, optional if updating the allow list.\n\t * @param allowList Updated list of identities that are allowed to modify the item.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The updated receipt.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tdata?: Uint8Array,\n\t\tallowList?: string[],\n\t\tcontroller?: string\n\t): Promise<IJsonLdNodeObject> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.update(\n\t\t\t\tcontroller,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tallowList\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get a verifiable storage item.\n\t * @param id The id of the verifiable storage item to get.\n\t * @param options Additional options for getting the verifiable storage item.\n\t * @param options.includeData Should the data be included in the response, defaults to true.\n\t * @param options.includeAllowList Should the allow list be included in the response, defaults to true.\n\t * @returns The data and receipt for the verifiable storage item.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: { includeData?: boolean; includeAllowList?: boolean }\n\t): Promise<{\n\t\tdata?: Uint8Array;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst result = await verifiableStorageConnector.get(id, options);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Remove a verifiable storage item.\n\t * @param id The id of the verifiable storage item to remove.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns A promise that resolves when the item has been removed.\n\t */\n\tpublic async remove(id: string, controller?: string): Promise<void> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tawait verifiableStorageConnector.remove(controller, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"removeFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the item in urn format.\n\t * @returns The connector.\n\t * @throws GeneralError If the namespace does not match.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): IVerifiableStorageConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== VerifiableStorageService._NAMESPACE) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: VerifiableStorageService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn VerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(\n\t\t\tidUri.namespaceMethod()\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"verifiableStorageService.js","sourceRoot":"","sources":["../../src/verifiableStorageService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EACN,iCAAiC,EAGjC,MAAM,qCAAqC,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,YAAY,CAAC;IAE1D;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;;OAIG;IACH,YAAY,OAAqD;QAChE,MAAM,KAAK,GAAG,iCAAiC,CAAC,KAAK,EAAE,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC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AC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC/F,CAAC;IACF,CAAC;IAED;;;;;;OAMG;IACK,YAAY,CAAC,EAAU;QAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAEtC,IAAI,KAAK,CAAC,mBAAmB,EAAE,KAAK,wBAAwB,CAAC,UAAU,EAAE,CAAC;YACzE,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBAChF,SAAS,EAAE,wBAAwB,CAAC,UAAU;gBAC9C,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,iCAAiC,CAAC,GAAG,CAC3C,KAAK,CAAC,eAAe,EAAE,CACvB,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tVerifiableStorageConnectorFactory,\n\ttype IVerifiableStorageComponent,\n\ttype IVerifiableStorageConnector\n} from \"@twin.org/verifiable-storage-models\";\nimport type { IVerifiableStorageServiceConstructorOptions } from \"./models/IVerifiableStorageServiceConstructorOptions.js\";\n\n/**\n * Service for performing Verifiable Storage operations to a connector.\n */\nexport class VerifiableStorageService implements IVerifiableStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerifiableStorageService>();\n\n\t/**\n\t * The namespace supported by the verifiableStorage service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"verifiable\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of VerifiableStorageService.\n\t * @param options The options for the service.\n\t * @throws GeneralError If no connectors are registered.\n\t */\n\tconstructor(options?: IVerifiableStorageServiceConstructorOptions) {\n\t\tconst names = VerifiableStorageConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn VerifiableStorageService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a verifiable storage item.\n\t * @param data The data for the verifiable storage item.\n\t * @param allowList The list of identities that are allowed to modify the item.\n\t * @param options Additional options for creating the item.\n\t * @param options.maxAllowListSize The maximum size of the allow list.\n\t * @param namespace The namespace to use for the connector to use.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The id of the created verifiable storage item.\n\t */\n\tpublic async create(\n\t\tdata: Uint8Array,\n\t\tallowList?: string[],\n\t\toptions?: {\n\t\t\tmaxAllowListSize?: number;\n\t\t},\n\t\tnamespace?: string,\n\t\tcontroller?: string\n\t): Promise<{\n\t\tid: string;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tGuards.uint8Array(VerifiableStorageService.CLASS_NAME, nameof(data), data);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst verifiableStorageConnector =\n\t\t\t\tVerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(connectorNamespace);\n\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.create(\n\t\t\t\tcontroller,\n\t\t\t\tdata,\n\t\t\t\tallowList,\n\t\t\t\toptions\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"createFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update an item in verifiable storage.\n\t * @param id The id of the item to update.\n\t * @param data The data to store, optional if updating the allow list.\n\t * @param allowList Updated list of identities that are allowed to modify the item.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The updated receipt.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tdata?: Uint8Array,\n\t\tallowList?: string[],\n\t\tcontroller?: string\n\t): Promise<IJsonLdNodeObject> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.update(\n\t\t\t\tcontroller,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tallowList\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get a verifiable storage item.\n\t * @param id The id of the verifiable storage item to get.\n\t * @param options Additional options for getting the verifiable storage item.\n\t * @param options.includeData Should the data be included in the response, defaults to true.\n\t * @param options.includeAllowList Should the allow list be included in the response, defaults to true.\n\t * @returns The data and receipt for the verifiable storage item.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: { includeData?: boolean; includeAllowList?: boolean }\n\t): Promise<{\n\t\tdata?: Uint8Array;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst result = await verifiableStorageConnector.get(id, options);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Remove a verifiable storage item.\n\t * @param id The id of the verifiable storage item to remove.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns A promise that resolves when the item has been removed.\n\t */\n\tpublic async remove(id: string, controller?: string): Promise<void> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tawait verifiableStorageConnector.remove(controller, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"removeFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the item in urn format.\n\t * @returns The connector.\n\t * @throws GeneralError If the namespace does not match.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): IVerifiableStorageConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== VerifiableStorageService._NAMESPACE) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: VerifiableStorageService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn VerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(\n\t\t\tidUri.namespaceMethod()\n\t\t);\n\t}\n}\n"]}
@@ -12,7 +12,7 @@ export declare class VerifiableStorageService implements IVerifiableStorageCompo
12
12
  /**
13
13
  * Create a new instance of VerifiableStorageService.
14
14
  * @param options The options for the service.
15
- * @throws {GeneralError} If no connectors are registered.
15
+ * @throws GeneralError If no connectors are registered.
16
16
  */
17
17
  constructor(options?: IVerifiableStorageServiceConstructorOptions);
18
18
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.2](https://github.com/iotaledger/twin-verifiable-storage/compare/verifiable-storage-service-v0.9.2...verifiable-storage-service-v0.9.2) (2026-08-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([6ce6744](https://github.com/iotaledger/twin-verifiable-storage/commit/6ce6744c124cca586c1ef0552624378d1207578d))
9
+ * release to production ([#75](https://github.com/iotaledger/twin-verifiable-storage/issues/75)) ([d631cd7](https://github.com/iotaledger/twin-verifiable-storage/commit/d631cd74bba5ac37d67178632eed5a779348170f))
10
+ * release to production ([#85](https://github.com/iotaledger/twin-verifiable-storage/issues/85)) ([a31f482](https://github.com/iotaledger/twin-verifiable-storage/commit/a31f4827556724694729deaa81d78445d96e4462))
11
+ * release to production ([#92](https://github.com/iotaledger/twin-verifiable-storage/issues/92)) ([eeb2ad7](https://github.com/iotaledger/twin-verifiable-storage/commit/eeb2ad7c3166d5b35f2c2be248a045f7e1b5f50b))
12
+
3
13
  ## [0.9.2-next.1](https://github.com/iotaledger/twin-verifiable-storage/compare/verifiable-storage-service-v0.9.2-next.0...verifiable-storage-service-v0.9.2-next.1) (2026-08-07)
4
14
 
5
15
 
@@ -28,7 +28,7 @@ The options for the service.
28
28
 
29
29
  #### Throws
30
30
 
31
- If no connectors are registered.
31
+ GeneralError If no connectors are registered.
32
32
 
33
33
  ## Properties
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/verifiable-storage-service",
3
- "version": "0.9.2-next.1",
3
+ "version": "0.9.2",
4
4
  "description": "Service component and REST routes that expose verifiable storage operations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,14 +17,14 @@
17
17
  "node": ">=24.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "@twin.org/api-models": "next",
21
- "@twin.org/context": "next",
22
- "@twin.org/core": "next",
23
- "@twin.org/data-json-ld": "next",
24
- "@twin.org/entity": "next",
25
- "@twin.org/nameof": "next",
26
- "@twin.org/verifiable-storage-models": "0.9.2-next.1",
27
- "@twin.org/web": "next"
20
+ "@twin.org/api-models": "^0.9.2",
21
+ "@twin.org/context": "^0.9.2",
22
+ "@twin.org/core": "^0.9.2",
23
+ "@twin.org/data-json-ld": "^0.9.2",
24
+ "@twin.org/entity": "^0.9.2",
25
+ "@twin.org/nameof": "^0.9.2",
26
+ "@twin.org/verifiable-storage-models": "^0.9.2",
27
+ "@twin.org/web": "^0.9.2"
28
28
  },
29
29
  "main": "./dist/es/index.js",
30
30
  "types": "./dist/types/index.d.ts",