Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add 3P workflow operations #31

Merged
merged 9 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 14-operations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Snap-in containing custom operations

The snap-in contains custom operations which can be used in the Workflow Builder once snap-in gets successfully activated.

Operations are workflow node blueprint which are used to create workflow steps.

## Operations in the snap-in

The snap-in contains the following operations:

- Get temperature: Prints the temperature of city from a map of temperatures in the backend. Shows how to override context in an operation

- Post comment on Ticket: Posts a specific comment only on tickets. Shows the usage of the DevRev SDK.

- Send slack message: Posts a message to specified slack channel. Shows the usage of keyrings to connect to external systems.
35 changes: 35 additions & 0 deletions 14-operations/code/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
extends: 'airbnb-typescript/base',
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', // Makes ESLint and Prettier play nicely together
'plugin:import/recommended',
'plugin:import/typescript',
],
ignorePatterns: ['**/dist/*'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: ['prettier', 'unused-imports', 'import', 'simple-import-sort', 'sort-keys-fix'],
root: true,
rules: {
'import/first': 'error', // Ensures all imports are at the top of the file
'import/newline-after-import': 'error', // Ensures there’s a newline after the imports
'import/no-duplicates': 'error', // Merges import statements from the same file
'import/order': 'off', // Not compatible with simple-import-sort
'no-unused-vars': 'off', // Handled by @typescript-eslint/no-unused-vars
'simple-import-sort/exports': 'error', // Auto-formats exports
'simple-import-sort/imports': 'error', // Auto-formats imports
'sort-imports': 'off', // Not compatible with simple-import-sort
'sort-keys-fix/sort-keys-fix': ['error', 'asc', { natural: true }], // Sorts long object key lists alphabetically
'unused-imports/no-unused-imports': 'error', // Removes unused imports automatically,
'@typescript-eslint/no-explicit-any': 'warn', // Allows any type with a warning
},
overrides:[{
"files": ["**/*.test.ts"],
"rules": {
'simple-import-sort/imports': 'off', // for test files we would want to load the mocked up modules later so on sorting the mocking mechanism will not work
}
}]
};
39 changes: 39 additions & 0 deletions 14-operations/code/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# Testing
coverage/

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# System Files
.DS_Store
Thumbs.db

deps.json
results.json
before-run-data.json

# packaged app
*.tar.gz
1 change: 1 addition & 0 deletions 14-operations/code/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
4 changes: 4 additions & 0 deletions 14-operations/code/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting

/dist

15 changes: 15 additions & 0 deletions 14-operations/code/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"proseWrap": "never",
"htmlWhitespaceSensitivity": "strict",
"endOfLine": "lf",
"organizeImportsSkipDestructiveCodeActions": true
}
3 changes: 3 additions & 0 deletions 14-operations/code/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};
12 changes: 12 additions & 0 deletions 14-operations/code/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageThreshold: {
"**/*": {
branches: 60
}
},
coverageReporters: ['text'],
preset: 'ts-jest',
testEnvironment: 'node'
};
5 changes: 5 additions & 0 deletions 14-operations/code/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"execMap": {
"ts": "ts-node"
}
}
Loading