Skip to content

Commit

Permalink
next release (#311)
Browse files Browse the repository at this point in the history
* Bump eslint-plugin-jsdoc from 46.5.1 to 48.2.6

Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 46.5.1 to 48.2.6.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](gajus/eslint-plugin-jsdoc@v46.5.1...v48.2.6)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* #285: allow customizing headers for patch, put and post calls

this is a copy of what phjulia pushed earlier but with fixed jsdocs

* #285: eslint -fix

* #285: upgrade eslint, eslint-config-prettier, eslint-plugin-prettier, eslint-plugin-unicorn, prettier-eslint; add prettier

* #285: jsdoc rules copied from mcdev

* #300: fixing bad jsdocs that break typescript tests

* #300: enable typescript validation

* #300: fixes for typescript validation

* #300: add exports section in package.json

* #300: add automatic d.ts generation and update husky

* #309: fix postcheck failing on checkout of develop branch

* #309: auto-run npm install if changes to package-lock were found

* Bump sinon from 15.2.0 to 18.0.0

Bumps [sinon](https://github.com/sinonjs/sinon) from 15.2.0 to 18.0.0.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](sinonjs/sinon@v15.2.0...v18.0.0)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-plugin-prettier from 5.0.0 to 5.1.3

Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 5.0.0 to 5.1.3.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](prettier/eslint-plugin-prettier@v5.0.0...v5.1.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump axios-mock-adapter from 1.21.5 to 1.22.0

Bumps [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) from 1.21.5 to 1.22.0.
- [Release notes](https://github.com/ctimmerm/axios-mock-adapter/releases)
- [Changelog](https://github.com/ctimmerm/axios-mock-adapter/blob/master/CHANGELOG.md)
- [Commits](ctimmerm/axios-mock-adapter@v1.21.5...v1.22.0)

---
updated-dependencies:
- dependency-name: axios-mock-adapter
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump assert from 2.0.0 to 2.1.0

Bumps [assert](https://github.com/browserify/commonjs-assert) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/browserify/commonjs-assert/releases)
- [Changelog](https://github.com/browserify/commonjs-assert/blob/main/CHANGELOG.md)
- [Commits](browserify/commonjs-assert@v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: assert
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* #318 EsLint Update plus General Actions Update (#319)

* #318 EsLint Update plus General Actions Update

* #318 intent issue and dep update

---------

Co-authored-by: Douglas Midgley <douglas.midgley@accenture.com>

* Chores/318 update eslint (#335)

* #318 EsLint Update plus General Actions Update

* #318 intent issue and dep update

* #318: restrict eslint scope and general update

---------

Co-authored-by: Douglas Midgley <douglas.midgley@accenture.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Doug Midgley <douglasmidgley@gmail.com>
Co-authored-by: Douglas Midgley <douglas.midgley@accenture.com>
  • Loading branch information
4 people committed Jul 1, 2024
1 parent 143abbc commit 4b2c741
Show file tree
Hide file tree
Showing 34 changed files with 3,378 additions and 2,656 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

60 changes: 0 additions & 60 deletions .eslintrc.json

This file was deleted.

10 changes: 3 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ jobs:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
16 changes: 10 additions & 6 deletions .github/workflows/prvalidation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v4
- uses: TimonVS/pr-labeler-action@v5
with:
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
runs-on: ubuntu-latest

strategy:
matrix:
node: [18, 20, 22]
name: Run Tests with node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
node-version: ${{ matrix.node }}
- run: npm install
- run: npm run lint
- run: npm run test
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
registry-url: https://registry.npmjs.org/
- uses: HarmvZ/set-package-json-version-action@v0.2.5
with:
Expand Down
4 changes: 1 addition & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
INPUT_FILE=$1
START_LINE=`head -n1 $INPUT_FILE`
PATTERN="^(#[[:digit:]]|Merge)"
PATTERN="^(#[[:digit:]]|Merge|Revert)"

if ! [[ "$START_LINE" =~ $PATTERN ]] ; then
echo "Bad commit message, see example: \"#431 commit message\", you provided: \"$START_LINE\""
Expand Down
38 changes: 34 additions & 4 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
#!/bin/sh
# ### git commit message template ###
git config commit.template .git/templatemessage
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '((feature|bug|bugfix|fix|hotfix|task|chore)\/)\K\d{1,7}'`
echo "[POST_CHECKOUT] Setting template commit to $TICKETID"
echo "#$TICKETID: " > ".git/templatemessage"
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '^((feature|bug|bugfix|fix|hotfix|task|chore)\/)?\K\d{1,7}' || true`
if [ -z "$TICKETID" ]
then
TICKETID="0"
fi
TEMPLATE="#$TICKETID: "
echo "[POST_CHECKOUT] Setting template commit to '$TEMPLATE'"
# wrap $TEMPLATE in quotes or else it is trimmed automatically
echo "$TEMPLATE" > ".git/templatemessage"


# ### run npm install ###
echo "[POST-CHECKOUT] 📦 Checking for changes to dependencies"
# define how to split strings into array elements
IFS=$'\n'
# $1 is the new HEAD pointer
NEWHEAD=$1
# $2 is the previous HEAD pointer
OLDHEAD=$2
# extract all paths to package-lock.json files
PACKAGE_LOCK_REGEX="(^package-lock\.json)"
PACKAGES=$(git diff --name-only $NEWHEAD $OLDHEAD | grep -E $PACKAGE_LOCK_REGEX || true)

if [[ ${PACKAGES[@]} ]]; then
for package in $PACKAGES; do
echo "📦 $package was changed."
done
echo "📦 Running npm install to update your dependencies..."
npm install
npm run lint:fix
else
echo "📦 All packages up-to-date. No need to run npm install."
fi
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# update typescript type declarations
npx tsc
git add @types
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"tabWidth": 4,
"printWidth": 100,
"singleQuote": true
"singleQuote": true,
"trailingComma": "es5"
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
"editor.defaultFormatter": "esbenp.prettier-vscode",
"js/ts.implicitProjectConfig.checkJs": true,
"javascript.validate.enable": true,
"eslint.useESLintClass": true
}
46 changes: 46 additions & 0 deletions @types/auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Class which handles authentication logic
*/
export default class Auth {
/**
* Creates an instance of Auth.
*
* @param {object} authObject Auth Payload
* @param {string} authObject.client_id Client Id from SFMC config
* @param {string} authObject.client_secret Client Secret from SFMC config
* @param {number} authObject.account_id MID of Business Unit used for API Calls
* @param {string} authObject.auth_url Auth URL from SFMC config
* @param {string[]} [authObject.scope] Array of scopes used for requests
* @param {object} options options for the SDK as a whole, for example collection of handler functions, or retry settings
*/
constructor(authObject: {
client_id: string;
client_secret: string;
account_id: number;
auth_url: string;
scope?: string[];
}, options: object);
authObject: {
client_id: string;
client_secret: string;
account_id: number;
auth_url: string;
scope?: string[];
};
options: any;
/**
*
*
* @param {boolean} [forceRefresh] used to enforce a refresh of token
* @param {number} [remainingAttempts] number of retries in case of issues
* @returns {Promise.<object>} current session information
*/
getAccessToken(forceRefresh?: boolean, remainingAttempts?: number): Promise<object>;
/**
* Helper to get back list of scopes supported by SDK
*
* @returns {string[]} array of potential scopes
*/
getSupportedScopes(): string[];
}
//# sourceMappingURL=auth.d.ts.map
1 change: 1 addition & 0 deletions @types/auth.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Class main handler for the SDK
*/
export default class SDK {
/**
* Creates an instance of SDK.
*
* @param {object} authObject Auth Object for making requests
* @param {object} [options] options for the SDK as a whole, for example collection of handler functions, or retry settings
* @param {number} [options.requestAttempts] number of retries which should be done, defaulted to 1
* @param {boolean} [options.retryOnConnectionError] should request be retried in case of connection issues
* @param {object} [options.eventHandlers] collection of functions which are executed on certain events
*/
constructor(authObject: object, options?: {
requestAttempts?: number;
retryOnConnectionError?: boolean;
eventHandlers?: object;
});
auth: Auth;
rest: Rest;
soap: Soap;
}
import Auth from './auth.js';
import Rest from './rest.js';
import Soap from './soap.js';
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions @types/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions @types/rest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* Class which handles rest endpoints
*/
export default class Rest {
/**
* Constuctor of Rest object
*
* @function Object() { [native code] }
* @param {object} authObject Auth object used for initializing
* @param {object} options options for the SDK as a whole, for example collection of handler functions, or retry settings
*/
constructor(authObject: object, options: object);
auth: any;
options: any;
transactionalApis: string[];
/**
* Method that makes the GET API request
*
* @param {string} url of the resource to retrieve
* @returns {Promise.<object>} API response
*/
get(url: string): Promise<object>;
/**
* helper for {@link this.getBulk} to determine if the url is a transactional message API
*
* @private
* @param {string} url url without query params
* @returns {boolean} true if the url is a transactional message API
*/
private _isTransactionalMessageApi;
/**
* helper for {@link this.getBulk} to determine if the url is a legacy API
*
* @private
* @param {string} url url without query params
* @returns {boolean} true if the url is a legacy API
*/
private _isLegacyApi;
/**
* Method that makes paginated GET API Requests using $pageSize and $page parameters
*
* @param {string} url of the resource to retrieve
* @param {number} [pageSize] of the response, defaults to 50
* @param {string} [iteratorField] attribute of the response to iterate over (only required if it's not 'items'|'definitions'|'entry')
* @returns {Promise.<object>} API response combined items
*/
getBulk(url: string, pageSize?: number, iteratorField?: string): Promise<object>;
/**
* Method that makes a GET API request for each URL (including rate limiting)
*
* @param {string[]} urlArray of the resource to retrieve
* @param {number} [concurrentLimit] number of requests to execute at once
* @returns {Promise.<Array>} API response
*/
getCollection(urlArray: string[], concurrentLimit?: number): Promise<any[]>;
/**
* Method that makes the POST api request
*
* @param {string} url of the resource to create
* @param {object} payload for the POST request body
* @param {object} [headers] optional headers to include in the request; note that Authorization-header is always overwritten
* @returns {Promise.<object>} API response
*/
post(url: string, payload: object, headers?: object): Promise<object>;
/**
* Method that makes the PUT api request
*
* @param {string} url of the resource to replace
* @param {object} payload for the PUT request body
* @param {object} [headers] optional headers to include in the request; note that Authorization-header is always overwritten
* @returns {Promise.<object>} API response
*/
put(url: string, payload: object, headers?: object): Promise<object>;
/**
* Method that makes the PATCH api request
*
* @param {string} url of the resource to update
* @param {object} payload for the PATCH request body
* @param {object} [headers] optional headers to include in the request; note that Authorization-header is always overwritten
* @returns {Promise.<object>} API response
*/
patch(url: string, payload: object, headers?: object): Promise<object>;
/**
* Method that makes the DELETE api request
*
* @param {string} url of the resource to delete
* @returns {Promise.<object>} API response
*/
delete(url: string): Promise<object>;
/**
* Method that makes the api request
*
* @param {object} requestOptions configuration for the request including body
* @param {number} remainingAttempts number of times this request should be reattempted in case of error
* @param {object} [headers] optional headers to include in the request; note that Authorization-header is always overwritten
* @returns {Promise.<object>} Results from the Rest request in Object format
*/
_apiRequest(requestOptions: object, remainingAttempts: number, headers?: object): Promise<object>;
}
//# sourceMappingURL=rest.d.ts.map
1 change: 1 addition & 0 deletions @types/rest.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b2c741

Please sign in to comment.