@ones-open/node-sdk 0.0.11 → 0.0.12-27205.3
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/index.cjs +17 -13
- package/dist/index.js +17 -13
- package/dist/types/packages/node/storage/entity/fetch/index.d.ts.map +1 -1
- package/dist/types/packages/node/storage/object/fetch/index.d.ts.map +1 -1
- package/dist/types/packages/strict/env/index.d.ts +10 -4
- package/dist/types/packages/strict/env/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4,8 +4,11 @@ const node_crypto = require("node:crypto");
|
|
|
4
4
|
const Fetch = require("axios");
|
|
5
5
|
const lodashEs = require("lodash-es");
|
|
6
6
|
const _sortInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/sort");
|
|
7
|
-
const
|
|
8
|
-
return process.env.
|
|
7
|
+
const getONESHostedAppBaseUrl = () => {
|
|
8
|
+
return process.env.ONES_HOSTED_APP_BASE_URL;
|
|
9
|
+
};
|
|
10
|
+
const getONESHostedManagerBaseUrl = () => {
|
|
11
|
+
return process.env.ONES_HOSTED_MANAGER_BASE_URL;
|
|
9
12
|
};
|
|
10
13
|
const getONESHostedAppID = () => {
|
|
11
14
|
return process.env.ONES_HOSTED_APP_ID;
|
|
@@ -15,8 +18,9 @@ const getONESHostedToken = () => {
|
|
|
15
18
|
};
|
|
16
19
|
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
17
20
|
__proto__: null,
|
|
21
|
+
getONESHostedAppBaseUrl,
|
|
18
22
|
getONESHostedAppID,
|
|
19
|
-
|
|
23
|
+
getONESHostedManagerBaseUrl,
|
|
20
24
|
getONESHostedToken
|
|
21
25
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
22
26
|
const ASSERTION_TTL_SECONDS = 24 * 60 * 60;
|
|
@@ -191,11 +195,11 @@ const buildAuthHeaders$1 = () => {
|
|
|
191
195
|
return {};
|
|
192
196
|
};
|
|
193
197
|
const fetchBase$1 = (path, params, config) => {
|
|
194
|
-
return Promise.all([
|
|
195
|
-
let [
|
|
196
|
-
if (
|
|
198
|
+
return Promise.all([getONESHostedManagerBaseUrl(), getONESHostedAppID()]).then((_ref) => {
|
|
199
|
+
let [managerBase, appId] = _ref;
|
|
200
|
+
if (managerBase && appId) {
|
|
197
201
|
var _config$headers;
|
|
198
|
-
const url = `${
|
|
202
|
+
const url = `${managerBase}/hosted_ability/storage/${appId}${path}`;
|
|
199
203
|
const data = {
|
|
200
204
|
...params
|
|
201
205
|
};
|
|
@@ -210,7 +214,7 @@ const fetchBase$1 = (path, params, config) => {
|
|
|
210
214
|
});
|
|
211
215
|
}
|
|
212
216
|
throw new Error(JSON.stringify({
|
|
213
|
-
|
|
217
|
+
managerBase,
|
|
214
218
|
appId
|
|
215
219
|
}));
|
|
216
220
|
}).then((response) => {
|
|
@@ -484,10 +488,10 @@ const buildAuthHeaders = () => {
|
|
|
484
488
|
return {};
|
|
485
489
|
};
|
|
486
490
|
const fetchBase = (path, params) => {
|
|
487
|
-
return Promise.all([
|
|
488
|
-
let [
|
|
489
|
-
if (
|
|
490
|
-
const url = `${
|
|
491
|
+
return Promise.all([getONESHostedManagerBaseUrl(), getONESHostedAppID()]).then((_ref) => {
|
|
492
|
+
let [managerBase, appId] = _ref;
|
|
493
|
+
if (managerBase && appId) {
|
|
494
|
+
const url = `${managerBase}/hosted_ability/storage/${appId}${path}`;
|
|
491
495
|
const data = {
|
|
492
496
|
...params
|
|
493
497
|
};
|
|
@@ -496,7 +500,7 @@ const fetchBase = (path, params) => {
|
|
|
496
500
|
});
|
|
497
501
|
}
|
|
498
502
|
throw new Error(JSON.stringify({
|
|
499
|
-
|
|
503
|
+
managerBase,
|
|
500
504
|
appId
|
|
501
505
|
}));
|
|
502
506
|
}).then((response) => {
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,11 @@ import { randomUUID, createHmac } from "node:crypto";
|
|
|
2
2
|
import Fetch, { AxiosError } from "axios";
|
|
3
3
|
import { isNull, isUndefined, isSymbol, set } from "lodash-es";
|
|
4
4
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
|
5
|
-
const
|
|
6
|
-
return process.env.
|
|
5
|
+
const getONESHostedAppBaseUrl = () => {
|
|
6
|
+
return process.env.ONES_HOSTED_APP_BASE_URL;
|
|
7
|
+
};
|
|
8
|
+
const getONESHostedManagerBaseUrl = () => {
|
|
9
|
+
return process.env.ONES_HOSTED_MANAGER_BASE_URL;
|
|
7
10
|
};
|
|
8
11
|
const getONESHostedAppID = () => {
|
|
9
12
|
return process.env.ONES_HOSTED_APP_ID;
|
|
@@ -13,8 +16,9 @@ const getONESHostedToken = () => {
|
|
|
13
16
|
};
|
|
14
17
|
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
15
18
|
__proto__: null,
|
|
19
|
+
getONESHostedAppBaseUrl,
|
|
16
20
|
getONESHostedAppID,
|
|
17
|
-
|
|
21
|
+
getONESHostedManagerBaseUrl,
|
|
18
22
|
getONESHostedToken
|
|
19
23
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
20
24
|
const ASSERTION_TTL_SECONDS = 24 * 60 * 60;
|
|
@@ -189,11 +193,11 @@ const buildAuthHeaders$1 = () => {
|
|
|
189
193
|
return {};
|
|
190
194
|
};
|
|
191
195
|
const fetchBase$1 = (path, params, config) => {
|
|
192
|
-
return Promise.all([
|
|
193
|
-
let [
|
|
194
|
-
if (
|
|
196
|
+
return Promise.all([getONESHostedManagerBaseUrl(), getONESHostedAppID()]).then((_ref) => {
|
|
197
|
+
let [managerBase, appId] = _ref;
|
|
198
|
+
if (managerBase && appId) {
|
|
195
199
|
var _config$headers;
|
|
196
|
-
const url = `${
|
|
200
|
+
const url = `${managerBase}/hosted_ability/storage/${appId}${path}`;
|
|
197
201
|
const data = {
|
|
198
202
|
...params
|
|
199
203
|
};
|
|
@@ -208,7 +212,7 @@ const fetchBase$1 = (path, params, config) => {
|
|
|
208
212
|
});
|
|
209
213
|
}
|
|
210
214
|
throw new Error(JSON.stringify({
|
|
211
|
-
|
|
215
|
+
managerBase,
|
|
212
216
|
appId
|
|
213
217
|
}));
|
|
214
218
|
}).then((response) => {
|
|
@@ -482,10 +486,10 @@ const buildAuthHeaders = () => {
|
|
|
482
486
|
return {};
|
|
483
487
|
};
|
|
484
488
|
const fetchBase = (path, params) => {
|
|
485
|
-
return Promise.all([
|
|
486
|
-
let [
|
|
487
|
-
if (
|
|
488
|
-
const url = `${
|
|
489
|
+
return Promise.all([getONESHostedManagerBaseUrl(), getONESHostedAppID()]).then((_ref) => {
|
|
490
|
+
let [managerBase, appId] = _ref;
|
|
491
|
+
if (managerBase && appId) {
|
|
492
|
+
const url = `${managerBase}/hosted_ability/storage/${appId}${path}`;
|
|
489
493
|
const data = {
|
|
490
494
|
...params
|
|
491
495
|
};
|
|
@@ -494,7 +498,7 @@ const fetchBase = (path, params) => {
|
|
|
494
498
|
});
|
|
495
499
|
}
|
|
496
500
|
throw new Error(JSON.stringify({
|
|
497
|
-
|
|
501
|
+
managerBase,
|
|
498
502
|
appId
|
|
499
503
|
}));
|
|
500
504
|
}).then((response) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/packages/node/storage/entity/fetch/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/packages/node/storage/entity/fetch/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAGV,oBAAoB,EAEpB,qBAAqB,EAErB,mBAAmB,EAEnB,oBAAoB,EAErB,MAAM,SAAS,CAAA;AAEhB,cAAc,SAAS,CAAA;AA2DvB,eAAO,MAAM,SAAS,EAAE,mBAIvB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,qBAIzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,oBAYxB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,oBAIxB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/packages/node/storage/object/fetch/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/packages/node/storage/object/fetch/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAGV,qBAAqB,EAErB,uBAAuB,EAEvB,qBAAqB,EAErB,uBAAuB,EAExB,MAAM,SAAS,CAAA;AAEhB,cAAc,SAAS,CAAA;AAwDvB,eAAO,MAAM,WAAW,EAAE,qBAKzB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,uBAK3B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,qBAEzB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,uBAE3B,CAAA"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description Get
|
|
3
|
-
* @alias
|
|
4
|
-
* @returns
|
|
2
|
+
* @description Get app outbound base URL
|
|
3
|
+
* @alias getONESHostedAppBaseUrl
|
|
4
|
+
* @returns ONES_HOSTED_APP_BASE_URL
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getONESHostedAppBaseUrl: () => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* @description Get runtime manager base URL
|
|
9
|
+
* @alias getONESHostedManagerBaseUrl
|
|
10
|
+
* @returns ONES_HOSTED_MANAGER_BASE_URL
|
|
11
|
+
*/
|
|
12
|
+
export declare const getONESHostedManagerBaseUrl: () => string | undefined;
|
|
7
13
|
/**
|
|
8
14
|
* @description Get the app instance ID
|
|
9
15
|
* @alias getONESHostedAppID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/packages/strict/env/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/packages/strict/env/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,0BAEnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,0BAEvC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0BAE9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0BAE9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ones-open/node-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12-27205.3+f1f548f0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/lodash-es": "^4.17.12"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "f1f548f01ac9971f5f410bea4e08ce08b4416251"
|
|
54
54
|
}
|