@qablehq/atto 0.0.6 → 0.0.8
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/out/main/index.js
CHANGED
|
@@ -3133,7 +3133,9 @@ function asProjects(value) {
|
|
|
3133
3133
|
id: row.id,
|
|
3134
3134
|
key: typeof row.key === "string" ? row.key : "",
|
|
3135
3135
|
name: row.name,
|
|
3136
|
-
role: typeof row.role === "string" ? row.role : "member"
|
|
3136
|
+
role: typeof row.role === "string" ? row.role : "member",
|
|
3137
|
+
clientName: typeof row.clientName === "string" ? row.clientName : void 0,
|
|
3138
|
+
userName: typeof row.userName === "string" ? row.userName : void 0
|
|
3137
3139
|
});
|
|
3138
3140
|
}
|
|
3139
3141
|
return projects;
|
|
@@ -3145,15 +3147,22 @@ async function loadAccount(link) {
|
|
|
3145
3147
|
return disconnected(await errorMessage(response));
|
|
3146
3148
|
}
|
|
3147
3149
|
if (!response.ok) throw new Error(await errorMessage(response));
|
|
3150
|
+
const projects = asProjects(await response.json());
|
|
3148
3151
|
return {
|
|
3149
3152
|
connected: true,
|
|
3150
3153
|
baseUrl: link.baseUrl,
|
|
3151
|
-
user:
|
|
3154
|
+
user: signedInUser(projects),
|
|
3152
3155
|
workspaces: [],
|
|
3153
|
-
projects
|
|
3156
|
+
projects,
|
|
3154
3157
|
error: null
|
|
3155
3158
|
};
|
|
3156
3159
|
}
|
|
3160
|
+
function signedInUser(projects) {
|
|
3161
|
+
const project = projects.find((item) => item.userName || item.clientName);
|
|
3162
|
+
if (!project) return null;
|
|
3163
|
+
const name = [project.userName, project.clientName].filter(Boolean).join(" · ");
|
|
3164
|
+
return { userId: project.userName || project.clientName || "", email: null, name: name || null };
|
|
3165
|
+
}
|
|
3157
3166
|
async function tesboStatus() {
|
|
3158
3167
|
const link = readLink();
|
|
3159
3168
|
if (!link) return disconnected();
|
|
@@ -3174,12 +3183,13 @@ async function tesboLogin(cmd) {
|
|
|
3174
3183
|
});
|
|
3175
3184
|
if (!response.ok) throw new Error(await errorMessage(response));
|
|
3176
3185
|
writeLink(link);
|
|
3186
|
+
const projects = asProjects(await response.json());
|
|
3177
3187
|
return {
|
|
3178
3188
|
connected: true,
|
|
3179
3189
|
baseUrl: link.baseUrl,
|
|
3180
|
-
user:
|
|
3190
|
+
user: signedInUser(projects),
|
|
3181
3191
|
workspaces: [],
|
|
3182
|
-
projects
|
|
3192
|
+
projects,
|
|
3183
3193
|
error: null
|
|
3184
3194
|
};
|
|
3185
3195
|
}
|
|
@@ -12067,7 +12077,85 @@ function updateFeedUrl() {
|
|
|
12067
12077
|
if (process.platform === "linux") return LINUX_FEED;
|
|
12068
12078
|
return WINDOWS_FEED;
|
|
12069
12079
|
}
|
|
12080
|
+
function readPackageName() {
|
|
12081
|
+
const require2 = node_module.createRequire(__filename);
|
|
12082
|
+
const pkg = require2(node_path.join(__dirname, "../../package.json"));
|
|
12083
|
+
return pkg.name ?? "@qablehq/atto";
|
|
12084
|
+
}
|
|
12085
|
+
function isNewerVersion(latest, current) {
|
|
12086
|
+
const parse = (value) => value.split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
12087
|
+
const next = parse(latest);
|
|
12088
|
+
const now = parse(current);
|
|
12089
|
+
for (let i = 0; i < 3; i += 1) {
|
|
12090
|
+
const a = next[i] ?? 0;
|
|
12091
|
+
const b = now[i] ?? 0;
|
|
12092
|
+
if (a > b) return true;
|
|
12093
|
+
if (a < b) return false;
|
|
12094
|
+
}
|
|
12095
|
+
return false;
|
|
12096
|
+
}
|
|
12097
|
+
function registryLatestUrl(name) {
|
|
12098
|
+
if (name.startsWith("@")) {
|
|
12099
|
+
return `https://registry.npmjs.org/${name.replace("/", "%2f")}/latest`;
|
|
12100
|
+
}
|
|
12101
|
+
return `https://registry.npmjs.org/${name}/latest`;
|
|
12102
|
+
}
|
|
12103
|
+
function detectNpmPrefix() {
|
|
12104
|
+
const packageRoot = node_path.join(__dirname, "../..");
|
|
12105
|
+
const needle = `${node_path.sep}node_modules${node_path.sep}`;
|
|
12106
|
+
const index = packageRoot.lastIndexOf(needle);
|
|
12107
|
+
if (index < 0) return void 0;
|
|
12108
|
+
const beforeModules = packageRoot.slice(0, index);
|
|
12109
|
+
const libSuffix = `${node_path.sep}lib`;
|
|
12110
|
+
if (beforeModules.endsWith(libSuffix)) {
|
|
12111
|
+
return beforeModules.slice(0, -libSuffix.length);
|
|
12112
|
+
}
|
|
12113
|
+
return beforeModules;
|
|
12114
|
+
}
|
|
12115
|
+
function setupNpmUpdater() {
|
|
12116
|
+
const name = readPackageName();
|
|
12117
|
+
let pending = null;
|
|
12118
|
+
const prefix = detectNpmPrefix();
|
|
12119
|
+
electron.app.on("before-quit", () => {
|
|
12120
|
+
if (!pending) return;
|
|
12121
|
+
const version = pending;
|
|
12122
|
+
pending = null;
|
|
12123
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
12124
|
+
const args = ["install", "-g", `${name}@${version}`];
|
|
12125
|
+
if (prefix) args.push("--prefix", prefix);
|
|
12126
|
+
console.log(
|
|
12127
|
+
`[npm-updater] installing ${name}@${version}${prefix ? ` --prefix ${prefix}` : ""} after quit`
|
|
12128
|
+
);
|
|
12129
|
+
const child = node_child_process.spawn(npm, args, {
|
|
12130
|
+
detached: true,
|
|
12131
|
+
stdio: "ignore",
|
|
12132
|
+
windowsHide: true
|
|
12133
|
+
});
|
|
12134
|
+
child.unref();
|
|
12135
|
+
});
|
|
12136
|
+
const current = electron.app.getVersion();
|
|
12137
|
+
void (async () => {
|
|
12138
|
+
const controller = new AbortController();
|
|
12139
|
+
const timer = setTimeout(() => controller.abort(), 15e3);
|
|
12140
|
+
try {
|
|
12141
|
+
const response = await fetch(registryLatestUrl(name), { signal: controller.signal });
|
|
12142
|
+
if (!response.ok) return;
|
|
12143
|
+
const body = await response.json();
|
|
12144
|
+
if (!body.version || !isNewerVersion(body.version, current)) return;
|
|
12145
|
+
pending = body.version;
|
|
12146
|
+
console.log(`[npm-updater] ${body.version} will install quietly on quit`);
|
|
12147
|
+
} catch (error) {
|
|
12148
|
+
console.error("[npm-updater] check failed", error);
|
|
12149
|
+
} finally {
|
|
12150
|
+
clearTimeout(timer);
|
|
12151
|
+
}
|
|
12152
|
+
})();
|
|
12153
|
+
}
|
|
12070
12154
|
function setupAutoUpdater() {
|
|
12155
|
+
if (process.env.ATTO_NPM_PACKAGE === "1") {
|
|
12156
|
+
setupNpmUpdater();
|
|
12157
|
+
return;
|
|
12158
|
+
}
|
|
12071
12159
|
if (!electron.app.isPackaged) {
|
|
12072
12160
|
return;
|
|
12073
12161
|
}
|
|
@@ -33118,7 +33118,8 @@ function TesboPanel() {
|
|
|
33118
33118
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
33119
33119
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
33120
33120
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-semibold", children: "Tesbo projects" }),
|
|
33121
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Paste the access code from your QAble contact. Atto does not open the Tesbo website." })
|
|
33121
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Paste the access code from your QAble contact. Atto does not open the Tesbo website." }),
|
|
33122
|
+
status?.connected && status.user?.name && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-sm text-foreground", children: status.user.name })
|
|
33122
33123
|
] }),
|
|
33123
33124
|
status?.connected && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => void disconnect(), disabled: busy, children: "Disconnect" })
|
|
33124
33125
|
] }),
|
package/out/renderer/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/>
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
10
|
<title>Tesbo Automate</title>
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-CWoTAmL0.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-CKtSvvUQ.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|