@actual-app/api 2.0.0 → 2.0.1
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/index.js +28 -3
- package/package.json +2 -2
- package/local.js +0 -28
package/index.js
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
let bundle = require('./app/bundle.api.js');
|
|
2
|
+
let methods = require('./methods');
|
|
3
|
+
let utils = require('./utils');
|
|
4
|
+
|
|
5
|
+
let injected = require('./injected');
|
|
6
|
+
let actualApp;
|
|
7
|
+
|
|
8
|
+
async function init({ budgetId, config } = {}) {
|
|
9
|
+
if (actualApp) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
global.fetch = require('node-fetch');
|
|
14
|
+
|
|
15
|
+
await bundle.init({ budgetId, config });
|
|
16
|
+
actualApp = bundle.lib;
|
|
17
|
+
|
|
18
|
+
injected.send = bundle.lib.send;
|
|
19
|
+
return bundle.lib;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function shutdown() {
|
|
23
|
+
if (actualApp) {
|
|
24
|
+
await actualApp.send('close-budget');
|
|
25
|
+
actualApp = null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
4
28
|
|
|
5
29
|
module.exports = {
|
|
6
30
|
init,
|
|
7
31
|
shutdown,
|
|
8
32
|
utils,
|
|
33
|
+
internal: bundle.lib,
|
|
9
34
|
...methods
|
|
10
35
|
};
|
package/package.json
CHANGED
package/local.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
let injected = require('./injected');
|
|
2
|
-
let actualApp;
|
|
3
|
-
|
|
4
|
-
async function init({ budgetId, config } = {}) {
|
|
5
|
-
if (actualApp) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
process.traceProcessWarnings = true;
|
|
10
|
-
|
|
11
|
-
global.fetch = require('node-fetch');
|
|
12
|
-
let bundle = require('./app/bundle.api.js');
|
|
13
|
-
|
|
14
|
-
await bundle.init({ budgetId, config });
|
|
15
|
-
actualApp = bundle.lib;
|
|
16
|
-
|
|
17
|
-
injected.send = bundle.lib.send;
|
|
18
|
-
return bundle.lib;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function shutdown() {
|
|
22
|
-
if (actualApp) {
|
|
23
|
-
await actualApp.send('close-budget');
|
|
24
|
-
actualApp = null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = { init, shutdown };
|