aeria-sdk 0.0.83 → 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/dist/mirror.js CHANGED
@@ -4,6 +4,7 @@ exports.mirrorRemotely = exports.writeMirrorFiles = exports.runtimeEsm = exports
4
4
  const path = require("path");
5
5
  const common_1 = require("@aeriajs/common");
6
6
  const promises_1 = require("fs/promises");
7
+ const module_1 = require("module");
7
8
  const topLevel_js_1 = require("./topLevel.js");
8
9
  const utils_js_1 = require("./utils.js");
9
10
  const mirrorDts = (mirrorObj, config) => {
@@ -109,15 +110,12 @@ exports.runtimeEsm = runtimeEsm;
109
110
  const writeMirrorFiles = async (mirror, config, filesPath = path.join(process.cwd(), '.aeria')) => {
110
111
  const resolvedPath = (() => {
111
112
  try {
112
- return require.resolve('aeria.sdk');
113
+ return require.resolve('aeria-sdk');
113
114
  }
114
115
  catch (err) {
115
116
  }
116
- const fn = new Function(`return (async () => {
117
- const { fileURLToPath } = await import('url')
118
- return fileURLToPath(import.meta.resolve('aeria-sdk'))
119
- })()`);
120
- return fn();
117
+ const syntheticRequire = (0, module_1.createRequire)(process.cwd());
118
+ return syntheticRequire.resolve('aeria-sdk');
121
119
  })();
122
120
  const runtimeBase = path.dirname(resolvedPath);
123
121
  await (0, promises_1.mkdir)(runtimeBase, {
package/dist/mirror.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  import * as path from "path";
3
3
  import { deserialize } from "@aeriajs/common";
4
4
  import { writeFile, mkdir } from "fs/promises";
5
+ import { createRequire } from "module";
5
6
  import { topLevel } from "./topLevel.mjs";
6
7
  import { publicUrl } from "./utils.mjs";
7
8
  const mirrorDts = (mirrorObj, config) => {
@@ -109,14 +110,11 @@ export default aeria
109
110
  export const writeMirrorFiles = async (mirror, config, filesPath = path.join(process.cwd(), ".aeria")) => {
110
111
  const resolvedPath = (() => {
111
112
  try {
112
- return require.resolve("aeria.sdk");
113
+ return require.resolve("aeria-sdk");
113
114
  } catch (err) {
114
115
  }
115
- const fn = new Function(`return (async () => {
116
- const { fileURLToPath } = await import('url')
117
- return fileURLToPath(import.meta.resolve('aeria-sdk'))
118
- })()`);
119
- return fn();
116
+ const syntheticRequire = createRequire(process.cwd());
117
+ return syntheticRequire.resolve("aeria-sdk");
120
118
  })();
121
119
  const runtimeBase = path.dirname(resolvedPath);
122
120
  await mkdir(runtimeBase, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
- "version": "0.0.83",
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",