fairspec-extension 0.1.1 → 0.2.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.
- package/index.ts +9 -5
- package/models/dataset.ts +23 -23
- package/models/table1.ts +12 -37
- package/models/table2.ts +12 -37
- package/package.json +3 -2
package/index.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as standard from "@fairspec/metadata"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
import * as extension from "./models/dataset.ts"
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
export type Dataset = standard.Dataset & extension.Dataset
|
|
5
|
+
export * from "./models/index.ts"
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const Dataset = z.intersection(standard.Dataset, extension.Dataset)
|
|
8
|
+
export const Resource = z.intersection(standard.Resource, extension.Resource)
|
|
9
|
+
|
|
10
|
+
export type Dataset = z.infer<typeof Dataset>
|
|
11
|
+
export type Resource = z.infer<typeof Resource>
|
package/models/dataset.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
|
|
4
|
+
export const Table1Resource = z.object({
|
|
5
|
+
name: z.literal("table1"),
|
|
6
|
+
Table: z.literal("https://fairspec.github.io/fairspec-extension/schemas/0.2.1/table1.json")
|
|
7
|
+
});
|
|
5
8
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
name: "table2"
|
|
25
|
-
tableSchema: "https://fairspec.github.io/schemas/0.1.1/table2.json"
|
|
26
|
-
}
|
|
9
|
+
export const Table2Resource = z.object({
|
|
10
|
+
name: z.literal("table2"),
|
|
11
|
+
Table: z.literal("https://fairspec.github.io/fairspec-extension/schemas/0.2.1/table2.json")
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const Resource = z.union([Table1Resource, Table2Resource]);
|
|
15
|
+
|
|
16
|
+
export const Dataset = z.object({
|
|
17
|
+
$schema: z.literal("https://fairspec.github.io/fairspec-extension/profiles/0.2.1/dataset.json"),
|
|
18
|
+
resources: z.tuple([Resource]).rest(Resource)
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const FairspecExtensionProfile = Dataset;
|
|
22
|
+
export type Table1Resource = z.infer<typeof Table1Resource>
|
|
23
|
+
export type Table2Resource = z.infer<typeof Table2Resource>
|
|
24
|
+
export type Resource = z.infer<typeof Resource>
|
|
25
|
+
export type Dataset = z.infer<typeof Dataset>
|
|
26
|
+
export type FairspecExtensionProfile = z.infer<typeof FairspecExtensionProfile>
|
package/models/table1.ts
CHANGED
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
name: string
|
|
15
|
-
/**
|
|
16
|
-
* Current status of the entity
|
|
17
|
-
*/
|
|
18
|
-
status: "active" | "inactive" | "pending"
|
|
19
|
-
/**
|
|
20
|
-
* Numeric value associated with the entity
|
|
21
|
-
*/
|
|
22
|
-
value: number
|
|
23
|
-
/**
|
|
24
|
-
* Count of items
|
|
25
|
-
*/
|
|
26
|
-
itemCount?: number
|
|
27
|
-
/**
|
|
28
|
-
* Whether the entity has been verified
|
|
29
|
-
*/
|
|
30
|
-
isVerified: boolean
|
|
31
|
-
/**
|
|
32
|
-
* Date when the entity was created
|
|
33
|
-
*/
|
|
34
|
-
createdDate: string
|
|
35
|
-
/**
|
|
36
|
-
* Optional description of the entity
|
|
37
|
-
*/
|
|
38
|
-
description?: string
|
|
39
|
-
}
|
|
4
|
+
export const Table1 = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
status: z.union([z.literal("active"), z.literal("inactive"), z.literal("pending")]),
|
|
8
|
+
value: z.number(),
|
|
9
|
+
itemCount: z.number().optional(),
|
|
10
|
+
isVerified: z.boolean(),
|
|
11
|
+
createdDate: z.string(),
|
|
12
|
+
description: z.string().optional()
|
|
13
|
+
});
|
|
14
|
+
export type Table1 = z.infer<typeof Table1>
|
package/models/table2.ts
CHANGED
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
table1Id?: string
|
|
15
|
-
/**
|
|
16
|
-
* Title or name of the item
|
|
17
|
-
*/
|
|
18
|
-
title: string
|
|
19
|
-
/**
|
|
20
|
-
* Monetary or numeric amount
|
|
21
|
-
*/
|
|
22
|
-
amount: number
|
|
23
|
-
/**
|
|
24
|
-
* Priority level of the item
|
|
25
|
-
*/
|
|
26
|
-
priority: "low" | "medium" | "high"
|
|
27
|
-
/**
|
|
28
|
-
* Percentage value between 0 and 100
|
|
29
|
-
*/
|
|
30
|
-
percentage?: number
|
|
31
|
-
/**
|
|
32
|
-
* Additional notes or comments
|
|
33
|
-
*/
|
|
34
|
-
notes?: string
|
|
35
|
-
/**
|
|
36
|
-
* Whether the item is currently active
|
|
37
|
-
*/
|
|
38
|
-
isActive: boolean
|
|
39
|
-
}
|
|
4
|
+
export const Table2 = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
table1Id: z.string().optional(),
|
|
7
|
+
title: z.string(),
|
|
8
|
+
amount: z.number(),
|
|
9
|
+
priority: z.union([z.literal("low"), z.literal("medium"), z.literal("high")]),
|
|
10
|
+
percentage: z.number().optional(),
|
|
11
|
+
notes: z.string().optional(),
|
|
12
|
+
isActive: z.boolean()
|
|
13
|
+
});
|
|
14
|
+
export type Table2 = z.infer<typeof Table2>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairspec-extension",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"slug": "fairspec-extension",
|
|
6
6
|
"title": "Fairspec Extension",
|
|
7
7
|
"description": "Fairspec Extension is a Git repository template for rapid Fairspec extension development",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"author": "Evgeny Karev",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@fairspec/metadata": "^0.2.2"
|
|
13
|
+
"@fairspec/metadata": "^0.2.2",
|
|
14
|
+
"zod": "^4.3.5"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc",
|