@twin.org/federated-catalogue-service 0.0.2-next.6 → 0.0.3-next.10
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/dist/es/entities/dataset.js +271 -0
- package/dist/es/entities/dataset.js.map +1 -0
- package/dist/es/federatedCatalogueRoutes.js +206 -0
- package/dist/es/federatedCatalogueRoutes.js.map +1 -0
- package/dist/es/index.js +11 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IFederatedCatalogueServiceConstructorOptions.js +4 -0
- package/dist/es/models/IFederatedCatalogueServiceConstructorOptions.js.map +1 -0
- package/dist/es/restEntryPoints.js +10 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +11 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/services/federatedCatalogueService.js +381 -0
- package/dist/es/services/federatedCatalogueService.js.map +1 -0
- package/dist/es/utils/catalogErrorUtils.js +49 -0
- package/dist/es/utils/catalogErrorUtils.js.map +1 -0
- package/dist/es/utils/datasetConverters.js +35 -0
- package/dist/es/utils/datasetConverters.js.map +1 -0
- package/dist/types/entities/dataset.d.ts +136 -0
- package/dist/types/federatedCatalogueRoutes.d.ts +4 -105
- package/dist/types/index.d.ts +8 -10
- package/dist/types/models/IFederatedCatalogueServiceConstructorOptions.d.ts +4 -29
- package/dist/types/schema.d.ts +1 -1
- package/dist/types/services/federatedCatalogueService.d.ts +82 -0
- package/dist/types/utils/catalogErrorUtils.d.ts +15 -0
- package/dist/types/utils/datasetConverters.d.ts +18 -0
- package/docs/changelog.md +29 -179
- package/docs/open-api/spec.json +143 -2760
- package/docs/reference/classes/Dataset.md +271 -0
- package/docs/reference/classes/FederatedCatalogueService.md +60 -242
- package/docs/reference/functions/datasetEntityToModel.md +20 -0
- package/docs/reference/functions/datasetModelToEntity.md +32 -0
- package/docs/reference/functions/generateRestRoutesFederatedCatalogue.md +4 -4
- package/docs/reference/functions/initSchema.md +1 -1
- package/docs/reference/functions/transformErrorToStatusCode.md +19 -0
- package/docs/reference/functions/transformToCatalogError.md +20 -0
- package/docs/reference/index.md +5 -17
- package/docs/reference/interfaces/IFederatedCatalogueServiceConstructorOptions.md +5 -69
- package/locales/en.json +14 -15
- package/package.json +9 -15
- package/dist/cjs/index.cjs +0 -2209
- package/dist/esm/index.mjs +0 -2191
- package/dist/types/entities/dataResourceEntry.d.ts +0 -64
- package/dist/types/entities/dataSpaceConnectorEntry.d.ts +0 -71
- package/dist/types/entities/participantEntry.d.ts +0 -47
- package/dist/types/entities/serviceOfferingEntry.d.ts +0 -60
- package/dist/types/federatedCatalogueService.d.ts +0 -93
- package/dist/types/models/IFederatedCatalogueServiceConfig.d.ts +0 -15
- package/dist/types/verification/complianceCredentialVerificationService.d.ts +0 -32
- package/docs/reference/classes/DataResourceEntry.md +0 -126
- package/docs/reference/classes/DataSpaceConnectorEntry.md +0 -141
- package/docs/reference/classes/ParticipantEntry.md +0 -93
- package/docs/reference/classes/ServiceOfferingEntry.md +0 -117
- package/docs/reference/functions/complianceCredentialPresentation.md +0 -37
- package/docs/reference/functions/dataResourceCredentialPresentation.md +0 -37
- package/docs/reference/functions/dataResourceGet.md +0 -31
- package/docs/reference/functions/dataResourceList.md +0 -31
- package/docs/reference/functions/dataSpaceConnectorCredentialPresentation.md +0 -37
- package/docs/reference/functions/dataSpaceConnectorGet.md +0 -31
- package/docs/reference/functions/dataSpaceConnectorList.md +0 -31
- package/docs/reference/functions/participantGet.md +0 -31
- package/docs/reference/functions/participantList.md +0 -31
- package/docs/reference/functions/serviceOfferingCredentialPresentation.md +0 -37
- package/docs/reference/functions/serviceOfferingGet.md +0 -31
- package/docs/reference/functions/serviceOfferingList.md +0 -31
- package/docs/reference/interfaces/IFederatedCatalogueServiceConfig.md +0 -21
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { entity, property } from "@twin.org/entity";
|
|
4
|
+
/**
|
|
5
|
+
* Class describing a DCAT dataset for entity storage.
|
|
6
|
+
* This wrapper enables efficient database indexing and querying while preserving
|
|
7
|
+
* the full IDcatDataset JSON-LD structure.
|
|
8
|
+
*/
|
|
9
|
+
let Dataset = class Dataset {
|
|
10
|
+
/**
|
|
11
|
+
* The unique identifier for the dataset (mapped from JSON-LD identifier).
|
|
12
|
+
*/
|
|
13
|
+
id;
|
|
14
|
+
/**
|
|
15
|
+
* The identity of the node that owns this entity (required for sync).
|
|
16
|
+
*/
|
|
17
|
+
nodeIdentity;
|
|
18
|
+
/**
|
|
19
|
+
* The date the entity was last modified (required for sync).
|
|
20
|
+
*/
|
|
21
|
+
dateModified;
|
|
22
|
+
/**
|
|
23
|
+
* The JSON-LD context for the dataset.
|
|
24
|
+
*/
|
|
25
|
+
"@context";
|
|
26
|
+
/**
|
|
27
|
+
* The type of the resource (typically "Dataset").
|
|
28
|
+
*/
|
|
29
|
+
"@type";
|
|
30
|
+
/**
|
|
31
|
+
* A name given to the resource.
|
|
32
|
+
*/
|
|
33
|
+
"dcterms:title";
|
|
34
|
+
/**
|
|
35
|
+
* A free-text account of the resource.
|
|
36
|
+
*/
|
|
37
|
+
"dcterms:description";
|
|
38
|
+
/**
|
|
39
|
+
* A unique identifier of the resource.
|
|
40
|
+
*/
|
|
41
|
+
"dcterms:identifier";
|
|
42
|
+
/**
|
|
43
|
+
* Date of formal issuance (publication) of the resource.
|
|
44
|
+
*/
|
|
45
|
+
"dcterms:issued";
|
|
46
|
+
/**
|
|
47
|
+
* Most recent date on which the resource was changed, updated or modified.
|
|
48
|
+
*/
|
|
49
|
+
"dcterms:modified";
|
|
50
|
+
/**
|
|
51
|
+
* A language of the resource.
|
|
52
|
+
*/
|
|
53
|
+
"dcterms:language";
|
|
54
|
+
/**
|
|
55
|
+
* An entity responsible for making the resource available.
|
|
56
|
+
*/
|
|
57
|
+
"dcterms:publisher";
|
|
58
|
+
/**
|
|
59
|
+
* An entity responsible for producing the resource.
|
|
60
|
+
*/
|
|
61
|
+
"dcterms:creator";
|
|
62
|
+
/**
|
|
63
|
+
* Information about who can access the resource or an indication of its security status.
|
|
64
|
+
*/
|
|
65
|
+
"dcterms:accessRights";
|
|
66
|
+
/**
|
|
67
|
+
* A legal document under which the resource is made available.
|
|
68
|
+
*/
|
|
69
|
+
"dcterms:license";
|
|
70
|
+
/**
|
|
71
|
+
* Information about rights held in and over the resource.
|
|
72
|
+
*/
|
|
73
|
+
"dcterms:rights";
|
|
74
|
+
/**
|
|
75
|
+
* An established standard to which the resource conforms.
|
|
76
|
+
*/
|
|
77
|
+
"dcterms:conformsTo";
|
|
78
|
+
/**
|
|
79
|
+
* The nature or genre of the resource.
|
|
80
|
+
*/
|
|
81
|
+
"dcterms:type";
|
|
82
|
+
/**
|
|
83
|
+
* Relevant contact information for the catalogued resource.
|
|
84
|
+
*/
|
|
85
|
+
"dcat:contactPoint";
|
|
86
|
+
/**
|
|
87
|
+
* A keyword or tag describing the resource.
|
|
88
|
+
*/
|
|
89
|
+
"dcat:keyword";
|
|
90
|
+
/**
|
|
91
|
+
* A main category of the resource. A resource can have multiple themes.
|
|
92
|
+
*/
|
|
93
|
+
"dcat:theme";
|
|
94
|
+
/**
|
|
95
|
+
* A Web page that can be navigated to gain access to the resource.
|
|
96
|
+
*/
|
|
97
|
+
"dcat:landingPage";
|
|
98
|
+
/**
|
|
99
|
+
* Link to a description of a relationship with another resource.
|
|
100
|
+
*/
|
|
101
|
+
"dcat:qualifiedRelation";
|
|
102
|
+
/**
|
|
103
|
+
* An ODRL conformant policy expressing the rights associated with the resource.
|
|
104
|
+
*/
|
|
105
|
+
"odrl:hasPolicy";
|
|
106
|
+
/**
|
|
107
|
+
* An available distribution of the dataset.
|
|
108
|
+
*/
|
|
109
|
+
"dcat:distribution";
|
|
110
|
+
/**
|
|
111
|
+
* The frequency at which the dataset is published.
|
|
112
|
+
*/
|
|
113
|
+
"dcterms:accrualPeriodicity";
|
|
114
|
+
/**
|
|
115
|
+
* A dataset series of which the dataset is part.
|
|
116
|
+
*/
|
|
117
|
+
"dcat:inSeries";
|
|
118
|
+
/**
|
|
119
|
+
* The geographical area covered by the dataset.
|
|
120
|
+
*/
|
|
121
|
+
"dcterms:spatial";
|
|
122
|
+
/**
|
|
123
|
+
* Minimum spatial separation resolvable in a dataset, measured in meters.
|
|
124
|
+
*/
|
|
125
|
+
"dcat:spatialResolutionInMeters";
|
|
126
|
+
/**
|
|
127
|
+
* The temporal period that the dataset covers.
|
|
128
|
+
*/
|
|
129
|
+
"dcterms:temporal";
|
|
130
|
+
/**
|
|
131
|
+
* Minimum time period resolvable in the dataset.
|
|
132
|
+
*/
|
|
133
|
+
"dcat:temporalResolution";
|
|
134
|
+
/**
|
|
135
|
+
* An activity that generated, or provides the business context for, the creation of the dataset.
|
|
136
|
+
*/
|
|
137
|
+
"prov:wasGeneratedBy";
|
|
138
|
+
};
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: "string", isPrimary: true }),
|
|
141
|
+
__metadata("design:type", String)
|
|
142
|
+
], Dataset.prototype, "id", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: "string", isSecondary: true }),
|
|
145
|
+
__metadata("design:type", String)
|
|
146
|
+
], Dataset.prototype, "nodeIdentity", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
property({ type: "string", isSecondary: true }),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], Dataset.prototype, "dateModified", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: "object" }),
|
|
153
|
+
__metadata("design:type", Object)
|
|
154
|
+
], Dataset.prototype, "@context", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
property({ type: "string" }),
|
|
157
|
+
__metadata("design:type", Object)
|
|
158
|
+
], Dataset.prototype, "@type", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
property({ type: "object", optional: true }),
|
|
161
|
+
__metadata("design:type", Object)
|
|
162
|
+
], Dataset.prototype, "dcterms:title", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: "object", optional: true }),
|
|
165
|
+
__metadata("design:type", Object)
|
|
166
|
+
], Dataset.prototype, "dcterms:description", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
property({ type: "object", optional: true }),
|
|
169
|
+
__metadata("design:type", Object)
|
|
170
|
+
], Dataset.prototype, "dcterms:identifier", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property({ type: "string", optional: true }),
|
|
173
|
+
__metadata("design:type", Object)
|
|
174
|
+
], Dataset.prototype, "dcterms:issued", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
property({ type: "string", optional: true }),
|
|
177
|
+
__metadata("design:type", Object)
|
|
178
|
+
], Dataset.prototype, "dcterms:modified", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
property({ type: "object", optional: true }),
|
|
181
|
+
__metadata("design:type", Object)
|
|
182
|
+
], Dataset.prototype, "dcterms:language", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: "object", optional: true }),
|
|
185
|
+
__metadata("design:type", Object)
|
|
186
|
+
], Dataset.prototype, "dcterms:publisher", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property({ type: "object", optional: true }),
|
|
189
|
+
__metadata("design:type", Object)
|
|
190
|
+
], Dataset.prototype, "dcterms:creator", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
property({ type: "object", optional: true }),
|
|
193
|
+
__metadata("design:type", Object)
|
|
194
|
+
], Dataset.prototype, "dcterms:accessRights", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: "object", optional: true }),
|
|
197
|
+
__metadata("design:type", Object)
|
|
198
|
+
], Dataset.prototype, "dcterms:license", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property({ type: "object", optional: true }),
|
|
201
|
+
__metadata("design:type", Object)
|
|
202
|
+
], Dataset.prototype, "dcterms:rights", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: "object", optional: true }),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], Dataset.prototype, "dcterms:conformsTo", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: "string", optional: true }),
|
|
209
|
+
__metadata("design:type", Object)
|
|
210
|
+
], Dataset.prototype, "dcterms:type", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: "object", optional: true }),
|
|
213
|
+
__metadata("design:type", Object)
|
|
214
|
+
], Dataset.prototype, "dcat:contactPoint", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: "object", optional: true }),
|
|
217
|
+
__metadata("design:type", Object)
|
|
218
|
+
], Dataset.prototype, "dcat:keyword", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: "object", optional: true }),
|
|
221
|
+
__metadata("design:type", Object)
|
|
222
|
+
], Dataset.prototype, "dcat:theme", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: "object", optional: true }),
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], Dataset.prototype, "dcat:landingPage", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: "object", optional: true }),
|
|
229
|
+
__metadata("design:type", Object)
|
|
230
|
+
], Dataset.prototype, "dcat:qualifiedRelation", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: "object", optional: true }),
|
|
233
|
+
__metadata("design:type", Object)
|
|
234
|
+
], Dataset.prototype, "odrl:hasPolicy", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: "object", optional: true }),
|
|
237
|
+
__metadata("design:type", Object)
|
|
238
|
+
], Dataset.prototype, "dcat:distribution", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
property({ type: "string", optional: true }),
|
|
241
|
+
__metadata("design:type", Object)
|
|
242
|
+
], Dataset.prototype, "dcterms:accrualPeriodicity", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property({ type: "string", optional: true }),
|
|
245
|
+
__metadata("design:type", Object)
|
|
246
|
+
], Dataset.prototype, "dcat:inSeries", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: "object", optional: true }),
|
|
249
|
+
__metadata("design:type", Object)
|
|
250
|
+
], Dataset.prototype, "dcterms:spatial", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
property({ type: "object", optional: true }),
|
|
253
|
+
__metadata("design:type", Object)
|
|
254
|
+
], Dataset.prototype, "dcat:spatialResolutionInMeters", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ type: "object", optional: true }),
|
|
257
|
+
__metadata("design:type", Object)
|
|
258
|
+
], Dataset.prototype, "dcterms:temporal", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
property({ type: "object", optional: true }),
|
|
261
|
+
__metadata("design:type", Object)
|
|
262
|
+
], Dataset.prototype, "dcat:temporalResolution", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
property({ type: "object", optional: true }),
|
|
265
|
+
__metadata("design:type", Object)
|
|
266
|
+
], Dataset.prototype, "prov:wasGeneratedBy", void 0);
|
|
267
|
+
Dataset = __decorate([
|
|
268
|
+
entity()
|
|
269
|
+
], Dataset);
|
|
270
|
+
export { Dataset };
|
|
271
|
+
//# sourceMappingURL=dataset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../../src/entities/dataset.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGpD;;;;GAIG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAO;IACnB;;OAEG;IAEI,EAAE,CAAU;IAEnB;;OAEG;IAEI,YAAY,CAAU;IAE7B;;OAEG;IAEI,YAAY,CAAU;IAE7B;;OAEG;IAEI,UAAU,CAA4B;IAE7C;;OAEG;IAEI,OAAO,CAAyB;IAEvC;;OAEG;IAEI,eAAe,CAAiC;I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IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACgB;AAMtD;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDAC8B;AAMpE;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACsB;AA/LvD,OAAO;IADnB,MAAM,EAAE;GACI,OAAO,CAgMnB","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { entity, property } from \"@twin.org/entity\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\n\n/**\n * Class describing a DCAT dataset for entity storage.\n * This wrapper enables efficient database indexing and querying while preserving\n * the full IDcatDataset JSON-LD structure.\n */\n@entity()\nexport class Dataset {\n\t/**\n\t * The unique identifier for the dataset (mapped from JSON-LD identifier).\n\t */\n\t@property({ type: \"string\", isPrimary: true })\n\tpublic id!: string;\n\n\t/**\n\t * The identity of the node that owns this entity (required for sync).\n\t */\n\t@property({ type: \"string\", isSecondary: true })\n\tpublic nodeIdentity!: string;\n\n\t/**\n\t * The date the entity was last modified (required for sync).\n\t */\n\t@property({ type: \"string\", isSecondary: true })\n\tpublic dateModified!: string;\n\n\t/**\n\t * The JSON-LD context for the dataset.\n\t */\n\t@property({ type: \"object\" })\n\tpublic \"@context\"!: IDcatDataset[\"@context\"];\n\n\t/**\n\t * The type of the resource (typically \"Dataset\").\n\t */\n\t@property({ type: \"string\" })\n\tpublic \"@type\"!: IDcatDataset[\"@type\"];\n\n\t/**\n\t * A name given to the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:title\"?: IDcatDataset[\"dcterms:title\"];\n\n\t/**\n\t * A free-text account of the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:description\"?: IDcatDataset[\"dcterms:description\"];\n\n\t/**\n\t * A unique identifier of the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:identifier\"?: IDcatDataset[\"dcterms:identifier\"];\n\n\t/**\n\t * Date of formal issuance (publication) of the resource.\n\t */\n\t@property({ type: \"string\", optional: true })\n\tpublic \"dcterms:issued\"?: IDcatDataset[\"dcterms:issued\"];\n\n\t/**\n\t * Most recent date on which the resource was changed, updated or modified.\n\t */\n\t@property({ type: \"string\", optional: true })\n\tpublic \"dcterms:modified\"?: IDcatDataset[\"dcterms:modified\"];\n\n\t/**\n\t * A language of the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:language\"?: IDcatDataset[\"dcterms:language\"];\n\n\t/**\n\t * An entity responsible for making the resource available.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:publisher\"?: IDcatDataset[\"dcterms:publisher\"];\n\n\t/**\n\t * An entity responsible for producing the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:creator\"?: IDcatDataset[\"dcterms:creator\"];\n\n\t/**\n\t * Information about who can access the resource or an indication of its security status.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:accessRights\"?: IDcatDataset[\"dcterms:accessRights\"];\n\n\t/**\n\t * A legal document under which the resource is made available.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:license\"?: IDcatDataset[\"dcterms:license\"];\n\n\t/**\n\t * Information about rights held in and over the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:rights\"?: IDcatDataset[\"dcterms:rights\"];\n\n\t/**\n\t * An established standard to which the resource conforms.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:conformsTo\"?: IDcatDataset[\"dcterms:conformsTo\"];\n\n\t/**\n\t * The nature or genre of the resource.\n\t */\n\t@property({ type: \"string\", optional: true })\n\tpublic \"dcterms:type\"?: IDcatDataset[\"dcterms:type\"];\n\n\t/**\n\t * Relevant contact information for the catalogued resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:contactPoint\"?: IDcatDataset[\"dcat:contactPoint\"];\n\n\t/**\n\t * A keyword or tag describing the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:keyword\"?: IDcatDataset[\"dcat:keyword\"];\n\n\t/**\n\t * A main category of the resource. A resource can have multiple themes.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:theme\"?: IDcatDataset[\"dcat:theme\"];\n\n\t/**\n\t * A Web page that can be navigated to gain access to the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:landingPage\"?: IDcatDataset[\"dcat:landingPage\"];\n\n\t/**\n\t * Link to a description of a relationship with another resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:qualifiedRelation\"?: IDcatDataset[\"dcat:qualifiedRelation\"];\n\n\t/**\n\t * An ODRL conformant policy expressing the rights associated with the resource.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"odrl:hasPolicy\"?: IDcatDataset[\"odrl:hasPolicy\"];\n\n\t/**\n\t * An available distribution of the dataset.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:distribution\"?: IDcatDataset[\"dcat:distribution\"];\n\n\t/**\n\t * The frequency at which the dataset is published.\n\t */\n\t@property({ type: \"string\", optional: true })\n\tpublic \"dcterms:accrualPeriodicity\"?: IDcatDataset[\"dcterms:accrualPeriodicity\"];\n\n\t/**\n\t * A dataset series of which the dataset is part.\n\t */\n\t@property({ type: \"string\", optional: true })\n\tpublic \"dcat:inSeries\"?: IDcatDataset[\"dcat:inSeries\"];\n\n\t/**\n\t * The geographical area covered by the dataset.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:spatial\"?: IDcatDataset[\"dcterms:spatial\"];\n\n\t/**\n\t * Minimum spatial separation resolvable in a dataset, measured in meters.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:spatialResolutionInMeters\"?: IDcatDataset[\"dcat:spatialResolutionInMeters\"];\n\n\t/**\n\t * The temporal period that the dataset covers.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcterms:temporal\"?: IDcatDataset[\"dcterms:temporal\"];\n\n\t/**\n\t * Minimum time period resolvable in the dataset.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"dcat:temporalResolution\"?: IDcatDataset[\"dcat:temporalResolution\"];\n\n\t/**\n\t * An activity that generated, or provides the business context for, the creation of the dataset.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic \"prov:wasGeneratedBy\"?: IDcatDataset[\"prov:wasGeneratedBy\"];\n}\n"]}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { Coerce, ComponentFactory, Guards, Is } from "@twin.org/core";
|
|
2
|
+
import { DataspaceProtocolCatalogTypes, DataspaceProtocolContexts } from "@twin.org/standards-dataspace-protocol";
|
|
3
|
+
import { DcatClasses } from "@twin.org/standards-w3c-dcat";
|
|
4
|
+
import { PolicyType } from "@twin.org/standards-w3c-odrl";
|
|
5
|
+
import { HeaderHelper, HeaderTypes, HttpStatusCode } from "@twin.org/web";
|
|
6
|
+
import { transformErrorToStatusCode, transformToCatalogError } from "./utils/catalogErrorUtils.js";
|
|
7
|
+
/**
|
|
8
|
+
* The source used when communicating about these routes.
|
|
9
|
+
*/
|
|
10
|
+
const ROUTES_SOURCE = "federatedCatalogueRoutes";
|
|
11
|
+
/**
|
|
12
|
+
* The tag to associate with the routes.
|
|
13
|
+
*/
|
|
14
|
+
export const tagsFederatedCatalogue = [
|
|
15
|
+
{
|
|
16
|
+
name: "Federated Catalogue",
|
|
17
|
+
description: "Service providing Dataspace Protocol-compliant catalogue endpoints for dataset discovery and query."
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* The REST routes for federated catalogue.
|
|
22
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
23
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
24
|
+
* @returns The generated routes.
|
|
25
|
+
*/
|
|
26
|
+
export function generateRestRoutesFederatedCatalogue(baseRouteName, componentName) {
|
|
27
|
+
const catalogRequestRoute = {
|
|
28
|
+
operationId: "catalogRequest",
|
|
29
|
+
summary: "Query the federated catalogue for datasets",
|
|
30
|
+
tag: tagsFederatedCatalogue[0].name,
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: `${baseRouteName}/request`,
|
|
33
|
+
handler: async (httpRequestContext, request) => catalogRequest(httpRequestContext, componentName, request),
|
|
34
|
+
requestType: {
|
|
35
|
+
type: "ICatalogRequestRequest",
|
|
36
|
+
examples: [
|
|
37
|
+
{
|
|
38
|
+
id: "catalogRequestExample",
|
|
39
|
+
request: {
|
|
40
|
+
body: {
|
|
41
|
+
"@context": [DataspaceProtocolContexts.Context],
|
|
42
|
+
"@type": DataspaceProtocolCatalogTypes.CatalogRequestMessage,
|
|
43
|
+
filter: [
|
|
44
|
+
{
|
|
45
|
+
"dcterms:title": "Energy Consumption Data"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "catalogRequestNoFilterExample",
|
|
53
|
+
request: {
|
|
54
|
+
body: {
|
|
55
|
+
"@context": [DataspaceProtocolContexts.Context],
|
|
56
|
+
"@type": DataspaceProtocolCatalogTypes.CatalogRequestMessage
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
responseType: [
|
|
63
|
+
{
|
|
64
|
+
type: "ICatalogRequestResponse",
|
|
65
|
+
examples: [
|
|
66
|
+
{
|
|
67
|
+
id: "catalogRequestResponseExample",
|
|
68
|
+
response: {
|
|
69
|
+
body: {
|
|
70
|
+
"@context": [DataspaceProtocolContexts.Context],
|
|
71
|
+
"@id": "urn:x-catalog:a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2",
|
|
72
|
+
"@type": "Catalog",
|
|
73
|
+
participantId: "did:example:node-identity-123",
|
|
74
|
+
dataset: [
|
|
75
|
+
{
|
|
76
|
+
"@id": "urn:uuid:dataset-123",
|
|
77
|
+
"@type": "Dataset",
|
|
78
|
+
"dcterms:title": "Energy Consumption Data",
|
|
79
|
+
"dcterms:description": "Historical energy consumption data",
|
|
80
|
+
hasPolicy: {
|
|
81
|
+
"@type": PolicyType.Offer,
|
|
82
|
+
uid: "urn:uuid:policy-456",
|
|
83
|
+
assigner: "did:example:data-provider-789"
|
|
84
|
+
},
|
|
85
|
+
distribution: {
|
|
86
|
+
"@id": "urn:uuid:distribution-789",
|
|
87
|
+
"@type": "Distribution",
|
|
88
|
+
format: "application/json",
|
|
89
|
+
accessService: {
|
|
90
|
+
"@id": "urn:uuid:access-service-321",
|
|
91
|
+
"@type": "DataService",
|
|
92
|
+
endpointURL: "https://example.com/data-access"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
const getDatasetRoute = {
|
|
105
|
+
operationId: "getDataset",
|
|
106
|
+
summary: "Retrieve a specific dataset by ID",
|
|
107
|
+
tag: tagsFederatedCatalogue[0].name,
|
|
108
|
+
method: "GET",
|
|
109
|
+
path: `${baseRouteName}/datasets/:datasetId`,
|
|
110
|
+
handler: async (httpRequestContext, request) => getDataset(httpRequestContext, componentName, request),
|
|
111
|
+
requestType: {
|
|
112
|
+
type: "IGetDatasetRequest",
|
|
113
|
+
examples: [
|
|
114
|
+
{
|
|
115
|
+
id: "getDatasetRequestExample",
|
|
116
|
+
request: {
|
|
117
|
+
pathParams: {
|
|
118
|
+
datasetId: "urn:uuid:dataset-123"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
responseType: [
|
|
125
|
+
{
|
|
126
|
+
type: "IGetDatasetResponse",
|
|
127
|
+
examples: [
|
|
128
|
+
{
|
|
129
|
+
id: "getDatasetResponseExample",
|
|
130
|
+
response: {
|
|
131
|
+
body: {
|
|
132
|
+
"@context": DataspaceProtocolContexts.Context,
|
|
133
|
+
"@id": "urn:uuid:dataset-123",
|
|
134
|
+
"@type": DcatClasses.Dataset,
|
|
135
|
+
"dcterms:title": "Energy Consumption Data",
|
|
136
|
+
"dcterms:description": "Historical energy consumption data"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
};
|
|
144
|
+
return [catalogRequestRoute, getDatasetRoute];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Handle the catalog request operation.
|
|
148
|
+
* @param httpRequestContext The request context for the operation.
|
|
149
|
+
* @param componentName The name of the component to use.
|
|
150
|
+
* @param request The request.
|
|
151
|
+
* @returns The response.
|
|
152
|
+
*/
|
|
153
|
+
async function catalogRequest(httpRequestContext, componentName, request) {
|
|
154
|
+
try {
|
|
155
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
156
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
157
|
+
Guards.stringValue(ROUTES_SOURCE, "@type", request.body["@type"]);
|
|
158
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
159
|
+
const component = ComponentFactory.get(componentName);
|
|
160
|
+
const result = await component.query(request.body.filter, request.query?.cursor, Coerce.integer(request.query?.limit));
|
|
161
|
+
const headers = {};
|
|
162
|
+
if (Is.stringValue(result.cursor)) {
|
|
163
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
headers,
|
|
167
|
+
statusCode: transformErrorToStatusCode(result.result),
|
|
168
|
+
body: result.result
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
const catalogError = transformToCatalogError(error);
|
|
173
|
+
return {
|
|
174
|
+
statusCode: transformErrorToStatusCode(catalogError) ?? HttpStatusCode.badRequest,
|
|
175
|
+
body: catalogError
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Handle the get dataset operation.
|
|
181
|
+
* @param httpRequestContext The request context for the operation.
|
|
182
|
+
* @param componentName The name of the component to use.
|
|
183
|
+
* @param request The request.
|
|
184
|
+
* @returns The response.
|
|
185
|
+
*/
|
|
186
|
+
async function getDataset(httpRequestContext, componentName, request) {
|
|
187
|
+
try {
|
|
188
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
189
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
190
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.datasetId", request.pathParams.datasetId);
|
|
191
|
+
const component = ComponentFactory.get(componentName);
|
|
192
|
+
const result = await component.get(request.pathParams.datasetId);
|
|
193
|
+
return {
|
|
194
|
+
statusCode: transformErrorToStatusCode(result),
|
|
195
|
+
body: result
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
const catalogError = transformToCatalogError(error);
|
|
200
|
+
return {
|
|
201
|
+
statusCode: transformErrorToStatusCode(catalogError) ?? HttpStatusCode.badRequest,
|
|
202
|
+
body: catalogError
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=federatedCatalogueRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federatedCatalogueRoutes.js","sourceRoot":"","sources":["../../src/federatedCatalogueRoutes.ts"],"names":[],"m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AM,SAAS,GAAiC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEpF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAEjE,OAAO;YACN,UAAU,EAAE,0BAA0B,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE,MAAM;SACZ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO;YACN,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,IAAI,cAAc,CAAC,UAAU;YACjF,IAAI,EAAE,YAAY;SAClB,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIHostingComponent,\n\tIHttpRequestContext,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { Coerce, ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport type {\n\tICatalogRequestRequest,\n\tICatalogRequestResponse,\n\tIFederatedCatalogueComponent,\n\tIGetDatasetRequest,\n\tIGetDatasetResponse\n} from \"@twin.org/federated-catalogue-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { DcatClasses, type DcatContextType } from \"@twin.org/standards-w3c-dcat\";\nimport { PolicyType } from \"@twin.org/standards-w3c-odrl\";\nimport { HeaderHelper, HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\nimport { transformErrorToStatusCode, transformToCatalogError } from \"./utils/catalogErrorUtils.js\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"federatedCatalogueRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsFederatedCatalogue: ITag[] = [\n\t{\n\t\tname: \"Federated Catalogue\",\n\t\tdescription:\n\t\t\t\"Service providing Dataspace Protocol-compliant catalogue endpoints for dataset discovery and query.\"\n\t}\n];\n\n/**\n * The REST routes for federated catalogue.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesFederatedCatalogue(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst catalogRequestRoute: IRestRoute<ICatalogRequestRequest, ICatalogRequestResponse> = {\n\t\toperationId: \"catalogRequest\",\n\t\tsummary: \"Query the federated catalogue for datasets\",\n\t\ttag: tagsFederatedCatalogue[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/request`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tcatalogRequest(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<ICatalogRequestRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"catalogRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolCatalogTypes.CatalogRequestMessage,\n\t\t\t\t\t\t\tfilter: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"dcterms:title\": \"Energy Consumption Data\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"catalogRequestNoFilterExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolCatalogTypes.CatalogRequestMessage\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICatalogRequestResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"catalogRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@id\":\n\t\t\t\t\t\t\t\t\t\"urn:x-catalog:a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2\",\n\t\t\t\t\t\t\t\t\"@type\": \"Catalog\",\n\t\t\t\t\t\t\t\tparticipantId: \"did:example:node-identity-123\",\n\t\t\t\t\t\t\t\tdataset: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"@id\": \"urn:uuid:dataset-123\",\n\t\t\t\t\t\t\t\t\t\t\"@type\": \"Dataset\",\n\t\t\t\t\t\t\t\t\t\t\"dcterms:title\": \"Energy Consumption Data\",\n\t\t\t\t\t\t\t\t\t\t\"dcterms:description\": \"Historical energy consumption data\",\n\t\t\t\t\t\t\t\t\t\thasPolicy: {\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": PolicyType.Offer,\n\t\t\t\t\t\t\t\t\t\t\tuid: \"urn:uuid:policy-456\",\n\t\t\t\t\t\t\t\t\t\t\tassigner: \"did:example:data-provider-789\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdistribution: {\n\t\t\t\t\t\t\t\t\t\t\t\"@id\": \"urn:uuid:distribution-789\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"Distribution\",\n\t\t\t\t\t\t\t\t\t\t\tformat: \"application/json\",\n\t\t\t\t\t\t\t\t\t\t\taccessService: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"@id\": \"urn:uuid:access-service-321\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"DataService\",\n\t\t\t\t\t\t\t\t\t\t\t\tendpointURL: \"https://example.com/data-access\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst getDatasetRoute: IRestRoute<IGetDatasetRequest, IGetDatasetResponse> = {\n\t\toperationId: \"getDataset\",\n\t\tsummary: \"Retrieve a specific dataset by ID\",\n\t\ttag: tagsFederatedCatalogue[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/datasets/:datasetId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tgetDataset(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IGetDatasetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"getDatasetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tdatasetId: \"urn:uuid:dataset-123\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IGetDatasetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"getDatasetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": DataspaceProtocolContexts.Context as unknown as DcatContextType,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:uuid:dataset-123\",\n\t\t\t\t\t\t\t\t\"@type\": DcatClasses.Dataset,\n\t\t\t\t\t\t\t\t\"dcterms:title\": \"Energy Consumption Data\",\n\t\t\t\t\t\t\t\t\"dcterms:description\": \"Historical energy consumption data\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [catalogRequestRoute, getDatasetRoute];\n}\n\n/**\n * Handle the catalog request operation.\n * @param httpRequestContext The request context for the operation.\n * @param componentName The name of the component to use.\n * @param request The request.\n * @returns The response.\n */\nasync function catalogRequest(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: ICatalogRequestRequest\n): Promise<ICatalogRequestResponse> {\n\ttry {\n\t\tGuards.object<ICatalogRequestRequest>(ROUTES_SOURCE, nameof(request), request);\n\t\tGuards.object(ROUTES_SOURCE, nameof(request.body), request.body);\n\t\tGuards.stringValue(ROUTES_SOURCE, \"@type\", request.body[\"@type\"]);\n\n\t\tconst hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t\t);\n\n\t\tconst component: IFederatedCatalogueComponent = ComponentFactory.get(componentName);\n\n\t\tconst result = await component.query(\n\t\t\trequest.body.filter,\n\t\t\trequest.query?.cursor,\n\t\t\tCoerce.integer(request.query?.limit)\n\t\t);\n\n\t\tconst headers: ICatalogRequestResponse[\"headers\"] = {};\n\n\t\tif (Is.stringValue(result.cursor)) {\n\t\t\theaders[HeaderTypes.Link] = HeaderHelper.createLinkHeader(\n\t\t\t\tawait hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url),\n\t\t\t\t{ cursor: result.cursor },\n\t\t\t\t\"next\"\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\theaders,\n\t\t\tstatusCode: transformErrorToStatusCode(result.result),\n\t\t\tbody: result.result\n\t\t};\n\t} catch (error) {\n\t\tconst catalogError = transformToCatalogError(error);\n\t\treturn {\n\t\t\tstatusCode: transformErrorToStatusCode(catalogError) ?? HttpStatusCode.badRequest,\n\t\t\tbody: catalogError\n\t\t};\n\t}\n}\n\n/**\n * Handle the get dataset operation.\n * @param httpRequestContext The request context for the operation.\n * @param componentName The name of the component to use.\n * @param request The request.\n * @returns The response.\n */\nasync function getDataset(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IGetDatasetRequest\n): Promise<IGetDatasetResponse> {\n\ttry {\n\t\tGuards.object<IGetDatasetRequest>(ROUTES_SOURCE, nameof(request), request);\n\t\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\t\tGuards.stringValue(\n\t\t\tROUTES_SOURCE,\n\t\t\tnameof(request.pathParams.datasetId),\n\t\t\trequest.pathParams.datasetId\n\t\t);\n\n\t\tconst component: IFederatedCatalogueComponent = ComponentFactory.get(componentName);\n\n\t\tconst result = await component.get(request.pathParams.datasetId);\n\n\t\treturn {\n\t\t\tstatusCode: transformErrorToStatusCode(result),\n\t\t\tbody: result\n\t\t};\n\t} catch (error) {\n\t\tconst catalogError = transformToCatalogError(error);\n\t\treturn {\n\t\t\tstatusCode: transformErrorToStatusCode(catalogError) ?? HttpStatusCode.badRequest,\n\t\t\tbody: catalogError\n\t\t};\n\t}\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./entities/dataset.js";
|
|
4
|
+
export * from "./federatedCatalogueRoutes.js";
|
|
5
|
+
export * from "./models/IFederatedCatalogueServiceConstructorOptions.js";
|
|
6
|
+
export * from "./restEntryPoints.js";
|
|
7
|
+
export * from "./schema.js";
|
|
8
|
+
export * from "./services/federatedCatalogueService.js";
|
|
9
|
+
export * from "./utils/catalogErrorUtils.js";
|
|
10
|
+
export * from "./utils/datasetConverters.js";
|
|
11
|
+
//# 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,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0DAA0D,CAAC;AACzE,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,yCAAyC,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entities/dataset.js\";\nexport * from \"./federatedCatalogueRoutes.js\";\nexport * from \"./models/IFederatedCatalogueServiceConstructorOptions.js\";\nexport * from \"./restEntryPoints.js\";\nexport * from \"./schema.js\";\nexport * from \"./services/federatedCatalogueService.js\";\nexport * from \"./utils/catalogErrorUtils.js\";\nexport * from \"./utils/datasetConverters.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFederatedCatalogueServiceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IFederatedCatalogueServiceConstructorOptions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Options for the FederatedCatalogueService constructor.\n */\nexport interface IFederatedCatalogueServiceConstructorOptions {\n\t/**\n\t * The type of the entity storage connector for datasets.\n\t */\n\tdatasetStorageConnectorType?: string;\n\n\t/**\n\t * The logging component for the service.\n\t */\n\tloggingComponentType?: string;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { generateRestRoutesFederatedCatalogue, tagsFederatedCatalogue } from "./federatedCatalogueRoutes.js";
|
|
2
|
+
export const restEntryPoints = [
|
|
3
|
+
{
|
|
4
|
+
name: "federated-catalogue",
|
|
5
|
+
defaultBaseRoute: "catalog",
|
|
6
|
+
tags: tagsFederatedCatalogue,
|
|
7
|
+
generateRoutes: generateRestRoutesFederatedCatalogue
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=restEntryPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,oCAAoC,EACpC,sBAAsB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,qBAAqB;QAC3B,gBAAgB,EAAE,SAAS;QAC3B,IAAI,EAAE,sBAAsB;QAC5B,cAAc,EAAE,oCAAoC;KACpD;CACD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport {\n\tgenerateRestRoutesFederatedCatalogue,\n\ttagsFederatedCatalogue\n} from \"./federatedCatalogueRoutes.js\";\n\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"federated-catalogue\",\n\t\tdefaultBaseRoute: \"catalog\",\n\t\ttags: tagsFederatedCatalogue,\n\t\tgenerateRoutes: generateRestRoutesFederatedCatalogue\n\t}\n];\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { EntitySchemaFactory, EntitySchemaHelper } from "@twin.org/entity";
|
|
4
|
+
import { Dataset } from "./entities/dataset.js";
|
|
5
|
+
/**
|
|
6
|
+
* Initialize the schema for the federated catalogue entity storage.
|
|
7
|
+
*/
|
|
8
|
+
export function initSchema() {
|
|
9
|
+
EntitySchemaFactory.register("Dataset", () => EntitySchemaHelper.getSchema(Dataset));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,mBAAmB,CAAC,QAAQ,YAAoB,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EntitySchemaFactory, EntitySchemaHelper } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { Dataset } from \"./entities/dataset.js\";\n\n/**\n * Initialize the schema for the federated catalogue entity storage.\n */\nexport function initSchema(): void {\n\tEntitySchemaFactory.register(nameof<Dataset>(), () => EntitySchemaHelper.getSchema(Dataset));\n}\n"]}
|