Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
fix: minor + crypto-js upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
einaralex committed Nov 8, 2023
1 parent 9304373 commit 89ee063
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
package-name: sdk
pull-request-header: "Monerium SDK release :rocket:"
prerelease: true
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{ "type": "revert", "section": "Reverts", "hidden": false }]'
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{ "type": "revert", "section": "Reverts", "hidden": false }, {"type":"docs","section":"Documentation","hidden":false}]'
# The logic below handles the npm publication:
- uses: actions/checkout@v3
# these if statements ensure that a publication only occurs when
Expand Down
20 changes: 10 additions & 10 deletions .pnp.cjs

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ cd ../your-project
yarn link "@monerium/sdk"
```

If you get an error that there is already a package called '@monerium/sdk' registered, but you can't find it and unlinking does nothing, remove it manually with `rm -rf ~/.config/yarn/link/@monerium` and try again.

```sh

#### Documentation

Refer to [Typedocs](https://typedoc.org/) syntaxes to use for this [documentation](https://monerium.github.io/sdk/).
Expand Down Expand Up @@ -390,3 +394,4 @@ Information about the software license.
---

This template is a comprehensive starting point. Each section should contain detailed information relevant to your SDK to guide your users from installation to effective usage and troubleshooting. Be sure to adjust the headers and content to suit your SDK's unique needs and features.
```
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@
"test:main": "jest",
"test:coverage": "yarn test --coverage"
},
"dependencies": {
"crypto-js": "^4.2.0"
},
"devDependencies": {
"@commitlint/cli": "^17.4.1",
"@commitlint/config-conventional": "^17.4.0",
"@types/crypto-js": "4.1.1",
"@types/crypto-js": "^4.2.1",
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"crypto-js": "4.1.1",
"dts-bundle-generator": "^7.1.0",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
10 changes: 7 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class MoneriumClient {
if (typeof envOrOptions === 'string') {
this.#env = MONERIUM_CONFIG.environments[envOrOptions];
} else {
this.#env = MONERIUM_CONFIG.environments[envOrOptions.env || 'sandbox'];
this.#env =
MONERIUM_CONFIG.environments[envOrOptions.environment || 'sandbox'];

if (!isServer) {
const { clientId, redirectUrl } =
Expand Down Expand Up @@ -130,7 +131,9 @@ export class MoneriumClient {
}

// TODO: TEST auto link & manual link + address
async connect(client: AuthorizationCodeCredentials | ClientCredentials) {
async connect(
client?: AuthorizationCodeCredentials | ClientCredentials,
): Promise<boolean> {
const clientId = client?.clientId || this.#client?.clientId;
const clientSecret =
(client as ClientCredentials)?.clientSecret ||
Expand All @@ -140,9 +143,10 @@ export class MoneriumClient {
if (!isServer) {
throw new Error('Only use client credentials on server side');
}
return this.#clientCredentialsAuthorization(
await this.#clientCredentialsAuthorization(
this.#client as ClientCredentials,
);
return !!this.bearerProfile;
}

const redirectUrl =
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export type MoneriumEventListener = (notification: OrderNotification) => void;
// };

export type ClassOptions = {
env?: ENV;
environment?: ENV;
} & BearerTokenCredentials;

export type AuthFlowOptions = {
Expand Down
6 changes: 6 additions & 0 deletions test/client.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/**
* @jest-environment jsdom
*/

// Login: [email protected]
// Password: Passw0rd!

// punkWallet: https://punkwallet.io/pk#0x30fa9f64fb85dab6b4bf045443e08315d6570d4eabce7c1363acda96042a6e1a

import 'jest-localstorage-mock';
import { MoneriumClient } from '../src/index';
import {
Expand Down
5 changes: 0 additions & 5 deletions test/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Login: [email protected]
// Password: Passw0rd!

// punkWallet: https://punkwallet.io/pk#0x30fa9f64fb85dab6b4bf045443e08315d6570d4eabce7c1363acda96042a6e1a

module.exports.APP_ONE_CREDENTIALS_CLIENT_ID =
'f99f7444-6dca-11ee-8aa6-5273f65ed05b';
module.exports.APP_ONE_CREDENTIALS_SECRET =
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"allowJs": true,
"outDir": "../../dist/out-tsc",
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"types": ["node", "vite/client"],
},
"include": ["src/**/*.ts", "src/**/*.js", "test/**/*.js", "test/**/*.ts"],
"include": ["src/**/**"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "./dist",
"module": "ESNext",
"target": "ESNext",
"types": ["jest", "node"]
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1276,11 +1276,11 @@ __metadata:
dependencies:
"@commitlint/cli": ^17.4.1
"@commitlint/config-conventional": ^17.4.0
"@types/crypto-js": 4.1.1
"@types/crypto-js": ^4.2.1
"@types/node": ^18.14.2
"@typescript-eslint/eslint-plugin": ^5.46.0
"@typescript-eslint/parser": ^5.46.0
crypto-js: 4.1.1
crypto-js: ^4.2.0
dts-bundle-generator: ^7.1.0
eslint: ^8.29.0
eslint-config-prettier: ^8.5.0
Expand Down Expand Up @@ -1524,10 +1524,10 @@ __metadata:
languageName: node
linkType: hard

"@types/crypto-js@npm:4.1.1":
version: 4.1.1
resolution: "@types/crypto-js@npm:4.1.1"
checksum: ea3d6a67b69f88baeb6af96004395903d2367a41bd5cd86306da23a44dd96589749495da50974a9b01bb5163c500764c8a33706831eade036bddae016417e3ea
"@types/crypto-js@npm:^4.2.1":
version: 4.2.1
resolution: "@types/crypto-js@npm:4.2.1"
checksum: 2111fb39a879e6c346a657cd4994534b8ff54d34dbfe45f82587e84165af0d9a3b8448c0d9a8ddabc81b5875295ea049462e7b969dbeb7cf24ae205e66dcf15a
languageName: node
linkType: hard

Expand Down Expand Up @@ -2639,10 +2639,10 @@ __metadata:
languageName: node
linkType: hard

"crypto-js@npm:4.1.1":
version: 4.1.1
resolution: "crypto-js@npm:4.1.1"
checksum: b3747c12ee3a7632fab3b3e171ea50f78b182545f0714f6d3e7e2858385f0f4101a15f2517e033802ce9d12ba50a391575ff4638c9de3dd9b2c4bc47768d5425
"crypto-js@npm:^4.2.0":
version: 4.2.0
resolution: "crypto-js@npm:4.2.0"
checksum: f051666dbc077c8324777f44fbd3aaea2986f198fe85092535130d17026c7c2ccf2d23ee5b29b36f7a4a07312db2fae23c9094b644cc35f7858b1b4fcaf27774
languageName: node
linkType: hard

Expand Down

0 comments on commit 89ee063

Please sign in to comment.