Skip to content

Commit e0be21b

Browse files
committed
chore: Rebased on self-hosted profiles/schemas
1 parent 43c8482 commit e0be21b

11 files changed

Lines changed: 286 additions & 44 deletions

File tree

@generate.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import metadata from "./package.json" with { type: "json" }
88

99
const loader = spinner()
1010
const root = join(import.meta.dirname)
11-
const [owner, repo] = new URL(metadata.repository).pathname.split("/").slice(1)
1211

1312
const $ = execa({
1413
cwd: root,
@@ -25,14 +24,14 @@ loader.start("Updating extension")
2524

2625
await replaceInFile({
2726
files: "extension/profile.json",
28-
from: /githubusercontent.*profile/g,
29-
to: `githubusercontent.com/${owner}/${repo}/v${metadata.version}/extension/profile`,
27+
from: /extension.*profile/g,
28+
to: `extension/v${metadata.version}/profile`,
3029
})
3130

3231
await replaceInFile({
3332
files: "extension/profile.json",
34-
from: /githubusercontent.*schemas/g,
35-
to: `githubusercontent.com/${owner}/${repo}/v${metadata.version}/extension/schemas`,
33+
from: /extension.*schemas/g,
34+
to: `extension/v${metadata.version}/schemas`,
3635
})
3736

3837
await $`
@@ -60,6 +59,11 @@ for (const file of await readdir("extension/schemas")) {
6059
`
6160
}
6261

62+
$`rm -rf extension/public/extension/v${metadata.version}`
63+
$`mkdir -p extension/public/extension/v${metadata.version}`
64+
$`cp extension/profile.json extension/public/extension/v${metadata.version}`
65+
$`cp -r extension/schemas extension/public/extension/v${metadata.version}`
66+
6367
loader.stop("Extension updated!")
6468

6569
// TypeScript

extension/content/docs/overview/examples.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ A basic example with two tables using inline data. Table2 records can optionally
1212

1313
```json
1414
{
15-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
15+
"$schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
1616
"resources": [
1717
{
1818
"name": "table1",
19-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
19+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
2020
"data": [
2121
{
2222
"id": "t1-001",
@@ -41,7 +41,7 @@ A basic example with two tables using inline data. Table2 records can optionally
4141
},
4242
{
4343
"name": "table2",
44-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
44+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
4545
"data": [
4646
{
4747
"id": "t2-001",
@@ -85,16 +85,16 @@ An example demonstrating the use of `path` instead of inline `data` to reference
8585

8686
```json
8787
{
88-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
88+
"$schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
8989
"resources": [
9090
{
9191
"name": "table1",
92-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
92+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
9393
"path": "data/table1.csv"
9494
},
9595
{
9696
"name": "table2",
97-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
97+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
9898
"path": "data/table2.csv"
9999
}
100100
]
@@ -123,11 +123,11 @@ A minimal valid Extension DP file with only required fields.
123123

124124
```json
125125
{
126-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
126+
"$schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
127127
"resources": [
128128
{
129129
"name": "table1",
130-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
130+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
131131
"data": [
132132
{
133133
"id": "t1-001",
@@ -141,7 +141,7 @@ A minimal valid Extension DP file with only required fields.
141141
},
142142
{
143143
"name": "table2",
144-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
144+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
145145
"data": [
146146
{
147147
"id": "t2-001",
@@ -164,11 +164,11 @@ An example showing various constraint validations:
164164

165165
```json
166166
{
167-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
167+
"$schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
168168
"resources": [
169169
{
170170
"name": "table1",
171-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
171+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
172172
"data": [
173173
{
174174
"id": "t1-999",
@@ -184,7 +184,7 @@ An example showing various constraint validations:
184184
},
185185
{
186186
"name": "table2",
187-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
187+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
188188
"data": [
189189
{
190190
"id": "t2-999",

extension/content/docs/overview/format.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ A Extension DP is a [Data Package](https://datapackage.org/) that follows the Da
2828

2929
```json
3030
{
31-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/<version>/extension/profile.json",
31+
"$schema": "https://datisthq.github.io/extensiondp/extension/<version>/profile.json",
3232
"resources": [
3333
{
3434
"name": "table1",
35-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/<version>/extension/schemas/table1.json",
35+
"schema": "https://datisthq.github.io/extensiondp/extension/<version>/schemas/table1.json",
3636
"data": [{...}, {...}, {...}]
3737
},
3838
{
3939
"name": "table2",
40-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/<version>/extension/schemas/table2.json",
40+
"schema": "https://datisthq.github.io/extensiondp/extension/<version>/schemas/table2.json",
4141
"data": [{...}]
4242
}
4343
]

extension/content/docs/overview/software.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ record2 = Table2(
4949

5050
package = Package(
5151
{
52-
"$schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
52+
"$schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
5353
"resources": [
5454
{
5555
"name": "table1",
5656
"data": [record1],
57-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
57+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
5858
},
5959
{
6060
"name": "table2",
6161
"data": [record2],
62-
"schema": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
62+
"schema": "https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
6363
},
6464
],
6565
}
@@ -127,19 +127,19 @@ const record2: Table2 = {
127127

128128
const dataPackage: Package = {
129129
$schema:
130-
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/profile.json",
130+
"https://datisthq.github.io/extensiondp/extension/v0.1.5/profile.json",
131131
resources: [
132132
{
133133
name: "table1",
134134
data: [record1],
135135
schema:
136-
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table1.json",
136+
"https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table1.json",
137137
},
138138
{
139139
name: "table2",
140140
data: [record2],
141141
schema:
142-
"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.0/extension/schemas/table2.json",
142+
"https://datisthq.github.io/extensiondp/extension/v0.1.5/schemas/table2.json",
143143
},
144144
],
145145
};

extension/content/docs/specification/metadata.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Metadata
55
## Definitions
66

77
- <a id="definitions/Package"></a>**`Package`** *(object)*
8-
- <a id="definitions/Package/properties/%24schema"></a>**`$schema`**: Must be: `"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/profile.json"`.
8+
- <a id="definitions/Package/properties/%24schema"></a>**`$schema`**: Must be: `"https://datisthq.github.io/extension/v0.1.6/profile.json"`.
99
- <a id="definitions/Package/properties/resources"></a>**`resources`** *(array, required)*: Length must be at least 1.
1010
- <a id="definitions/Package/properties/resources/items"></a>**Items**: Refer to *[#/definitions/Resource](#definitions/Resource)*.
1111
- <a id="definitions/Resource"></a>**`Resource`**
@@ -14,7 +14,7 @@ title: Metadata
1414
- <a id="definitions/Resource/oneOf/1"></a>: Refer to *[#/definitions/Table2Resource](#definitions/Table2Resource)*.
1515
- <a id="definitions/Table1Resource"></a>**`Table1Resource`** *(object)*: Data records have to conform to the Table1 schema.
1616
- <a id="definitions/Table1Resource/properties/name"></a>**`name`**: Must be: `"table1"`.
17-
- <a id="definitions/Table1Resource/properties/schema"></a>**`schema`**: Must be: `"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/schemas/table1.json"`.
17+
- <a id="definitions/Table1Resource/properties/schema"></a>**`schema`**: Must be: `"https://datisthq.github.io/extension/v0.1.6/schemas/table1.json"`.
1818
- <a id="definitions/Table2Resource"></a>**`Table2Resource`** *(object)*: Data items have to conform to the Table2 schema.
1919
- <a id="definitions/Table2Resource/properties/name"></a>**`name`**: Must be: `"table2"`.
20-
- <a id="definitions/Table2Resource/properties/schema"></a>**`schema`**: Must be: `"https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/schemas/table2.json"`.
20+
- <a id="definitions/Table2Resource/properties/schema"></a>**`schema`**: Must be: `"https://datisthq.github.io/extension/v0.1.6/schemas/table2.json"`.

extension/profile.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"required": ["$schema", "resources"],
1212
"properties": {
1313
"$schema": {
14-
"const": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/profile.json"
14+
"const": "https://datisthq.github.io/extension/v0.1.6/profile.json"
1515
},
1616
"resources": {
1717
"type": "array",
@@ -41,7 +41,7 @@
4141
"const": "table1"
4242
},
4343
"schema": {
44-
"const": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/schemas/table1.json"
44+
"const": "https://datisthq.github.io/extension/v0.1.6/schemas/table1.json"
4545
}
4646
}
4747
},
@@ -54,7 +54,7 @@
5454
"const": "table2"
5555
},
5656
"schema": {
57-
"const": "https://raw.githubusercontent.com/datisthq/extensiondp/v0.1.6/extension/schemas/table2.json"
57+
"const": "https://datisthq.github.io/extension/v0.1.6/schemas/table2.json"
5858
}
5959
}
6060
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"title": "Extension Data Package Profile",
4+
"allOf": [
5+
{ "$ref": "https://datapackage.org/profiles/2.0/datapackage.json" },
6+
{ "$ref": "#/definitions/Package" }
7+
],
8+
"definitions": {
9+
"Package": {
10+
"type": "object",
11+
"required": ["$schema", "resources"],
12+
"properties": {
13+
"$schema": {
14+
"const": "https://datisthq.github.io/extension/v0.1.6/profile.json"
15+
},
16+
"resources": {
17+
"type": "array",
18+
"minItems": 1,
19+
"items": {
20+
"$ref": "#/definitions/Resource"
21+
}
22+
}
23+
}
24+
},
25+
"Resource": {
26+
"oneOf": [
27+
{
28+
"$ref": "#/definitions/Table1Resource"
29+
},
30+
{
31+
"$ref": "#/definitions/Table2Resource"
32+
}
33+
]
34+
},
35+
"Table1Resource": {
36+
"type": "object",
37+
"required": ["name", "schema"],
38+
"description": "Data records have to conform to the Table1 schema",
39+
"properties": {
40+
"name": {
41+
"const": "table1"
42+
},
43+
"schema": {
44+
"const": "https://datisthq.github.io/extension/v0.1.6/schemas/table1.json"
45+
}
46+
}
47+
},
48+
"Table2Resource": {
49+
"type": "object",
50+
"required": ["name", "schema"],
51+
"description": "Data items have to conform to the Table2 schema",
52+
"properties": {
53+
"name": {
54+
"const": "table2"
55+
},
56+
"schema": {
57+
"const": "https://datisthq.github.io/extension/v0.1.6/schemas/table2.json"
58+
}
59+
}
60+
}
61+
}
62+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"$schema": "https://datapackage.org/profiles/2.0/tableschema.json",
3+
"title": "Table1",
4+
"description": "An exemplar schema demonstrating various field types and constraints",
5+
"primaryKey": ["id"],
6+
"fieldsMatch": "equal",
7+
"fields": [
8+
{
9+
"name": "id",
10+
"type": "string",
11+
"description": "Unique identifier for the record",
12+
"examples": ["t1-001", "t1-002", "t1-003"],
13+
"constraints": {
14+
"required": true,
15+
"pattern": "^t1-[0-9]{3}$"
16+
}
17+
},
18+
{
19+
"name": "name",
20+
"type": "string",
21+
"description": "Name of the entity",
22+
"examples": ["Example Entity", "Sample Item"],
23+
"constraints": {
24+
"required": true,
25+
"minLength": 3,
26+
"maxLength": 100
27+
}
28+
},
29+
{
30+
"name": "status",
31+
"type": "string",
32+
"description": "Current status of the entity",
33+
"examples": ["active", "inactive", "pending"],
34+
"categories": ["active", "inactive", "pending"],
35+
"constraints": {
36+
"required": true,
37+
"enum": ["active", "inactive", "pending"]
38+
}
39+
},
40+
{
41+
"name": "value",
42+
"type": "number",
43+
"description": "Numeric value associated with the entity",
44+
"examples": [100.5, 250.75, 500],
45+
"constraints": {
46+
"required": true,
47+
"minimum": 0
48+
}
49+
},
50+
{
51+
"name": "itemCount",
52+
"type": "integer",
53+
"description": "Count of items",
54+
"examples": [5, 10, 25],
55+
"constraints": {
56+
"minimum": 0,
57+
"maximum": 1000
58+
}
59+
},
60+
{
61+
"name": "isVerified",
62+
"type": "boolean",
63+
"description": "Whether the entity has been verified",
64+
"examples": [true, false],
65+
"constraints": {
66+
"required": true
67+
}
68+
},
69+
{
70+
"name": "createdDate",
71+
"type": "date",
72+
"description": "Date when the entity was created",
73+
"examples": ["2024-01-15", "2024-03-20"],
74+
"constraints": {
75+
"required": true
76+
}
77+
},
78+
{
79+
"name": "description",
80+
"type": "string",
81+
"description": "Optional description of the entity",
82+
"examples": [
83+
"This is a sample description",
84+
"Additional notes about the entity"
85+
]
86+
}
87+
]
88+
}

0 commit comments

Comments
 (0)