@3sixty/federated-catalogue-rest-client 0.20.0-next.0 → 0.20.0-next.1
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":"federatedCatalogueRestClient.js","
|
|
1
|
+
{"version":3,"file":"federatedCatalogueRestClient.js","sources":["../../src/federatedCatalogueRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAA8B,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAa9C,OAAO,EACN,6BAA6B,EAC7B,yBAAyB,EAGzB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,4BACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,8BAA8B,CAAC;IAE3E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,8BAA8B,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,4BAA4B,CAAC,UAAU,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACf,SAAiB,EACjB,YAAqB;QAErB,MAAM,CAAC,WAAW,CAAC,4BAA4B,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACpF,MAAM,CAAC,WAAW,CAAC,4BAA4B,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QAE1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,sBAAsB,EACtB,UA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AAsB,EACtB,UAAU,CAAC,MAAM,EACjB;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC;aACpE;YACD,UAAU,EAAE;gBACX,SAAS;aACT;SACD,CACD,CAAC;QAEF,OAAO,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,KAAK,CACjB,MAA6B,EAC7B,MAA0B,EAC1B,KAAyB,EACzB,YAAqB;QAKrB,MAAM,CAAC,WAAW,CAAC,4BAA4B,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QAC1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,UAAU,CAAC,IAAI,EACf;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC;aACpE;YACD,KAAK,EAAE;gBACN,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;YACD,IAAI,EAAE;gBACL,UAAU,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;gBAC/C,OAAO,EAAE,6BAA6B,CAAC,qBAAqB;gBAC5D,MAAM;aACN;SACD,CACD,CAAC;QAEF,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,IAAI;YACrB,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC;SACxD,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@3sixty/api-core\";\nimport { HttpHeaderHelper, type IBaseRestClientConfig } from \"@3sixty/api-models\";\nimport { Coerce, Guards } from \"@3sixty/core\";\nimport type {\n\tICatalogRequestRequest,\n\tICatalogRequestResponse,\n\tIDatasetGetRequest,\n\tIDatasetGetResponse,\n\tIDatasetRemoveRequest,\n\tIDatasetRemoveResponse,\n\tIDatasetSetRequest,\n\tIDatasetSetResponse,\n\tIFederatedCatalogueComponent\n} from \"@3sixty/federated-catalogue-models\";\n\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts,\n\ttype IDataspaceProtocolCatalog,\n\ttype IDataspaceProtocolCatalogError\n} from \"@3sixty/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@3sixty/standards-w3c-dcat\";\nimport { HeaderHelper, HeaderTypes, HttpMethod, HttpStatusCode } from \"@3sixty/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 = \"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(\"FederatedCatalogueRestClient\", config, \"catalog\");\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 A promise that resolves with 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, \"datasetId\", datasetId);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, \"trustPayload\", trustPayload);\n\n\t\tconst response = await this.fetch<IDatasetGetRequest, IDatasetGetResponse>(\n\t\t\t\"/datasets/:datasetId\",\n\t\t\tHttpMethod.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 * @param dataset The dataset to store.\n\t * @param trustPayload Optional payload for trust evaluation, if applicable.\n\t * @returns A promise that resolves with 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, \"dataset\", dataset);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, \"trustPayload\", trustPayload);\n\n\t\tconst response = await this.fetch<IDatasetSetRequest, IDatasetSetResponse>(\n\t\t\t\"/datasets\",\n\t\t\tHttpMethod.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.statusCode === HttpStatusCode.created\n\t\t\t? HttpHeaderHelper.extractId(response.headers, `${this.getPathPrefix()}/datasets/:id`)\n\t\t\t: (response.body ?? \"\");\n\t}\n\n\t/**\n\t * Remove a dataset from the catalogue by its unique identifier.\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 A promise that resolves with undefined on success, or a CatalogError if removal fails.\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, \"datasetId\", datasetId);\n\t\tGuards.stringValue(FederatedCatalogueRestClient.CLASS_NAME, \"trustPayload\", trustPayload);\n\n\t\tconst result = await this.fetch<IDatasetRemoveRequest, IDatasetRemoveResponse>(\n\t\t\t\"/datasets/:datasetId\",\n\t\t\tHttpMethod.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 A promise that resolves with the catalog result and optional next-page cursor.\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, \"trustPayload\", trustPayload);\n\t\tconst response = await this.fetch<ICatalogRequestRequest, ICatalogRequestResponse>(\n\t\t\t\"/request\",\n\t\t\tHttpMethod.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: HttpHeaderHelper.extractCursor(response.headers)\n\t\t};\n\t}\n}\n"]}
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","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"]}
|
package/docs/changelog.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.20.0-next.1](https://github.com/3sixtyglobal/federated-catalogue/compare/federated-catalogue-rest-client-v0.20.0-next.0...federated-catalogue-rest-client-v0.20.0-next.1) (2026-10-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* publish packages under the [@3sixty](https://github.com/3sixty) namespace ([79bdb62](https://github.com/3sixtyglobal/federated-catalogue/commit/79bdb626f38f05531692035fcb1b6316075516b6))
|
|
9
|
+
* updated ts compile ([9d539d3](https://github.com/3sixtyglobal/federated-catalogue/commit/9d539d356467b78109bb7392aa64861834d110ed))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* The following workspace dependencies were updated
|
|
15
|
+
* dependencies
|
|
16
|
+
* @3sixty/federated-catalogue-models bumped from 0.20.0-next.0 to 0.20.0-next.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3sixty/federated-catalogue-rest-client",
|
|
3
|
-
"version": "0.20.0-next.
|
|
3
|
+
"version": "0.20.0-next.1",
|
|
4
4
|
"description": "Federated Catalogue contract implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@3sixty/context": "next",
|
|
20
20
|
"@3sixty/core": "next",
|
|
21
21
|
"@3sixty/data-json-ld": "next",
|
|
22
|
-
"@3sixty/federated-catalogue-models": "0.20.0-next.
|
|
22
|
+
"@3sixty/federated-catalogue-models": "0.20.0-next.1",
|
|
23
23
|
"@3sixty/nameof": "next",
|
|
24
24
|
"@3sixty/standards-dataspace-protocol": "next",
|
|
25
25
|
"@3sixty/standards-w3c-dcat": "next",
|