Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio committed Dec 15, 2021
1 parent 49218ba commit 8fea200
Show file tree
Hide file tree
Showing 28 changed files with 198 additions and 93 deletions.
8 changes: 4 additions & 4 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ tasks:
npm install
command: |
gp open .gitpod.readme.md
gp sync-await server-up
cd hello-world
sleep 30
npm run start.watch
- name: Run Hello World Workflow
init: |
alias tctl="docker exec temporal-admin-tools tctl"
echo "tctl configured! try typing tctl -v" # can't run tctl directly from gitpod.yml
command: |
cd hello-world
until npm run workflow; do sleep 5; done; # "sleep until temporal is actually up"
gp sync-done server-up
gp preview http://localhost:8088 # open up Temporal Web to show new workflow
sleep 30
npm run workflow # run workflow again for user's easy access
sleep 5
gp preview http://localhost:8088 # open up Temporal Web to show new workflow
openMode: split-right
- name: Temporal Server
init: docker-compose pull
Expand Down
4 changes: 2 additions & 2 deletions .shared/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ module.exports = {

// code style preference
'object-shorthand': ['error', 'always'],
// relaxed rules, for convenience

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand Down
11 changes: 8 additions & 3 deletions activities-cancellation-heartbeating/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions activities-dependency-injection/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions activities-examples/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions activities-sticky-queues/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions child-workflows/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions continue-as-new/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions cron-workflows/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions dsl-interpreter/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
5 changes: 1 addition & 4 deletions dsl-interpreter/src/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ export async function DSLInterpreter(dsl: DSL): Promise<unknown> {
return await execute(dsl.root, bindings);
}

async function execute(
statement: Statement,
bindings: Record<string, string | undefined>
): Promise<void> {
async function execute(statement: Statement, bindings: Record<string, string | undefined>): Promise<void> {
// note that this function returns void
// we don't assign the results here - all results must be declared+bound in the activity DSL
if ('parallel' in statement) {
Expand Down
11 changes: 8 additions & 3 deletions expense/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions hello-world-mtls/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions hello-world/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
8 changes: 5 additions & 3 deletions hello-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ The [Hello World Tutorial](https://docs.temporal.io/docs/typescript/hello-world/
1. Make sure Temporal Server is running locally (see the [quick install guide](https://docs.temporal.io/docs/server/quick-install/)).
1. `npm install` to install dependencies.
1. `npm run start.watch` to start the Worker.
1. In another shell, `npm run workflow` to run the Workflow.
1. In another shell, `npm run workflow` to run the Workflow Client.

The Workflow should return:
The client should log the Workflow ID that is started, and you should see it reflected in Temporal Web UI.

```
Optionally, you can also uncomment the `await handle.result()`, rerun, and see the client script return:

```bash
Hello, Temporal!
```
6 changes: 4 additions & 2 deletions hello-world/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ async function run() {
});

// Invoke the `example` Workflow, only resolved when the workflow completes
const result = await client.execute(example, {
const handle = await client.start(example, {
args: ['Temporal'], // type inference works! args: [name: string]
taskQueue: 'tutorial',
workflowId: 'my-business-id',
});
console.log(result); // Hello, Temporal!
console.log(`Started workflow ${handle.workflowId}`);
// optional: wait for client result
// console.log(await handle.result()); // Hello, Temporal!
}

run().catch((err) => {
Expand Down
11 changes: 8 additions & 3 deletions instrumentation/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
11 changes: 8 additions & 3 deletions interceptors-opentelemetry/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = {
'prettier',
],
rules: {
// recommended for safety
'@typescript-eslint/no-floating-promises': 'error', // forgetting to await Activities and Workflow APIs is bad
'deprecation/deprecation': 'warn',

// code style preference
'object-shorthand': ['error', 'always'],

// relaxed rules, for convenience
'@typescript-eslint/no-unused-vars': [
'warn',
{
Expand All @@ -21,8 +29,5 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'object-shorthand': ['error', 'always'],
'deprecation/deprecation': 'warn',
},
};
Loading

0 comments on commit 8fea200

Please sign in to comment.