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 +1 -1
- package/dist/auth.d.ts +5 -1
- package/dist/auth.js +3 -4
- package/dist/auth.mjs +4 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -10
- package/dist/index.mjs +1 -9
- package/dist/mirror.js +4 -6
- package/dist/mirror.mjs +4 -6
- package/package.json +3 -3
package/bin/index.js
CHANGED
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<
|
|
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
|
|
12
|
-
if (
|
|
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
|
|
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 {
|
|
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
|
|
10
|
-
if (
|
|
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
|
|
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 {
|
|
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.
|
|
17
|
+
exports.throwIfError = exports.Result = void 0;
|
|
18
18
|
var common_1 = require("@aeriajs/common");
|
|
19
|
-
Object.defineProperty(exports, "
|
|
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
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
|
|
113
|
+
return require.resolve('aeria-sdk');
|
|
113
114
|
}
|
|
114
115
|
catch (err) {
|
|
115
116
|
}
|
|
116
|
-
const
|
|
117
|
-
|
|
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
|
|
113
|
+
return require.resolve("aeria-sdk");
|
|
113
114
|
} catch (err) {
|
|
114
115
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
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.
|
|
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.
|
|
64
|
-
"@aeriajs/types": "^0.0.
|
|
63
|
+
"@aeriajs/common": "^0.0.60",
|
|
64
|
+
"@aeriajs/types": "^0.0.56"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"test": "echo skipping",
|