bkper 5.0.0 → 5.1.0
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/lib/agent/startup-maintenance.d.ts +7 -4
- package/lib/agent/startup-maintenance.d.ts.map +1 -1
- package/lib/agent/startup-maintenance.js +13 -29
- package/lib/agent/startup-maintenance.js.map +1 -1
- package/lib/cli.js +5 -1
- package/lib/cli.js.map +1 -1
- package/lib/commands/upgrade.d.ts.map +1 -1
- package/lib/commands/upgrade.js +2 -3
- package/lib/commands/upgrade.js.map +1 -1
- package/lib/docs/apps/event-handlers.md +12 -0
- package/lib/docs/cli/app-management.md +1 -0
- package/lib/docs/sdk/bkper-api-types.md +4 -2
- package/lib/docs/sdk/bkper-js.md +1 -0
- package/lib/upgrade/index.d.ts +5 -4
- package/lib/upgrade/index.d.ts.map +1 -1
- package/lib/upgrade/index.js +3 -2
- package/lib/upgrade/index.js.map +1 -1
- package/lib/upgrade/installation.d.ts +54 -20
- package/lib/upgrade/installation.d.ts.map +1 -1
- package/lib/upgrade/installation.js +222 -122
- package/lib/upgrade/installation.js.map +1 -1
- package/lib/upgrade/update-check.d.ts +69 -0
- package/lib/upgrade/update-check.d.ts.map +1 -0
- package/lib/upgrade/update-check.js +253 -0
- package/lib/upgrade/update-check.js.map +1 -0
- package/lib/upgrade/update-worker.d.ts +2 -0
- package/lib/upgrade/update-worker.d.ts.map +1 -0
- package/lib/upgrade/update-worker.js +6 -0
- package/lib/upgrade/update-worker.js.map +1 -0
- package/lib/upgrade/upgrade.d.ts +11 -28
- package/lib/upgrade/upgrade.d.ts.map +1 -1
- package/lib/upgrade/upgrade.js +49 -96
- package/lib/upgrade/upgrade.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UpdateNotice } from '../upgrade/index.js';
|
|
2
2
|
type NotificationType = 'info' | 'warning' | 'error';
|
|
3
3
|
export interface StartupMaintenanceCallbacks {
|
|
4
4
|
notify: (message: string, type?: NotificationType) => void;
|
|
5
5
|
}
|
|
6
6
|
export interface StartupMaintenanceDependencies {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
startDetachedUpgrade: (method: InstallMethod, version: string) => void;
|
|
7
|
+
readNotice: () => UpdateNotice | undefined;
|
|
8
|
+
startUpdateCheck: () => boolean;
|
|
10
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Reports the outcome of the last background update and starts the daily
|
|
12
|
+
* check. The install itself runs in the detached update worker.
|
|
13
|
+
*/
|
|
11
14
|
export declare function runStartupMaintenance(callbacks: StartupMaintenanceCallbacks, dependencies?: StartupMaintenanceDependencies): Promise<void>;
|
|
12
15
|
export {};
|
|
13
16
|
//# sourceMappingURL=startup-maintenance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,YAAY,EACpB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,8BAA8B;IAC3C,UAAU,EAAE,MAAM,YAAY,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,MAAM,OAAO,CAAC;CACnC;AASD;;;GAGG;AACH,wBAAsB,qBAAqB,CACvC,SAAS,EAAE,2BAA2B,EACtC,YAAY,GAAE,8BAA4D,GAC3E,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -7,46 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { formatUpdateNotice, getUpdateNotice, isUpdateCheckDisabled, maybeStartUpdateCheck, readUpdateState, } from '../upgrade/index.js';
|
|
11
11
|
function createDefaultDependencies() {
|
|
12
12
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
startDetachedUpgrade,
|
|
13
|
+
readNotice: () => getUpdateNotice(readUpdateState()),
|
|
14
|
+
startUpdateCheck: () => maybeStartUpdateCheck(),
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Reports the outcome of the last background update and starts the daily
|
|
19
|
+
* check. The install itself runs in the detached update worker.
|
|
20
|
+
*/
|
|
21
21
|
export function runStartupMaintenance(callbacks_1) {
|
|
22
22
|
return __awaiter(this, arguments, void 0, function* (callbacks, dependencies = createDefaultDependencies()) {
|
|
23
|
-
if (
|
|
23
|
+
if (isUpdateCheckDisabled()) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (availableUpgrade.method === 'unknown') {
|
|
32
|
-
callbacks.notify(getManualUpgradeMessage(availableUpgrade.latest), 'warning');
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (yield dependencies.isVersionInstalled(availableUpgrade.method, availableUpgrade.latest)) {
|
|
36
|
-
callbacks.notify(`bkper ${availableUpgrade.latest} is already installed. ` +
|
|
37
|
-
`Restart this session to use it.`, 'info');
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
dependencies.startDetachedUpgrade(availableUpgrade.method, availableUpgrade.latest);
|
|
42
|
-
callbacks.notify(`Updating bkper to ${availableUpgrade.latest} in background. ` +
|
|
43
|
-
`Restart later to use it.`, 'info');
|
|
44
|
-
}
|
|
45
|
-
catch (_a) {
|
|
46
|
-
callbacks.notify(getManualUpgradeMessage(availableUpgrade.latest), 'warning');
|
|
27
|
+
const notice = dependencies.readNotice();
|
|
28
|
+
if (notice) {
|
|
29
|
+
callbacks.notify(formatUpdateNotice(notice), notice.kind === 'installed' ? 'info' : 'warning');
|
|
47
30
|
}
|
|
31
|
+
dependencies.startUpdateCheck();
|
|
48
32
|
}
|
|
49
|
-
catch (
|
|
33
|
+
catch (_a) {
|
|
50
34
|
// Silent failure — never break the TUI
|
|
51
35
|
}
|
|
52
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,GAElB,MAAM,qBAAqB,CAAC;AAa7B,SAAS,yBAAyB;IAC9B,OAAO;QACH,UAAU,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;QACpD,gBAAgB,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE;KAClD,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,qBAAqB;yDACvC,SAAsC,EACtC,eAA+C,yBAAyB,EAAE;QAE1E,IAAI,qBAAqB,EAAE,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,MAAM,EAAE,CAAC;gBACT,SAAS,CAAC,MAAM,CACZ,kBAAkB,CAAC,MAAM,CAAC,EAC1B,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CACnD,CAAC;YACN,CAAC;YACD,YAAY,CAAC,gBAAgB,EAAE,CAAC;QACpC,CAAC;QAAC,WAAM,CAAC;YACL,uCAAuC;QAC3C,CAAC;IACL,CAAC;CAAA"}
|
package/lib/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ import { registerUpgradeCommand } from './commands/upgrade.js';
|
|
|
24
24
|
import { registerOutputOptions } from './commands/cli-helpers.js';
|
|
25
25
|
import { getAgentCommandArgs, shouldRunAgentCommand, shouldShowHelpForBareInvocation, } from './agent/cli-dispatch.js';
|
|
26
26
|
import { runAgentCommandInChild } from './agent/agent-command-runner.js';
|
|
27
|
-
import { VERSION } from './upgrade/index.js';
|
|
27
|
+
import { VERSION, runCommandUpdateCheck } from './upgrade/index.js';
|
|
28
28
|
import { getUnsupportedNodeVersionMessage } from './utils/node-version.js';
|
|
29
29
|
function registerAgentCommands(command) {
|
|
30
30
|
command
|
|
@@ -50,6 +50,10 @@ function main() {
|
|
|
50
50
|
process.exit(1);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
// Daily background update check (never blocks, installs only safe global copies)
|
|
54
|
+
if (process.argv[2] !== 'upgrade') {
|
|
55
|
+
runCommandUpdateCheck();
|
|
56
|
+
}
|
|
53
57
|
// Version
|
|
54
58
|
program.name('bkper');
|
|
55
59
|
program.version(VERSION, '-v, --version');
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B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O,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAO7D"}
|
package/lib/commands/upgrade.js
CHANGED
|
@@ -12,9 +12,8 @@ export function registerUpgradeCommand(program) {
|
|
|
12
12
|
program
|
|
13
13
|
.command('upgrade [version]')
|
|
14
14
|
.description('Upgrade bkper CLI to the latest version')
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
yield foregroundUpgrade(version, options.method);
|
|
15
|
+
.action((version) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
yield foregroundUpgrade(version);
|
|
18
17
|
}));
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=upgrade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACnD,OAAO;SACF,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACnD,OAAO;SACF,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,CAAO,OAA2B,EAAE,EAAE;QAC1C,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAA,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -244,5 +244,17 @@ The complete API set of event types is listed below. `COMMENT_CREATED` and `COMM
|
|
|
244
244
|
| `INTEGRATION_DELETED` | An integration was deleted. |
|
|
245
245
|
| `BOOK_CREATED` | A book was created. |
|
|
246
246
|
| `BOOK_AUDITED` | A balances audit completed for the book. |
|
|
247
|
+
| `BOOK_OVERNIGHT` | Daily scheduled event for the book, delivered at or after 01:00 in the book's time zone. |
|
|
247
248
|
| `BOOK_UPDATED` | Book settings were updated. |
|
|
248
249
|
| `BOOK_DELETED` | The book was deleted. |
|
|
250
|
+
|
|
251
|
+
### Scheduled work with `BOOK_OVERNIGHT`
|
|
252
|
+
|
|
253
|
+
`BOOK_OVERNIGHT` lets your app run daily work on a book without waiting for a user action — for example, end-of-day recalculations, fetching external data, or consistency checks.
|
|
254
|
+
|
|
255
|
+
- **When:** once per day, at or after 01:00 in the book's time zone (UTC if the book has no time zone). Delivery may be up to about an hour later.
|
|
256
|
+
- **Which books:** only books where an installed app subscribes to `BOOK_OVERNIGHT`. Books without such an app receive nothing.
|
|
257
|
+
- **What day:** each event represents the local day that just ended. A book gets at most one `BOOK_OVERNIGHT` event per local day.
|
|
258
|
+
- **Idempotency:** the event `id` is stable for the book and day, so use it to skip repeated deliveries.
|
|
259
|
+
- **User:** the event `user` is the book owner. Your handler still runs on behalf of the user who installed the app.
|
|
260
|
+
- **Development webhook:** `webhookUrlDev` is used when the user who installed the app is its owner or one of its developers.
|
|
@@ -459,6 +459,7 @@ events:
|
|
|
459
459
|
- BOOK_UPDATED
|
|
460
460
|
- BOOK_DELETED
|
|
461
461
|
- BOOK_AUDITED
|
|
462
|
+
- BOOK_OVERNIGHT # Daily per-Book event, at or after 01:00 in the Book's time zone
|
|
462
463
|
|
|
463
464
|
# -----------------------------------------------------------------------------
|
|
464
465
|
# FILE PATTERNS (optional)
|
|
@@ -89,7 +89,7 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
|
|
|
89
89
|
- `deprecated?`: `boolean` — Whether the app is deprecated
|
|
90
90
|
- `description?`: `string` — The App description
|
|
91
91
|
- `developers?`: `string` — The developers (usernames and domain patterns), comma or space separated
|
|
92
|
-
- `events?`: `("FILE_CREATED" | "FILE_UPDATED" | "FILE_DELETED" | "TRANSACTION_CREATED" | "TRANSACTION_UPDATED" | "TRANSACTION_DELETED" | "TRANSACTION_POSTED" | "TRANSACTION_CHECKED" | "TRANSACTION_UNCHECKED" | "TRANSACTION_RESTORED" | "ACCOUNT_CREATED" | "ACCOUNT_UPDATED" | "ACCOUNT_DELETED" | "QUERY_CREATED" | "QUERY_UPDATED" | "QUERY_DELETED" | "GROUP_CREATED" | "GROUP_UPDATED" | "GROUP_DELETED" | "COMMENT_CREATED" | "COMMENT_DELETED" | "COLLABORATOR_ADDED" | "COLLABORATOR_UPDATED" | "COLLABORATOR_REMOVED" | "INTEGRATION_CREATED" | "INTEGRATION_UPDATED" | "INTEGRATION_DELETED" | "BOOK_CREATED" | "BOOK_AUDITED" | "BOOK_UPDATED" | "BOOK_DELETED")[]` — Event types the App listen to
|
|
92
|
+
- `events?`: `("FILE_CREATED" | "FILE_UPDATED" | "FILE_DELETED" | "TRANSACTION_CREATED" | "TRANSACTION_UPDATED" | "TRANSACTION_DELETED" | "TRANSACTION_POSTED" | "TRANSACTION_CHECKED" | "TRANSACTION_UNCHECKED" | "TRANSACTION_RESTORED" | "ACCOUNT_CREATED" | "ACCOUNT_UPDATED" | "ACCOUNT_DELETED" | "QUERY_CREATED" | "QUERY_UPDATED" | "QUERY_DELETED" | "GROUP_CREATED" | "GROUP_UPDATED" | "GROUP_DELETED" | "COMMENT_CREATED" | "COMMENT_DELETED" | "COLLABORATOR_ADDED" | "COLLABORATOR_UPDATED" | "COLLABORATOR_REMOVED" | "INTEGRATION_CREATED" | "INTEGRATION_UPDATED" | "INTEGRATION_DELETED" | "BOOK_CREATED" | "BOOK_AUDITED" | "BOOK_OVERNIGHT" | "BOOK_UPDATED" | "BOOK_DELETED")[]` — Event types the App listen to
|
|
93
93
|
- `filePatterns?`: `string[]` — File patterns the App handles - wildcard accepted. E.g. *.pdf, *-bank.csv
|
|
94
94
|
- `id?`: `string` — The unique agent id of the App - this can't be changed after created
|
|
95
95
|
- `installable?`: `boolean` — Whether this app is installable in a book
|
|
@@ -331,7 +331,7 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
|
|
|
331
331
|
- `data?`: `bkper.EventData`
|
|
332
332
|
- `id?`: `string` — The unique id that identifies the Event
|
|
333
333
|
- `resource?`: `string` — The resource associated to the Event
|
|
334
|
-
- `type?`: `"FILE_CREATED" | "FILE_UPDATED" | "FILE_DELETED" | "TRANSACTION_CREATED" | "TRANSACTION_UPDATED" | "TRANSACTION_DELETED" | "TRANSACTION_POSTED" | "TRANSACTION_CHECKED" | "TRANSACTION_UNCHECKED" | "TRANSACTION_RESTORED" | "ACCOUNT_CREATED" | "ACCOUNT_UPDATED" | "ACCOUNT_DELETED" | "QUERY_CREATED" | "QUERY_UPDATED" | "QUERY_DELETED" | "GROUP_CREATED" | "GROUP_UPDATED" | "GROUP_DELETED" | "COMMENT_CREATED" | "COMMENT_DELETED" | "COLLABORATOR_ADDED" | "COLLABORATOR_UPDATED" | "COLLABORATOR_REMOVED" | "INTEGRATION_CREATED" | "INTEGRATION_UPDATED" | "INTEGRATION_DELETED" | "BOOK_CREATED" | "BOOK_AUDITED" | "BOOK_UPDATED" | "BOOK_DELETED"` — The type of the Event
|
|
334
|
+
- `type?`: `"FILE_CREATED" | "FILE_UPDATED" | "FILE_DELETED" | "TRANSACTION_CREATED" | "TRANSACTION_UPDATED" | "TRANSACTION_DELETED" | "TRANSACTION_POSTED" | "TRANSACTION_CHECKED" | "TRANSACTION_UNCHECKED" | "TRANSACTION_RESTORED" | "ACCOUNT_CREATED" | "ACCOUNT_UPDATED" | "ACCOUNT_DELETED" | "QUERY_CREATED" | "QUERY_UPDATED" | "QUERY_DELETED" | "GROUP_CREATED" | "GROUP_UPDATED" | "GROUP_DELETED" | "COMMENT_CREATED" | "COMMENT_DELETED" | "COLLABORATOR_ADDED" | "COLLABORATOR_UPDATED" | "COLLABORATOR_REMOVED" | "INTEGRATION_CREATED" | "INTEGRATION_UPDATED" | "INTEGRATION_DELETED" | "BOOK_CREATED" | "BOOK_AUDITED" | "BOOK_OVERNIGHT" | "BOOK_UPDATED" | "BOOK_DELETED"` — The type of the Event
|
|
335
335
|
- `user?`: `bkper.User`
|
|
336
336
|
|
|
337
337
|
### EventData
|
|
@@ -547,6 +547,8 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
|
|
|
547
547
|
- `id?`: `string` — The user unique id
|
|
548
548
|
- `name?`: `string` — The user display name
|
|
549
549
|
- `plan?`: `string` — The user plan
|
|
550
|
+
- `planAmount?`: `number` — The confirmed recurring plan total in currency minor units
|
|
551
|
+
- `planCurrency?`: `string` — The confirmed recurring plan currency
|
|
550
552
|
- `planCycle?`: `"MONTHLY" | "YEARLY"` — The user plan billing cycle
|
|
551
553
|
- `planOverdue?`: `boolean` — True if subscription payment is overdue
|
|
552
554
|
- `startedTrial?`: `boolean` — True if user started trial
|
package/lib/docs/sdk/bkper-js.md
CHANGED
|
@@ -1403,6 +1403,7 @@ Enum that represents event types.
|
|
|
1403
1403
|
- `BOOK_AUDITED`
|
|
1404
1404
|
- `BOOK_CREATED`
|
|
1405
1405
|
- `BOOK_DELETED`
|
|
1406
|
+
- `BOOK_OVERNIGHT` — Daily per-Book event for Apps subscribed to it, delivered at or after 01:00 in the Book's time zone.
|
|
1406
1407
|
- `BOOK_UPDATED`
|
|
1407
1408
|
- `COLLABORATOR_ADDED`
|
|
1408
1409
|
- `COLLABORATOR_REMOVED`
|
package/lib/upgrade/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
1
|
+
export { PACKAGE_DIR, VERSION, detectInstallMethod, fetchLatestVersion, getInstallCommand, getSelfUpdatePlan, } from './installation.js';
|
|
2
|
+
export { foregroundUpgrade, isNewerVersion, runUpgrade } from './upgrade.js';
|
|
3
|
+
export { formatUpdateNotice, getUpdateNotice, isUpdateCheckDisabled, maybeStartUpdateCheck, readUpdateState, runCommandUpdateCheck, } from './update-check.js';
|
|
4
|
+
export type { InstallMethod, SelfUpdatePlan } from './installation.js';
|
|
5
|
+
export type { UpdateNotice } from './update-check.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/lib/upgrade/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { PACKAGE_DIR, VERSION, detectInstallMethod, fetchLatestVersion, getInstallCommand, getSelfUpdatePlan, } from './installation.js';
|
|
2
|
+
export { foregroundUpgrade, isNewerVersion, runUpgrade } from './upgrade.js';
|
|
3
|
+
export { formatUpdateNotice, getUpdateNotice, isUpdateCheckDisabled, maybeStartUpdateCheck, readUpdateState, runCommandUpdateCheck, } from './update-check.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/lib/upgrade/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,GACxB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,38 +1,72 @@
|
|
|
1
1
|
/** Current installed version of the CLI. */
|
|
2
2
|
export declare const VERSION: string;
|
|
3
|
+
/** Directory of the running bkper package (the folder holding its package.json). */
|
|
4
|
+
export declare const PACKAGE_DIR: string;
|
|
3
5
|
/** Supported installation methods. */
|
|
4
|
-
export type InstallMethod = 'npm' | '
|
|
5
|
-
|
|
6
|
-
export
|
|
6
|
+
export type InstallMethod = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'unknown';
|
|
7
|
+
/** Where the running CLI lives and how it was started. */
|
|
8
|
+
export interface RuntimeLocation {
|
|
9
|
+
packageDir: string;
|
|
10
|
+
/** process.argv[1], not symlink-resolved. */
|
|
11
|
+
entrypoint?: string;
|
|
12
|
+
execPath: string;
|
|
13
|
+
isBunRuntime: boolean;
|
|
14
|
+
platform: NodeJS.Platform;
|
|
15
|
+
}
|
|
16
|
+
/** Side effects needed to decide whether the running copy can upgrade itself. */
|
|
17
|
+
export interface SelfUpdateEnvironment {
|
|
18
|
+
homedir: string;
|
|
19
|
+
readCommandOutput: (command: string) => string | undefined;
|
|
20
|
+
isWritable: (dir: string) => boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface InstallPlan {
|
|
23
|
+
kind: 'install';
|
|
24
|
+
method: InstallMethod;
|
|
25
|
+
packageDir: string;
|
|
26
|
+
command: string;
|
|
27
|
+
/** package.json to read after installing, reached through the global root. */
|
|
28
|
+
packageJsonPath: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ManualPlan {
|
|
31
|
+
kind: 'manual';
|
|
32
|
+
method: InstallMethod;
|
|
33
|
+
packageDir: string;
|
|
34
|
+
instruction: string;
|
|
35
|
+
}
|
|
36
|
+
export type SelfUpdatePlan = InstallPlan | ManualPlan;
|
|
37
|
+
export declare function getRuntimeLocation(): RuntimeLocation;
|
|
7
38
|
/**
|
|
8
|
-
* Detects
|
|
9
|
-
*
|
|
39
|
+
* Detects the package manager from the location of the running code
|
|
40
|
+
* (same rules as Pi's detectInstallMethod).
|
|
10
41
|
*/
|
|
11
|
-
export declare function
|
|
42
|
+
export declare function detectInstallMethod(location?: RuntimeLocation): InstallMethod;
|
|
12
43
|
/**
|
|
13
|
-
*
|
|
44
|
+
* Infers the npm prefix from a `<prefix>/lib/node_modules/bkper` layout.
|
|
45
|
+
* Windows prefixes look like project installs, so they are never inferred.
|
|
14
46
|
*/
|
|
15
|
-
export declare function
|
|
47
|
+
export declare function inferNpmPrefix(packageDir: string, platform: NodeJS.Platform): string | undefined;
|
|
16
48
|
/**
|
|
17
|
-
*
|
|
49
|
+
* Returns the shell command that installs a version with a package manager.
|
|
18
50
|
*/
|
|
19
|
-
export declare function
|
|
51
|
+
export declare function getInstallCommand(method: InstallMethod, version: string, npmPrefix?: string): string | null;
|
|
20
52
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
53
|
+
* Decides whether the running copy can safely upgrade itself: it must be
|
|
54
|
+
* inside its package manager's global root and writable. Otherwise returns
|
|
55
|
+
* the manual instruction to show. Never suggests sudo.
|
|
23
56
|
*/
|
|
24
|
-
export declare function
|
|
57
|
+
export declare function getSelfUpdatePlan(version: string, location?: RuntimeLocation, environment?: SelfUpdateEnvironment): SelfUpdatePlan;
|
|
25
58
|
/**
|
|
26
|
-
*
|
|
59
|
+
* Reads a package version from disk, bypassing the module cache.
|
|
27
60
|
*/
|
|
28
|
-
export declare function
|
|
61
|
+
export declare function readInstalledVersion(packageJsonPath: string): string | undefined;
|
|
29
62
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
63
|
+
* Runs an install command synchronously. BKPER_AUTOUPDATE_COMMAND replaces
|
|
64
|
+
* the command (for tests) but never the safety checks that lead here.
|
|
32
65
|
*/
|
|
33
|
-
export declare function
|
|
66
|
+
export declare function runInstallCommand(command: string): void;
|
|
34
67
|
/**
|
|
35
|
-
*
|
|
68
|
+
* Fetches the latest published version from the npm registry.
|
|
69
|
+
* Returns null if the fetch fails.
|
|
36
70
|
*/
|
|
37
|
-
export declare function
|
|
71
|
+
export declare function fetchLatestVersion(timeoutMs?: number): Promise<string | null>;
|
|
38
72
|
//# sourceMappingURL=installation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../../src/upgrade/installation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../../src/upgrade/installation.ts"],"names":[],"mappings":"AAUA,4CAA4C;AAC5C,eAAO,MAAM,OAAO,EAAE,MAAoB,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