@curviate/cli 0.31.1 → 0.33.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/CHANGELOG.md +254 -1
- package/README.md +2 -0
- package/dist/{account-DZRX4YOK.js → account-IPAW6YRD.js} +89 -46
- package/dist/{chunk-A73TUZBK.js → chunk-27E2M2PS.js} +9 -6
- package/dist/chunk-4EH6EWFW.js +327 -0
- package/dist/{chunk-SKJNLN37.js → chunk-4GXO42ZH.js} +85 -1
- package/dist/{chunk-KQXYEQAD.js → chunk-4IPHFPLO.js} +172 -8
- package/dist/{chunk-Y3H55OSY.js → chunk-5SHLELR7.js} +16 -16
- package/dist/{chunk-JRKM4OV2.js → chunk-REO2BCEX.js} +1 -1
- package/dist/{chunk-6P52Q2GK.js → chunk-REVD4GXL.js} +5 -4
- package/dist/chunk-TCUYH5GO.js +34 -0
- package/dist/{chunk-X3YWBMBC.js → chunk-YCLU5VSN.js} +14 -17
- package/dist/cli.js +104 -37
- package/dist/{comment-6JI4Q6QY.js → comment-F2O4UOSD.js} +32 -26
- package/dist/{company-RLU5SHUO.js → company-ANZGO2HT.js} +52 -34
- package/dist/{config-FUHT23SX.js → config-ZD3Y5MWP.js} +74 -29
- package/dist/{connect-63NUITEZ.js → connect-HYJCGYFO.js} +34 -31
- package/dist/{doctor-KSLZNAKH.js → doctor-VPGGB5CW.js} +22 -16
- package/dist/{exit-codes-RUKZC4WV.js → exit-codes-ZFWQJYOY.js} +1 -1
- package/dist/{feed-PAWXR56T.js → feed-IZZYSYYI.js} +18 -17
- package/dist/{group-ZIIWI7JV.js → group-ETDDF2PJ.js} +21 -18
- package/dist/{inbox-GIPLWRHQ.js → inbox-XQQ4YRRO.js} +27 -22
- package/dist/{inboxes-ECGEMDH7.js → inboxes-6KHXXEBC.js} +18 -17
- package/dist/{job-WPWIAVQY.js → job-PBTJ5DWL.js} +43 -29
- package/dist/{login-3OAUY7TG.js → login-HP5URYD6.js} +15 -3
- package/dist/{message-JQL2XABC.js → message-DQQPMRFU.js} +7 -9
- package/dist/{notification-URSGC7OR.js → notification-CXIRJB57.js} +20 -19
- package/dist/{post-2HI6KL73.js → post-2S7FYMZO.js} +33 -25
- package/dist/{profile-4BXLUYMH.js → profile-UCERD6RR.js} +61 -43
- package/dist/{recruiter-OUXQ5XYU.js → recruiter-PJFUM2ZZ.js} +41 -28
- package/dist/{sales-nav-MJAMCSBO.js → sales-nav-7XNJGVIX.js} +43 -29
- package/dist/{search-M3R35BIB.js → search-DYGIIODT.js} +57 -43
- package/dist/{setup-YV5PVIU5.js → setup-BRULZH53.js} +12 -8
- package/dist/{webhook-3TEYA3B2.js → webhook-2TKWOXYK.js} +25 -22
- package/package.json +2 -2
- package/dist/chunk-LKF5MZIP.js +0 -90
- package/dist/chunk-PKSKQ3LN.js +0 -68
- package/dist/chunk-R3VLWLVV.js +0 -23
- package/dist/chunk-TD2ZIXFR.js +0 -67
- package/dist/chunk-TQJ77SL4.js +0 -147
package/dist/chunk-R3VLWLVV.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/lib/preview.ts
|
|
4
|
-
function buildPreviewOutput(req) {
|
|
5
|
-
const result = {
|
|
6
|
-
method: req.method,
|
|
7
|
-
args: req.args,
|
|
8
|
-
body: req.body
|
|
9
|
-
};
|
|
10
|
-
if (req.account !== void 0) {
|
|
11
|
-
result.account = req.account;
|
|
12
|
-
}
|
|
13
|
-
if (req.attachments && req.attachments.length > 0) {
|
|
14
|
-
result.attachments = req.attachments.map(
|
|
15
|
-
(a) => `${a.name} (${a.buffer.byteLength} bytes)`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
buildPreviewOutput
|
|
23
|
-
};
|
package/dist/chunk-TD2ZIXFR.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
betaOverrideHeader
|
|
4
|
-
} from "./chunk-PKSKQ3LN.js";
|
|
5
|
-
import {
|
|
6
|
-
readConfig
|
|
7
|
-
} from "./chunk-TQJ77SL4.js";
|
|
8
|
-
import {
|
|
9
|
-
assertNoStdinPlaceholder
|
|
10
|
-
} from "./chunk-SKJNLN37.js";
|
|
11
|
-
|
|
12
|
-
// src/lib/client.ts
|
|
13
|
-
import { Curviate } from "@curviate/sdk";
|
|
14
|
-
function headerStrings(headers) {
|
|
15
|
-
if (!headers) return [];
|
|
16
|
-
if (headers instanceof Headers) {
|
|
17
|
-
const out = [];
|
|
18
|
-
headers.forEach((value, key) => out.push(key, value));
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(headers)) return headers.flat().map(String);
|
|
22
|
-
return Object.entries(headers).flat().map(String);
|
|
23
|
-
}
|
|
24
|
-
var guardedFetch = (input, init) => {
|
|
25
|
-
const beta = betaOverrideHeader();
|
|
26
|
-
let merged = init;
|
|
27
|
-
if (Object.keys(beta).length > 0) {
|
|
28
|
-
const headers = new Headers(init?.headers);
|
|
29
|
-
for (const [name, value] of Object.entries(beta)) headers.set(name, value);
|
|
30
|
-
merged = { ...init, headers };
|
|
31
|
-
}
|
|
32
|
-
assertNoStdinPlaceholder("the request about to be sent", [
|
|
33
|
-
String(input instanceof Request ? input.url : input),
|
|
34
|
-
...headerStrings(merged?.headers),
|
|
35
|
-
typeof merged?.body === "string" ? merged.body : void 0
|
|
36
|
-
]);
|
|
37
|
-
return fetch(input, merged);
|
|
38
|
-
};
|
|
39
|
-
function createClient(config) {
|
|
40
|
-
return new Curviate({
|
|
41
|
-
apiKey: config.apiKey.trim(),
|
|
42
|
-
fetch: guardedFetch,
|
|
43
|
-
...config.baseUrl !== void 0 ? { baseUrl: config.baseUrl } : {},
|
|
44
|
-
...config.timeout !== void 0 ? { timeout: config.timeout } : {}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/lib/resolve.ts
|
|
49
|
-
var DEFAULT_BASE_URL = "https://api.curviate.com";
|
|
50
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
51
|
-
async function resolveEffectiveConfig(flags) {
|
|
52
|
-
const cfg = await readConfig();
|
|
53
|
-
const profileName = flags.profile ?? (cfg?.active ?? "default");
|
|
54
|
-
const profile = cfg?.profiles[profileName];
|
|
55
|
-
const apiKey = flags.apiKey ?? process.env["CURVIATE_API_KEY"] ?? profile?.apiKey ?? void 0;
|
|
56
|
-
const apiKeySource = flags.apiKey !== void 0 ? "flag" : process.env["CURVIATE_API_KEY"] !== void 0 ? "env" : profile?.apiKey !== void 0 ? "profile" : "none";
|
|
57
|
-
const baseUrl = flags.baseUrl ?? process.env["CURVIATE_BASE_URL"] ?? profile?.baseUrl ?? DEFAULT_BASE_URL;
|
|
58
|
-
const timeoutFlag = flags.timeout !== void 0 ? parseInt(flags.timeout, 10) : void 0;
|
|
59
|
-
const timeout = timeoutFlag ?? profile?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
60
|
-
const account = flags.account ?? process.env["CURVIATE_ACCOUNT"] ?? profile?.account ?? void 0;
|
|
61
|
-
return { apiKey, baseUrl, timeout, account, apiKeySource };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
createClient,
|
|
66
|
-
resolveEffectiveConfig
|
|
67
|
-
};
|
package/dist/chunk-TQJ77SL4.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
assertNoStdinPlaceholder
|
|
4
|
-
} from "./chunk-SKJNLN37.js";
|
|
5
|
-
|
|
6
|
-
// src/lib/config.ts
|
|
7
|
-
import {
|
|
8
|
-
readFile,
|
|
9
|
-
writeFile,
|
|
10
|
-
mkdir,
|
|
11
|
-
rename,
|
|
12
|
-
chmod,
|
|
13
|
-
unlink
|
|
14
|
-
} from "fs/promises";
|
|
15
|
-
import { join, dirname } from "path";
|
|
16
|
-
import { homedir, tmpdir } from "os";
|
|
17
|
-
import { randomBytes } from "crypto";
|
|
18
|
-
function nullProtoProfiles(profiles) {
|
|
19
|
-
return Object.assign(/* @__PURE__ */ Object.create(null), profiles);
|
|
20
|
-
}
|
|
21
|
-
function getConfigPath() {
|
|
22
|
-
const xdg = process.env["XDG_CONFIG_HOME"] ?? (process.env["APPDATA"] ?? join(homedir(), ".config"));
|
|
23
|
-
return join(xdg, "curviate", "config.json");
|
|
24
|
-
}
|
|
25
|
-
async function readConfig() {
|
|
26
|
-
const cfgPath = getConfigPath();
|
|
27
|
-
let raw;
|
|
28
|
-
try {
|
|
29
|
-
raw = await readFile(cfgPath, "utf8");
|
|
30
|
-
} catch (err) {
|
|
31
|
-
const e = err;
|
|
32
|
-
if (e.code === "ENOENT") return null;
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
const parsed = JSON.parse(raw);
|
|
36
|
-
return { ...parsed, profiles: nullProtoProfiles(parsed.profiles ?? {}) };
|
|
37
|
-
}
|
|
38
|
-
async function writeConfig(cfg) {
|
|
39
|
-
const cfgPath = getConfigPath();
|
|
40
|
-
const cfgDir = dirname(cfgPath);
|
|
41
|
-
await mkdir(cfgDir, { recursive: true, mode: 448 });
|
|
42
|
-
try {
|
|
43
|
-
await chmod(cfgDir, 448);
|
|
44
|
-
} catch {
|
|
45
|
-
}
|
|
46
|
-
const content = JSON.stringify(cfg, null, 2) + "\n";
|
|
47
|
-
assertNoStdinPlaceholder("the configuration about to be written", [content]);
|
|
48
|
-
const tmpPath = join(
|
|
49
|
-
tmpdir(),
|
|
50
|
-
`curviate-cfg-${randomBytes(6).toString("hex")}.tmp`
|
|
51
|
-
);
|
|
52
|
-
try {
|
|
53
|
-
await writeFile(tmpPath, content, { encoding: "utf8", mode: 384 });
|
|
54
|
-
try {
|
|
55
|
-
await chmod(tmpPath, 384);
|
|
56
|
-
} catch {
|
|
57
|
-
}
|
|
58
|
-
await rename(tmpPath, cfgPath);
|
|
59
|
-
try {
|
|
60
|
-
await chmod(cfgPath, 384);
|
|
61
|
-
} catch {
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
try {
|
|
65
|
-
await unlink(tmpPath);
|
|
66
|
-
} catch {
|
|
67
|
-
}
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async function writeProfile(profileName, entry) {
|
|
72
|
-
const existing = await readConfig() ?? {
|
|
73
|
-
active: profileName,
|
|
74
|
-
profiles: nullProtoProfiles({})
|
|
75
|
-
};
|
|
76
|
-
const current = existing.profiles[profileName] ?? {};
|
|
77
|
-
existing.profiles[profileName] = { ...current, ...entry };
|
|
78
|
-
if (!existing.active) {
|
|
79
|
-
existing.active = profileName;
|
|
80
|
-
}
|
|
81
|
-
await writeConfig(existing);
|
|
82
|
-
}
|
|
83
|
-
async function setActiveProfile(profileName) {
|
|
84
|
-
const cfg = await readConfig();
|
|
85
|
-
if (!cfg || !cfg.profiles[profileName]) {
|
|
86
|
-
throw new Error(`Profile "${profileName}" not found.`);
|
|
87
|
-
}
|
|
88
|
-
cfg.active = profileName;
|
|
89
|
-
await writeConfig(cfg);
|
|
90
|
-
}
|
|
91
|
-
async function renameProfile(oldName, newName) {
|
|
92
|
-
const cfg = await readConfig();
|
|
93
|
-
if (!cfg || !cfg.profiles[oldName]) {
|
|
94
|
-
throw new Error(`Profile "${oldName}" not found.`);
|
|
95
|
-
}
|
|
96
|
-
if (cfg.profiles[newName]) {
|
|
97
|
-
throw new Error(
|
|
98
|
-
`Profile "${newName}" already exists. Remove it first or choose another name.`
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
cfg.profiles[newName] = cfg.profiles[oldName];
|
|
102
|
-
delete cfg.profiles[oldName];
|
|
103
|
-
if (cfg.active === oldName) {
|
|
104
|
-
cfg.active = newName;
|
|
105
|
-
}
|
|
106
|
-
await writeConfig(cfg);
|
|
107
|
-
}
|
|
108
|
-
async function removeProfile(profileName) {
|
|
109
|
-
const cfg = await readConfig();
|
|
110
|
-
if (!cfg) return;
|
|
111
|
-
delete cfg.profiles[profileName];
|
|
112
|
-
if (cfg.active === profileName) {
|
|
113
|
-
cfg.active = "default";
|
|
114
|
-
}
|
|
115
|
-
await writeConfig(cfg);
|
|
116
|
-
}
|
|
117
|
-
async function updateProfileField(profileName, field, value) {
|
|
118
|
-
const cfg = await readConfig();
|
|
119
|
-
if (!cfg || !cfg.profiles[profileName]) {
|
|
120
|
-
throw new Error(`Profile "${profileName}" not found.`);
|
|
121
|
-
}
|
|
122
|
-
const profile = cfg.profiles[profileName];
|
|
123
|
-
if (profile) {
|
|
124
|
-
if (field === "timeout") {
|
|
125
|
-
profile.timeout = typeof value === "number" ? value : value !== void 0 ? Number(value) : void 0;
|
|
126
|
-
} else if (field === "apiKey") {
|
|
127
|
-
profile.apiKey = value !== void 0 ? String(value) : void 0;
|
|
128
|
-
} else if (field === "account") {
|
|
129
|
-
profile.account = value !== void 0 ? String(value) : void 0;
|
|
130
|
-
} else if (field === "baseUrl") {
|
|
131
|
-
profile.baseUrl = value !== void 0 ? String(value) : void 0;
|
|
132
|
-
} else if (field === "tenant") {
|
|
133
|
-
profile.tenant = value !== void 0 ? String(value) : void 0;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
await writeConfig(cfg);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export {
|
|
140
|
-
getConfigPath,
|
|
141
|
-
readConfig,
|
|
142
|
-
writeProfile,
|
|
143
|
-
setActiveProfile,
|
|
144
|
-
renameProfile,
|
|
145
|
-
removeProfile,
|
|
146
|
-
updateProfileField
|
|
147
|
-
};
|