Skip to content

Commit

Permalink
docs: adding docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
manchuck committed Jan 11, 2024
1 parent 8463ed3 commit 9d4ed2d
Show file tree
Hide file tree
Showing 937 changed files with 22,284 additions and 5,219 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"plugin:jest-formatting/recommended",
"prettier"
],
"ignorePatterns": ["**/__tests__/**"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
Expand Down Expand Up @@ -62,10 +63,11 @@
"error",
{
"code": 80,
"comments": 120,
"ignoreUrls": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
"ignorePattern": "^import.+|test"
"ignorePattern": "^import.+|test|@"
}
]
}
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Documentation

on:
push:
branches:
- 3.x

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install packages
run: npm install

- name: Build Typedoc
run: npm run typedoc

- name: Build example markdown
run: node scripts/generateExample.mjs


- name: Upload Documentation to Wiki
uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: "docs"
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_WIKI_PERSONAL_ACCESS_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages/**/dist
tsconfig.tsbuildinfo
lerna-debug.log
package-lock.json
docs
5 changes: 0 additions & 5 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ const config: Config.InitialOptions = {
testMatch: ['<rootDir>/packages/verify2/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
displayName: 'VETCH',
testMatch: ['<rootDir>/packages/vetch/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
displayName: 'VIDEO',
testMatch: ['<rootDir>/packages/video/__tests__/**/*.test.ts'],
Expand Down
193 changes: 108 additions & 85 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,90 +1,113 @@
{
"name": "@vonage/server-sdk-monorepo",
"private": true,
"description": "Vonage Server SDK for Node.js. API support for SMS, Voice Calls, Text-to-Speech, Numbers, Verify (2FA) and more.",
"keywords": [
"sms",
"voice",
"vonage",
"verify",
"2fa",
"phone numbers"
],
"homepage": "https://github.com/vonage/vonage-node-sdk",
"repository": {
"type": "git",
"url": "git://github.com/vonage/vonage-node-sdk.git"
},
"license": "Apache 2.0",
"author": "vonage",
"contributors": [
"kellyjandrews"
],
"workspaces": [
"packages/*"
],
"scripts": {
"bootstrap": "npx lerna bootstrap",
"build": "lerna run build",
"clean": "lerna run clean",
"compile": "lerna run compile",
"depcheck": "lerna exec --no-bail --stream --prefix npx depcheck -- --ignore-dirs=dist",
"eslint": "eslint",
"format": "prettier -- -w",
"jest": "jest",
"lerna": "lerna",
"lint": "eslint .",
"lint:fix": "eslint -- . --fix",
"prepare": "is-ci || husky install",
"publish": "lerna publish",
"test": "jest",
"test:watch": "jest --watch",
"tsc": "tsc"
"$schema": "https://json.schemastore.org/package.json",
"name": "@vonage/server-sdk-monorepo",
"private": true,
"description": "Vonage Server SDK for Node.js. API support for SMS, Voice Calls, Text-to-Speech, Numbers, Verify (2FA) and more.",
"keywords": [
"sms",
"voice",
"vonage",
"verify",
"2fa",
"phone numbers"
],
"homepage": "https://github.com/vonage/vonage-node-sdk",
"repository": {
"type": "git",
"url": "git://github.com/vonage/vonage-node-sdk.git"
},
"license": "Apache 2.0",
"author": "vonage",
"contributors": [
{
"name": "Kelly Andrews",
"url": "https://github.com/kellyjandrews"
},
"lint-staged": {
"package.json": [
"npx sort-package-json"
],
"*.js": [
"prettier -w",
"eslint --fix"
],
"*.ts": [
"prettier -w",
"eslint --fix"
]
{
"name": "Chuck \"MANCHUCK\" Reeves",
"url": "https://github.com/manchuck"
},
"devDependencies": {
"@babel/core": "7.23.2",
"@babel/plugin-transform-modules-commonjs": "^7.23.0",
"@babel/plugin-transform-typescript": "7.22.15",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"@babel/types": "^7.23.0",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.4",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"babel-jest": "29.7.0",
"babel-plugin-module-resolver": "5.0.0",
"eslint": "8.51.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-deprecation": "2.0.0",
"eslint-plugin-jest": "27.4.2",
"eslint-plugin-jest-extended": "2.0.0",
"eslint-plugin-jest-formatting": "3.1.0",
"eslint-plugin-prettier": "5.0.1",
"husky": "^8.0.3",
"is-ci": "3.0.1",
"jest": "^29.7.0",
"lerna": "^7.3.1",
"lerna-changelog": "^2.2.0",
"lint-staged": "14.0.1",
"nock": "^13.3.4",
"prettier": "3.0.3",
"prettier-eslint": "15.0.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2"
{
"name": "Chris Tankersley",
"url": "https://github.com/dragonmantank"
}
],
"workspaces": [
"packages/*"
],
"scripts": {
"bootstrap": "npx lerna bootstrap",
"build": "lerna run build",
"clean": "lerna run clean",
"compile": "lerna run compile",
"depcheck": "lerna exec --no-bail --stream --prefix npx depcheck -- --ignore-dirs=dist",
"eslint": "eslint",
"format": "prettier -- -w",
"jest": "jest",
"lerna": "lerna",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"prepare": "is-ci || husky install",
"publish": "lerna publish",
"test": "jest",
"test:watch": "jest --watch",
"tsc": "tsc",
"typedoc": "typedoc"
},
"lint-staged": {
"package.json": [
"npx sort-package-json"
],
"*.js": [
"prettier -w",
"eslint --fix"
],
"*.ts": [
"prettier -w",
"eslint --fix"
]
},
"dependencies": {
"@droppedcode/typedoc-plugin-copy-assets": "1.0.10"
},
"devDependencies": {
"@babel/core": "7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/plugin-transform-typescript": "7.22.15",
"@babel/preset-env": "7.22.5",
"@babel/preset-typescript": "7.22.5",
"@babel/types": "^7.22.5",
"@mxssfd/typedoc-theme": "1.1.3",
"@tsconfig/node16": "16.1.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.4",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"babel-jest": "29.7.0",
"babel-plugin-module-resolver": "5.0.0",
"eslint": "8.51.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-deprecation": "2.0.0",
"eslint-plugin-jest": "27.4.2",
"eslint-plugin-jest-extended": "2.0.0",
"eslint-plugin-jest-formatting": "3.1.0",
"eslint-plugin-prettier": "5.0.1",
"husky": "^8.0.3",
"is-ci": "3.0.1",
"jest": "^29.7.0",
"lerna": "^7.3.1",
"lerna-changelog": "^2.2.0",
"lint-staged": "14.0.1",
"nock": "^13.3.4",
"prettier": "3.0.3",
"prettier-eslint": "15.0.1",
"recursive-iterator": "3.3.0",
"ts-node-dev": "^2.0.0",
"typedoc": "0.25.2",
"typedoc-github-wiki-theme": "1.1.0",
"typedoc-plugin-markdown": "3.17.1",
"typedoc-plugin-merge-modules": "5.1.0",
"typescript": "^5.1.3"
}
}
35 changes: 23 additions & 12 deletions packages/accounts/__tests__/accounts.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import nock from 'nock';
import { Accounts } from '../lib/index'
import { Accounts } from '../lib/index';
import { Auth } from '@vonage/auth';

describe('accounts', () => {
let client;

beforeEach(() => {
client = new Accounts(new Auth({ apiKey: 'abcd', apiSecret: '1234' }));
client = new Accounts(new Auth({ apiKey: 'abcd', apiSecret: '1234' }));
});

afterEach(() => {
client = null;
client = null;
});

test("get balance", async () => {
const expectedResponse = {
"value": 10.28,
"autoReload": false
"autoReload": false,
};

nock("https://rest.nexmo.com")
Expand All @@ -33,7 +33,7 @@ describe('accounts', () => {
test("top up balance", async () => {
const expectedResponse = {
"error-code": "200",
"error-code-label": "success"
"error-code-label": "success",
};

nock("https://rest.nexmo.com")
Expand All @@ -42,21 +42,28 @@ describe('accounts', () => {
.query({ api_key: 'abcd', api_secret: '1234' })
.reply(200, expectedResponse);

const lookup = await client.topUpBalance('8ef2447e69604f642ae59363aa5f781b');
const lookup = await client.topUpBalance(
'8ef2447e69604f642ae59363aa5f781b',
);
expect(lookup['error-code']).toEqual(expectedResponse['error-code']);
expect(lookup['error-code-label']).toEqual(expectedResponse['error-code-label']);
expect(
lookup['error-code-label'],
).toEqual(expectedResponse['error-code-label']);
});

test("update callbacks", async () => {
const expectedResponse = {
"mo-callback-url": "https://example.com/webhooks/inbound-sms",
"dr-callback-url": "https://example.com/webhooks/delivery-receipt",
"mo-callback-url": "https://example.com/webhooks/inbound-sms",
"max-outbound-request": 30,
"max-inbound-request": 30,
"max-calls-per-second": 30
"max-calls-per-second": 30,
};

const callbacks = {moCallBackUrl: "https://example.com/webhooks/inbound-sms", drCallBackUrl: "https://example.com/webhooks/delivery-receipt"};
const callbacks = {
drCallBackUrl: "https://example.com/webhooks/delivery-receipt",
moCallBackUrl: "https://example.com/webhooks/inbound-sms",
};
const queryString = new URLSearchParams(callbacks);
const re = new RegExp(queryString.toString(), "g");

Expand All @@ -67,7 +74,11 @@ describe('accounts', () => {
.reply(200, expectedResponse);

const lookup = await client.updateAccountCallbacks(callbacks);
expect(lookup['mo-callback-url']).toEqual(expectedResponse['mo-callback-url']);
expect(lookup['dr-callback-url']).toEqual(expectedResponse['dr-callback-url']);
expect(
lookup['mo-callback-url'],
).toEqual(expectedResponse['mo-callback-url']);
expect(
lookup['dr-callback-url'],
).toEqual(expectedResponse['dr-callback-url']);
});
});
Loading

0 comments on commit 9d4ed2d

Please sign in to comment.