@twin.org/trust-models 0.0.3-next.2 → 0.0.3-next.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ITrustComponent.js","sourceRoot":"","sources":["../../../src/models/ITrustComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a trust component.\n */\nexport interface ITrustComponent extends IComponent {\n\t/**\n\t * Verify a payload by checking the validity of its structure and content using the registered verifiers.\n\t * @param payload The payload to verify.\n\t * @param overrideVerifiers List of verifiers to use instead of the default ones.\n\t * @returns Whether the payload is verified and any additional information extracted from the payload, or failures per verifier.\n\t */\n\tverify(\n\t\tpayload: unknown,\n\t\toverrideVerifiers?: string[]\n\t): Promise<{\n\t\tverified: boolean;\n\t\tinfo?: IJsonLdNodeObject[];\n\t\tfailures?: { [id: string]: IError[] };\n\t}>;\n}\n"]}
1
+ {"version":3,"file":"ITrustComponent.js","sourceRoot":"","sources":["../../../src/models/ITrustComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a trust component.\n */\nexport interface ITrustComponent extends IComponent {\n\t/**\n\t * Verify a payload by checking the validity of its structure and content using the registered verifiers.\n\t * @param payload The payload to verify.\n\t * @param overrideVerifiers List of verifiers to use instead of the default ones.\n\t * @returns Whether the payload is verified and any additional information extracted from the payload, or errors.\n\t */\n\tverify(\n\t\tpayload: unknown,\n\t\toverrideVerifiers?: string[]\n\t): Promise<{\n\t\tverified: boolean;\n\t\tinfo?: IJsonLdNodeObject[];\n\t\terrors?: IError[];\n\t}>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ITrustVerifier.js","sourceRoot":"","sources":["../../../src/models/ITrustVerifier.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a trust verifier component.\n */\nexport interface ITrustVerifier extends IComponent {\n\t/**\n\t * Verify a payload by checking the validity of its structure and content.\n\t * @param payload The payload to verify.\n\t * @param info Information extracted from previous verifiers and to be added by this verifier.\n\t * @returns Whether the payload is verified and possible verification failures, returns undefined if payload not processed.\n\t */\n\tverify(\n\t\tpayload: unknown,\n\t\tinfo: IJsonLdNodeObject[]\n\t): Promise<\n\t\t| {\n\t\t\t\tverified: boolean;\n\t\t\t\tfailures?: IError[];\n\t\t }\n\t\t| undefined\n\t>;\n}\n"]}
1
+ {"version":3,"file":"ITrustVerifier.js","sourceRoot":"","sources":["../../../src/models/ITrustVerifier.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a trust verifier component.\n */\nexport interface ITrustVerifier extends IComponent {\n\t/**\n\t * Verify a payload by checking the validity of its structure and content.\n\t * @param payload The payload to verify.\n\t * @param info Information extracted from previous verifiers and to be added by this verifier.\n\t * @param errors Array to collect verification errors.\n\t * @returns Whether the payload is verified, returns undefined if payload was not processed.\n\t */\n\tverify(\n\t\tpayload: unknown,\n\t\tinfo: IJsonLdNodeObject[],\n\t\terrors: IError[]\n\t): Promise<boolean | undefined>;\n}\n"]}
@@ -8,13 +8,11 @@ export interface ITrustComponent extends IComponent {
8
8
  * Verify a payload by checking the validity of its structure and content using the registered verifiers.
9
9
  * @param payload The payload to verify.
10
10
  * @param overrideVerifiers List of verifiers to use instead of the default ones.
11
- * @returns Whether the payload is verified and any additional information extracted from the payload, or failures per verifier.
11
+ * @returns Whether the payload is verified and any additional information extracted from the payload, or errors.
12
12
  */
13
13
  verify(payload: unknown, overrideVerifiers?: string[]): Promise<{
14
14
  verified: boolean;
15
15
  info?: IJsonLdNodeObject[];
16
- failures?: {
17
- [id: string]: IError[];
18
- };
16
+ errors?: IError[];
19
17
  }>;
20
18
  }
@@ -8,10 +8,8 @@ export interface ITrustVerifier extends IComponent {
8
8
  * Verify a payload by checking the validity of its structure and content.
9
9
  * @param payload The payload to verify.
10
10
  * @param info Information extracted from previous verifiers and to be added by this verifier.
11
- * @returns Whether the payload is verified and possible verification failures, returns undefined if payload not processed.
11
+ * @param errors Array to collect verification errors.
12
+ * @returns Whether the payload is verified, returns undefined if payload was not processed.
12
13
  */
13
- verify(payload: unknown, info: IJsonLdNodeObject[]): Promise<{
14
- verified: boolean;
15
- failures?: IError[];
16
- } | undefined>;
14
+ verify(payload: unknown, info: IJsonLdNodeObject[], errors: IError[]): Promise<boolean | undefined>;
17
15
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.3](https://github.com/twinfoundation/trust/compare/trust-models-v0.0.3-next.2...trust-models-v0.0.3-next.3) (2025-12-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * flatten error structure ([5fdd665](https://github.com/twinfoundation/trust/commit/5fdd665d0fc523a655563a0c20d1d82b634534e2))
9
+
3
10
  ## [0.0.3-next.2](https://github.com/twinfoundation/trust/compare/trust-models-v0.0.3-next.1...trust-models-v0.0.3-next.2) (2025-12-03)
4
11
 
5
12
 
@@ -10,7 +10,7 @@ Interface describing a trust component.
10
10
 
11
11
  ### verify()
12
12
 
13
- > **verify**(`payload`, `overrideVerifiers?`): `Promise`\<\{ `verified`: `boolean`; `info?`: `IJsonLdNodeObject`[]; `failures?`: \{\[`id`: `string`\]: `IError`[]; \}; \}\>
13
+ > **verify**(`payload`, `overrideVerifiers?`): `Promise`\<\{ `verified`: `boolean`; `info?`: `IJsonLdNodeObject`[]; `errors?`: `IError`[]; \}\>
14
14
 
15
15
  Verify a payload by checking the validity of its structure and content using the registered verifiers.
16
16
 
@@ -30,6 +30,6 @@ List of verifiers to use instead of the default ones.
30
30
 
31
31
  #### Returns
32
32
 
33
- `Promise`\<\{ `verified`: `boolean`; `info?`: `IJsonLdNodeObject`[]; `failures?`: \{\[`id`: `string`\]: `IError`[]; \}; \}\>
33
+ `Promise`\<\{ `verified`: `boolean`; `info?`: `IJsonLdNodeObject`[]; `errors?`: `IError`[]; \}\>
34
34
 
35
- Whether the payload is verified and any additional information extracted from the payload, or failures per verifier.
35
+ Whether the payload is verified and any additional information extracted from the payload, or errors.
@@ -10,7 +10,7 @@ Interface describing a trust verifier component.
10
10
 
11
11
  ### verify()
12
12
 
13
- > **verify**(`payload`, `info`): `Promise`\<\{ `verified`: `boolean`; `failures?`: `IError`[]; \} \| `undefined`\>
13
+ > **verify**(`payload`, `info`, `errors`): `Promise`\<`boolean` \| `undefined`\>
14
14
 
15
15
  Verify a payload by checking the validity of its structure and content.
16
16
 
@@ -28,8 +28,14 @@ The payload to verify.
28
28
 
29
29
  Information extracted from previous verifiers and to be added by this verifier.
30
30
 
31
+ ##### errors
32
+
33
+ `IError`[]
34
+
35
+ Array to collect verification errors.
36
+
31
37
  #### Returns
32
38
 
33
- `Promise`\<\{ `verified`: `boolean`; `failures?`: `IError`[]; \} \| `undefined`\>
39
+ `Promise`\<`boolean` \| `undefined`\>
34
40
 
35
- Whether the payload is verified and possible verification failures, returns undefined if payload not processed.
41
+ Whether the payload is verified, returns undefined if payload was not processed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/trust-models",
3
- "version": "0.0.3-next.2",
3
+ "version": "0.0.3-next.3",
4
4
  "description": "Models which define the structure of the trust contracts",
5
5
  "repository": {
6
6
  "type": "git",