Skip to content

Commit b8350c8

Browse files
committed
update docs
1 parent 30af638 commit b8350c8

File tree

10 files changed

+10866
-24133
lines changed

10 files changed

+10866
-24133
lines changed

blog/2023-01-25-issue-tracker/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ This can be achieved by Background scripts.
201201
4. Paste in the following code:
202202

203203
```tsx
204-
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
204+
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
205205
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
206206

207207
export async function main(auth: Resource<"supabase">) {
@@ -520,7 +520,7 @@ user and sends them to the database.
520520
`Create Issue` and paste in the following code:
521521

522522
```tsx
523-
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
523+
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
524524
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
525525

526526
export async function main(
@@ -572,7 +572,7 @@ the form of buttons. Select the `Table` component and follow the steps:
572572
`Delete Issue` and paste in the following code:
573573

574574
```tsx
575-
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
575+
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
576576
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
577577

578578
export async function main(auth: Resource<"supabase">, id: string) {

blog/2023-01-31-issue-tracker-p2/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Finally, we need to add a `Button` component to submit the form:
112112
`Update Issue` and paste in the following code:
113113

114114
```ts
115-
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
115+
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
116116
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
117117

118118
export async function main(

docs/getting_started/0_scripts_quickstart/1_typescript_quickstart/index.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
title: "TypeScript"
3-
slug: "/getting_started/scripts_quickstart/typescript"
2+
title: 'TypeScript'
3+
slug: '/getting_started/scripts_quickstart/typescript'
44
---
55

66
# TypeScript Quickstart
77

88
In this quick start guide, we will write our first script in TypeScript.
99
Windmill uses [Deno](https://deno.land/) as the TypeScript runtime.
1010

11-
1211
<video
1312
className="border-2 rounded-xl object-cover w-full h-full"
1413
autoPlay
@@ -79,17 +78,17 @@ boilerplate. Let's take a look:
7978
// Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
8079

8180
// import { toWords } from "npm:number-to-words@1"
82-
// import * as wmill from "https://deno.land/x/windmill@v1.61.1/mod.ts"
81+
// import * as wmill from "https://deno.land/x/windmill@v1.89.1/mod.ts"
8382

8483
export async function main(
85-
a: number,
86-
b: "my" | "enum",
87-
d = "inferred type string from default arg",
88-
c = { nested: "object" },
89-
//e: wmill.Base64
84+
a: number,
85+
b: 'my' | 'enum',
86+
d = 'inferred type string from default arg',
87+
c = { nested: 'object' }
88+
//e: wmill.Base64
9089
) {
91-
// let x = await wmill.getVariable('u/user/foo')
92-
return { foo: a };
90+
// let x = await wmill.getVariable('u/user/foo')
91+
return { foo: a };
9392
}
9493
```
9594

@@ -115,8 +114,8 @@ this later if we use this Script within a Flow and need to pass it on.
115114

116115
```typescript
117116
export async function main(name: string) {
118-
console.log("Hello world! Oh, it's you %s? Greetings!", name);
119-
return { name };
117+
console.log("Hello world! Oh, it's you %s? Greetings!", name);
118+
return { name };
120119
}
121120
```
122121

docs/integrations/mongodb.md

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can find more information about setting up MongoDB Atlas
1616

1717
:::
1818

19-
![Integrattion between MongoDB and Windmill](../assets/integrations/0-header.png "Connect a MongoDB Atlas project with Windmill")
19+
![Integrattion between MongoDB and Windmill](../assets/integrations/0-header.png 'Connect a MongoDB Atlas project with Windmill')
2020

2121
## Create Resource
2222

@@ -37,7 +37,6 @@ Head to the [Resources][wm-app-resources] page in the Windmill app, click on
3737

3838
![Select Resource Type](../assets/integrations/1-resources.png)
3939

40-
4140
:::caution
4241

4342
There is a `mongodb` and a `mongodb_rest` Resource Type. Make sure that you
@@ -72,23 +71,23 @@ MongoDB Dataset" for example and click "Next".
7271
Paste in the following code into the editor:
7372

7473
```typescript
75-
import { Resource } from "https://deno.land/x/windmill@v1.55.0/mod.ts";
76-
import { MongoClient } from "https://deno.land/x/atlas_sdk@v1.0.3/mod.ts";
74+
import { Resource } from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
75+
import { MongoClient } from 'https://deno.land/x/atlas_sdk@v1.0.3/mod.ts';
7776

7877
export async function main(
79-
auth: Resource<"mongodb_rest">,
80-
data_source: string,
81-
database: string,
82-
collection: string,
83-
filter: Record<string, any>,
78+
auth: Resource<'mongodb_rest'>,
79+
data_source: string,
80+
database: string,
81+
collection: string,
82+
filter: Record<string, any>
8483
) {
85-
const client = new MongoClient({
86-
endpoint: auth.endpoint,
87-
dataSource: data_source,
88-
auth: { apiKey: auth.api_key },
89-
});
90-
const documents = client.database(database).collection(collection);
91-
return await documents.find(filter);
84+
const client = new MongoClient({
85+
endpoint: auth.endpoint,
86+
dataSource: data_source,
87+
auth: { apiKey: auth.api_key }
88+
});
89+
const documents = client.database(database).collection(collection);
90+
return await documents.find(filter);
9291
}
9392
```
9493

@@ -117,29 +116,26 @@ ObjectID first. Replace your code with the following to make it able to query by
117116
ID:
118117

119118
```typescript
120-
import { Resource } from "https://deno.land/x/windmill@v1.55.0/mod.ts";
121-
import {
122-
MongoClient,
123-
ObjectId,
124-
} from "https://deno.land/x/atlas_sdk@v1.0.3/mod.ts";
119+
import { Resource } from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
120+
import { MongoClient, ObjectId } from 'https://deno.land/x/atlas_sdk@v1.0.3/mod.ts';
125121

126122
export async function main(
127-
auth: Resource<"mongodb_rest">,
128-
data_source: string,
129-
database: string,
130-
collection: string,
131-
filter: Record<string, any>,
123+
auth: Resource<'mongodb_rest'>,
124+
data_source: string,
125+
database: string,
126+
collection: string,
127+
filter: Record<string, any>
132128
) {
133-
const client = new MongoClient({
134-
endpoint: auth.endpoint,
135-
dataSource: data_source,
136-
auth: { apiKey: auth.api_key },
137-
});
138-
const documents = client.database(database).collection(collection);
139-
if ("_id" in filter) {
140-
filter["_id"] = new ObjectId(filter["_id"]);
141-
}
142-
return await documents.find(filter);
129+
const client = new MongoClient({
130+
endpoint: auth.endpoint,
131+
dataSource: data_source,
132+
auth: { apiKey: auth.api_key }
133+
});
134+
const documents = client.database(database).collection(collection);
135+
if ('_id' in filter) {
136+
filter['_id'] = new ObjectId(filter['_id']);
137+
}
138+
return await documents.find(filter);
143139
}
144140
```
145141

@@ -171,4 +167,4 @@ standalone.
171167
[mongodb-atlas]: https://www.mongodb.com/atlas/database
172168
[mongodb-atlas-setup]: https://www.mongodb.com/basics/mongodb-atlas-tutorial
173169
[mongo-api]: https://www.mongodb.com/docs/atlas/api/data-api/
174-
[mongo-sample-data]: https://www.mongodb.com/docs/atlas/sample-data/
170+
[mongo-sample-data]: https://www.mongodb.com/docs/atlas/sample-data/

docs/integrations/postgresql.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
We will see how to connect your Windmill instance to an external PostgreSQL
44
service and then send queries to the database using Windmill Scripts.
55

6-
![Integrattion between PostgreSQL and Windmill](../assets/integrations/psql-0-header.png "Connect a PostgreSQL instance with Windmill")
6+
![Integrattion between PostgreSQL and Windmill](../assets/integrations/psql-0-header.png 'Connect a PostgreSQL instance with Windmill')
77

88
## Create Resource
99

@@ -48,21 +48,16 @@ We will use Postgres' parameterized queries with the template being written in
4848
TypeScript. Paste the following code in the editor:
4949

5050
```typescript
51-
import {
52-
pgSql,
53-
type Resource,
54-
} from "https://deno.land/x/windmill@v1.62.0/mod.ts";
51+
import { pgSql, type Resource } from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
5552

5653
//PG parameterized statement. No SQL injection is possible.
5754
export async function main(
58-
db: Resource<"postgresql"> = "$res:g/all/demodb",
59-
key: number,
60-
value: string,
55+
db: Resource<'postgresql'> = '$res:g/all/demodb',
56+
key: number,
57+
value: string
6158
) {
62-
const query = await pgSql(
63-
db,
64-
)`INSERT INTO demo VALUES (${key}, ${value}) RETURNING *;`;
65-
return query.rows;
59+
const query = await pgSql(db)`INSERT INTO demo VALUES (${key}, ${value}) RETURNING *;`;
60+
return query.rows;
6661
}
6762
```
6863

docs/integrations/slack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ and click "Next". Paste the following code in the editor and click "Test" - you
150150
should see the list of users and bots in your Slack workspace.
151151

152152
```typescript
153-
import { Resource } from 'https://deno.land/x/windmill@v1.62.0/mod.ts';
153+
import { Resource } from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
154154
import { SlackAPI } from 'https://deno.land/x/deno_slack_api@1.6.0/mod.ts';
155155

156156
export async function main(auth: Resource<'slack'>) {

docs/integrations/supabase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _This tutorial assumes that you already have a
88
[Windmill documentation](https://docs.windmill.dev/docs/intro) or the
99
[Supabase documentation](https://supabase.com/docs) to find out more._
1010

11-
![Integrattion between Supabase and Windmill](../assets/integrations/sb-0-header.png "Connect a Supabase project with Windmill")
11+
![Integrattion between Supabase and Windmill](../assets/integrations/sb-0-header.png 'Connect a Supabase project with Windmill')
1212

1313
## Get the API keys
1414

@@ -50,10 +50,10 @@ You can reference the type of a Supabase resource in a script the following way:
5050
// To get the latest supported resource types,
5151
// check for the latest version of the Windmill Deno
5252
// package at https://deno.land/x/windmill/mod.ts
53-
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
53+
import { Resource } from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
5454

55-
export async function main(auth: Resource<"supabase">) {
56-
// Function contents
55+
export async function main(auth: Resource<'supabase'>) {
56+
// Function contents
5757
}
5858
```
5959

src/components/denoScript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Return a list of all the new items on HN that match a pattern since being last run
22
// Code run as-is, not just a showcase code
33

4-
import * as wmill from 'https://deno.land/x/windmill@v1.25.0/mod.ts';
4+
import * as wmill from 'https://deno.land/x/windmill@v1.89.0/mod.ts';
55

66
const MAX_LOOKBACK = 20
77

0 commit comments

Comments
 (0)