Skip to content

Commit

Permalink
Fix/the way bs58 is imported (#305)
Browse files Browse the repository at this point in the history
* Use 'import' to get 'bs58' into the codebase

* Version bump up

* Update the changelog

* Update @meeco/vc-api-sdk

* 7.4.0 - fix import of the form-data library

* 7.5.0 - fix import of the chalk library

---------

Co-authored-by: Linas Išganaitis <linas.isganaitis@meeco.me>
  • Loading branch information
linasi and Linas Išganaitis authored Oct 9, 2024
1 parent 0b30339 commit c93151a
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 35 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@meeco/cryppo": "2.0.2",
"@meeco/file-storage-node": "5.0.4",
"@meeco/keystore-api-sdk": "10.1.1-develop.20230816154849.c7c2018",
"@meeco/sdk": "^7.2.0",
"@meeco/sdk": "^7.5.0",
"@meeco/vault-api-sdk": "39.6.1-develop.20231213134427.3dde2fcb3",
"oclif": "^3.1.0",
"@oclif/core": "^1.9.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/file-storage-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"stream-browserify": "^3.0.0"
},
"devDependencies": {
"@meeco/sdk": "^7.2.0",
"@meeco/sdk": "^7.5.0",
"bili": "^5.0.5",
"typedoc": "^0.23.2",
"typescript": "^4.7.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint": "tslint -p . -t stylish -c ../../tslint.json"
},
"dependencies": {
"@meeco/sdk": "^7.2.0",
"@meeco/sdk": "^7.5.0",
"@meeco/style-kit": "^2.0.1",
"crypto-browserify": "^3.12.0",
"json-formatter-js": "^2.3.4",
Expand Down
22 changes: 22 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project (loosely) adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 7.5.0

### Fixed

- Fix `import` of `chalk` dependency that makes library to crash

## 7.4.0

### Fixed

- Fix `import` of `form-data` dependency that makes library to crash

## 7.3.0

### Changed

- Upgraded `@meeco/vc-api-sdk` version to `10.0.0-develop.20241007171031.c55e9e0`

### Fixed

- Fix `import` of `bs58` dependency that makes library to crash

## 7.2.0

### Changed
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@meeco/sdk",
"description": "A wrapper library around Meeco's various API SDK's and encryption libraries",
"version": "7.2.0",
"version": "7.5.0",
"author": "Meeco",
"bugs": "https://github.com/Meeco/cli/issues",
"source": "src/index.ts",
Expand All @@ -13,7 +13,7 @@
"@meeco/identity-network-api-sdk": "1.1.0-develop.20230808164050.d37ca3c",
"@meeco/keystore-api-sdk": "10.1.1-develop.20230816154849.c7c2018",
"@meeco/vault-api-sdk": "39.6.1-develop.20231213134427.3dde2fcb3",
"@meeco/vc-api-sdk": "10.0.0-develop.20241007093232.e3e28ab",
"@meeco/vc-api-sdk": "10.0.0-develop.20241007171031.c55e9e0",
"@noble/curves": "^1.4.0",
"@noble/hashes": "^1.4.0",
"bs58": "5.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/src/models/did-management/Ed25519.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// tslint:disable-next-line: no-var-requires
const b58 = require('bs58');
import { ed25519 } from '@noble/curves/ed25519';
import { bytesToHex } from '@noble/hashes/utils';
import b58 from 'bs58';
import { bytesToBase64url } from 'did-jwt';
import { IKeyPairDID } from './key-pair-did';

Expand Down
7 changes: 1 addition & 6 deletions packages/sdk/src/util/api-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@ import * as Keystore from '@meeco/keystore-api-sdk';
import * as Vault from '@meeco/vault-api-sdk';
import { Configuration } from '@meeco/vault-api-sdk';
import * as VC from '@meeco/vc-api-sdk';
import chalk from 'chalk';
import { debug } from 'debug';
import { Environment } from '../models/environment';
import { IIdentityNetworkToken, IKeystoreToken, IVaultToken, IVCToken } from '../services/service';
import SDKFormData from './sdk-form-data';

/**
* INFO: using 'import' statement causes typescript errors either in tests or in built version of the package
*/
/* tslint:disable no-var-requires */
const chalk = require('chalk');

let fetchLib = fetch;

/**
Expand Down
11 changes: 5 additions & 6 deletions packages/sdk/src/util/sdk-form-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// tslint:disable-next-line: no-var-requires
const FormData = require('form-data');
import FormData from 'form-data';

/**
* @hidden
Expand All @@ -10,12 +9,12 @@ const FormData = require('form-data');
* This monkey-patches the constructor of FormData to ensure the argument always exists
*/
class SDKFormData extends FormData {
append(...args) {
if (args[0] === 'attachment[file]' || args[0] === 'binary[file]') {
return super.append(args[0], args[1], 'file');
append(key: string, value: any, options?: FormData.AppendOptions | string) {
if (key === 'attachment[file]' || key === 'binary[file]') {
return super.append(key, value, 'file');
}

return super.append(...args);
return super.append(key, value, options);
}
}

Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/src/util/secrets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// tslint:disable-next-line: no-var-requires
const b58 = require('bs58');
import { binaryStringToBytes, bytesToBinaryString } from '@meeco/cryppo';
import b58 from 'bs58';
import { ERROR_CODES, MeecoServiceError } from '../models/service-error';
import { SymmetricKey } from '../models/symmetric-key';
import cryppo from '../services/cryppo-service';
Expand Down

0 comments on commit c93151a

Please sign in to comment.