asma-core-helpers 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asma-core-helpers",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Core helper utilities for ASMA applications",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'buffer'
2
2
  export function fromBase64ToJSON<T>(base64: string): T {
3
3
  const json_str = Buffer.from(base64, 'base64').toString('utf-8')
4
- return JSON.parse(json_str)
4
+ return JSON.parse(json_str) as T
5
5
  }
6
6
 
7
7
  export function fromJSONToBase64<T>(json: T): string {
@@ -18,10 +18,10 @@ export function _getServerErrorMessage(error: Record<string, any> | string): str
18
18
  return error['data']['Message']
19
19
  }
20
20
  if (Array.isArray(error)) {
21
- return _getArrayErrorsMessage(error)
21
+ return _getArrayErrorsMessage(error as Record<string, unknown>[])
22
22
  }
23
23
  if (Array.isArray(error?.['errors'])) {
24
- return _getArrayErrorsMessage(error['errors'])
24
+ return _getArrayErrorsMessage(error['errors'] as Record<string, unknown>[])
25
25
  }
26
26
  //graphql
27
27
  else if (error['bodyText']) {
@@ -3,5 +3,5 @@ export async function http<R>(request: RequestInfo, init?: RequestInit): Promise
3
3
 
4
4
  const body = await response.json()
5
5
 
6
- return body
6
+ return body as R
7
7
  }