@lde/dataset-registry-client 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +34 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +24 -6
- package/dist/schema.d.ts +34 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +35 -2
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -8,13 +8,42 @@ export declare class Client {
|
|
|
8
8
|
readonly title: {
|
|
9
9
|
readonly '@id': "dcterms:title";
|
|
10
10
|
readonly '@multilang': true;
|
|
11
|
-
readonly '@optional': true;
|
|
12
11
|
};
|
|
13
12
|
readonly description: {
|
|
14
13
|
readonly '@id': "dcterms:description";
|
|
14
|
+
readonly '@optional': true;
|
|
15
15
|
readonly '@multilang': true;
|
|
16
|
+
};
|
|
17
|
+
readonly language: {
|
|
18
|
+
readonly '@id': "dcterms:language";
|
|
19
|
+
readonly '@optional': true;
|
|
20
|
+
readonly '@array': true;
|
|
21
|
+
};
|
|
22
|
+
readonly license: {
|
|
23
|
+
readonly '@id': "dcterms:license";
|
|
16
24
|
readonly '@optional': true;
|
|
17
25
|
};
|
|
26
|
+
readonly creator: {
|
|
27
|
+
readonly '@id': "dcterms:creator";
|
|
28
|
+
readonly '@optional': true;
|
|
29
|
+
readonly '@array': true;
|
|
30
|
+
readonly '@schema': {
|
|
31
|
+
readonly name: {
|
|
32
|
+
readonly '@id': "foaf:name";
|
|
33
|
+
readonly '@multilang': true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly publisher: {
|
|
38
|
+
readonly '@id': "dcterms:publisher";
|
|
39
|
+
readonly '@optional': true;
|
|
40
|
+
readonly '@schema': {
|
|
41
|
+
readonly name: {
|
|
42
|
+
readonly '@id': "foaf:name";
|
|
43
|
+
readonly '@multilang': true;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
18
47
|
readonly distribution: {
|
|
19
48
|
readonly '@id': "dcat:distribution";
|
|
20
49
|
readonly '@array': true;
|
|
@@ -27,6 +56,10 @@ export declare class Client {
|
|
|
27
56
|
readonly '@type': "xsd:nonNegativeInteger";
|
|
28
57
|
readonly '@optional': true;
|
|
29
58
|
};
|
|
59
|
+
readonly conformsTo: {
|
|
60
|
+
readonly '@id': "dcterms:conformsTo";
|
|
61
|
+
readonly '@optional': true;
|
|
62
|
+
};
|
|
30
63
|
readonly modified: {
|
|
31
64
|
readonly '@id': "dcterms:modified";
|
|
32
65
|
readonly '@type': "xsd:dateTime";
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,GAAG,EACnB,MAAM
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,GAAG,EACnB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAgB;IAGlC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACpD,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CAuElE"}
|
package/dist/client.js
CHANGED
|
@@ -36,17 +36,35 @@ export class Client {
|
|
|
36
36
|
let items;
|
|
37
37
|
if (typeof args === 'string') {
|
|
38
38
|
// Custom query has no paginated results.
|
|
39
|
+
// TODO: we could add a convention here like {OFFSET} {LIMIT} in the query string.
|
|
39
40
|
items = await datasets.query(prepareQuery(args));
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
43
|
items = await datasets.find({ ...args, take: limit, skip: offset });
|
|
43
44
|
}
|
|
44
|
-
return items.map((dataset) => new Dataset(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
return items.map((dataset) => new Dataset({
|
|
46
|
+
iri: new URL(dataset.$id),
|
|
47
|
+
title: dataset.title,
|
|
48
|
+
description: dataset.description,
|
|
49
|
+
language: dataset.language,
|
|
50
|
+
license: dataset.license ? new URL(dataset.license) : undefined,
|
|
51
|
+
distributions: dataset.distribution.map((d) => {
|
|
52
|
+
const distribution = new Distribution(new URL(d.accessURL), d.mediaType, d.conformsTo ? new URL(d.conformsTo) : undefined);
|
|
53
|
+
distribution.byteSize = d.byteSize ?? undefined;
|
|
54
|
+
distribution.lastModified = d.modified ?? undefined;
|
|
55
|
+
return distribution;
|
|
56
|
+
}),
|
|
57
|
+
creator: dataset.creator.map((creator) => ({
|
|
58
|
+
iri: new URL(creator.$id),
|
|
59
|
+
name: creator.name,
|
|
60
|
+
})),
|
|
61
|
+
publisher: dataset.publisher
|
|
62
|
+
? {
|
|
63
|
+
iri: new URL(dataset.publisher.$id),
|
|
64
|
+
name: dataset.publisher.name,
|
|
65
|
+
}
|
|
66
|
+
: undefined,
|
|
67
|
+
}));
|
|
50
68
|
}, total, pageSize);
|
|
51
69
|
}
|
|
52
70
|
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -3,13 +3,42 @@ export declare const DatasetSchema: {
|
|
|
3
3
|
readonly title: {
|
|
4
4
|
readonly '@id': "dcterms:title";
|
|
5
5
|
readonly '@multilang': true;
|
|
6
|
-
readonly '@optional': true;
|
|
7
6
|
};
|
|
8
7
|
readonly description: {
|
|
9
8
|
readonly '@id': "dcterms:description";
|
|
9
|
+
readonly '@optional': true;
|
|
10
10
|
readonly '@multilang': true;
|
|
11
|
+
};
|
|
12
|
+
readonly language: {
|
|
13
|
+
readonly '@id': "dcterms:language";
|
|
14
|
+
readonly '@optional': true;
|
|
15
|
+
readonly '@array': true;
|
|
16
|
+
};
|
|
17
|
+
readonly license: {
|
|
18
|
+
readonly '@id': "dcterms:license";
|
|
11
19
|
readonly '@optional': true;
|
|
12
20
|
};
|
|
21
|
+
readonly creator: {
|
|
22
|
+
readonly '@id': "dcterms:creator";
|
|
23
|
+
readonly '@optional': true;
|
|
24
|
+
readonly '@array': true;
|
|
25
|
+
readonly '@schema': {
|
|
26
|
+
readonly name: {
|
|
27
|
+
readonly '@id': "foaf:name";
|
|
28
|
+
readonly '@multilang': true;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly publisher: {
|
|
33
|
+
readonly '@id': "dcterms:publisher";
|
|
34
|
+
readonly '@optional': true;
|
|
35
|
+
readonly '@schema': {
|
|
36
|
+
readonly name: {
|
|
37
|
+
readonly '@id': "foaf:name";
|
|
38
|
+
readonly '@multilang': true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
13
42
|
readonly distribution: {
|
|
14
43
|
readonly '@id': "dcat:distribution";
|
|
15
44
|
readonly '@array': true;
|
|
@@ -22,6 +51,10 @@ export declare const DatasetSchema: {
|
|
|
22
51
|
readonly '@type': "xsd:nonNegativeInteger";
|
|
23
52
|
readonly '@optional': true;
|
|
24
53
|
};
|
|
54
|
+
readonly conformsTo: {
|
|
55
|
+
readonly '@id': "dcterms:conformsTo";
|
|
56
|
+
readonly '@optional': true;
|
|
57
|
+
};
|
|
25
58
|
readonly modified: {
|
|
26
59
|
readonly '@id': "dcterms:modified";
|
|
27
60
|
readonly '@type': "xsd:dateTime";
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEhB,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
|
-
import { dcterms, xsd } from 'ldkit/namespaces';
|
|
1
|
+
import { dcterms, foaf, xsd } from 'ldkit/namespaces';
|
|
2
2
|
import { dcat } from './dcat.js';
|
|
3
3
|
export const DatasetSchema = {
|
|
4
4
|
'@type': dcat.Dataset,
|
|
5
5
|
title: {
|
|
6
6
|
'@id': dcterms.title,
|
|
7
7
|
'@multilang': true,
|
|
8
|
-
'@optional': true,
|
|
9
8
|
},
|
|
10
9
|
description: {
|
|
11
10
|
'@id': dcterms.description,
|
|
11
|
+
'@optional': true, // But required in DCAT-AP 3.0
|
|
12
12
|
'@multilang': true,
|
|
13
|
+
},
|
|
14
|
+
language: {
|
|
15
|
+
'@id': dcterms.language,
|
|
16
|
+
'@optional': true,
|
|
17
|
+
'@array': true,
|
|
18
|
+
},
|
|
19
|
+
license: {
|
|
20
|
+
'@id': dcterms.license,
|
|
13
21
|
'@optional': true,
|
|
14
22
|
},
|
|
23
|
+
creator: {
|
|
24
|
+
'@id': dcterms.creator,
|
|
25
|
+
'@optional': true, // But required in DCAT-AP 3.0
|
|
26
|
+
'@array': true,
|
|
27
|
+
'@schema': {
|
|
28
|
+
name: {
|
|
29
|
+
'@id': foaf.name,
|
|
30
|
+
'@multilang': true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
publisher: {
|
|
35
|
+
'@id': dcterms.publisher,
|
|
36
|
+
'@optional': true,
|
|
37
|
+
'@schema': {
|
|
38
|
+
name: {
|
|
39
|
+
'@id': foaf.name,
|
|
40
|
+
'@multilang': true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
15
44
|
distribution: {
|
|
16
45
|
'@id': dcat.distribution,
|
|
17
46
|
'@array': true,
|
|
@@ -24,6 +53,10 @@ export const DatasetSchema = {
|
|
|
24
53
|
'@type': xsd.nonNegativeInteger,
|
|
25
54
|
'@optional': true,
|
|
26
55
|
},
|
|
56
|
+
conformsTo: {
|
|
57
|
+
'@id': dcterms.conformsTo,
|
|
58
|
+
'@optional': true,
|
|
59
|
+
},
|
|
27
60
|
modified: {
|
|
28
61
|
'@id': dcterms.modified,
|
|
29
62
|
'@type': xsd.dateTime,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/dataset-registry-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"!**/*.tsbuildinfo"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lde/dataset": "0.
|
|
23
|
-
"ldkit": "^2.
|
|
22
|
+
"@lde/dataset": "0.3.0",
|
|
23
|
+
"ldkit": "^2.5.0",
|
|
24
24
|
"n3": "^1.26.0",
|
|
25
25
|
"sparqljs": "^3.7.3",
|
|
26
26
|
"tslib": "^2.3.0"
|