fairspec-extension 0.1.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/.user/example.ts +58 -0
- package/LICENSE.md +9 -0
- package/README.md +3 -0
- package/build/index.d.ts +7 -0
- package/build/index.js +2 -0
- package/build/profile.d.ts +23 -0
- package/build/profile.js +8 -0
- package/build/schemas/car.d.ts +9 -0
- package/build/schemas/car.js +8 -0
- package/build/schemas/index.d.ts +1 -0
- package/build/schemas/index.js +2 -0
- package/index.ts +7 -0
- package/models/dataset.ts +26 -0
- package/models/index.ts +3 -0
- package/models/table1.ts +39 -0
- package/models/table2.ts +39 -0
- package/package.json +19 -0
- package/tsconfig.json +3 -0
package/.user/example.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Car, Dealer, Package } from "./index.ts"
|
|
2
|
+
|
|
3
|
+
// Create dealer information
|
|
4
|
+
const dealer: Dealer = {
|
|
5
|
+
title: "Premium Auto Sales",
|
|
6
|
+
country: "United States",
|
|
7
|
+
region: "California",
|
|
8
|
+
city: "Los Angeles",
|
|
9
|
+
address: "1234 Sunset Boulevard",
|
|
10
|
+
postcode: "90028",
|
|
11
|
+
phone: "+1-323-555-0100",
|
|
12
|
+
email: "sales@premiumauto.com",
|
|
13
|
+
url: "https://www.premiumauto.com",
|
|
14
|
+
lat: 34.0983,
|
|
15
|
+
lon: -118.3267,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Create car listings
|
|
19
|
+
const car: Car = {
|
|
20
|
+
title: "2023 Tesla Model 3 Long Range",
|
|
21
|
+
url: "https://www.premiumauto.com/cars/tesla-model-3-2023",
|
|
22
|
+
price: 45990,
|
|
23
|
+
currency: "USD",
|
|
24
|
+
year: 2023,
|
|
25
|
+
mileage: 12000,
|
|
26
|
+
brand: "Tesla",
|
|
27
|
+
model: "Model 3",
|
|
28
|
+
version: "Long Range AWD",
|
|
29
|
+
fuel: "electric",
|
|
30
|
+
gearbox: "auto",
|
|
31
|
+
category: "saloon",
|
|
32
|
+
color: "white",
|
|
33
|
+
door: "fourfive",
|
|
34
|
+
power: 346,
|
|
35
|
+
seats: 5,
|
|
36
|
+
range: 358,
|
|
37
|
+
battery: 75,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Create the package
|
|
41
|
+
const dataPackage: Package = {
|
|
42
|
+
resources: [
|
|
43
|
+
{
|
|
44
|
+
name: "car",
|
|
45
|
+
data: [car],
|
|
46
|
+
schema:
|
|
47
|
+
"https://raw.githubusercontent.com/datisthq/cardealerdp/v0.2.2/extension/schemas/car.json",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "dealer",
|
|
51
|
+
data: [dealer],
|
|
52
|
+
schema:
|
|
53
|
+
"https://raw.githubusercontent.com/datisthq/cardealerdp/v0.2.2/extension/schemas/dealer.json",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(dataPackage)
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2026 Evgeny Karev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as standard from "@dpkit/core";
|
|
2
|
+
import type * as extension from "./profile.ts";
|
|
3
|
+
export type Package = standard.Package & extension.Package;
|
|
4
|
+
export type Resource = standard.Resource & extension.Resource;
|
|
5
|
+
export type Schema = extension.Schema;
|
|
6
|
+
export type Dialect = standard.Dialect;
|
|
7
|
+
export type * from "./schemas/index.ts";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgKiBhcyBzdGFuZGFyZCBmcm9tIFwiQGRwa2l0L2NvcmVcIlxuaW1wb3J0IHR5cGUgKiBhcyBleHRlbnNpb24gZnJvbSBcIi4vcHJvZmlsZS50c1wiXG5cbmV4cG9ydCB0eXBlIFBhY2thZ2UgPSBzdGFuZGFyZC5QYWNrYWdlICYgZXh0ZW5zaW9uLlBhY2thZ2VcbmV4cG9ydCB0eXBlIFJlc291cmNlID0gc3RhbmRhcmQuUmVzb3VyY2UgJiBleHRlbnNpb24uUmVzb3VyY2VcbmV4cG9ydCB0eXBlIFNjaGVtYSA9IGV4dGVuc2lvbi5TY2hlbWFcbmV4cG9ydCB0eXBlIERpYWxlY3QgPSBzdGFuZGFyZC5EaWFsZWN0XG5cbmV4cG9ydCB0eXBlICogZnJvbSBcIi4vc2NoZW1hcy9pbmRleC50c1wiXG4iXX0=
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export type CarDealerDataPackageProfile = Package;
|
|
7
|
+
export type Schema = "https://raw.githubusercontent.com/datisthq/cardealerdp/v0.1.0/schemas/car.json";
|
|
8
|
+
export interface Package {
|
|
9
|
+
dealer: Dealer;
|
|
10
|
+
/**
|
|
11
|
+
* @minItems 1
|
|
12
|
+
* @maxItems 1
|
|
13
|
+
*/
|
|
14
|
+
resources: [Resource];
|
|
15
|
+
}
|
|
16
|
+
export interface Dealer {
|
|
17
|
+
title: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Resource {
|
|
21
|
+
name: "car";
|
|
22
|
+
schema: Schema;
|
|
23
|
+
}
|
package/build/profile.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3Byb2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCOzs7O0dBSUciLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSAqL1xuLyoqXG4gKiBUaGlzIGZpbGUgd2FzIGF1dG9tYXRpY2FsbHkgZ2VuZXJhdGVkIGJ5IGpzb24tc2NoZW1hLXRvLXR5cGVzY3JpcHQuXG4gKiBETyBOT1QgTU9ESUZZIElUIEJZIEhBTkQuIEluc3RlYWQsIG1vZGlmeSB0aGUgc291cmNlIEpTT05TY2hlbWEgZmlsZSxcbiAqIGFuZCBydW4ganNvbi1zY2hlbWEtdG8tdHlwZXNjcmlwdCB0byByZWdlbmVyYXRlIHRoaXMgZmlsZS5cbiAqL1xuXG5leHBvcnQgdHlwZSBDYXJEZWFsZXJEYXRhUGFja2FnZVByb2ZpbGUgPSBQYWNrYWdlO1xuZXhwb3J0IHR5cGUgU2NoZW1hID0gXCJodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vZGF0aXN0aHEvY2FyZGVhbGVyZHAvdjAuMS4wL3NjaGVtYXMvY2FyLmpzb25cIjtcblxuZXhwb3J0IGludGVyZmFjZSBQYWNrYWdlIHtcbiAgZGVhbGVyOiBEZWFsZXI7XG4gIC8qKlxuICAgKiBAbWluSXRlbXMgMVxuICAgKiBAbWF4SXRlbXMgMVxuICAgKi9cbiAgcmVzb3VyY2VzOiBbUmVzb3VyY2VdO1xufVxuZXhwb3J0IGludGVyZmFjZSBEZWFsZXIge1xuICB0aXRsZTogc3RyaW5nO1xuICB1cmw/OiBzdHJpbmc7XG59XG5leHBvcnQgaW50ZXJmYWNlIFJlc291cmNlIHtcbiAgbmFtZTogXCJjYXJcIjtcbiAgc2NoZW1hOiBTY2hlbWE7XG59XG4iXX0=
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export interface Car {
|
|
7
|
+
name?: string;
|
|
8
|
+
price?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc2NoZW1hcy9jYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCOzs7O0dBSUciLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSAqL1xuLyoqXG4gKiBUaGlzIGZpbGUgd2FzIGF1dG9tYXRpY2FsbHkgZ2VuZXJhdGVkIGJ5IGpzb24tc2NoZW1hLXRvLXR5cGVzY3JpcHQuXG4gKiBETyBOT1QgTU9ESUZZIElUIEJZIEhBTkQuIEluc3RlYWQsIG1vZGlmeSB0aGUgc291cmNlIEpTT05TY2hlbWEgZmlsZSxcbiAqIGFuZCBydW4ganNvbi1zY2hlbWEtdG8tdHlwZXNjcmlwdCB0byByZWdlbmVyYXRlIHRoaXMgZmlsZS5cbiAqL1xuXG5leHBvcnQgaW50ZXJmYWNlIENhciB7XG4gIG5hbWU/OiBzdHJpbmc7XG4gIHByaWNlPzogbnVtYmVyO1xufVxuIl19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./car.ts";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from "./car.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zY2hlbWFzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsVUFBVSxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSBcIi4vY2FyLnRzXCIiXX0=
|
package/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as standard from "@fairspec/metadata"
|
|
2
|
+
import type * as extension from "./models/dataset.ts"
|
|
3
|
+
|
|
4
|
+
export type Resource = standard.Resource & extension.Resource
|
|
5
|
+
export type Dataset = standard.Dataset & extension.Dataset
|
|
6
|
+
|
|
7
|
+
export type * from "./models/index.ts"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
|
|
3
|
+
export type FairspecExtensionProfile = Dataset
|
|
4
|
+
export type Resource = Table1Resource | Table2Resource
|
|
5
|
+
|
|
6
|
+
export interface Dataset {
|
|
7
|
+
$schema: "https://fairspec.github.io/profiles/0.1.0/dataset.json"
|
|
8
|
+
/**
|
|
9
|
+
* @minItems 1
|
|
10
|
+
*/
|
|
11
|
+
resources: [Resource, ...Resource[]]
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Data records have to conform to the Table1 schema
|
|
15
|
+
*/
|
|
16
|
+
export interface Table1Resource {
|
|
17
|
+
name: "table1"
|
|
18
|
+
tableSchema: "https://fairspec.github.io/schemas/0.1.0/table1.json"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Data items have to conform to the Table2 schema
|
|
22
|
+
*/
|
|
23
|
+
export interface Table2Resource {
|
|
24
|
+
name: "table2"
|
|
25
|
+
tableSchema: "https://fairspec.github.io/schemas/0.1.0/table2.json"
|
|
26
|
+
}
|
package/models/index.ts
ADDED
package/models/table1.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An exemplar schema demonstrating various field types and constraints
|
|
5
|
+
*/
|
|
6
|
+
export interface Table1 {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for the record
|
|
9
|
+
*/
|
|
10
|
+
id: string
|
|
11
|
+
/**
|
|
12
|
+
* Name of the entity
|
|
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
|
+
}
|
package/models/table2.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// biome-ignore-all format: DO NOT UPDATE this @generated file
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An exemplar schema demonstrating foreign key relationships and additional constraints
|
|
5
|
+
*/
|
|
6
|
+
export interface Table2 {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for the record
|
|
9
|
+
*/
|
|
10
|
+
id: string
|
|
11
|
+
/**
|
|
12
|
+
* Reference to the parent table1 record. If not provided, the record is independent
|
|
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
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fairspec-extension",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"slug": "fairspec-extension",
|
|
6
|
+
"title": "Fairspec Extension",
|
|
7
|
+
"description": "Fairspec Extension is a Git repository template for rapid Fairspec extension development",
|
|
8
|
+
"repository": "https://github.com/fairspec/fairspec-extension",
|
|
9
|
+
"homepage": "https://fairspec.github.io/fairspec-extension",
|
|
10
|
+
"author": "Evgeny Karev",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@fairspec/metadata": "^0.2.2"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"type": "tsc --noEmit"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/tsconfig.json
ADDED