aeria-sdk 0.0.84 → 0.0.85

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/bin/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../dist/cli')
3
+ require('../dist/cli.js')
package/dist/auth.d.ts CHANGED
@@ -11,5 +11,9 @@ export type AuthenticationPayload = {
11
11
  password: string;
12
12
  };
13
13
  export declare const authMemo: AuthenticationResult;
14
- export declare const authenticate: (config: InstanceConfig) => (payload: AuthenticationPayload) => Promise<any>;
14
+ export declare const authenticate: (config: InstanceConfig) => (payload: AuthenticationPayload) => Promise<{
15
+ readonly _tag: "Error";
16
+ readonly error: any;
17
+ readonly result: undefined;
18
+ }>;
15
19
  export declare const signout: (config: InstanceConfig) => () => Promise<void>;
package/dist/auth.js CHANGED
@@ -8,12 +8,11 @@ const storage_js_1 = require("./storage.js");
8
8
  exports.authMemo = {};
9
9
  const authenticate = (config) => async (payload) => {
10
10
  const response = await (0, http_js_1.request)(config, `${(0, utils_js_1.publicUrl)(config)}/user/authenticate`, payload);
11
- const resultEither = response.data;
12
- if ((0, common_1.isRight)(resultEither)) {
13
- const result = (0, common_1.unwrapEither)(resultEither);
11
+ const { error, value: result } = response.data;
12
+ if (result) {
14
13
  (0, storage_js_1.getStorage)(config).set('auth', result);
15
14
  }
16
- return resultEither;
15
+ return common_1.Result.error(error);
17
16
  };
18
17
  exports.authenticate = authenticate;
19
18
  const signout = (config) => async () => {
package/dist/auth.mjs CHANGED
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
- import { isRight, unwrapEither } from "@aeriajs/common";
2
+ import { Result } from "@aeriajs/common";
3
3
  import { request } from "./http.mjs";
4
4
  import { publicUrl } from "./utils.mjs";
5
5
  import { getStorage } from "./storage.mjs";
6
6
  export const authMemo = {};
7
7
  export const authenticate = (config) => async (payload) => {
8
8
  const response = await request(config, `${publicUrl(config)}/user/authenticate`, payload);
9
- const resultEither = response.data;
10
- if (isRight(resultEither)) {
11
- const result = unwrapEither(resultEither);
9
+ const { error, value: result } = response.data;
10
+ if (result) {
12
11
  getStorage(config).set("auth", result);
13
12
  }
14
- return resultEither;
13
+ return Result.error(error);
15
14
  };
16
15
  export const signout = (config) => async () => {
17
16
  getStorage(config).remove("auth");
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { left, right, isLeft, isRight, unwrapEither, error, isError, unwrapError, throwIfLeft, throwIfError, } from '@aeriajs/common';
1
+ export { Result, throwIfError, } from '@aeriajs/common';
2
2
  export * from './auth.js';
3
3
  export * from './topLevel.js';
4
4
  export * from './constants.js';
package/dist/index.js CHANGED
@@ -14,17 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.throwIfError = exports.throwIfLeft = exports.unwrapError = exports.isError = exports.error = exports.unwrapEither = exports.isRight = exports.isLeft = exports.right = exports.left = void 0;
17
+ exports.throwIfError = exports.Result = void 0;
18
18
  var common_1 = require("@aeriajs/common");
19
- Object.defineProperty(exports, "left", { enumerable: true, get: function () { return common_1.left; } });
20
- Object.defineProperty(exports, "right", { enumerable: true, get: function () { return common_1.right; } });
21
- Object.defineProperty(exports, "isLeft", { enumerable: true, get: function () { return common_1.isLeft; } });
22
- Object.defineProperty(exports, "isRight", { enumerable: true, get: function () { return common_1.isRight; } });
23
- Object.defineProperty(exports, "unwrapEither", { enumerable: true, get: function () { return common_1.unwrapEither; } });
24
- Object.defineProperty(exports, "error", { enumerable: true, get: function () { return common_1.error; } });
25
- Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return common_1.isError; } });
26
- Object.defineProperty(exports, "unwrapError", { enumerable: true, get: function () { return common_1.unwrapError; } });
27
- Object.defineProperty(exports, "throwIfLeft", { enumerable: true, get: function () { return common_1.throwIfLeft; } });
19
+ Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return common_1.Result; } });
28
20
  Object.defineProperty(exports, "throwIfError", { enumerable: true, get: function () { return common_1.throwIfError; } });
29
21
  __exportStar(require("./auth.js"), exports);
30
22
  __exportStar(require("./topLevel.js"), exports);
package/dist/index.mjs CHANGED
@@ -1,14 +1,6 @@
1
1
  "use strict";
2
2
  export {
3
- left,
4
- right,
5
- isLeft,
6
- isRight,
7
- unwrapEither,
8
- error,
9
- isError,
10
- unwrapError,
11
- throwIfLeft,
3
+ Result,
12
4
  throwIfError
13
5
  } from "@aeriajs/common";
14
6
  export * from "./auth.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
- "version": "0.0.84",
3
+ "version": "0.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -60,8 +60,8 @@
60
60
  "@aeriajs/types": "link:../types"
61
61
  },
62
62
  "peerDependencies": {
63
- "@aeriajs/common": "^0.0.59",
64
- "@aeriajs/types": "^0.0.55"
63
+ "@aeriajs/common": "^0.0.60",
64
+ "@aeriajs/types": "^0.0.56"
65
65
  },
66
66
  "scripts": {
67
67
  "test": "echo skipping",