-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
21,256 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
target/ | ||
node_modules/ |
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,3 @@ | ||
target | ||
node_modules | ||
|
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Wing | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,66 @@ | ||
# wingdocs | ||
|
||
A markdown-based documentation system. Unsurprisingly, great for stuff like [the Wing Documentation](https://winglang.io/docs). | ||
|
||
## Prerequisites | ||
|
||
* [winglang](https://winglang.io). | ||
|
||
## Installation | ||
|
||
```sh | ||
npm i @winglibs/wingdocs | ||
``` | ||
|
||
## Usage | ||
|
||
Create `main.w`: | ||
|
||
```js | ||
bring wingdocs; | ||
|
||
new wingdocs.Site( | ||
source: "{@dirname}/docs", // location of your docs markdown tree | ||
title: "Dokidokidocs", | ||
// more configuration coming soon... | ||
); | ||
``` | ||
|
||
Create `docs/index.md`: | ||
|
||
```md | ||
Hello, I am your docs! | ||
``` | ||
|
||
Run in the simulator: | ||
|
||
```sh | ||
wing it | ||
``` | ||
|
||
Deploy to AWS (via CloudFront): | ||
|
||
```sh | ||
wing compile -t tf-aws | ||
cd target/main.tfaws | ||
terraform init | ||
terraform apply | ||
``` | ||
|
||
(You'll need AWS credentials) | ||
|
||
## Roadmap | ||
|
||
- Blog | ||
- Additional sections ("contributing") | ||
- Winglibs documentation (with API docs) | ||
- Patterns | ||
- Playground | ||
- Multi-language | ||
- Learn (guided tutorials) | ||
- Patterns | ||
|
||
|
||
## License | ||
|
||
This library is licensed under the [MIT License](./LICENSE). |
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,22 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
.history | ||
|
||
# Misc | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,57 @@ | ||
const axios = require('axios'); | ||
const dayjs = require('dayjs'); | ||
|
||
const channelWebhook = 'https://hooks.slack.com/services/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'; | ||
|
||
/** | ||
* Handler that will be called during the execution of a PostLogin flow. | ||
* | ||
* @param {Event} event - Details about the user and the context in which they are logging in. | ||
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login. | ||
*/ | ||
exports.onExecutePostLogin = async (event, api) => { | ||
console.info('user_id: ', event.user.user_id); | ||
console.info('client_id: ', event.client.client_id); | ||
|
||
if (event.client.name !== 'Docs') { | ||
console.info('Not logging into Docs, so not notifying anything'); | ||
return; | ||
} | ||
|
||
const user = event.user; | ||
if (dayjs(event.user.created_at) < dayjs().subtract(1, 'minute') || event.stats.logins_count > 1) { | ||
return; | ||
} | ||
|
||
const encodedUserUri = Buffer.from(encodeURIComponent(user.user_id)).toString('base64').replace(/=/gi, ''); | ||
|
||
console.info({user}); | ||
const prompt = `A new user, ${user.email}, has tried logging into the Docs site!`; | ||
await axios.post(channelWebhook, { | ||
text: prompt, | ||
blocks: [ | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'plain_text', | ||
text: 'Should this user have access to the Wing Alpha?' | ||
} | ||
}, | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'plain_text', | ||
text: prompt | ||
} | ||
}, | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'mrkdwn', | ||
text: `https://manage.auth0.com/dashboard/us/dev-9zrd68w6/users/${encodedUserUri}` | ||
} | ||
} | ||
] | ||
}); | ||
|
||
}; |
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 @@ | ||
function addRoles(user, context, callback) { | ||
const namespace = 'https://winglang.io'; | ||
const assignedRoles = (context.authorization || {}).roles; | ||
|
||
let idTokenClaims = context.idToken || {}; | ||
let accessTokenClaims = context.accessToken || {}; | ||
|
||
idTokenClaims[`${namespace}/roles`] = assignedRoles; | ||
accessTokenClaims[`${namespace}/roles`] = assignedRoles; | ||
|
||
context.idToken = idTokenClaims; | ||
context.accessToken = accessTokenClaims; | ||
|
||
callback(null, user, context); | ||
} |
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,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
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,3 @@ | ||
[ | ||
"latest" | ||
] |
Oops, something went wrong.