@sogni-ai/sogni-client 0.4.0-aplha.5 → 0.4.0-aplha.6

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.
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.base64Encode = base64Encode;
7
4
  exports.base64Decode = base64Decode;
8
- const isNodejs_1 = __importDefault(require("./isNodejs"));
9
5
  function base64Encode(str) {
10
- return isNodejs_1.default ? Buffer.from(str).toString('base64') : btoa(str);
6
+ const encoder = new TextEncoder();
7
+ const uint8Array = encoder.encode(str);
8
+ const binaryString = String.fromCharCode(...uint8Array);
9
+ return btoa(binaryString);
11
10
  }
12
11
  function base64Decode(str) {
13
- return isNodejs_1.default ? Buffer.from(str, 'base64').toString() : atob(str);
12
+ const binaryString = atob(str);
13
+ const binaryArray = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
14
+ const decoder = new TextDecoder();
15
+ return decoder.decode(binaryArray);
14
16
  }
15
17
  //# sourceMappingURL=base64.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/lib/base64.ts"],"names":[],"mappings":";;;;;AAEA,oCAEC;AAED,oCAEC;AARD,0DAAkC;AAElC,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,kBAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC;AAED,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,kBAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
1
+ {"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/lib/base64.ts"],"names":[],"mappings":";;AAAA,oCAKC;AAED,oCAKC;AAZD,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC;AAC5B,CAAC;AAED,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACrC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.4.0-aplha.5";
1
+ export declare const LIB_VERSION = "0.4.0-aplha.6";
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = "0.4.0-aplha.5";
4
+ exports.LIB_VERSION = "0.4.0-aplha.6";
5
5
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.0-aplha.5",
6
+ "version": "0.4.0-aplha.6",
7
7
  "description": "Sogni Supernet Client",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
package/src/lib/base64.ts CHANGED
@@ -1,9 +1,13 @@
1
- import isNodejs from './isNodejs';
2
-
3
1
  export function base64Encode(str: string): string {
4
- return isNodejs ? Buffer.from(str).toString('base64') : btoa(str);
2
+ const encoder = new TextEncoder();
3
+ const uint8Array = encoder.encode(str);
4
+ const binaryString = String.fromCharCode(...uint8Array);
5
+ return btoa(binaryString);
5
6
  }
6
7
 
7
8
  export function base64Decode(str: string): string {
8
- return isNodejs ? Buffer.from(str, 'base64').toString() : atob(str);
9
+ const binaryString = atob(str);
10
+ const binaryArray = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
11
+ const decoder = new TextDecoder();
12
+ return decoder.decode(binaryArray);
9
13
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.4.0-aplha.5";
1
+ export const LIB_VERSION = "0.4.0-aplha.6";