mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 16:02:11 +00:00
fix: pin deno windmill-client version to relase
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import type { AppComponent } from '.'
|
||||
|
||||
export function defaultCode(component: string, language: string): string | undefined {
|
||||
return DEFAULT_CODES[component]?.[language]
|
||||
return DEFAULT_CODES[component]?.[language]
|
||||
}
|
||||
|
||||
export const DEFAULT_CODES: Partial<
|
||||
Record<
|
||||
AppComponent['type'],
|
||||
Partial<Record<'deno' | 'python3' | 'go' | 'bash' | 'pgsql' | 'mysql', string>>
|
||||
>
|
||||
Record<
|
||||
AppComponent['type'],
|
||||
Partial<Record<'deno' | 'python3' | 'go' | 'bash' | 'pgsql' | 'mysql', string>>
|
||||
>
|
||||
> = {
|
||||
tablecomponent: {
|
||||
deno: `export async function main() {
|
||||
tablecomponent: {
|
||||
deno: `export async function main() {
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
@@ -25,7 +25,7 @@ export const DEFAULT_CODES: Partial<
|
||||
}
|
||||
]
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
@@ -38,7 +38,7 @@ export const DEFAULT_CODES: Partial<
|
||||
"age": 84
|
||||
}
|
||||
]`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -46,9 +46,9 @@ export async function main(db: Postgresql) {
|
||||
const query = await pgSql(db)\`SELECT * FROM demo;\`;
|
||||
return query.rows;
|
||||
}`
|
||||
},
|
||||
aggridcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
aggridcomponent: {
|
||||
deno: `export async function main() {
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
@@ -62,7 +62,7 @@ export async function main(db: Postgresql) {
|
||||
}
|
||||
]
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
@@ -75,7 +75,7 @@ export async function main(db: Postgresql) {
|
||||
"age": 84
|
||||
}
|
||||
]`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -83,29 +83,29 @@ export async function main(db: Postgresql) {
|
||||
const query = await pgSql(db)\`SELECT * FROM demo;\`;
|
||||
return query.rows;
|
||||
}`
|
||||
},
|
||||
steppercomponent: {
|
||||
deno: `export async function main(stepIndex: number) {
|
||||
},
|
||||
steppercomponent: {
|
||||
deno: `export async function main(stepIndex: number) {
|
||||
// if (stepIndex == 0) {
|
||||
// if (page0Invalid) throw Error("first step invalid")
|
||||
// } else if ...
|
||||
}`,
|
||||
python3: `def main(stepIndex: int):
|
||||
python3: `def main(stepIndex: int):
|
||||
# if stepIndex == 0:
|
||||
# if page0Invalid:
|
||||
# raise Exception("first step invalid")
|
||||
# elif ...
|
||||
`
|
||||
},
|
||||
textcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
textcomponent: {
|
||||
deno: `export async function main() {
|
||||
return "foo"
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return "foo"`
|
||||
},
|
||||
barchartcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
barchartcomponent: {
|
||||
deno: `export async function main() {
|
||||
return {
|
||||
"data": [
|
||||
25,
|
||||
@@ -119,7 +119,7 @@ export async function main(db: Postgresql) {
|
||||
]
|
||||
}
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"data": [
|
||||
25,
|
||||
@@ -132,7 +132,7 @@ export async function main(db: Postgresql) {
|
||||
"<3"
|
||||
]
|
||||
}`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -143,20 +143,20 @@ export async function main(db: Postgresql) {
|
||||
labels: query.rows.map((row) => row['1']?.slice(0, 6))
|
||||
};
|
||||
}`
|
||||
},
|
||||
displaycomponent: {
|
||||
deno: `export async function main(x = 42) {
|
||||
},
|
||||
displaycomponent: {
|
||||
deno: `export async function main(x = 42) {
|
||||
return {
|
||||
foo: x
|
||||
}
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"foo": 42
|
||||
}`
|
||||
},
|
||||
htmlcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
htmlcomponent: {
|
||||
deno: `export async function main() {
|
||||
return \`<img
|
||||
src="https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1024&h=1280&q=80"
|
||||
>
|
||||
@@ -164,16 +164,16 @@ export async function main(db: Postgresql) {
|
||||
Hello world
|
||||
</h1>\`
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return '''<img
|
||||
src="https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1024&h=1280&q=80"
|
||||
>
|
||||
<h1 class="absolute top-4 left-2 text-white">
|
||||
Hello world
|
||||
</h1>'''`
|
||||
},
|
||||
vegalitecomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
vegalitecomponent: {
|
||||
deno: `export async function main() {
|
||||
return {
|
||||
data: {
|
||||
values: [
|
||||
@@ -190,7 +190,7 @@ export async function main(db: Postgresql) {
|
||||
}
|
||||
}
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"data": {
|
||||
"values": [
|
||||
@@ -206,7 +206,7 @@ export async function main(db: Postgresql) {
|
||||
"y": { "field": "b", "type": "quantitative" },
|
||||
},
|
||||
}`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -226,9 +226,9 @@ export async function main(Postgresqlstgresql) {
|
||||
}
|
||||
};
|
||||
}`
|
||||
},
|
||||
plotlycomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
plotlycomponent: {
|
||||
deno: `export async function main() {
|
||||
return {
|
||||
type: 'bar',
|
||||
x: [1, 2, 3, 4],
|
||||
@@ -241,7 +241,7 @@ export async function main(Postgresqlstgresql) {
|
||||
}
|
||||
};
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"type": "bar",
|
||||
"x": [1, 2, 3, 4],
|
||||
@@ -253,7 +253,7 @@ export async function main(Postgresqlstgresql) {
|
||||
}
|
||||
}
|
||||
}`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -271,9 +271,9 @@ export async function main(Postgresqlstgresql) {
|
||||
}
|
||||
};
|
||||
}`
|
||||
},
|
||||
piechartcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
piechartcomponent: {
|
||||
deno: `export async function main() {
|
||||
return {
|
||||
"data": [
|
||||
25,
|
||||
@@ -287,7 +287,7 @@ export async function main(Postgresqlstgresql) {
|
||||
]
|
||||
}
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"data": [
|
||||
25,
|
||||
@@ -300,7 +300,7 @@ export async function main(Postgresqlstgresql) {
|
||||
"<3"
|
||||
]
|
||||
}`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -311,9 +311,9 @@ export async function main(db: Postgresql) {
|
||||
labels: query.rows.map((row) => row['1']?.slice(0, 6))
|
||||
};
|
||||
}`
|
||||
},
|
||||
scatterchartcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
scatterchartcomponent: {
|
||||
deno: `export async function main() {
|
||||
return [
|
||||
{
|
||||
label: "foo",
|
||||
@@ -335,7 +335,7 @@ export async function main(db: Postgresql) {
|
||||
}
|
||||
];
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return [
|
||||
{
|
||||
"label": "foo",
|
||||
@@ -356,7 +356,7 @@ export async function main(db: Postgresql) {
|
||||
"backgroundColor": "orange"
|
||||
}
|
||||
]`,
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@1";
|
||||
pgsql: `import { pgSql } from "npm:windmill-client@${__pkg__.version}";
|
||||
|
||||
type Postgresql = object
|
||||
|
||||
@@ -386,9 +386,9 @@ export async function main(db: Postgresql) {
|
||||
return [];
|
||||
}
|
||||
}`
|
||||
},
|
||||
timeseriescomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
timeseriescomponent: {
|
||||
deno: `export async function main() {
|
||||
return [
|
||||
{
|
||||
label: "foo",
|
||||
@@ -428,7 +428,7 @@ export async function main(db: Postgresql) {
|
||||
}
|
||||
]
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return [
|
||||
{
|
||||
"label": "foo",
|
||||
@@ -467,16 +467,16 @@ export async function main(db: Postgresql) {
|
||||
"backgroundColor": "orange"
|
||||
}
|
||||
]`
|
||||
},
|
||||
iconcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
iconcomponent: {
|
||||
deno: `export async function main() {
|
||||
return "Smile";
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return "Smile"`
|
||||
},
|
||||
schemaformcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
schemaformcomponent: {
|
||||
deno: `export async function main() {
|
||||
return {
|
||||
properties: {
|
||||
first_name: {
|
||||
@@ -488,7 +488,7 @@ return {
|
||||
required: []
|
||||
}
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return {
|
||||
"properties": {
|
||||
"first_name": {
|
||||
@@ -500,9 +500,9 @@ return {
|
||||
"required": []
|
||||
}
|
||||
`
|
||||
},
|
||||
listcomponent: {
|
||||
deno: `export async function main() {
|
||||
},
|
||||
listcomponent: {
|
||||
deno: `export async function main() {
|
||||
return [{
|
||||
"foo": 1,
|
||||
}, {
|
||||
@@ -511,7 +511,7 @@ return {
|
||||
"foo": 3,
|
||||
}];
|
||||
}`,
|
||||
python3: `def main():
|
||||
python3: `def main():
|
||||
return [{"foo": 1}, {"foo": 2}, {"foo": 3}]`
|
||||
}
|
||||
}
|
||||
} as const
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
const langs = [
|
||||
['deno', 'TypeScript (Deno)'],
|
||||
['python3', 'Python'],
|
||||
['bun', 'TypeScript (Bun)'],
|
||||
['go', 'Go'],
|
||||
['bash', 'Bash'],
|
||||
['powershell', 'PowerShell'],
|
||||
@@ -104,8 +105,7 @@
|
||||
['bigquery', 'BigQuery'],
|
||||
['snowflake', 'Snowflake'],
|
||||
['mssql', 'MS SQL Server'],
|
||||
['graphql', 'GraphQL'],
|
||||
['bun', 'TypeScript (Bun)']
|
||||
['graphql', 'GraphQL']
|
||||
] as [Script.language, string][]
|
||||
</script>
|
||||
|
||||
|
||||
@@ -120,6 +120,20 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<FlowScriptPicker
|
||||
disabled={noEditor && (summary == undefined || summary == '')}
|
||||
label="TypeScript (Bun)"
|
||||
lang={Script.language.BUN}
|
||||
on:click={() => {
|
||||
dispatch('new', {
|
||||
language: RawScript.language.BUN,
|
||||
kind,
|
||||
subkind: 'flow',
|
||||
summary
|
||||
})
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if kind != 'approval'}
|
||||
<FlowScriptPicker
|
||||
disabled={noEditor && (summary == undefined || summary == '')}
|
||||
@@ -298,20 +312,6 @@
|
||||
/> -->
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<FlowScriptPicker
|
||||
disabled={noEditor && (summary == undefined || summary == '')}
|
||||
label="TypeScript (Bun)"
|
||||
lang={Script.language.BUN}
|
||||
on:click={() => {
|
||||
dispatch('new', {
|
||||
language: RawScript.language.BUN,
|
||||
kind,
|
||||
subkind: 'flow',
|
||||
summary
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const deno = {
|
||||
s3_client: `import * as wmill from "npm:windmill-client@1";
|
||||
s3_client: `import * as wmill from "npm:windmill-client@${__pkg__.version}";
|
||||
import { S3Client } from "https://deno.land/x/s3_lite_client@0.2.0/mod.ts";
|
||||
|
||||
type s3object = object;
|
||||
|
||||
@@ -37,7 +37,7 @@ export async function main() {
|
||||
export const DENO_INIT_CODE = `// Ctrl/CMD+. to cache dependencies on imports hover.
|
||||
|
||||
// Deno uses "npm:" prefix to import from npm (https://deno.land/manual@v1.36.3/node/npm_specifiers)
|
||||
// import * as wmill from "npm:windmill-client@1"
|
||||
// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
||||
|
||||
// fill the type, or use the +Resource type to get a type-safe reference to a resource
|
||||
// type Postgresql = object
|
||||
@@ -114,7 +114,7 @@ func main(message string, name string) (interface{}, error) {
|
||||
}
|
||||
`
|
||||
|
||||
export const DENO_INIT_CODE_CLEAR = `// import * as wmill from "npm:windmill-client@1"
|
||||
export const DENO_INIT_CODE_CLEAR = `// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
||||
|
||||
export async function main(x: string) {
|
||||
return x
|
||||
@@ -214,7 +214,7 @@ dflt="\${2:-default value}"
|
||||
echo "Hello $msg"
|
||||
`
|
||||
|
||||
export const DENO_INIT_CODE_TRIGGER = `import * as wmill from "npm:windmill-client@1"
|
||||
export const DENO_INIT_CODE_TRIGGER = `import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
||||
|
||||
export async function main() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user