attio 0.0.1-experimental.20251104.3 → 0.0.1-experimental.20251105.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/README.md +6 -0
- package/lib/api/api.js +183 -0
- package/lib/api/fetcher.js +69 -0
- package/lib/api/schemas.js +89 -0
- package/lib/attio-logo.js +24 -0
- package/lib/attio.js +22 -40290
- package/lib/auth/auth.js +174 -0
- package/lib/auth/keychain.js +108 -0
- package/lib/build/client/generate-client-entry.js +1 -1
- package/lib/build/server/generate-server-entry.js +1 -1
- package/lib/build/workflow-block-modules.js +1 -0
- package/lib/build.js +1 -1
- package/lib/commands/build.js +2 -1
- package/lib/commands/dev/boot.js +2 -1
- package/lib/commands/dev/graphql-code-gen.js +1 -1
- package/lib/commands/dev/graphql-server.js +6 -5
- package/lib/commands/dev/onboarding.js +2 -1
- package/lib/commands/dev/upload.js +2 -1
- package/lib/commands/dev.js +4 -5
- package/lib/commands/init/create-project.js +36 -0
- package/lib/commands/init.js +41 -9
- package/lib/commands/login.js +2 -1
- package/lib/commands/logout.js +2 -1
- package/lib/commands/logs.js +3 -1
- package/lib/commands/version/create.js +4 -1
- package/lib/commands/version/list.js +2 -1
- package/lib/commands/whoami.js +3 -1
- package/lib/constants/settings-files.js +2 -0
- package/lib/env.js +5 -0
- package/lib/errors.js +1 -0
- package/lib/print-errors.js +177 -0
- package/lib/sdk-version.js +1 -0
- package/lib/spinners/determine-workspace.spinner.js +2 -1
- package/lib/spinners/get-app-info.spinner.js +2 -1
- package/lib/spinners/get-versions.spinner.js +2 -1
- package/lib/template/README.md +21 -0
- package/lib/template/biome.jsonc +59 -0
- package/lib/template/eslint.attio.config.js +41 -0
- package/lib/template/graphql.config.json +9 -0
- package/lib/template/package.json +35 -0
- package/lib/template/src/app.settings.ts +8 -0
- package/lib/template/src/app.ts +10 -0
- package/lib/template/src/assets/icon.png +0 -0
- package/lib/template/src/get-stoic-quote.server.ts +14 -0
- package/lib/template/src/hello-world-action.tsx +18 -0
- package/lib/template/src/hello-world-dialog.tsx +27 -0
- package/lib/template/src/stoic-quote.tsx +21 -0
- package/lib/template/tsconfig.json +42 -0
- package/lib/util/assert-app-settings.js +1 -1
- package/lib/util/can-write.js +11 -0
- package/lib/util/copy-with-replace.js +56 -0
- package/lib/util/create-directory.js +27 -0
- package/lib/util/exit-with-missing-app-settings.js +1 -1
- package/lib/util/exit-with-missing-entry-point.js +1 -1
- package/lib/util/find-available-port.js +37 -0
- package/lib/util/generate-settings-files.js +1 -1
- package/lib/util/hard-exit.js +6 -0
- package/lib/util/print-logo.js +5 -0
- package/lib/util/realtime.js +1 -1
- package/lib/util/spinner.js +61 -0
- package/lib/util/text-gradient.js +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import net from "net";
|
|
2
|
+
import { hardExit } from "./hard-exit.js";
|
|
3
|
+
async function isPortAvailable(port) {
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
const portTester = net.createConnection(port, "127.0.0.1");
|
|
6
|
+
portTester.setTimeout(1000);
|
|
7
|
+
const cleanup = () => {
|
|
8
|
+
portTester.removeAllListeners();
|
|
9
|
+
portTester.destroy();
|
|
10
|
+
};
|
|
11
|
+
portTester.once("error", (err) => {
|
|
12
|
+
cleanup();
|
|
13
|
+
if (err.code === "ECONNREFUSED") {
|
|
14
|
+
resolve(true);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolve(false);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
portTester.once("connect", () => {
|
|
21
|
+
cleanup();
|
|
22
|
+
resolve(false);
|
|
23
|
+
});
|
|
24
|
+
portTester.once("timeout", () => {
|
|
25
|
+
cleanup();
|
|
26
|
+
resolve(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export async function findAvailablePort(startPort, maxAttempts = 100) {
|
|
31
|
+
for (let port = startPort; port < startPort + maxAttempts; port++) {
|
|
32
|
+
if (await isPortAvailable(port)) {
|
|
33
|
+
return port;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
hardExit(`Could not find an available port after ${maxAttempts} attempts`);
|
|
37
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { APP_SETTINGS_FILENAME, SETTINGS_TYPES_FILENAME } from "@attio/cli";
|
|
4
3
|
import { combineAsync, complete, errored, isErrored } from "@attio/fetchable-npm";
|
|
5
4
|
import { HIDDEN_ATTIO_DIRECTORY } from "../constants/hidden-attio-directory.js";
|
|
5
|
+
import { APP_SETTINGS_FILENAME, SETTINGS_TYPES_FILENAME } from "../constants/settings-files.js";
|
|
6
6
|
const SETTINGS_SCHEMA_FILE_CONTENT = `import type {SettingsSchema} from "attio"
|
|
7
7
|
|
|
8
8
|
export const settingsSchema = {
|
package/lib/util/realtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Ably from "ably";
|
|
2
|
-
import { api } from "@attio/cli";
|
|
3
2
|
import { complete, errored, isComplete, isErrored } from "@attio/fetchable-npm";
|
|
3
|
+
import { api } from "../api/api.js";
|
|
4
4
|
function makeConnectionError(error) {
|
|
5
5
|
return errored({
|
|
6
6
|
code: "FAILED_TO_CONNECT_TO_REALTIME_SERVER",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { isComplete } from "@attio/fetchable-npm";
|
|
3
|
+
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
4
|
+
class Spinner {
|
|
5
|
+
frameIndex = 0;
|
|
6
|
+
stopped = false;
|
|
7
|
+
interval = null;
|
|
8
|
+
message = "";
|
|
9
|
+
start(message) {
|
|
10
|
+
if (this.interval) {
|
|
11
|
+
clearInterval(this.interval);
|
|
12
|
+
}
|
|
13
|
+
this.message = message;
|
|
14
|
+
this.stopped = false;
|
|
15
|
+
this.interval = setInterval(() => {
|
|
16
|
+
if (this.stopped)
|
|
17
|
+
return;
|
|
18
|
+
const frame = frames[(this.frameIndex = ++this.frameIndex % frames.length)];
|
|
19
|
+
process.stdout.write(`\r${frame} ${this.message}`);
|
|
20
|
+
}, 80);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
update(message) {
|
|
24
|
+
this.message = message;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
stop(message) {
|
|
28
|
+
this.stopped = true;
|
|
29
|
+
if (this.interval) {
|
|
30
|
+
clearInterval(this.interval);
|
|
31
|
+
this.interval = null;
|
|
32
|
+
}
|
|
33
|
+
if (message) {
|
|
34
|
+
process.stdout.write(`\r${message} \n`);
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
success(message) {
|
|
39
|
+
return this.stop(`${chalk.green("✓")} ${message}`);
|
|
40
|
+
}
|
|
41
|
+
error(message) {
|
|
42
|
+
return this.stop(`${chalk.red("✖")} ${message}`);
|
|
43
|
+
}
|
|
44
|
+
warning(message) {
|
|
45
|
+
return this.stop(`${chalk.yellow("⚠")} ${message}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export async function spinnerify(busyMessage, successMessage, fn) {
|
|
49
|
+
const spinner = new Spinner();
|
|
50
|
+
spinner.start(busyMessage);
|
|
51
|
+
try {
|
|
52
|
+
const result = await fn();
|
|
53
|
+
if (isComplete(result)) {
|
|
54
|
+
spinner.success(typeof successMessage === "string" ? successMessage : successMessage(result.value));
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
spinner.stop();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
function hexToRgb(hex) {
|
|
3
|
+
const bigint = parseInt(hex.replace("#", ""), 16);
|
|
4
|
+
return [(bigint >> 16) & 255, (bigint >> 8) & 255, bigint & 255];
|
|
5
|
+
}
|
|
6
|
+
function interpolateColor(start, end, factor) {
|
|
7
|
+
return [
|
|
8
|
+
Math.round(start[0] + (end[0] - start[0]) * factor),
|
|
9
|
+
Math.round(start[1] + (end[1] - start[1]) * factor),
|
|
10
|
+
Math.round(start[2] + (end[2] - start[2]) * factor),
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
export function textGradient(input, startHex, endHex) {
|
|
14
|
+
const lines = input.split("\n");
|
|
15
|
+
const startColor = hexToRgb(startHex);
|
|
16
|
+
const endColor = hexToRgb(endHex);
|
|
17
|
+
const gradientLines = lines.map((line) => {
|
|
18
|
+
const length = line.length;
|
|
19
|
+
return Array.from(line)
|
|
20
|
+
.map((char, index) => {
|
|
21
|
+
const factor = length > 1 ? index / (length - 1) : 0;
|
|
22
|
+
const [r, g, b] = interpolateColor(startColor, endColor, factor);
|
|
23
|
+
return chalk.rgb(r, g, b)(char);
|
|
24
|
+
})
|
|
25
|
+
.join("");
|
|
26
|
+
});
|
|
27
|
+
return gradientLines.join("\n");
|
|
28
|
+
}
|