@data-fair/catalog-data-fair 0.2.2 → 0.2.3
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/index.ts +1 -1
- package/lib/download.ts +2 -0
- package/lib/imports.ts +3 -3
- package/package.json +2 -2
- package/types/datafairSchemas/.type/index.d.ts +9 -0
- package/types/datafairSchemas/schema.json +16 -0
package/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ const plugin: CatalogPlugin<DataFairConfig, DataFairCapabilities> = {
|
|
|
12
12
|
return prepare(context)
|
|
13
13
|
},
|
|
14
14
|
|
|
15
|
-
async
|
|
15
|
+
async list (context) {
|
|
16
16
|
const { listResources } = await import('./lib/imports.ts')
|
|
17
17
|
return listResources(context)
|
|
18
18
|
},
|
package/lib/download.ts
CHANGED
|
@@ -71,6 +71,8 @@ const getMetaData = async ({ catalogConfig, resourceId, log, secrets }: GetResou
|
|
|
71
71
|
frequency: dataset.frequency,
|
|
72
72
|
image: dataset.image,
|
|
73
73
|
keywords: dataset.keywords,
|
|
74
|
+
analysis: dataset.analysis,
|
|
75
|
+
projection: dataset.projection,
|
|
74
76
|
size,
|
|
75
77
|
schema: dataset.schema,
|
|
76
78
|
filePath: '',
|
package/lib/imports.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DataFairCatalog, DataFairDataset, DataFairConfig } from '#types'
|
|
2
2
|
import axios from '@data-fair/lib-node/axios.js'
|
|
3
|
-
import type { CatalogPlugin,
|
|
3
|
+
import type { CatalogPlugin, ListContext } from '@data-fair/types-catalogs'
|
|
4
4
|
import type { DataFairCapabilities } from './capabilities.ts'
|
|
5
5
|
|
|
6
|
-
type ResourceList = Awaited<ReturnType<CatalogPlugin['
|
|
6
|
+
type ResourceList = Awaited<ReturnType<CatalogPlugin['list']>>['results']
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param dataFairDataset the dataset to transform
|
|
@@ -35,7 +35,7 @@ const prepareCatalog = (dataFairDatasets: DataFairDataset[]): ResourceList => {
|
|
|
35
35
|
* @param config the Data Fair configuration
|
|
36
36
|
* @returns the list of Resources available on this catalog
|
|
37
37
|
*/
|
|
38
|
-
export const listResources = async (config:
|
|
38
|
+
export const listResources = async (config: ListContext<DataFairConfig, DataFairCapabilities>): ReturnType<CatalogPlugin<DataFairConfig>['list']> => {
|
|
39
39
|
const dataFairParams: Record<string, any> = { sort: 'title' }
|
|
40
40
|
if (config.params?.q) dataFairParams.q = config.params.q
|
|
41
41
|
if (config.params?.size) dataFairParams.size = config.params.size
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/catalog-data-fair",
|
|
3
3
|
"description": "A simple Data Fair plugin for the Data Fair catalogs service.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@commitlint/cli": "^19.8.0",
|
|
39
39
|
"@commitlint/config-conventional": "^19.8.0",
|
|
40
40
|
"@data-fair/lib-types-builder": "^1.8.0",
|
|
41
|
-
"@data-fair/types-catalogs": "^0.
|
|
41
|
+
"@data-fair/types-catalogs": "^0.5.1",
|
|
42
42
|
"@types/nock": "^10.0.3",
|
|
43
43
|
"chalk": "^5.4.1",
|
|
44
44
|
"dayjs": "^1.11.13",
|
|
@@ -101,6 +101,15 @@ export type DataFairDataset = {
|
|
|
101
101
|
| "daily"
|
|
102
102
|
| "continuous"
|
|
103
103
|
| "irregular";
|
|
104
|
+
analysis?: {
|
|
105
|
+
escapeKeyAlgorithm?: "compat-ods";
|
|
106
|
+
[k: string]: unknown;
|
|
107
|
+
};
|
|
108
|
+
projection?: {
|
|
109
|
+
code?: string;
|
|
110
|
+
title?: string;
|
|
111
|
+
[k: string]: unknown;
|
|
112
|
+
};
|
|
104
113
|
file?: {
|
|
105
114
|
/**
|
|
106
115
|
* Size of the file on disk
|
|
@@ -81,6 +81,22 @@
|
|
|
81
81
|
"irregular"
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
+
"analysis": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"escapeKeyAlgorithm": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"enum": ["compat-ods"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"projection": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"properties": {
|
|
96
|
+
"code": { "type": "string" },
|
|
97
|
+
"title": { "type": "string" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
84
100
|
"file": {
|
|
85
101
|
"type": "object",
|
|
86
102
|
"required": [
|