@twin.org/auditable-item-graph-rest-client 0.0.2-next.8 → 0.0.3-next.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.
@@ -1,14 +1,13 @@
1
- import { BaseRestClient } from '@twin.org/api-core';
2
- import { HttpParameterHelper } from '@twin.org/api-models';
3
- import { Guards, NotSupportedError, Coerce } from '@twin.org/core';
4
- import { HeaderTypes, MimeTypes } from '@twin.org/web';
5
-
6
1
  // Copyright 2024 IOTA Stiftung.
7
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseRestClient } from "@twin.org/api-core";
4
+ import { HttpParameterHelper } from "@twin.org/api-models";
5
+ import { Coerce, Guards, NotSupportedError } from "@twin.org/core";
6
+ import { HeaderTypes, MimeTypes } from "@twin.org/web";
8
7
  /**
9
8
  * Client for performing auditable item graph through to REST endpoints.
10
9
  */
11
- class AuditableItemGraphRestClient extends BaseRestClient {
10
+ export class AuditableItemGraphRestClient extends BaseRestClient {
12
11
  /**
13
12
  * Runtime name for the class.
14
13
  */
@@ -20,6 +19,13 @@ class AuditableItemGraphRestClient extends BaseRestClient {
20
19
  constructor(config) {
21
20
  super("AuditableItemGraphRestClient", config, "auditable-item-graph");
22
21
  }
22
+ /**
23
+ * Returns the class name of the component.
24
+ * @returns The class name of the component.
25
+ */
26
+ className() {
27
+ return AuditableItemGraphRestClient.CLASS_NAME;
28
+ }
23
29
  /**
24
30
  * Create a new graph vertex.
25
31
  * @param vertex The vertex to create.
@@ -130,5 +136,4 @@ class AuditableItemGraphRestClient extends BaseRestClient {
130
136
  return response.body;
131
137
  }
132
138
  }
133
-
134
- export { AuditableItemGraphRestClient };
139
+ //# sourceMappingURL=auditableItemGraphRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auditableItemGraphRestClient.js","sourceRoot":"","sources":["../../src/auditableItemGraphRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO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AAC,UAAU,CAAC;gBAC1D,OAAO;gBACP,gBAAgB;gBAChB,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC;gBACzD,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport {\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype ICreatedResponse,\n\ttype INoContentResponse\n} from \"@twin.org/api-models\";\nimport type {\n\tIAuditableItemGraphComponent,\n\tIAuditableItemGraphCreateRequest,\n\tIAuditableItemGraphGetRequest,\n\tIAuditableItemGraphGetResponse,\n\tIAuditableItemGraphListRequest,\n\tIAuditableItemGraphListResponse,\n\tIAuditableItemGraphUpdateRequest,\n\tIAuditableItemGraphVertex,\n\tIAuditableItemGraphVertexList,\n\tVerifyDepth\n} from \"@twin.org/auditable-item-graph-models\";\nimport { Coerce, Guards, NotSupportedError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IComparator, SortDirection } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing auditable item graph through to REST endpoints.\n */\nexport class AuditableItemGraphRestClient\n\textends BaseRestClient\n\timplements IAuditableItemGraphComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<AuditableItemGraphRestClient>();\n\n\t/**\n\t * Create a new instance of AuditableItemGraphRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<AuditableItemGraphRestClient>(), config, \"auditable-item-graph\");\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 AuditableItemGraphRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new graph vertex.\n\t * @param vertex The vertex to create.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns The id of the new graph item.\n\t */\n\tpublic async create(vertex: {\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<string> {\n\t\tconst response = await this.fetch<IAuditableItemGraphCreateRequest, ICreatedResponse>(\n\t\t\t\"/\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: vertex\n\t\t\t}\n\t\t);\n\n\t\treturn response.headers[HeaderTypes.Location];\n\t}\n\n\t/**\n\t * Get a graph vertex.\n\t * @param id The id of the vertex to get.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.\n\t * @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The vertex if found.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeDeleted?: boolean;\n\t\t\tincludeChangesets?: boolean;\n\t\t\tverifySignatureDepth?: VerifyDepth;\n\t\t}\n\t): Promise<IAuditableItemGraphVertex> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphGetRequest,\n\t\t\tIAuditableItemGraphGetResponse\n\t\t>(\"/:id\", \"GET\", {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tincludeDeleted: options?.includeDeleted,\n\t\t\t\tincludeChangesets: options?.includeChangesets,\n\t\t\t\tverifySignatureDepth: options?.verifySignatureDepth\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update a graph vertex.\n\t * @param vertex The vertex to update.\n\t * @param vertex.id The id of the vertex to update.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns Nothing.\n\t */\n\tpublic async update(vertex: {\n\t\tid: string;\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<void> {\n\t\tGuards.object(AuditableItemGraphRestClient.CLASS_NAME, nameof(vertex), vertex);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(vertex.id), vertex.id);\n\n\t\tconst { id, ...rest } = vertex;\n\n\t\tawait this.fetch<IAuditableItemGraphUpdateRequest, INoContentResponse>(\"/:id\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: rest\n\t\t});\n\t}\n\n\t/**\n\t * Remove the verifiable storage for an item, not supported on client.\n\t * @param id The id of the vertex to get.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async removeVerifiable(id: string): Promise<void> {\n\t\tthrow new NotSupportedError(AuditableItemGraphRestClient.CLASS_NAME, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"removeVerifiable\"\n\t\t});\n\t}\n\n\t/**\n\t * Query the graph for vertices.\n\t * @param options The query options.\n\t * @param options.id The optional id to look for.\n\t * @param options.idMode Look in id, alias or both, defaults to both.\n\t * @param options.idExact Find only exact matches, default to false meaning partial matching.\n\t * @param options.resourceTypes Include vertices with specific resource types.\n\t * @param conditions Conditions to use in the query.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param properties The properties to return, if not provided defaults to id, created, aliases and object.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns The entities, which can be partial if a limited keys list was provided.\n\t */\n\tpublic async query(\n\t\toptions?: {\n\t\t\tid?: string;\n\t\t\tidMode?: \"id\" | \"alias\" | \"both\";\n\t\t\tidExact?: boolean;\n\t\t\tresourceTypes?: string[];\n\t\t},\n\t\tconditions?: IComparator[],\n\t\torderBy?: keyof Pick<IAuditableItemGraphVertex, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tproperties?: (keyof IAuditableItemGraphVertex)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IAuditableItemGraphVertexList> {\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphListRequest,\n\t\t\tIAuditableItemGraphListResponse\n\t\t>(\"/\", \"GET\", {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tid: options?.id,\n\t\t\t\tidMode: options?.idMode,\n\t\t\t\tidExact: options?.idExact,\n\t\t\t\tresourceTypes: HttpParameterHelper.arrayToString(options?.resourceTypes),\n\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\torderBy,\n\t\t\t\torderByDirection,\n\t\t\t\tproperties: HttpParameterHelper.arrayToString(properties),\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./auditableItemGraphRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./auditableItemGraphRestClient.js\";\n"]}
@@ -16,6 +16,11 @@ export declare class AuditableItemGraphRestClient extends BaseRestClient impleme
16
16
  * @param config The configuration for the client.
17
17
  */
18
18
  constructor(config: IBaseRestClientConfig);
19
+ /**
20
+ * Returns the class name of the component.
21
+ * @returns The class name of the component.
22
+ */
23
+ className(): string;
19
24
  /**
20
25
  * Create a new graph vertex.
21
26
  * @param vertex The vertex to create.
@@ -1 +1 @@
1
- export * from "./auditableItemGraphRestClient";
1
+ export * from "./auditableItemGraphRestClient.js";
@@ -44,6 +44,24 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
+ ### className()
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IAuditableItemGraphComponent.className`
62
+
63
+ ***
64
+
47
65
  ### create()
48
66
 
49
67
  > **create**(`vertex`): `Promise`\<`string`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/auditable-item-graph-rest-client",
3
- "version": "0.0.2-next.8",
3
+ "version": "0.0.3-next.0",
4
4
  "description": "Auditable Item Graph contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@twin.org/api-core": "next",
18
18
  "@twin.org/api-models": "next",
19
- "@twin.org/auditable-item-graph-models": "0.0.2-next.8",
19
+ "@twin.org/auditable-item-graph-models": "0.0.3-next.0",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/data-json-ld": "next",
22
22
  "@twin.org/entity": "next",
@@ -24,20 +24,18 @@
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/web": "next"
26
26
  },
27
- "main": "./dist/cjs/index.cjs",
28
- "module": "./dist/esm/index.mjs",
27
+ "main": "./dist/es/index.js",
29
28
  "types": "./dist/types/index.d.ts",
30
29
  "exports": {
31
30
  ".": {
32
31
  "types": "./dist/types/index.d.ts",
33
- "require": "./dist/cjs/index.cjs",
34
- "import": "./dist/esm/index.mjs"
32
+ "import": "./dist/es/index.js",
33
+ "default": "./dist/es/index.js"
35
34
  },
36
35
  "./locales/*.json": "./locales/*.json"
37
36
  },
38
37
  "files": [
39
- "dist/cjs",
40
- "dist/esm",
38
+ "dist/es",
41
39
  "dist/types",
42
40
  "locales",
43
41
  "docs"
@@ -1,136 +0,0 @@
1
- 'use strict';
2
-
3
- var apiCore = require('@twin.org/api-core');
4
- var apiModels = require('@twin.org/api-models');
5
- var core = require('@twin.org/core');
6
- var web = require('@twin.org/web');
7
-
8
- // Copyright 2024 IOTA Stiftung.
9
- // SPDX-License-Identifier: Apache-2.0.
10
- /**
11
- * Client for performing auditable item graph through to REST endpoints.
12
- */
13
- class AuditableItemGraphRestClient extends apiCore.BaseRestClient {
14
- /**
15
- * Runtime name for the class.
16
- */
17
- static CLASS_NAME = "AuditableItemGraphRestClient";
18
- /**
19
- * Create a new instance of AuditableItemGraphRestClient.
20
- * @param config The configuration for the client.
21
- */
22
- constructor(config) {
23
- super("AuditableItemGraphRestClient", config, "auditable-item-graph");
24
- }
25
- /**
26
- * Create a new graph vertex.
27
- * @param vertex The vertex to create.
28
- * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
29
- * @param vertex.aliases Alternative aliases that can be used to identify the vertex.
30
- * @param vertex.resources The resources attached to the vertex.
31
- * @param vertex.edges The edges connected to the vertex.
32
- * @returns The id of the new graph item.
33
- */
34
- async create(vertex) {
35
- const response = await this.fetch("/", "POST", {
36
- body: vertex
37
- });
38
- return response.headers[web.HeaderTypes.Location];
39
- }
40
- /**
41
- * Get a graph vertex.
42
- * @param id The id of the vertex to get.
43
- * @param options Additional options for the get operation.
44
- * @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
45
- * @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.
46
- * @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
47
- * @returns The vertex if found.
48
- * @throws NotFoundError if the vertex is not found.
49
- */
50
- async get(id, options) {
51
- core.Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
52
- const response = await this.fetch("/:id", "GET", {
53
- headers: {
54
- [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
55
- },
56
- pathParams: {
57
- id
58
- },
59
- query: {
60
- includeDeleted: options?.includeDeleted,
61
- includeChangesets: options?.includeChangesets,
62
- verifySignatureDepth: options?.verifySignatureDepth
63
- }
64
- });
65
- return response.body;
66
- }
67
- /**
68
- * Update a graph vertex.
69
- * @param vertex The vertex to update.
70
- * @param vertex.id The id of the vertex to update.
71
- * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
72
- * @param vertex.aliases Alternative aliases that can be used to identify the vertex.
73
- * @param vertex.resources The resources attached to the vertex.
74
- * @param vertex.edges The edges connected to the vertex.
75
- * @returns Nothing.
76
- */
77
- async update(vertex) {
78
- core.Guards.object(AuditableItemGraphRestClient.CLASS_NAME, "vertex", vertex);
79
- core.Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "vertex.id", vertex.id);
80
- const { id, ...rest } = vertex;
81
- await this.fetch("/:id", "PUT", {
82
- pathParams: {
83
- id
84
- },
85
- body: rest
86
- });
87
- }
88
- /**
89
- * Remove the verifiable storage for an item, not supported on client.
90
- * @param id The id of the vertex to get.
91
- * @returns Nothing.
92
- * @throws NotFoundError if the vertex is not found.
93
- */
94
- async removeVerifiable(id) {
95
- throw new core.NotSupportedError(AuditableItemGraphRestClient.CLASS_NAME, "notSupportedOnClient", {
96
- methodName: "removeVerifiable"
97
- });
98
- }
99
- /**
100
- * Query the graph for vertices.
101
- * @param options The query options.
102
- * @param options.id The optional id to look for.
103
- * @param options.idMode Look in id, alias or both, defaults to both.
104
- * @param options.idExact Find only exact matches, default to false meaning partial matching.
105
- * @param options.resourceTypes Include vertices with specific resource types.
106
- * @param conditions Conditions to use in the query.
107
- * @param orderBy The order for the results, defaults to created.
108
- * @param orderByDirection The direction for the order, defaults to descending.
109
- * @param properties The properties to return, if not provided defaults to id, created, aliases and object.
110
- * @param cursor The cursor to request the next chunk of entities.
111
- * @param limit Limit the number of entities to return.
112
- * @returns The entities, which can be partial if a limited keys list was provided.
113
- */
114
- async query(options, conditions, orderBy, orderByDirection, properties, cursor, limit) {
115
- const response = await this.fetch("/", "GET", {
116
- headers: {
117
- [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
118
- },
119
- query: {
120
- id: options?.id,
121
- idMode: options?.idMode,
122
- idExact: options?.idExact,
123
- resourceTypes: apiModels.HttpParameterHelper.arrayToString(options?.resourceTypes),
124
- conditions: apiModels.HttpParameterHelper.objectToString(conditions),
125
- orderBy,
126
- orderByDirection,
127
- properties: apiModels.HttpParameterHelper.arrayToString(properties),
128
- cursor,
129
- limit: core.Coerce.string(limit)
130
- }
131
- });
132
- return response.body;
133
- }
134
- }
135
-
136
- exports.AuditableItemGraphRestClient = AuditableItemGraphRestClient;