breakaway 2.0.0-main.86 → 2.0.0-main.87
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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/infra-inventory.js +37 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "breakaway",
|
|
3
|
-
"version": "2.0.0-main.
|
|
3
|
+
"version": "2.0.0-main.87",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "breakaway",
|
|
9
|
-
"version": "2.0.0-main.
|
|
9
|
+
"version": "2.0.0-main.87",
|
|
10
10
|
"license": "FSL-1.1-Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"breakaway": "scripts/tasks.mjs"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "breakaway",
|
|
3
|
-
"version": "2.0.0-main.
|
|
3
|
+
"version": "2.0.0-main.87",
|
|
4
4
|
"description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
|
|
5
5
|
"license": "FSL-1.1-Apache-2.0",
|
|
6
6
|
"type": "module",
|
package/src/infra-inventory.js
CHANGED
|
@@ -95,6 +95,43 @@ export function resourceView(row, environment, task) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/** The longest reason a stale environment keeps. */
|
|
99
|
+
const MAX_STALE_ERROR = 500;
|
|
100
|
+
|
|
101
|
+
/** @param {string} text */
|
|
102
|
+
export function clipError(text) {
|
|
103
|
+
const t = String(text ?? '').trim() || 'no reason given';
|
|
104
|
+
return t.length > MAX_STALE_ERROR ? `${t.slice(0, MAX_STALE_ERROR - 1)}…` : t;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* What Connections' discovery row says when some environments failed (BRK-257): how many of them discovery reached,
|
|
109
|
+
* then each failure, naming its environment.
|
|
110
|
+
* @param {Array<{ message: string }>} failures
|
|
111
|
+
* @param {number} total the environments with a target on the provider
|
|
112
|
+
*/
|
|
113
|
+
export function discoveredWords(failures, total) {
|
|
114
|
+
const reached = total - failures.length;
|
|
115
|
+
return `${reached} of ${total} ${total === 1 ? 'environment' : 'environments'} discovered; ${failures.map((f) => f.message).join('; ')}`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A stale environment as the API shows it (BRK-257): its discovery failed, so its inventory is what the board saw at
|
|
120
|
+
* `seen`, kept until a discovery works again.
|
|
121
|
+
* @param {{ environment: number, provider: string, at: number, error: string, env_repo: string, env_name: string, seen: number | null }} row
|
|
122
|
+
*/
|
|
123
|
+
export function staleView(row) {
|
|
124
|
+
return {
|
|
125
|
+
environmentId: Number(row.environment),
|
|
126
|
+
repo: row.env_repo,
|
|
127
|
+
environment: row.env_name,
|
|
128
|
+
provider: row.provider,
|
|
129
|
+
at: new Date(Number(row.at)).toISOString(),
|
|
130
|
+
error: row.error,
|
|
131
|
+
seen: row.seen === null || row.seen === undefined ? null : new Date(Number(row.seen)).toISOString(),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
98
135
|
/** How often the cron refreshes a provider's inventory by itself (BRK-248). */
|
|
99
136
|
export const REFRESH_EVERY_MS = 15 * 60 * 1000;
|
|
100
137
|
|