smart-home-engine 1.44.0 → 1.46.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/dist/web/assets/{index-DDpHIMRc.css → index--6OfYbIN.css} +1 -1
- package/dist/web/assets/index-BhEvCzQ6.js +295 -0
- package/dist/web/assets/{tsMode-IQCYIRzL.js → tsMode-zr639NI9.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/service/she-servicectl +4 -4
- package/src/lib/services-catalog.js +48 -2
- package/src/web/services-api.js +4 -4
- package/dist/web/assets/index-C5CNdJWG.js +0 -289
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-BhEvCzQ6.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
}
|
|
173
173
|
})();
|
|
174
174
|
</script>
|
|
175
|
-
<script type="module" crossorigin src="/assets/index-
|
|
175
|
+
<script type="module" crossorigin src="/assets/index-BhEvCzQ6.js"></script>
|
|
176
176
|
<link rel="modulepreload" crossorigin href="/assets/monaco-langs-DKJI_o9J.js">
|
|
177
177
|
<link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
|
|
178
|
-
<link rel="stylesheet" crossorigin href="/assets/index
|
|
178
|
+
<link rel="stylesheet" crossorigin href="/assets/index--6OfYbIN.css">
|
|
179
179
|
</head>
|
|
180
180
|
<body>
|
|
181
181
|
<div id="app"></div>
|
package/package.json
CHANGED
package/service/she-servicectl
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
# she-servicectl files <adapter> <instance> JSON listing of /etc/<adapter>/ and /var/lib/<adapter>/<instance>/
|
|
32
32
|
# she-servicectl file <adapter> <instance> read|write <path> a file inside those two directories (write: content on stdin)
|
|
33
33
|
# she-servicectl asset <adapter> <relpath> a file shipped in the adapter package (example, schema)
|
|
34
|
-
# she-servicectl node update [--lts|--latest]
|
|
34
|
+
# she-servicectl node update [--lts|--latest|--stable] install/refresh tj/n (downloaded, no npm), then n install <label> — JSON with the version before and after
|
|
35
35
|
# she-servicectl restart-all restart every running instance on this host (after a node update, say)
|
|
36
36
|
# she-servicectl self-update replace this script with the one on stdin (she ships it)
|
|
37
37
|
# she-servicectl remove-key drop the public key on stdin from the calling user's authorized_keys
|
|
@@ -693,14 +693,14 @@ cmd_node() {
|
|
|
693
693
|
action=$1
|
|
694
694
|
shift
|
|
695
695
|
[ "$action" = update ] || die "unknown node action: $action"
|
|
696
|
-
# n
|
|
697
|
-
#
|
|
696
|
+
# the label is handed to n as it is: stable and lts both resolve to the newest
|
|
697
|
+
# long-term-support release (stable is n's older name for it), latest to the newest of all
|
|
698
698
|
spec=lts
|
|
699
699
|
while [ $# -gt 0 ]; do
|
|
700
700
|
case "$1" in
|
|
701
701
|
--lts) spec=lts ;;
|
|
702
702
|
--latest) spec=latest ;;
|
|
703
|
-
--stable) spec=
|
|
703
|
+
--stable) spec=stable ;;
|
|
704
704
|
*) die "unknown option: $1" ;;
|
|
705
705
|
esac
|
|
706
706
|
shift
|
|
@@ -20,6 +20,7 @@ const path = require('path');
|
|
|
20
20
|
|
|
21
21
|
const CORE = 'mqtt-interfaces-core';
|
|
22
22
|
const REGISTRY = 'https://registry.npmjs.org';
|
|
23
|
+
const GITHUB_API = 'https://api.github.com';
|
|
23
24
|
const TTL = 24 * 60 * 60 * 1000;
|
|
24
25
|
|
|
25
26
|
let _fetch = (...args) => fetch(...args);
|
|
@@ -101,6 +102,33 @@ async function details(name, version) {
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
/** owner/repo of a GitHub repository URL, or null for anything else (GitLab, a tarball, …). */
|
|
106
|
+
function githubSlug(repository) {
|
|
107
|
+
if (typeof repository !== 'string') return null;
|
|
108
|
+
const m = repository.match(/github\.com[/:]([^/]+)\/([^/#?]+)/i);
|
|
109
|
+
return m ? { owner: m[1], repo: m[2].replace(/\.git$/, '') } : null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Stars and the owner's profile for a package's GitHub repository. One unauthenticated API
|
|
114
|
+
* call per adapter, and only during the daily sweep — best effort: a rate limit or a moved
|
|
115
|
+
* repository simply leaves the star count out, it never fails the catalog.
|
|
116
|
+
*/
|
|
117
|
+
async function githubInfo(repository) {
|
|
118
|
+
const slug = githubSlug(repository);
|
|
119
|
+
if (!slug) return { stars: null, owner: null, ownerUrl: null };
|
|
120
|
+
try {
|
|
121
|
+
const data = await getJson(`${GITHUB_API}/repos/${slug.owner}/${slug.repo}`, { accept: 'application/vnd.github+json' });
|
|
122
|
+
return {
|
|
123
|
+
stars: typeof data.stargazers_count === 'number' ? data.stargazers_count : null,
|
|
124
|
+
owner: (data.owner && data.owner.login) || slug.owner,
|
|
125
|
+
ownerUrl: (data.owner && data.owner.html_url) || `https://github.com/${slug.owner}`,
|
|
126
|
+
};
|
|
127
|
+
} catch {
|
|
128
|
+
return { stars: null, owner: slug.owner, ownerUrl: `https://github.com/${slug.owner}` };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
104
132
|
/**
|
|
105
133
|
* Sweep the registry for the trusted publishers' adapters.
|
|
106
134
|
* @param {string[]} publishers
|
|
@@ -124,7 +152,8 @@ async function sweep(publishers, now) {
|
|
|
124
152
|
if (!dep) continue;
|
|
125
153
|
const d = await details(p.name, dep.version);
|
|
126
154
|
if (d.deprecated) continue;
|
|
127
|
-
|
|
155
|
+
const gh = await githubInfo(d.repository);
|
|
156
|
+
seen.set(p.name, { name: p.name, version: dep.version, coreRange: dep.range, publisher, ...d, ...gh });
|
|
128
157
|
} catch (err) {
|
|
129
158
|
errors.push({ package: p.name, error: err.message });
|
|
130
159
|
}
|
|
@@ -187,4 +216,21 @@ function refreshing() {
|
|
|
187
216
|
return Boolean(_cache && _cache.promise);
|
|
188
217
|
}
|
|
189
218
|
|
|
190
|
-
module.exports = {
|
|
219
|
+
module.exports = {
|
|
220
|
+
catalog,
|
|
221
|
+
sweep,
|
|
222
|
+
packagesOf,
|
|
223
|
+
coreDependency,
|
|
224
|
+
details,
|
|
225
|
+
githubInfo,
|
|
226
|
+
githubSlug,
|
|
227
|
+
validPublisher,
|
|
228
|
+
setFetch,
|
|
229
|
+
clearCache,
|
|
230
|
+
init,
|
|
231
|
+
refreshing,
|
|
232
|
+
CORE,
|
|
233
|
+
REGISTRY,
|
|
234
|
+
GITHUB_API,
|
|
235
|
+
TTL,
|
|
236
|
+
};
|
package/src/web/services-api.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* POST /she/services/ssh/keygen generate it
|
|
31
31
|
* POST /she/services/hosts/:host/test run `she-servicectl version` → ok / code
|
|
32
32
|
* GET /she/services/node/releases[?refresh=1] what a node update would install: the newest lts and latest release
|
|
33
|
-
* POST /she/services/hosts/:host/node/update { channel: lts|latest } update Node.js with tj/n (helper v13)
|
|
33
|
+
* POST /she/services/hosts/:host/node/update { channel: stable|lts|latest } update Node.js with tj/n (helper v13)
|
|
34
34
|
* POST /she/services/hosts/:host/instances/restart-all restart every running instance (after a node update)
|
|
35
35
|
* POST /she/services/hosts/:host/helper/deploy scp the helper to a remote host, install it, print the sudoers line
|
|
36
36
|
* POST /she/services/hosts/:host/helper/remove { mode: key|all, force? } remove she from the host (I11), drop the host entry
|
|
@@ -1054,9 +1054,9 @@ router.get('/node/releases', async (req, res) => {
|
|
|
1054
1054
|
router.post('/hosts/:host/node/update', async (req, res) => {
|
|
1055
1055
|
const entry = resolve(req, res);
|
|
1056
1056
|
if (!entry) return;
|
|
1057
|
-
//
|
|
1058
|
-
const channel = (req.body && req.body.channel)
|
|
1059
|
-
if (
|
|
1057
|
+
// n's own labels, passed through as they are: stable and lts both mean the newest LTS
|
|
1058
|
+
const channel = (req.body && req.body.channel) || 'lts';
|
|
1059
|
+
if (!['stable', 'lts', 'latest'].includes(channel)) return res.status(400).json({ error: "channel must be 'stable', 'lts' or 'latest'" });
|
|
1060
1060
|
try {
|
|
1061
1061
|
// downloading and unpacking a node build on a small host takes a while
|
|
1062
1062
|
const { stdout } = await entry.driver.exec(['node', 'update', '--' + channel], { timeout: 900000 });
|