From 674e812c627046e05b5f94e71690a7062fc77b51 Mon Sep 17 00:00:00 2001 From: Azeemuddin Aziz Date: Sun, 23 Feb 2025 22:43:09 +0530 Subject: [PATCH] Postman Snap In | Team: Qubit | By: Azeemuddin Aziz --- postman-snap-in/README.md | 153 + postman-snap-in/code/.eslintrc.js | 35 + postman-snap-in/code/.gitignore | 48 + postman-snap-in/code/.npmrc | 1 + postman-snap-in/code/.prettierignore | 4 + postman-snap-in/code/.prettierrc | 15 + postman-snap-in/code/babel.config.js | 3 + postman-snap-in/code/jest.config.js | 12 + postman-snap-in/code/nodemon.json | 5 + postman-snap-in/code/package-lock.json | 14521 ++++++++++++++++ postman-snap-in/code/package.json | 73 + postman-snap-in/code/src/function-factory.ts | 12 + .../create_collection_article/index.ts | 151 + .../functions/run_postman_collection/index.ts | 144 + .../src/functions/show_collections/index.ts | 77 + postman-snap-in/code/src/index.ts | 1 + postman-snap-in/code/src/main.ts | 27 + .../code/src/test-runner/test-runner.ts | 27 + postman-snap-in/code/test/http_client.ts | 52 + postman-snap-in/code/test/main.ts | 29 + postman-snap-in/code/test/runner.ts | 294 + postman-snap-in/code/test/types.ts | 87 + postman-snap-in/code/tsconfig.eslint.json | 4 + postman-snap-in/code/tsconfig.json | 24 + postman-snap-in/manifest.yaml | 123 + 25 files changed, 15922 insertions(+) create mode 100644 postman-snap-in/README.md create mode 100644 postman-snap-in/code/.eslintrc.js create mode 100644 postman-snap-in/code/.gitignore create mode 100644 postman-snap-in/code/.npmrc create mode 100644 postman-snap-in/code/.prettierignore create mode 100644 postman-snap-in/code/.prettierrc create mode 100644 postman-snap-in/code/babel.config.js create mode 100644 postman-snap-in/code/jest.config.js create mode 100644 postman-snap-in/code/nodemon.json create mode 100644 postman-snap-in/code/package-lock.json create mode 100644 postman-snap-in/code/package.json create mode 100644 postman-snap-in/code/src/function-factory.ts create mode 100644 postman-snap-in/code/src/functions/create_collection_article/index.ts create mode 100644 postman-snap-in/code/src/functions/run_postman_collection/index.ts create mode 100644 postman-snap-in/code/src/functions/show_collections/index.ts create mode 100644 postman-snap-in/code/src/index.ts create mode 100644 postman-snap-in/code/src/main.ts create mode 100644 postman-snap-in/code/src/test-runner/test-runner.ts create mode 100644 postman-snap-in/code/test/http_client.ts create mode 100644 postman-snap-in/code/test/main.ts create mode 100644 postman-snap-in/code/test/runner.ts create mode 100644 postman-snap-in/code/test/types.ts create mode 100644 postman-snap-in/code/tsconfig.eslint.json create mode 100644 postman-snap-in/code/tsconfig.json create mode 100644 postman-snap-in/manifest.yaml diff --git a/postman-snap-in/README.md b/postman-snap-in/README.md new file mode 100644 index 0000000..5e10102 --- /dev/null +++ b/postman-snap-in/README.md @@ -0,0 +1,153 @@ +## DevRev Snaps TypeScript Template + +This repository contains a template for the functions that can be deployed as +part of Snap-Ins. + +For reference on snap-ins, refer to the [documentation](https://github.com/devrev/snap-in-docs). + +### Getting started with the template + +1. Create a new repository using this template. +2. In the new repository, you can add functions at the path `src/functions` where the folder name corresponds to the function name in your manifest file. +3. Ensure to include each new function in the file named "src/function-factory.ts". + +### Testing locally + +To test your code locally, add test events under 'src/fixtures' following the example event provided. Additionally, you can include keyring values in the event payload to test API calls.``` + +After adding the event, execute the following commands to test your code: + +``` +npm install +npm run start -- --functionName=on_work_creation --fixturePath=on_work_created_event.json +``` + +### Adding external dependencies + +You can also add dependencies on external packages to package.json under the “dependencies” key. These dependencies will be made available to your function at runtime and during testing. + +### Linting + +To check for lint errors, run the following command: + +```bash +npm run lint +``` + +To automatically fix fixable lint errors, run: + +```bash +npm run lint:fix +``` + +### Deploying Snap-ins + +Once you are done with the testing, run the following commands to deploy your snap-in: + +1. Authenticate to devrev CLI, run the following command: + +``` +devrev profiles authenticate --org --usr +``` + +2. To create a snap_in_version, run the following command: + +``` +devrev snap_in_version create-one --path