@lindas/trifid-plugin-ckan 7.0.1 → 7.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lindas/trifid-plugin-ckan",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "Endpoint for opendata.swiss CKAN harvester",
5
5
  "main": "src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -38,16 +38,17 @@
38
38
  "ckan"
39
39
  ],
40
40
  "dependencies": {
41
+ "@lindas/clownface": "^2.0.4",
42
+ "@lindas/env": "^3.0.1",
43
+ "@lindas/prefixes": "^2.4.0",
44
+ "@lindas/trifid-core": "^7.0.2",
41
45
  "@tpluscode/rdf-string": "^1.3.3",
42
- "@zazuko/env": "^3.0.1",
43
- "@zazuko/prefixes": "^2.4.0",
44
46
  "is-graph-pointer": "^2.2.0",
45
47
  "sparql-http-client": "^3.0.1",
46
- "xmlbuilder2": "^3.1.1"
48
+ "xmlbuilder2": "^4.0.3"
47
49
  },
48
50
  "devDependencies": {
49
- "@lindas/trifid-core": "^7.0.0",
50
- "@lindas/trifid-handler-fetch": "^7.0.0",
51
+ "@lindas/trifid-handler-fetch": "^7.0.2",
51
52
  "@types/node": "^24.7.0",
52
53
  "c8": "^10.1.3",
53
54
  "chai": "^6.2.0",
@@ -58,7 +59,6 @@
58
59
  "xml2js-xpath": "^0.13.0"
59
60
  },
60
61
  "publishConfig": {
61
- "access": "public",
62
- "provenance": false
62
+ "access": "public"
63
63
  }
64
64
  }
package/src/ckan.js CHANGED
@@ -1,47 +1,51 @@
1
- // @ts-check
2
-
3
- import ParsingClient from 'sparql-http-client/ParsingClient.js'
4
- import { toXML } from './xml.js'
5
- import { datasetsQuery } from './query.js'
6
-
7
- /**
8
- * API Configuration.
9
- *
10
- * @typedef {Object} APIConfig
11
- * @property {string} endpointUrl The SPARQL endpoint URL.
12
- * @property {string} user The user for the endpoint.
13
- * @property {string} password The password for the endpoint.
14
- */
15
-
16
- /**
17
- * Fetch datasets.
18
- *
19
- * @typedef {(organizationId: import('@rdfjs/types').NamedNode<string>) => Promise<import('@rdfjs/types').DatasetCore<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad>>} FetchDatasets
20
- */
21
-
22
- /**
23
- * Create CKAN API.
24
- *
25
- * @param {APIConfig} config API configuration.
26
- * @returns {{ fetchDatasets: FetchDatasets, toXML: (dataset: import('@rdfjs/types').DatasetCore<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad>) => string}}
27
- */
28
- export const createAPI = (config) => {
29
- const client = new ParsingClient({
30
- endpointUrl: config.endpointUrl,
31
- user: config.user,
32
- password: config.password,
33
- })
34
-
35
- /**
36
- * @type {FetchDatasets}
37
- */
38
- const fetchDatasets = async (organizationId) => {
39
- const query = datasetsQuery(organizationId)
40
- return await client.query.construct(query.toString())
41
- }
42
-
43
- return {
44
- fetchDatasets,
45
- toXML,
46
- }
47
- }
1
+ // @ts-check
2
+
3
+ import ParsingClient from 'sparql-http-client/ParsingClient.js'
4
+ import { nodeCompatibleFetch } from '@lindas/trifid-core'
5
+ import { toXML } from './xml.js'
6
+ import { datasetsQuery } from './query.js'
7
+
8
+ /**
9
+ * API Configuration.
10
+ *
11
+ * @typedef {Object} APIConfig
12
+ * @property {string} endpointUrl The SPARQL endpoint URL.
13
+ * @property {string} user The user for the endpoint.
14
+ * @property {string} password The password for the endpoint.
15
+ */
16
+
17
+ /**
18
+ * Fetch datasets.
19
+ *
20
+ * @typedef {(organizationId: import('@rdfjs/types').NamedNode<string>) => Promise<import('@rdfjs/types').DatasetCore<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad>>} FetchDatasets
21
+ */
22
+
23
+ /**
24
+ * Create CKAN API.
25
+ *
26
+ * @param {APIConfig} config API configuration.
27
+ * @returns {{ fetchDatasets: FetchDatasets, toXML: (dataset: import('@rdfjs/types').DatasetCore<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad>) => string}}
28
+ */
29
+ export const createAPI = (config) => {
30
+ const client = new ParsingClient({
31
+ endpointUrl: config.endpointUrl,
32
+ user: config.user,
33
+ password: config.password,
34
+ // Use native fetch wrapper for proper brotli/gzip decompression support
35
+ // (node-fetch has brotli bugs that cause "Decompression failed" errors)
36
+ fetch: nodeCompatibleFetch,
37
+ })
38
+
39
+ /**
40
+ * @type {FetchDatasets}
41
+ */
42
+ const fetchDatasets = async (organizationId) => {
43
+ const query = datasetsQuery(organizationId)
44
+ return await client.query.construct(query.toString())
45
+ }
46
+
47
+ return {
48
+ fetchDatasets,
49
+ toXML,
50
+ }
51
+ }
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- import rdf from '@zazuko/env'
3
+ import rdf from '@lindas/env'
4
4
  import { createAPI } from './ckan.js'
5
5
 
6
6
  /** @type {import('../../core/types/index.js').TrifidPlugin} */
package/src/query.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
 
3
3
  import { sparql } from '@tpluscode/rdf-string'
4
- import rdf from '@zazuko/env'
4
+ import rdf from '@lindas/env'
5
5
 
6
6
  /**
7
7
  * Query to retrieve all datasets for a given organization.