-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1418 from evidence-dev/feat/next/storybook-usql
[No Merge] Add USQL to storybook
- Loading branch information
Showing
35 changed files
with
1,306 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@evidence-dev/core-components': patch | ||
'@evidence-dev/faker-datasource': patch | ||
--- | ||
|
||
Add USQL to core components; augment faker datasource to generate better and consistent data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ const config = { | |
}, | ||
docs: { | ||
autodocs: 'tag' | ||
} | ||
}, | ||
staticDirs: ['../static'] | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
datasources: | ||
@evidence-dev/faker-datasource: {} | ||
|
||
components: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/core-components/sources/faker-demo-source/connection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This file was automatically generated by @evidence-dev/faker-datasource | ||
# This source is designed to contain examples for many series perumtations | ||
name: series_demo_source | ||
type: faker | ||
options: | ||
seed: evidence-series-demo |
15 changes: 15 additions & 0 deletions
15
packages/core-components/sources/faker-demo-source/numeric_series.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
series: | ||
count: 4 |
16 changes: 16 additions & 0 deletions
16
packages/core-components/sources/faker-demo-source/numeric_series_seriesgaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
series: | ||
count: 4 | ||
alwaysExists: false |
16 changes: 16 additions & 0 deletions
16
packages/core-components/sources/faker-demo-source/numeric_series_xgaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
gaps: true | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
series: | ||
count: 4 |
17 changes: 17 additions & 0 deletions
17
packages/core-components/sources/faker-demo-source/numeric_series_xgaps_seriesgaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
gaps: true | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
series: | ||
count: 4 | ||
alwaysExists: false |
17 changes: 17 additions & 0 deletions
17
packages/core-components/sources/faker-demo-source/numeric_series_xgaps_ynulls.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
gaps: true | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
nulls: true | ||
series: | ||
count: 4 |
18 changes: 18 additions & 0 deletions
18
...ges/core-components/sources/faker-demo-source/numeric_series_xgaps_ynulls_seriesgaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
gaps: true | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
nulls: true | ||
series: | ||
count: 4 | ||
alwaysExists: false |
16 changes: 16 additions & 0 deletions
16
packages/core-components/sources/faker-demo-source/numeric_series_ynulls.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
nulls: true | ||
series: | ||
count: 4 |
17 changes: 17 additions & 0 deletions
17
packages/core-components/sources/faker-demo-source/numeric_series_ynulls_seriesgaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rows: 100 | ||
fuzz: 0 | ||
series: | ||
type: numeric | ||
columns: | ||
x: | ||
type: number | ||
y: | ||
category: number | ||
item: int | ||
options: | ||
- min: 0 | ||
max: 1000 | ||
nulls: true | ||
series: | ||
count: 4 | ||
alwaysExists: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { QueryStore } from '@evidence-dev/query-store'; | ||
import { query } from '@evidence-dev/universal-sql/client-duckdb'; | ||
export const fakerSeries = { | ||
numeric_series: { | ||
false: { | ||
false: { | ||
false: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_seriesgaps', | ||
store: new QueryStore('SELECT * FROM series_demo_source.numeric_series_seriesgaps', query) | ||
}, | ||
true: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series', | ||
store: new QueryStore('SELECT * FROM series_demo_source.numeric_series', query) | ||
} | ||
}, | ||
true: { | ||
false: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_ynulls_seriesgaps', | ||
store: new QueryStore( | ||
'SELECT * FROM series_demo_source.numeric_series_ynulls_seriesgaps', | ||
query | ||
) | ||
}, | ||
true: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_ynulls', | ||
store: new QueryStore('SELECT * FROM series_demo_source.numeric_series_ynulls', query) | ||
} | ||
} | ||
}, | ||
true: { | ||
false: { | ||
false: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_xgaps_seriesgaps', | ||
store: new QueryStore( | ||
'SELECT * FROM series_demo_source.numeric_series_xgaps_seriesgaps', | ||
query | ||
) | ||
}, | ||
true: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_xgaps', | ||
store: new QueryStore('SELECT * FROM series_demo_source.numeric_series_xgaps', query) | ||
} | ||
}, | ||
true: { | ||
false: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_xgaps_ynulls_seriesgaps', | ||
store: new QueryStore( | ||
'SELECT * FROM series_demo_source.numeric_series_xgaps_ynulls_seriesgaps', | ||
query | ||
) | ||
}, | ||
true: { | ||
text: 'SELECT * FROM series_demo_source.numeric_series_xgaps_ynulls', | ||
store: new QueryStore( | ||
'SELECT * FROM series_demo_source.numeric_series_xgaps_ynulls', | ||
query | ||
) | ||
} | ||
} | ||
} | ||
} | ||
}; |
29 changes: 29 additions & 0 deletions
29
packages/core-components/src/lib/storybook-helpers/WithUSQL.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script> | ||
import { | ||
initDB, | ||
setParquetURLs, | ||
updateSearchPath, | ||
query | ||
} from '@evidence-dev/universal-sql/client-duckdb'; | ||
const initializing = (async () => { | ||
await initDB(); | ||
const res = await fetch('/data/manifest.json').then((r) => r.json()); | ||
await setParquetURLs(res.renderedFiles ?? {}); | ||
await updateSearchPath(Object.keys(res.renderedFiles ?? {})); | ||
if (!res.renderedFiles) console.error('No fixture data available!'); | ||
// Test Query | ||
const r = await query('SELECT * FROM information_schema.tables'); | ||
if (r.length === 0) throw new Error('Failed to run test query'); | ||
})(); | ||
</script> | ||
{#await initializing} | ||
Universal SQL is loading... | ||
{:then} | ||
<slot /> | ||
{:catch e} | ||
Universal SQL failed to initialize. | ||
{e} | ||
{/await} |
Oops, something went wrong.