aeria-sdk 0.0.51 → 0.0.53
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/dist/auth.js +1 -1
- package/dist/auth.mjs +2 -2
- package/dist/mirror.js +2 -2
- package/dist/mirror.mjs +3 -3
- package/dist/topLevel.js +1 -1
- package/dist/topLevel.mjs +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +7 -7
- package/dist/utils.mjs +4 -4
- package/package.json +5 -5
package/dist/auth.js
CHANGED
|
@@ -7,7 +7,7 @@ const utils_js_1 = require("./utils.js");
|
|
|
7
7
|
const storage_js_1 = require("./storage.js");
|
|
8
8
|
exports.authMemo = {};
|
|
9
9
|
const authenticate = (config) => async (payload) => {
|
|
10
|
-
const response = await (0, http_js_1.request)(config, `${(0, utils_js_1.
|
|
10
|
+
const response = await (0, http_js_1.request)(config, `${(0, utils_js_1.publicUrl)(config)}/user/authenticate`, payload);
|
|
11
11
|
const resultEither = response.data;
|
|
12
12
|
if ((0, common_1.isRight)(resultEither)) {
|
|
13
13
|
const result = (0, common_1.unwrapEither)(resultEither);
|
package/dist/auth.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { isRight, unwrapEither } from "@aeriajs/common";
|
|
3
3
|
import { request } from "./http.mjs";
|
|
4
|
-
import {
|
|
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
|
-
const response = await request(config, `${
|
|
8
|
+
const response = await request(config, `${publicUrl(config)}/user/authenticate`, payload);
|
|
9
9
|
const resultEither = response.data;
|
|
10
10
|
if (isRight(resultEither)) {
|
|
11
11
|
const result = unwrapEither(resultEither);
|
package/dist/mirror.js
CHANGED
|
@@ -87,14 +87,14 @@ declare module 'aeria-sdk' {
|
|
|
87
87
|
};
|
|
88
88
|
const runtimeCjs = (config) => `const config = ${JSON.stringify(config)}
|
|
89
89
|
exports.config = config
|
|
90
|
-
exports.url = '${(0, utils_js_1.
|
|
90
|
+
exports.url = '${(0, utils_js_1.publicUrl)(config)}'
|
|
91
91
|
exports.aeria = require('aeria-sdk/topLevel').topLevel(config)
|
|
92
92
|
exports.storage = require('aeria-sdk/storage').getStorage(config)
|
|
93
93
|
\n`;
|
|
94
94
|
exports.runtimeCjs = runtimeCjs;
|
|
95
95
|
const runtimeEsm = (config) => `import { Aeria, getStorage } from 'aeria-sdk'
|
|
96
96
|
export const config = ${JSON.stringify(config)}
|
|
97
|
-
export const url = '${(0, utils_js_1.
|
|
97
|
+
export const url = '${(0, utils_js_1.publicUrl)(config)}'
|
|
98
98
|
export const aeria = Aeria(config)
|
|
99
99
|
export const storage = getStorage(config)
|
|
100
100
|
\n`;
|
package/dist/mirror.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { deserialize } from "@aeriajs/common";
|
|
4
4
|
import { writeFile, mkdir } from "fs/promises";
|
|
5
5
|
import { topLevel } from "./topLevel.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { publicUrl } from "./utils.mjs";
|
|
7
7
|
const mirrorDts = (mirrorObj) => {
|
|
8
8
|
const collections = mirrorObj.descriptions;
|
|
9
9
|
return `import type {
|
|
@@ -85,14 +85,14 @@ declare module 'aeria-sdk' {
|
|
|
85
85
|
};
|
|
86
86
|
export const runtimeCjs = (config) => `const config = ${JSON.stringify(config)}
|
|
87
87
|
exports.config = config
|
|
88
|
-
exports.url = '${
|
|
88
|
+
exports.url = '${publicUrl(config)}'
|
|
89
89
|
exports.aeria = require('aeria-sdk/topLevel').topLevel(config)
|
|
90
90
|
exports.storage = require('aeria-sdk/storage').getStorage(config)
|
|
91
91
|
|
|
92
92
|
`;
|
|
93
93
|
export const runtimeEsm = (config) => `import { Aeria, getStorage } from 'aeria-sdk'
|
|
94
94
|
export const config = ${JSON.stringify(config)}
|
|
95
|
-
export const url = '${
|
|
95
|
+
export const url = '${publicUrl(config)}'
|
|
96
96
|
export const aeria = Aeria(config)
|
|
97
97
|
export const storage = getStorage(config)
|
|
98
98
|
|
package/dist/topLevel.js
CHANGED
|
@@ -29,7 +29,7 @@ const topLevel = (config) => {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const response = await (0, http_js_1.request)(config, `${(0, utils_js_1.
|
|
32
|
+
const response = await (0, http_js_1.request)(config, `${(0, utils_js_1.publicUrl)(config)}/${endpoint}`, payload, requestConfig);
|
|
33
33
|
return response.data;
|
|
34
34
|
};
|
|
35
35
|
const path = parent
|
package/dist/topLevel.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { authenticate, signout } from "./auth.mjs";
|
|
3
3
|
import { request } from "./http.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { publicUrl } from "./utils.mjs";
|
|
5
5
|
export const topLevel = (config) => {
|
|
6
6
|
const proxify = (target, parent) => new Proxy(target, {
|
|
7
7
|
get: (_, key) => {
|
|
@@ -31,7 +31,7 @@ export const topLevel = (config) => {
|
|
|
31
31
|
}
|
|
32
32
|
const response = await request(
|
|
33
33
|
config,
|
|
34
|
-
`${
|
|
34
|
+
`${publicUrl(config)}/${endpoint}`,
|
|
35
35
|
payload,
|
|
36
36
|
requestConfig
|
|
37
37
|
);
|
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -3,18 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getConfig = exports.
|
|
6
|
+
exports.getConfig = exports.publicUrl = void 0;
|
|
7
7
|
const common_1 = require("@aeriajs/common");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const
|
|
10
|
-
if (typeof config.
|
|
11
|
-
return config.
|
|
9
|
+
const publicUrl = (config) => {
|
|
10
|
+
if (typeof config.publicUrl === 'string') {
|
|
11
|
+
return config.publicUrl;
|
|
12
12
|
}
|
|
13
13
|
return process.env.NODE_ENV === 'production'
|
|
14
|
-
? config.
|
|
15
|
-
: config.
|
|
14
|
+
? config.publicUrl.production
|
|
15
|
+
: config.publicUrl.development;
|
|
16
16
|
};
|
|
17
|
-
exports.
|
|
17
|
+
exports.publicUrl = publicUrl;
|
|
18
18
|
const getConfig = async () => {
|
|
19
19
|
const { aeriaSdk } = await (0, common_1.dynamicImport)(path_1.default.join(process.cwd(), 'package.json'));
|
|
20
20
|
if (typeof aeriaSdk !== 'object' || !aeriaSdk) {
|
package/dist/utils.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { dynamicImport } from "@aeriajs/common";
|
|
3
3
|
import path from "path";
|
|
4
|
-
export const
|
|
5
|
-
if (typeof config.
|
|
6
|
-
return config.
|
|
4
|
+
export const publicUrl = (config) => {
|
|
5
|
+
if (typeof config.publicUrl === "string") {
|
|
6
|
+
return config.publicUrl;
|
|
7
7
|
}
|
|
8
|
-
return false ? config.
|
|
8
|
+
return false ? config.publicUrl.production : config.publicUrl.development;
|
|
9
9
|
};
|
|
10
10
|
export const getConfig = async () => {
|
|
11
11
|
const { aeriaSdk } = await dynamicImport(path.join(process.cwd(), "package.json"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aeria-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@aeriajs/common": "^0.0.
|
|
58
|
-
"@aeriajs/types": "^0.0.
|
|
57
|
+
"@aeriajs/common": "^0.0.34",
|
|
58
|
+
"@aeriajs/types": "^0.0.31"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@aeriajs/common": "^0.0.
|
|
62
|
-
"@aeriajs/types": "^0.0.
|
|
61
|
+
"@aeriajs/common": "^0.0.34",
|
|
62
|
+
"@aeriajs/types": "^0.0.31"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"test": "echo skipping",
|