@twin.org/federated-catalogue-rest-client 0.0.3-next.2 → 0.0.3-next.20

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # TWIN Federated Catalogue REST Client
1
+ # Federated Catalogue REST Client
2
2
 
3
- Federated Catalogue contract implementation which can connect to REST endpoints.
3
+ This package provides a client interface for calling catalogue REST endpoints and handling paged query and dataset retrieval workflows. It simplifies remote catalogue integration by encapsulating endpoint requests and response parsing.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,9 +1,9 @@
1
1
  // Copyright 2025 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import { BaseRestClient } from "@twin.org/api-core";
4
- import { Guards, NotSupportedError } from "@twin.org/core";
5
- import { FederatedCatalogueContexts } from "@twin.org/federated-catalogue-models";
6
- import { CatalogTypes, DataspaceProtocolContexts } from "@twin.org/standards-dataspace-protocol";
4
+ import { Coerce, Guards } from "@twin.org/core";
5
+ import { DataspaceProtocolCatalogTypes, DataspaceProtocolContexts } from "@twin.org/standards-dataspace-protocol";
6
+ import { HeaderHelper, HeaderTypes } from "@twin.org/web";
7
7
  /**
8
8
  * Client for performing federated catalogue operations through REST endpoints.
9
9
  */
@@ -26,32 +26,19 @@ export class FederatedCatalogueRestClient extends BaseRestClient {
26
26
  className() {
27
27
  return FederatedCatalogueRestClient.CLASS_NAME;
28
28
  }
29
- /**
30
- * Query the federated catalogue with an optional filter.
31
- * @param filter Optional filter criteria for querying datasets.
32
- * @returns The catalog containing matching datasets.
33
- */
34
- async query(filter) {
35
- const response = await this.fetch("/request", "POST", {
36
- body: {
37
- "@context": [
38
- DataspaceProtocolContexts.ContextRoot,
39
- FederatedCatalogueContexts.ContextRoot
40
- ],
41
- "@type": CatalogTypes.CatalogRequestMessage,
42
- filter
43
- }
44
- });
45
- return response.body;
46
- }
47
29
  /**
48
30
  * Retrieve a specific dataset by its unique identifier.
49
31
  * @param datasetId The unique identifier of the dataset.
50
- * @returns The dataset if found.
32
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
33
+ * @returns The dataset if found, or a CatalogError if not found or an error occurs.
51
34
  */
52
- async get(datasetId) {
35
+ async get(datasetId, trustPayload) {
53
36
  Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "datasetId", datasetId);
37
+ Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "trustPayload", trustPayload);
54
38
  const response = await this.fetch("/datasets/:datasetId", "GET", {
39
+ headers: {
40
+ [HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
41
+ },
55
42
  pathParams: {
56
43
  datasetId
57
44
  }
@@ -61,24 +48,70 @@ export class FederatedCatalogueRestClient extends BaseRestClient {
61
48
  /**
62
49
  * Insert or update a dataset in the catalogue.
63
50
  * This method is internal and is not exposed via REST endpoints.
64
- * @param dataSet The dataset to store.
65
- * @returns Nothing.
51
+ * @param dataset The dataset to store.
52
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
53
+ * @returns The unique identifier of the stored dataset, or a CatalogError if an error occurs.
66
54
  */
67
- async set(dataSet) {
68
- throw new NotSupportedError(FederatedCatalogueRestClient.CLASS_NAME, "notSupportedOnClient", {
69
- methodName: "set"
55
+ async set(dataset, trustPayload) {
56
+ Guards.object(FederatedCatalogueRestClient.CLASS_NAME, "dataset", dataset);
57
+ Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "trustPayload", trustPayload);
58
+ const response = await this.fetch("/datasets", "POST", {
59
+ headers: {
60
+ [HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
61
+ },
62
+ body: dataset
70
63
  });
64
+ return response.headers?.[HeaderTypes.Location] ?? response.body ?? "";
71
65
  }
72
66
  /**
73
67
  * Remove a dataset from the catalogue by its unique identifier.
74
68
  * This method is internal and is not exposed via REST endpoints.
75
- * @param dataSetId The unique identifier of the dataset to remove.
69
+ * @param datasetId The unique identifier of the dataset to remove.
70
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
76
71
  * @returns Nothing.
77
72
  */
78
- async remove(dataSetId) {
79
- throw new NotSupportedError(FederatedCatalogueRestClient.CLASS_NAME, "notSupportedOnClient", {
80
- methodName: "remove"
73
+ async remove(datasetId, trustPayload) {
74
+ Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "datasetId", datasetId);
75
+ Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "trustPayload", trustPayload);
76
+ const result = await this.fetch("/datasets/:datasetId", "DELETE", {
77
+ headers: {
78
+ [HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
79
+ },
80
+ pathParams: {
81
+ datasetId
82
+ }
83
+ });
84
+ return result.body;
85
+ }
86
+ /**
87
+ * Query the federated catalogue with an optional filter.
88
+ * @param filter Optional filter criteria for querying datasets.
89
+ * @param cursor Optional cursor for pagination.
90
+ * @param limit Optional limit for pagination.
91
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
92
+ * @returns The catalog containing matching datasets (or CatalogError if none found), with cursor if more pages exist.
93
+ */
94
+ async query(filter, cursor, limit, trustPayload) {
95
+ Guards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, "trustPayload", trustPayload);
96
+ const response = await this.fetch("/request", "POST", {
97
+ headers: {
98
+ [HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
99
+ },
100
+ query: {
101
+ cursor,
102
+ limit: Coerce.string(limit)
103
+ },
104
+ body: {
105
+ "@context": [DataspaceProtocolContexts.Context],
106
+ "@type": DataspaceProtocolCatalogTypes.CatalogRequestMessage,
107
+ filter
108
+ }
81
109
  });
110
+ return {
111
+ result: response.body,
112
+ cursor: HeaderHelper.extractLinkHeaderRelation(response.headers?.[HeaderTypes.Link], "next")
113
+ ?.urlQueryParams?.cursor
114
+ };
82
115
  }
83
116
  }
84
117
  //# sourceMappingURL=federatedCatalogueRestClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"federatedCatalogueRestClient.js","sourceRoot":"","sources":["../../src/federatedCatalogueRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,0BAA0B,EAM1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAGjG;;GAEG;AACH,MAAM,OAAO,4BACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,kCAAkD;IAEnF;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,iCAAyC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,4BAA4B,CAAC,UAAU,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,MAAkB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,MAAM,EACN;YACC,IAAI,EAAE;gBACL,UAAU,EAAE;oBACX,yBAAyB,CAAC,WAAW;oBACrC,0BAA0B,CAAC,WAAW;iBACtC;gBACD,OAAO,EAAE,YAAY,CAAC,qBAAqB;gBAC3C,MAAM;aACN;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,SAAiB;QACjC,MAAM,CAAC,WAAW,CAAC,4BAA4B,CAAC,UAAU,eAAqB,SAAS,CAAC,CAAC;QAE1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,sBAAsB,EACtB,KAAK,EACL;YACC,UAAU,EAAE;gBACX,SAAS;aACT;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,OAAiB;QACjC,MAAM,IAAI,iBAAiB,CAAC,4BAA4B,CAAC,UAAU,EAAE,sBAAsB,EAAE;YAC5F,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,SAAiB;QACpC,MAAM,IAAI,iBAAiB,CAAC,4BAA4B,CAAC,UAAU,EAAE,sBAAsB,EAAE;YAC5F,UAAU,EAAE,QAAQ;SACpB,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig } from \"@twin.org/api-models\";\nimport { Guards, NotSupportedError } from \"@twin.org/core\";\nimport {\n\tFederatedCatalogueContexts,\n\ttype IFederatedCatalogueComponent,\n\ttype ICatalogRequestRequest,\n\ttype ICatalogRequestResponse,\n\ttype IGetDatasetRequest,\n\ttype IGetDatasetResponse\n} from \"@twin.org/federated-catalogue-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { CatalogTypes, DataspaceProtocolContexts } from \"@twin.org/standards-dataspace-protocol\";\nimport type { ICatalog, IDataset } from \"@twin.org/standards-w3c-dcat\";\n\n/**\n * Client for performing federated catalogue operations through REST endpoints.\n */\nexport class FederatedCatalogueRestClient\n\textends BaseRestClient\n\timplements IFederatedCatalogueComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<FederatedCatalogueRestClient>();\n\n\t/**\n\t * Create a new instance of FederatedCatalogueRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<FederatedCatalogueRestClient>(), config, \"federated-catalogue\");\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 FederatedCatalogueRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Query the federated catalogue with an optional filter.\n\t * @param filter Optional filter criteria for querying datasets.\n\t * @returns The catalog containing matching datasets.\n\t */\n\tpublic async query(filter?: unknown[]): Promise<ICatalog> {\n\t\tconst response = await this.fetch<ICatalogRequestRequest, ICatalogRequestResponse>(\n\t\t\t\"/request\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tDataspaceProtocolContexts.ContextRoot,\n\t\t\t\t\t\tFederatedCatalogueContexts.ContextRoot\n\t\t\t\t\t],\n\t\t\t\t\t\"@type\": CatalogTypes.CatalogRequestMessage,\n\t\t\t\t\tfilter\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Retrieve a specific dataset by its unique identifier.\n\t * @param datasetId The unique identifier of the dataset.\n\t * @returns The dataset if found.\n\t */\n\tpublic async get(datasetId: string): Promise<IDataset> {\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(datasetId), datasetId);\n\n\t\tconst response = await this.fetch<IGetDatasetRequest, IGetDatasetResponse>(\n\t\t\t\"/datasets/:datasetId\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tdatasetId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Insert or update a dataset in the catalogue.\n\t * This method is internal and is not exposed via REST endpoints.\n\t * @param dataSet The dataset to store.\n\t * @returns Nothing.\n\t */\n\tpublic async set(dataSet: IDataset): Promise<void> {\n\t\tthrow new NotSupportedError(FederatedCatalogueRestClient.CLASS_NAME, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"set\"\n\t\t});\n\t}\n\n\t/**\n\t * Remove a dataset from the catalogue by its unique identifier.\n\t * This method is internal and is not exposed via REST endpoints.\n\t * @param dataSetId The unique identifier of the dataset to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(dataSetId: string): Promise<void> {\n\t\tthrow new NotSupportedError(FederatedCatalogueRestClient.CLASS_NAME, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"remove\"\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"federatedCatalogueRestClient.js","sourceRoot":"","sources":["../../src/federatedCatalogueRestClient.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig } from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tICatalogRequestRequest,\n\tICatalogRequestResponse,\n\tIDatasetGetRequest,\n\tIDatasetGetResponse,\n\tIDatasetRemoveRequest,\n\tIDatasetRemoveResponse,\n\tIDatasetSetRequest,\n\tIDatasetSetResponse,\n\tIFederatedCatalogueComponent\n} from \"@twin.org/federated-catalogue-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts,\n\ttype IDataspaceProtocolCatalog,\n\ttype IDataspaceProtocolCatalogError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { HeaderHelper, HeaderTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing federated catalogue operations through REST endpoints.\n */\nexport class FederatedCatalogueRestClient\n\textends BaseRestClient\n\timplements IFederatedCatalogueComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<FederatedCatalogueRestClient>();\n\n\t/**\n\t * Create a new instance of FederatedCatalogueRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<FederatedCatalogueRestClient>(), config, \"federated-catalogue\");\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 FederatedCatalogueRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Retrieve a specific dataset by its unique identifier.\n\t * @param datasetId The unique identifier of the dataset.\n\t * @param trustPayload Optional payload for trust evaluation, if applicable.\n\t * @returns The dataset if found, or a CatalogError if not found or an error occurs.\n\t */\n\tpublic async get(\n\t\tdatasetId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDcatDataset | IDataspaceProtocolCatalogError> {\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(trustPayload), trustPayload);\n\n\t\tconst response = await this.fetch<IDatasetGetRequest, IDatasetGetResponse>(\n\t\t\t\"/datasets/:datasetId\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tdatasetId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Insert or update a dataset in the catalogue.\n\t * This method is internal and is not exposed via REST endpoints.\n\t * @param dataset The dataset to store.\n\t * @param trustPayload Optional payload for trust evaluation, if applicable.\n\t * @returns The unique identifier of the stored dataset, or a CatalogError if an error occurs.\n\t */\n\tpublic async set(\n\t\tdataset: IDcatDataset,\n\t\ttrustPayload: unknown\n\t): Promise<string | IDataspaceProtocolCatalogError> {\n\t\tGuards.object<IDcatDataset>(FederatedCatalogueRestClient.CLASS_NAME, nameof(dataset), dataset);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(trustPayload), trustPayload);\n\n\t\tconst response = await this.fetch<IDatasetSetRequest, IDatasetSetResponse>(\n\t\t\t\"/datasets\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\n\t\t\t\t},\n\t\t\t\tbody: dataset\n\t\t\t}\n\t\t);\n\n\t\treturn response.headers?.[HeaderTypes.Location] ?? response.body ?? \"\";\n\t}\n\n\t/**\n\t * Remove a dataset from the catalogue by its unique identifier.\n\t * This method is internal and is not exposed via REST endpoints.\n\t * @param datasetId The unique identifier of the dataset to remove.\n\t * @param trustPayload Optional payload for trust evaluation, if applicable.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(\n\t\tdatasetId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolCatalogError | undefined> {\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(trustPayload), trustPayload);\n\n\t\tconst result = await this.fetch<IDatasetRemoveRequest, IDatasetRemoveResponse>(\n\t\t\t\"/datasets/:datasetId\",\n\t\t\t\"DELETE\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tdatasetId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn result.body;\n\t}\n\n\t/**\n\t * Query the federated catalogue with an optional filter.\n\t * @param filter Optional filter criteria for querying datasets.\n\t * @param cursor Optional cursor for pagination.\n\t * @param limit Optional limit for pagination.\n\t * @param trustPayload Optional payload for trust evaluation, if applicable.\n\t * @returns The catalog containing matching datasets (or CatalogError if none found), with cursor if more pages exist.\n\t */\n\tpublic async query(\n\t\tfilter: unknown[] | undefined,\n\t\tcursor: string | undefined,\n\t\tlimit: number | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tresult: IDataspaceProtocolCatalog | IDataspaceProtocolCatalogError;\n\t\tcursor?: string;\n\t}> {\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, nameof(trustPayload), trustPayload);\n\t\tconst response = await this.fetch<ICatalogRequestRequest, ICatalogRequestResponse>(\n\t\t\t\"/request\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tcursor,\n\t\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t\t},\n\t\t\t\tbody: {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolCatalogTypes.CatalogRequestMessage,\n\t\t\t\t\tfilter\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\tresult: response.body,\n\t\t\tcursor: HeaderHelper.extractLinkHeaderRelation(response.headers?.[HeaderTypes.Link], \"next\")\n\t\t\t\t?.urlQueryParams?.cursor\n\t\t};\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\nexport * from \"./federatedCatalogueRestClient.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./federatedCatalogueRestClient.js\";\n"]}
@@ -1,7 +1,8 @@
1
1
  import { BaseRestClient } from "@twin.org/api-core";
2
2
  import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
- import { type IFederatedCatalogueComponent } from "@twin.org/federated-catalogue-models";
4
- import type { ICatalog, IDataset } from "@twin.org/standards-w3c-dcat";
3
+ import type { IFederatedCatalogueComponent } from "@twin.org/federated-catalogue-models";
4
+ import { type IDataspaceProtocolCatalog, type IDataspaceProtocolCatalogError } from "@twin.org/standards-dataspace-protocol";
5
+ import type { IDcatDataset } from "@twin.org/standards-w3c-dcat";
5
6
  /**
6
7
  * Client for performing federated catalogue operations through REST endpoints.
7
8
  */
@@ -20,30 +21,39 @@ export declare class FederatedCatalogueRestClient extends BaseRestClient impleme
20
21
  * @returns The class name of the component.
21
22
  */
22
23
  className(): string;
23
- /**
24
- * Query the federated catalogue with an optional filter.
25
- * @param filter Optional filter criteria for querying datasets.
26
- * @returns The catalog containing matching datasets.
27
- */
28
- query(filter?: unknown[]): Promise<ICatalog>;
29
24
  /**
30
25
  * Retrieve a specific dataset by its unique identifier.
31
26
  * @param datasetId The unique identifier of the dataset.
32
- * @returns The dataset if found.
27
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
28
+ * @returns The dataset if found, or a CatalogError if not found or an error occurs.
33
29
  */
34
- get(datasetId: string): Promise<IDataset>;
30
+ get(datasetId: string, trustPayload: unknown): Promise<IDcatDataset | IDataspaceProtocolCatalogError>;
35
31
  /**
36
32
  * Insert or update a dataset in the catalogue.
37
33
  * This method is internal and is not exposed via REST endpoints.
38
- * @param dataSet The dataset to store.
39
- * @returns Nothing.
34
+ * @param dataset The dataset to store.
35
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
36
+ * @returns The unique identifier of the stored dataset, or a CatalogError if an error occurs.
40
37
  */
41
- set(dataSet: IDataset): Promise<void>;
38
+ set(dataset: IDcatDataset, trustPayload: unknown): Promise<string | IDataspaceProtocolCatalogError>;
42
39
  /**
43
40
  * Remove a dataset from the catalogue by its unique identifier.
44
41
  * This method is internal and is not exposed via REST endpoints.
45
- * @param dataSetId The unique identifier of the dataset to remove.
42
+ * @param datasetId The unique identifier of the dataset to remove.
43
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
46
44
  * @returns Nothing.
47
45
  */
48
- remove(dataSetId: string): Promise<void>;
46
+ remove(datasetId: string, trustPayload: unknown): Promise<IDataspaceProtocolCatalogError | undefined>;
47
+ /**
48
+ * Query the federated catalogue with an optional filter.
49
+ * @param filter Optional filter criteria for querying datasets.
50
+ * @param cursor Optional cursor for pagination.
51
+ * @param limit Optional limit for pagination.
52
+ * @param trustPayload Optional payload for trust evaluation, if applicable.
53
+ * @returns The catalog containing matching datasets (or CatalogError if none found), with cursor if more pages exist.
54
+ */
55
+ query(filter: unknown[] | undefined, cursor: string | undefined, limit: number | undefined, trustPayload: unknown): Promise<{
56
+ result: IDataspaceProtocolCatalog | IDataspaceProtocolCatalogError;
57
+ cursor?: string;
58
+ }>;
49
59
  }
package/docs/changelog.md CHANGED
@@ -1,11 +1,264 @@
1
- # @twin.org/federated-catalogue-rest-client - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.3-next.2](https://github.com/twinfoundation/federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.1...federated-catalogue-rest-client-v0.0.3-next.2) (2025-11-28)
3
+ ## [0.0.3-next.20](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.19...federated-catalogue-rest-client-v0.0.3-next.20) (2026-06-11)
4
4
 
5
5
 
6
6
  ### Features
7
7
 
8
- * implement Dataspace Protocol federated catalogue ([#36](https://github.com/twinfoundation/federated-catalogue/issues/36)) ([4765aba](https://github.com/twinfoundation/federated-catalogue/commit/4765aba4485ef8ad61e7ec1affbf0e454d974d36))
8
+ * organization identifiers ([#84](https://github.com/iotaledger/twin-federated-catalogue/issues/84)) ([1e02971](https://github.com/iotaledger/twin-federated-catalogue/commit/1e02971a12e40bd20a0034ee1de0988a689d3dc8))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.19 to 0.0.3-next.20
16
+
17
+ ## [0.0.3-next.19](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.18...federated-catalogue-rest-client-v0.0.3-next.19) (2026-06-08)
18
+
19
+
20
+ ### Features
21
+
22
+ * replace sync storage with shared DB and trust-token auth ([#79](https://github.com/iotaledger/twin-federated-catalogue/issues/79)) ([3a07f02](https://github.com/iotaledger/twin-federated-catalogue/commit/3a07f02aba8d6f3540a23e5c2cebc7b0e579ef30))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.18 to 0.0.3-next.19
30
+
31
+ ## [0.0.3-next.18](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.17...federated-catalogue-rest-client-v0.0.3-next.18) (2026-06-01)
32
+
33
+
34
+ ### Miscellaneous Chores
35
+
36
+ * **federated-catalogue-rest-client:** Synchronize repo versions
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.17 to 0.0.3-next.18
44
+
45
+ ## [0.0.3-next.17](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.16...federated-catalogue-rest-client-v0.0.3-next.17) (2026-05-20)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **federated-catalogue-rest-client:** Synchronize repo versions
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.16 to 0.0.3-next.17
58
+
59
+ ## [0.0.3-next.16](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.15...federated-catalogue-rest-client-v0.0.3-next.16) (2026-05-12)
60
+
61
+
62
+ ### Features
63
+
64
+ * typescript 6 update ([ead042d](https://github.com/iotaledger/twin-federated-catalogue/commit/ead042d09f4e6b03a2db46ace2ea95d197f0f4b0))
65
+
66
+
67
+ ### Dependencies
68
+
69
+ * The following workspace dependencies were updated
70
+ * dependencies
71
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.15 to 0.0.3-next.16
72
+
73
+ ## [0.0.3-next.15](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.14...federated-catalogue-rest-client-v0.0.3-next.15) (2026-05-08)
74
+
75
+
76
+ ### Miscellaneous Chores
77
+
78
+ * **federated-catalogue-rest-client:** Synchronize repo versions
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.14 to 0.0.3-next.15
86
+
87
+ ## [0.0.3-next.14](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.13...federated-catalogue-rest-client-v0.0.3-next.14) (2026-03-20)
88
+
89
+
90
+ ### Miscellaneous Chores
91
+
92
+ * **federated-catalogue-rest-client:** Synchronize repo versions
93
+
94
+
95
+ ### Dependencies
96
+
97
+ * The following workspace dependencies were updated
98
+ * dependencies
99
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.13 to 0.0.3-next.14
100
+
101
+ ## [0.0.3-next.13](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.12...federated-catalogue-rest-client-v0.0.3-next.13) (2026-03-12)
102
+
103
+
104
+ ### Miscellaneous Chores
105
+
106
+ * **federated-catalogue-rest-client:** Synchronize repo versions
107
+
108
+
109
+ ### Dependencies
110
+
111
+ * The following workspace dependencies were updated
112
+ * dependencies
113
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.12 to 0.0.3-next.13
114
+
115
+ ## [0.0.3-next.12](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.11...federated-catalogue-rest-client-v0.0.3-next.12) (2026-03-06)
116
+
117
+
118
+ ### Miscellaneous Chores
119
+
120
+ * **federated-catalogue-rest-client:** Synchronize repo versions
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.11 to 0.0.3-next.12
128
+
129
+ ## [0.0.3-next.11](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.10...federated-catalogue-rest-client-v0.0.3-next.11) (2026-03-05)
130
+
131
+
132
+ ### Miscellaneous Chores
133
+
134
+ * **federated-catalogue-rest-client:** Synchronize repo versions
135
+
136
+
137
+ ### Dependencies
138
+
139
+ * The following workspace dependencies were updated
140
+ * dependencies
141
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.10 to 0.0.3-next.11
142
+
143
+ ## [0.0.3-next.10](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.9...federated-catalogue-rest-client-v0.0.3-next.10) (2026-02-25)
144
+
145
+
146
+ ### Miscellaneous Chores
147
+
148
+ * **federated-catalogue-rest-client:** Synchronize repo versions
149
+
150
+
151
+ ### Dependencies
152
+
153
+ * The following workspace dependencies were updated
154
+ * dependencies
155
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.9 to 0.0.3-next.10
156
+
157
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.8...federated-catalogue-rest-client-v0.0.3-next.9) (2026-02-12)
158
+
159
+
160
+ ### Miscellaneous Chores
161
+
162
+ * **federated-catalogue-rest-client:** Synchronize repo versions
163
+
164
+
165
+ ### Dependencies
166
+
167
+ * The following workspace dependencies were updated
168
+ * dependencies
169
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.8 to 0.0.3-next.9
170
+
171
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.7...federated-catalogue-rest-client-v0.0.3-next.8) (2026-01-26)
172
+
173
+
174
+ ### Miscellaneous Chores
175
+
176
+ * **federated-catalogue-rest-client:** Synchronize repo versions
177
+
178
+
179
+ ### Dependencies
180
+
181
+ * The following workspace dependencies were updated
182
+ * dependencies
183
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.7 to 0.0.3-next.8
184
+
185
+ ## [0.0.3-next.7](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.6...federated-catalogue-rest-client-v0.0.3-next.7) (2026-01-22)
186
+
187
+
188
+ ### Bug Fixes
189
+
190
+ * context usage ([cd51790](https://github.com/iotaledger/twin-federated-catalogue/commit/cd51790ef97e14d21e89ef668b98477c163856bb))
191
+
192
+
193
+ ### Dependencies
194
+
195
+ * The following workspace dependencies were updated
196
+ * dependencies
197
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.6 to 0.0.3-next.7
198
+
199
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.5...federated-catalogue-rest-client-v0.0.3-next.6) (2026-01-20)
200
+
201
+
202
+ ### Bug Fixes
203
+
204
+ * transform GuardError to CatalogError for DS Protocol compliance ([#49](https://github.com/iotaledger/twin-federated-catalogue/issues/49)) ([d0f1090](https://github.com/iotaledger/twin-federated-catalogue/commit/d0f10900c251b9abc18e58c90562c393c3265727))
205
+
206
+
207
+ ### Dependencies
208
+
209
+ * The following workspace dependencies were updated
210
+ * dependencies
211
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.5 to 0.0.3-next.6
212
+
213
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.4...federated-catalogue-rest-client-v0.0.3-next.5) (2026-01-15)
214
+
215
+
216
+ ### Bug Fixes
217
+
218
+ * linting ([df034b1](https://github.com/iotaledger/twin-federated-catalogue/commit/df034b11e78fed68f64dfe9406809d2365acdfb8))
219
+ * pagination and ld context ([#45](https://github.com/iotaledger/twin-federated-catalogue/issues/45)) ([e36f096](https://github.com/iotaledger/twin-federated-catalogue/commit/e36f096aa4fdc61eb5b929a0fc4403247dbd41ce))
220
+
221
+
222
+ ### Dependencies
223
+
224
+ * The following workspace dependencies were updated
225
+ * dependencies
226
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.4 to 0.0.3-next.5
227
+
228
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.3...federated-catalogue-rest-client-v0.0.3-next.4) (2026-01-06)
229
+
230
+
231
+ ### Features
232
+
233
+ * updates standards dependencies ([62f5d9c](https://github.com/iotaledger/twin-federated-catalogue/commit/62f5d9c6180bc27497ac43624ffd714e7ce65ce6))
234
+
235
+
236
+ ### Dependencies
237
+
238
+ * The following workspace dependencies were updated
239
+ * dependencies
240
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.3 to 0.0.3-next.4
241
+
242
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.2...federated-catalogue-rest-client-v0.0.3-next.3) (2025-11-28)
243
+
244
+
245
+ ### Miscellaneous Chores
246
+
247
+ * **federated-catalogue-rest-client:** Synchronize repo versions
248
+
249
+
250
+ ### Dependencies
251
+
252
+ * The following workspace dependencies were updated
253
+ * dependencies
254
+ * @twin.org/federated-catalogue-models bumped from 0.0.3-next.2 to 0.0.3-next.3
255
+
256
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-federated-catalogue/compare/federated-catalogue-rest-client-v0.0.3-next.1...federated-catalogue-rest-client-v0.0.3-next.2) (2025-11-28)
257
+
258
+
259
+ ### Features
260
+
261
+ * implement Dataspace Protocol federated catalogue ([#36](https://github.com/iotaledger/twin-federated-catalogue/issues/36)) ([4765aba](https://github.com/iotaledger/twin-federated-catalogue/commit/4765aba4485ef8ad61e7ec1affbf0e454d974d36))
9
262
 
10
263
 
11
264
  ### Dependencies
package/docs/examples.md CHANGED
@@ -1 +1,79 @@
1
- # @twin.org/federated-catalogue-rest-client - Examples
1
+ # Federated Catalogue REST Client Examples
2
+
3
+ Use these snippets to call catalogue endpoints consistently, including paged queries, dataset retrieval and unsupported mutation handling.
4
+
5
+ ## FederatedCatalogueRestClient
6
+
7
+ ```typescript
8
+ import { FederatedCatalogueRestClient } from '@twin.org/federated-catalogue-rest-client';
9
+
10
+ const client = new FederatedCatalogueRestClient({
11
+ endpoint: 'http://localhost:3000'
12
+ });
13
+
14
+ console.log(client.className() === FederatedCatalogueRestClient.CLASS_NAME); // true
15
+ ```
16
+
17
+ ```typescript
18
+ import { FederatedCatalogueRestClient } from '@twin.org/federated-catalogue-rest-client';
19
+
20
+ const client = new FederatedCatalogueRestClient({
21
+ endpoint: 'http://localhost:3000'
22
+ });
23
+
24
+ const queryResponse = await client.query(
25
+ [
26
+ {
27
+ '@type': 'FilterByMetadata',
28
+ 'dcterms:publisher': {
29
+ '@id': 'did:web:publisher.example'
30
+ }
31
+ }
32
+ ],
33
+ 'page-1',
34
+ 25
35
+ );
36
+
37
+ console.log(queryResponse.result['@type']); // Catalog
38
+ console.log(typeof queryResponse.cursor === 'string' || queryResponse.cursor === undefined); // true
39
+ ```
40
+
41
+ ```typescript
42
+ import { FederatedCatalogueRestClient } from '@twin.org/federated-catalogue-rest-client';
43
+
44
+ const client = new FederatedCatalogueRestClient({
45
+ endpoint: 'http://localhost:3000'
46
+ });
47
+
48
+ const dataset = await client.get('urn:dataset:air-quality-2026');
49
+
50
+ console.log(dataset['@id']); // urn:dataset:air-quality-2026
51
+ ```
52
+
53
+ ```typescript
54
+ import { FederatedCatalogueRestClient } from '@twin.org/federated-catalogue-rest-client';
55
+
56
+ const client = new FederatedCatalogueRestClient({
57
+ endpoint: 'http://localhost:3000'
58
+ });
59
+
60
+ try {
61
+ await client.set({
62
+ '@context': ['https://www.w3.org/ns/dcat3.jsonld'],
63
+ '@type': 'dcat:Dataset',
64
+ '@id': 'urn:dataset:air-quality-2026'
65
+ });
66
+ } catch (error: unknown) {
67
+ if (error instanceof Error) {
68
+ console.log(error.name); // NotSupportedError
69
+ }
70
+ }
71
+
72
+ try {
73
+ await client.remove('urn:dataset:air-quality-2026');
74
+ } catch (error: unknown) {
75
+ if (error instanceof Error) {
76
+ console.log(error.name); // NotSupportedError
77
+ }
78
+ }
79
+ ```
@@ -36,7 +36,7 @@ The configuration for the client.
36
36
 
37
37
  ## Properties
38
38
 
39
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
40
40
 
41
41
  > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
@@ -44,7 +44,7 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
- ### className()
47
+ ### className() {#classname}
48
48
 
49
49
  > **className**(): `string`
50
50
 
@@ -62,106 +62,142 @@ The class name of the component.
62
62
 
63
63
  ***
64
64
 
65
- ### query()
65
+ ### get() {#get}
66
66
 
67
- > **query**(`filter?`): `Promise`\<`ICatalog`\>
67
+ > **get**(`datasetId`, `trustPayload`): `Promise`\<`IDcatDataset` \| `IDataspaceProtocolCatalogError`\>
68
68
 
69
- Query the federated catalogue with an optional filter.
69
+ Retrieve a specific dataset by its unique identifier.
70
70
 
71
71
  #### Parameters
72
72
 
73
- ##### filter?
73
+ ##### datasetId
74
74
 
75
- `unknown`[]
75
+ `string`
76
76
 
77
- Optional filter criteria for querying datasets.
77
+ The unique identifier of the dataset.
78
+
79
+ ##### trustPayload
80
+
81
+ `unknown`
82
+
83
+ Optional payload for trust evaluation, if applicable.
78
84
 
79
85
  #### Returns
80
86
 
81
- `Promise`\<`ICatalog`\>
87
+ `Promise`\<`IDcatDataset` \| `IDataspaceProtocolCatalogError`\>
82
88
 
83
- The catalog containing matching datasets.
89
+ The dataset if found, or a CatalogError if not found or an error occurs.
84
90
 
85
91
  #### Implementation of
86
92
 
87
- `IFederatedCatalogueComponent.query`
93
+ `IFederatedCatalogueComponent.get`
88
94
 
89
95
  ***
90
96
 
91
- ### get()
97
+ ### set() {#set}
92
98
 
93
- > **get**(`datasetId`): `Promise`\<`IDataset`\>
99
+ > **set**(`dataset`, `trustPayload`): `Promise`\<`string` \| `IDataspaceProtocolCatalogError`\>
94
100
 
95
- Retrieve a specific dataset by its unique identifier.
101
+ Insert or update a dataset in the catalogue.
102
+ This method is internal and is not exposed via REST endpoints.
96
103
 
97
104
  #### Parameters
98
105
 
99
- ##### datasetId
106
+ ##### dataset
100
107
 
101
- `string`
108
+ `IDcatDataset`
102
109
 
103
- The unique identifier of the dataset.
110
+ The dataset to store.
111
+
112
+ ##### trustPayload
113
+
114
+ `unknown`
115
+
116
+ Optional payload for trust evaluation, if applicable.
104
117
 
105
118
  #### Returns
106
119
 
107
- `Promise`\<`IDataset`\>
120
+ `Promise`\<`string` \| `IDataspaceProtocolCatalogError`\>
108
121
 
109
- The dataset if found.
122
+ The unique identifier of the stored dataset, or a CatalogError if an error occurs.
110
123
 
111
124
  #### Implementation of
112
125
 
113
- `IFederatedCatalogueComponent.get`
126
+ `IFederatedCatalogueComponent.set`
114
127
 
115
128
  ***
116
129
 
117
- ### set()
130
+ ### remove() {#remove}
118
131
 
119
- > **set**(`dataSet`): `Promise`\<`void`\>
132
+ > **remove**(`datasetId`, `trustPayload`): `Promise`\<`IDataspaceProtocolCatalogError` \| `undefined`\>
120
133
 
121
- Insert or update a dataset in the catalogue.
134
+ Remove a dataset from the catalogue by its unique identifier.
122
135
  This method is internal and is not exposed via REST endpoints.
123
136
 
124
137
  #### Parameters
125
138
 
126
- ##### dataSet
139
+ ##### datasetId
140
+
141
+ `string`
127
142
 
128
- `IDataset`
143
+ The unique identifier of the dataset to remove.
129
144
 
130
- The dataset to store.
145
+ ##### trustPayload
146
+
147
+ `unknown`
148
+
149
+ Optional payload for trust evaluation, if applicable.
131
150
 
132
151
  #### Returns
133
152
 
134
- `Promise`\<`void`\>
153
+ `Promise`\<`IDataspaceProtocolCatalogError` \| `undefined`\>
135
154
 
136
155
  Nothing.
137
156
 
138
157
  #### Implementation of
139
158
 
140
- `IFederatedCatalogueComponent.set`
159
+ `IFederatedCatalogueComponent.remove`
141
160
 
142
161
  ***
143
162
 
144
- ### remove()
163
+ ### query() {#query}
145
164
 
146
- > **remove**(`dataSetId`): `Promise`\<`void`\>
165
+ > **query**(`filter`, `cursor`, `limit`, `trustPayload`): `Promise`\<\{ `result`: `IDataspaceProtocolCatalogError` \| `IDataspaceProtocolCatalog`; `cursor?`: `string`; \}\>
147
166
 
148
- Remove a dataset from the catalogue by its unique identifier.
149
- This method is internal and is not exposed via REST endpoints.
167
+ Query the federated catalogue with an optional filter.
150
168
 
151
169
  #### Parameters
152
170
 
153
- ##### dataSetId
171
+ ##### filter
154
172
 
155
- `string`
173
+ `unknown`[] \| `undefined`
156
174
 
157
- The unique identifier of the dataset to remove.
175
+ Optional filter criteria for querying datasets.
176
+
177
+ ##### cursor
178
+
179
+ `string` \| `undefined`
180
+
181
+ Optional cursor for pagination.
182
+
183
+ ##### limit
184
+
185
+ `number` \| `undefined`
186
+
187
+ Optional limit for pagination.
188
+
189
+ ##### trustPayload
190
+
191
+ `unknown`
192
+
193
+ Optional payload for trust evaluation, if applicable.
158
194
 
159
195
  #### Returns
160
196
 
161
- `Promise`\<`void`\>
197
+ `Promise`\<\{ `result`: `IDataspaceProtocolCatalogError` \| `IDataspaceProtocolCatalog`; `cursor?`: `string`; \}\>
162
198
 
163
- Nothing.
199
+ The catalog containing matching datasets (or CatalogError if none found), with cursor if more pages exist.
164
200
 
165
201
  #### Implementation of
166
202
 
167
- `IFederatedCatalogueComponent.remove`
203
+ `IFederatedCatalogueComponent.query`
package/locales/en.json CHANGED
@@ -1,7 +1 @@
1
- {
2
- "error": {
3
- "federatedCatalogueRestClient": {
4
- "notSupportedOnClient": "The method \"{methodName}\" is not supported on the REST client, it can only be used on a server side component"
5
- }
6
- }
7
- }
1
+ {}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@twin.org/federated-catalogue-rest-client",
3
- "version": "0.0.3-next.2",
3
+ "version": "0.0.3-next.20",
4
4
  "description": "Federated Catalogue contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/federated-catalogue.git",
7
+ "url": "git+https://github.com/iotaledger/twin-federated-catalogue.git",
8
8
  "directory": "packages/federated-catalogue-rest-client"
9
9
  },
10
- "author": "jose.cantera@iota.org",
10
+ "author": "cornel.filip@iota.org",
11
11
  "license": "Apache-2.0",
12
12
  "type": "module",
13
13
  "engines": {
@@ -16,12 +16,14 @@
16
16
  "dependencies": {
17
17
  "@twin.org/api-core": "next",
18
18
  "@twin.org/api-models": "next",
19
+ "@twin.org/context": "next",
19
20
  "@twin.org/core": "next",
20
21
  "@twin.org/data-json-ld": "next",
21
- "@twin.org/federated-catalogue-models": "0.0.3-next.2",
22
+ "@twin.org/federated-catalogue-models": "0.0.3-next.20",
22
23
  "@twin.org/nameof": "next",
23
24
  "@twin.org/standards-dataspace-protocol": "next",
24
25
  "@twin.org/standards-w3c-dcat": "next",
26
+ "@twin.org/trust-models": "next",
25
27
  "@twin.org/web": "next"
26
28
  },
27
29
  "main": "./dist/es/index.js",
@@ -49,7 +51,7 @@
49
51
  "federated-catalogue"
50
52
  ],
51
53
  "bugs": {
52
- "url": "git+https://github.com/twinfoundation/federated-catalogue/issues"
54
+ "url": "git+https://github.com/iotaledger/twin-federated-catalogue/issues"
53
55
  },
54
56
  "homepage": "https://twindev.org"
55
57
  }