Skip to content

Commit

Permalink
feat(docs): update docs
Browse files Browse the repository at this point in the history
Updates the Wing docs. See details in [workflow run].

[Workflow Run]: https://github.com/winglang/docsite/actions/runs/5448037751

------

*Automatically created via the "update-docs" workflow*

Signed-off-by: monabot <[email protected]>
  • Loading branch information
monadabot committed Jul 3, 2023
1 parent 1fa3a04 commit e1f56b0
Show file tree
Hide file tree
Showing 26 changed files with 236 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Both are important to the health of Wing however users should be prioritized ove
User-facing projects and their supporting contributor pieces:

- [Homepage](https://winglang.io)
- [Documentation](https://docs.winglang.io)
- [Documentation](https://www.winglang.io/docs/)
- https://github.com/winglang/docsite
- https://github.com/winglang/wing/tree/main/docs
- Wing CLI
- https://github.com/winglang/wing
- Wing Console
- https://docs.winglang.io/core-concepts/simulator
- https://www.winglang.io/docs/concepts/simulator
- [Playground](https://play.winglang.io)
- [NPM Packages](https://www.npmjs.com/~monabot) (https://www.npmjs.com/package/winglang and https://www.npmjs.com/package/@winglang/sdk)
- [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=Monada.vscode-wing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ the log message `Hello, cloud!`.
Now that you've written your first Wing program, what's next? Here are some
resources to help you get started:

- [Wing Language Specification](https://docs.winglang.io/contributing/rfcs/language-spec)
- [Wing SDK Reference](https://docs.winglang.io/contributing/rfcs/2023-01-20-wingsdk-spec)
- [Wing Language Specification](https://www.winglang.io/contributing/rfcs/language-spec)
- [Wing SDK Reference](https://www.winglang.io/contributing/rfcs/2023-01-20-wingsdk-spec)

## Staying up to date

Expand Down Expand Up @@ -222,7 +222,7 @@ As such, our focus for this sprint is:
- Consolidate everything related to Wing into the [monadahq/winglang](https://github.com/monadahq/winglang/) GitHub repo. This includes:
- The [Wing SDK](https://github.com/monadahq/wingsdk)
- The [language spec](https://github.com/monadahq/winglang-spec) - should go under `docs/winglang-spec.md`
- The [language requirements RFC](https://docs.winglang.io/contributing/rfcs/2022-05-28-winglang-reqs) -
- The [language requirements RFC](https://www.winglang.io/contributing/rfcs/2022-05-28-winglang-reqs) -
should go under `rfcs/winglang-reqs.md`
- All issues should also be transfered into this repository.
- Updating the main README file to match this RFC as close as possible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The winglang.io webpage is simple & clean (see [Figma](https://www.figma.com/fil

It says below "Sign up for early access". She can't wait... Puts her email and clicks "submit". A message pops up saying that she should be expecting an email from us on how you can register, she goes into her inbox and sees she got an email from Elad that welcomes and asks her to fill in a short form so we can learn more about her before giving her access. She clicks the link. Her web browser takes her to a short form that asks her questions about her job (devops/developer/both/other), how she heard about wing, etc, and also her github username. She submits the form and gets a message, “thank you for submitting the form, please expect a github invitation to github.com/winglang/wing repo in your email”, she goes back to her email where an invite email is awaiting her. Wow these guys are quick! She clicks the link, approves the invite and goes to grab coffee.

She lands in https://githug.com/winglang/wing and starts skimming through the README.md. It is clear to her that this project is in a very early stage, both because of the amount of stars and because of the first commit time. The big disclaimer at the top of the README.md also provides a hint. She starts reading the README and is excited to see the quick screencasts of what it looks like to write and compile wing software. She is psyched to take wing for a spin. She follows the instructions in the README (Mona Lisa told her about that already from Sprint 4), downloads the toolchain, writes the little "Hello World" and it works, sweet! The README points to a https://docs.winglang.io, to learn more about the language and its capabilities. She clicks on the link, where she reads about why we need a language like wing, and what is currently supported, she learns about inflights, resources, and Polymorphism. She reads through the language reference, and the roadmap and browses through the Wing SDK documentation. She feels like this might be a beginning of something big!
She lands in https://githug.com/winglang/wing and starts skimming through the README.md. It is clear to her that this project is in a very early stage, both because of the amount of stars and because of the first commit time. The big disclaimer at the top of the README.md also provides a hint. She starts reading the README and is excited to see the quick screencasts of what it looks like to write and compile wing software. She is psyched to take wing for a spin. She follows the instructions in the README (Mona Lisa told her about that already from Sprint 4), downloads the toolchain, writes the little "Hello World" and it works, sweet! The README points to a https://www.winglang.io/docs/, to learn more about the language and its capabilities. She clicks on the link, where she reads about why we need a language like wing, and what is currently supported, she learns about inflights, resources, and Polymorphism. She reads through the language reference, and the roadmap and browses through the Wing SDK documentation. She feels like this might be a beginning of something big!

Maria starts playing with the language, she wants to take this to the next level, and see how it is to build something with this, F$#!#! the disclaimer... She compiles a very simple program and gets a compiler error with the following message “'for' loops are not yet supported, please +1 https://winglang/wing/issues/119". She goes to GitHub and clicks the 👍 to indicate this is a feature she is after. A couple of minutes later she gets a notification from github with a reply from a guy named Mark. He comments on the issue:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: The original requirements documents for the wing language experienc
- **Author(s):**: @eladb
- **Submission Date**: {2022-05-28}
- **Stage**: Approved
- **Implementation**: [Language Specification](https://docs.winglang.io/contributing/rfcs/language-spec)
- **Implementation**: [Language Specification](https://www.winglang.io/contributing/rfcs/language-spec)

## About this Document

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Stage: Fill in with current stage in the RFC lifecycle
Stage Date: Fill in with date of last stage change
-->

> Implementing the website resource following the [SDK spec](https://docs.winglang.io/contributing/rfcs/2023-01-20-wingsdk-spec#website).
> Implementing the website resource following the [SDK spec](https://www.winglang.io/contributing/rfcs/2023-01-20-wingsdk-spec#website).
<!--
This RFC has 3 sections: Requirements -> Design -> Implementation. We intentionally start with *Design* since it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@ test "can add objects" {
The behavior of running tests with `wing test` CLI command is determined by the `cloud.TestRunner` resource in the Wing SDK, which can be implemented for any compiler target.
See the [CLI User Manual](https://docs.winglang.io/reference/cli#test-wing-test) for more details on running tests.
See the [CLI User Manual](https://www.winglang.io/docs/tools/cli#test-wing-test) for more details on running tests.
[`top`][top]
Expand Down Expand Up @@ -2461,7 +2461,7 @@ If [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Gl
### 6.1 Strings
String reference doc is available [here](https://docs.winglang.io/standard-library/sdk#string-).
String reference doc is available [here](https://www.winglang.io/docs/standard-library/std/api-reference#string-).
Type of string is UTF-16 internally.
All string declaration variants are multi-line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords: [rfcs, rfc, overview, process]
An RFC is short for "request for comments". It's a document that describes a new feature or change
to Wing. It's a way to propose, gather feedback, and reach consensus for a change from maintainers,
contributors, and users before writing any code. For an example of an RFC, check out:
https://docs.winglang.io/contributing/rfcs/2022-06-14-polycons
https://www.winglang.io/contributing/rfcs/2022-06-14-polycons

Usually, an RFC is a common practice for major features or complex changes that require that extra
vetting. However, the process is designed to be as lightweight as needed and can be used to request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Please don't hesitate to ping us on [Slack](https://t.winglang.io/slack) or
[file an issue](https://github.com/winglang/wing). We promise to do our best to
respond quickly and help out.

Our <a href="https://docs.winglang.io/status">Project Status</a> page includes
Our <a href="https://www.winglang.io/contributing/status">Project Status</a> page includes
more information about stability and roadmap 👷‍♀️

:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords: [Wing]

To learn more, check out the rest of our docs where we cover all the basics with Wing, or check out our [examples repository](https://github.com/winglang/examples) to see some samples of Wing applications.

We also have a [YouTube channel](https://www.youtube.com/@winglangio) where we share clips of demos and guest interviews on our [Twitch show](https://www.twitch.tv/winglangio), and a [blog](https://docs.winglang.io/blog).
We also have a [YouTube channel](https://www.youtube.com/@winglangio) where we share clips of demos and guest interviews on our [Twitch show](https://www.twitch.tv/winglangio), and a [blog](https://www.winglang.io/blog).

Finally, we encourage you to join our [Wing Slack](http://t.winglang.io/slack).
We're here to help each other, answer questions, and share our cloud adventures.
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@ test "can add objects" {
The behavior of running tests with `wing test` CLI command is determined by the `cloud.TestRunner` resource in the Wing SDK, which can be implemented for any compiler target.
See the [CLI User Manual](https://docs.winglang.io/reference/cli#test-wing-test) for more details on running tests.
See the [Test Concenpt Doc](https://www.winglang.io/docs/concepts/tests) for more details on running tests.
### 3.10 Roadmap
Expand Down Expand Up @@ -1962,7 +1962,7 @@ If [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Gl
### 6.1 Strings
String reference doc is available [here](https://docs.winglang.io/standard-library/sdk#string-).
String reference doc is available [here](https://www.winglang.io/docs/language-guide/language-reference#61-strings).
Type of string is UTF-16 internally.
All string declaration variants are multi-line.
Expand Down
92 changes: 89 additions & 3 deletions versioned_docs/version-latest/04-standard-library/01-cloud/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,98 @@ When a client invokes a route, the corresponding event handler function executes

## Usage

TODO
### REST API

The following example shows a complete REST API implemetnation using `cloud.Api`, `cloud.Table` & `cloud.Counter`
```ts playground
bring cloud;

let api = new cloud.Api();
// Used for generating unique id
let counter = new cloud.Counter();
// our employee database
let db = new cloud.Table(
name: "employees",
primaryKey: "id",
columns: {
"name" => cloud.ColumnType.STRING
}
);

api.get("/employees", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
let result = MutJson [];
let var i = 0;
for employee in db.list() {
result.setAt(i, employee);
i = i + 1;
}
return cloud.ApiResponse {
status: 200,
body: Json.stringify(result)
};
});


api.get("/employees/{id}", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
let employee = db.get(request.vars.get("id"));
return cloud.ApiResponse {
status: 200,
body: Json.stringify(employee)
};
});

api.post("/employees", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
if let body = request.body {
let employeeData = Json.parse(body);
let id = "${counter.inc()}";
db.insert(id, employeeData);
return cloud.ApiResponse {
status: 201,
body: id
};
}
});

api.put("/employees/{id}", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
if let body = request.body {
let employeeData = Json.parse(body);
let id = request.vars.get("id");
db.update(id, employeeData);
return cloud.ApiResponse {
status: 200,
body: Json.stringify(employeeData)
};
}
});

api.delete("/employees/{id}", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
let id = request.vars.get("id");
db.delete(id);
return cloud.ApiResponse {
status: 204
};
});
```
## Target-specific details
TODO
### Simulator (`sim`)
The sim implementation of `cloud.Api` uses [nodejs express]([url](https://expressjs.com/)).
### AWS (`tf-aws` and `awscdk`)
The AWS implementation of `cloud.Api` uses [Amazon API Gateway](https://aws.amazon.com/api-gateway/).
### Azure (`tf-azure`)
🚧 Not supported yet (tracking issue: [#625](https://github.com/winglang/wing/issues/625))
### GCP (`tf-gcp`)
🚧 Not supported yet (tracking issue: [#624](https://github.com/winglang/wing/issues/624))
## API Reference
The full list of APIs for `cloud.Api` is available in the [API Reference](../api-reference).
The full list of APIs for `cloud.Api` is available in the [API Reference](../api-reference).
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,42 @@ For performance reasons, most cloud providers impose a timeout on functions, aft

## Usage

TODO
```ts playground
bring cloud;

// defining a cloud.Function resource
let countWords = new cloud.Function(inflight (s: str): str => {
return "${s.split(" ").length}";
}) as "countWords";

new cloud.Function(inflight () => {
let sentence = "I am a sentence with 7 words";
// invoking cloud.Function from inflight context
let wordsCount = countWords.invoke(sentence);
log("'${sentence}' has ${wordsCount} words");
}) as "Invoke Me";
```

## Target-specific details

TODO
### Simulator (`sim`)

The sim implementation of `cloud.Function` uses JavaScript's function

### AWS (`tf-aws` and `awscdk`)

The AWS implementation of `cloud.Function` uses [Amazon Lambda](https://aws.amazon.com/lambda/).

### Azure (`tf-azure`)

The Azure implementation of `cloud.Function` uses [Azure Function](https://azure.microsoft.com/en-us/products/function).

🚧 `invoke` API is not supported yet (tracking issue: [#1371](https://github.com/winglang/wing/issues/1371))

### GCP (`tf-gcp`)

🚧 Not supported yet (tracking issue: [#614](https://github.com/winglang/wing/issues/614))

## API Reference

The full list of APIs for `cloud.Function` is available in the [API Reference](../api-reference).
The full list of APIs for `cloud.Function` is available in the [API Reference](../api-reference).
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,63 @@ Queues are typically used to decouple producers of data and the consumers of sai

## Usage

TODO
### Setting a Queue Consumer

```ts playground
bring cloud;

let q = new cloud.Queue();

q.setConsumer(inflight (m: str) => {
log("messgae ${m} consumed")
});

new cloud.Function(inflight () => {
q.push("message a");
q.push("message b");
});
```

### Using Queue inflight api

Pusing messages, popping them, and purge
```ts playground
bring cloud;

let q = new cloud.Queue();

new cloud.Function(inflight () => {
q.push("message a");
q.push("message b");
q.push("message c");
q.push("message d");
log("approxSize is ${q.approxSize()}");
log("popping message ${q.pop()}");
log("popping message ${q.pop()}");
log("approxSize is ${q.approxSize()}");
q.purge();
log("approxSize is ${q.approxSize()}");
});
```

## Target-specific details

TODO
### Simulator (`sim`)

The sim implementation of `cloud.Queue` uses JavaScript's `Array`

### AWS (`tf-aws` and `awscdk`)

The AWS implementation of `cloud.Queue` uses [Amazon Simple Queue Service](https://aws.amazon.com/sqs/).

### Azure (`tf-azure`)

🚧 Not supported yet (tracking issue: [#617](https://github.com/winglang/wing/issues/617))

### GCP (`tf-gcp`)

🚧 Not supported yet (tracking issue: [#616](https://github.com/winglang/wing/issues/616))

## API Reference

The full list of APIs for `cloud.Queue` is available in the [API Reference](../api-reference).
The full list of APIs for `cloud.Queue` is available in the [API Reference](../api-reference).
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ The request's method.
| <code><a href="#@winglang/sdk.http.HttpMethod.DELETE">DELETE</a></code> | DELETE. |
| <code><a href="#@winglang/sdk.http.HttpMethod.PATCH">PATCH</a></code> | PATCH. |
| <code><a href="#@winglang/sdk.http.HttpMethod.POST">POST</a></code> | POST. |
| <code><a href="#@winglang/sdk.http.HttpMethod.OPTIONS">OPTIONS</a></code> | OPTIONS. |
| <code><a href="#@winglang/sdk.http.HttpMethod.HEAD">HEAD</a></code> | HEAD. |

---

Expand Down Expand Up @@ -441,6 +443,20 @@ POST.
---


##### `OPTIONS` <a name="OPTIONS" id="@winglang/sdk.http.HttpMethod.OPTIONS"></a>

OPTIONS.

---


##### `HEAD` <a name="HEAD" id="@winglang/sdk.http.HttpMethod.HEAD"></a>

HEAD.

---


### RequestCache <a name="RequestCache" id="@winglang/sdk.http.RequestCache"></a>

The cache mode of the request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import CodeComparison from '../src/components/CodeComparison';
| Testing | Same tests run on local simulator and cloud, without mocks | Need mocks for local testing | Need mocks for local testing | Need mocks for local testing |

## Anything else?
Creating a new language that is tailored to the cloud from the ground up also allows us to assemble a variety of features (some of which exist in other languages, of course) that, when put together, offer a delightful cloud development experience. You can read more about what these features are [here](https://docs.winglang.io/faq/good-fit).
Creating a new language that is tailored to the cloud from the ground up also allows us to assemble a variety of features (some of which exist in other languages, of course) that, when put together, offer a delightful cloud development experience. You can read more about what these features are [here](https://www.winglang.io/docs/faq/good-fit).



Expand Down
Loading

0 comments on commit e1f56b0

Please sign in to comment.