Skip to content

Commit

Permalink
chore: release 0.33.1 (#773)
Browse files Browse the repository at this point in the history
* fix: cbor-web imports do not work in esm (#772)
* chore: set release version 0.33.1
  • Loading branch information
rflechtner committed Jun 14, 2023
1 parent e9fb6ee commit d0445c3
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@
"typedoc": "^0.22.15",
"typescript": "^4.8.3"
},
"version": "0.33.0",
"version": "0.33.1",
"packageManager": "yarn@3.3.1"
}
2 changes: 1 addition & 1 deletion packages/asset-did/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/asset-did",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/augment-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/augment-api",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"types": "./lib/index.d.ts",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/chain-helpers",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/config",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"type": "commonjs",
"main": "./lib/index.js",
Expand Down
5 changes: 2 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/core",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down Expand Up @@ -49,7 +49,6 @@
"@polkadot/keyring": "^12.0.0",
"@polkadot/types": "^10.4.0",
"@polkadot/util": "^12.0.0",
"@polkadot/util-crypto": "^12.0.0",
"cbor-web": "^8.0.0"
"@polkadot/util-crypto": "^12.0.0"
}
}
8 changes: 3 additions & 5 deletions packages/core/src/publicCredential/PublicCredential.chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import type {
PublicCredentialsCredentialsCredentialEntry,
} from '@kiltprotocol/augment-api'

import { encode as cborEncode, decode as cborDecode } from 'cbor-web'

import { HexString } from '@polkadot/util/types'
import { ConfigService } from '@kiltprotocol/config'
import { fromChain as didFromChain } from '@kiltprotocol/did'
import { validateUri } from '@kiltprotocol/asset-did'
import { SDKErrors } from '@kiltprotocol/utils'
import { SDKErrors, cbor } from '@kiltprotocol/utils'

import { getIdForCredential } from './PublicCredential.js'
import { flattenCalls, isBatch, retrieveExtrinsicFromBlock } from '../utils.js'
Expand All @@ -51,7 +49,7 @@ export function toChain(
): EncodedPublicCredential {
const { cTypeHash, claims, subject, delegationId } = publicCredential

const cborSerializedClaims = cborEncode(claims)
const cborSerializedClaims = cbor.encode(claims)

return {
ctypeHash: cTypeHash,
Expand All @@ -72,7 +70,7 @@ function credentialInputFromChain({
const credentialSubject = subject.toUtf8()
validateUri(credentialSubject)
return {
claims: cborDecode(claims),
claims: cbor.decode(claims),
cTypeHash: ctypeHash.toHex(),
delegationId: authorization.unwrapOr(undefined)?.toHex() ?? null,
subject: credentialSubject as AssetDidUri,
Expand Down
5 changes: 2 additions & 3 deletions packages/did/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/did",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down Expand Up @@ -44,7 +44,6 @@
"@polkadot/types": "^10.4.0",
"@polkadot/types-codec": "^10.4.0",
"@polkadot/util": "^12.0.0",
"@polkadot/util-crypto": "^12.0.0",
"cbor-web": "^8.0.0"
"@polkadot/util-crypto": "^12.0.0"
}
}
7 changes: 3 additions & 4 deletions packages/did/src/DidDetails/LightDidDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* found in the LICENSE file in the root directory of this source tree.
*/

import { decode as cborDecode, encode as cborEncode } from 'cbor-web'
import {
base58Decode,
base58Encode,
Expand All @@ -22,7 +21,7 @@ import type {
} from '@kiltprotocol/types'
import { encryptionKeyTypes } from '@kiltprotocol/types'

import { SDKErrors, ss58Format } from '@kiltprotocol/utils'
import { SDKErrors, ss58Format, cbor } from '@kiltprotocol/utils'

import { getAddressByKey, parse } from '../Did.utils.js'
import { resourceIdToChain, validateService } from '../Did.chain.js'
Expand Down Expand Up @@ -147,7 +146,7 @@ function serializeAdditionalLightDidDetails({
}

const serializationVersion = 0x0
const serialized = cborEncode(objectToSerialize)
const serialized = cbor.encode(objectToSerialize)
return base58Encode([serializationVersion, ...serialized], true)
}

Expand All @@ -166,7 +165,7 @@ function deserializeAdditionalLightDidDetails(
if (serializationVersion !== 0x0) {
throw new SDKErrors.DidError('Serialization algorithm not supported')
}
const deserialized: SerializableStructure = cborDecode(serialized)
const deserialized: SerializableStructure = cbor.decode(serialized)

const keyAgreement = deserialized[KEY_AGREEMENT_MAP_KEY]
return {
Expand Down
1 change: 0 additions & 1 deletion packages/did/src/cbor-web.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/messaging/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/messaging",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/sdk-js",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kiltprotocol/testing",
"private": true,
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/type-definitions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/type-definitions",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/types",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/utils",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down Expand Up @@ -39,6 +39,7 @@
"@polkadot/keyring": "^12.0.0",
"@polkadot/util": "^12.0.0",
"@polkadot/util-crypto": "^12.0.0",
"cbor-web": "^8.0.0",
"tweetnacl": "^1.0.3",
"uuid": "^9.0.0"
}
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions packages/utils/src/cbor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2018-2023, BOTLabs GmbH.
*
* This source code is licensed under the BSD 4-Clause "Original" license
* found in the LICENSE file in the root directory of this source tree.
*/

// special import syntax as this is a pure cjs import
import * as cborImp from 'cbor-web'
// this is horrible but the only way to make this import work in both cjs & esm builds
export const cbor = cborImp?.default ?? cborImp
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export * as DataUtils from './DataUtils.js'
export * as SDKErrors from './SDKErrors.js'
export * as JsonSchema from './json-schema/index.js'
export { ss58Format } from './ss58Format.js'
export { cbor } from './cbor.js'
export { Keyring } from '@polkadot/keyring'
2 changes: 1 addition & 1 deletion packages/vc-export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiltprotocol/vc-export",
"version": "0.33.0",
"version": "0.33.1",
"description": "",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,6 @@ __metadata:
"@polkadot/util": ^12.0.0
"@polkadot/util-crypto": ^12.0.0
"@types/uuid": ^8.0.0
cbor-web: ^8.0.0
rimraf: ^3.0.2
testcontainers: ^9.0.0
typescript: ^4.8.3
Expand All @@ -1921,7 +1920,6 @@ __metadata:
"@polkadot/types-codec": ^10.4.0
"@polkadot/util": ^12.0.0
"@polkadot/util-crypto": ^12.0.0
cbor-web: ^8.0.0
rimraf: ^3.0.2
typescript: ^4.8.3
languageName: unknown
Expand Down Expand Up @@ -2016,6 +2014,7 @@ __metadata:
"@polkadot/keyring": ^12.0.0
"@polkadot/util": ^12.0.0
"@polkadot/util-crypto": ^12.0.0
cbor-web: ^8.0.0
rimraf: ^3.0.2
tweetnacl: ^1.0.3
typescript: ^4.8.3
Expand Down

0 comments on commit d0445c3

Please sign in to comment.