@nodaro/cli 1.26.2 → 1.28.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/index.js +176 -23
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createClient, StaticTokenAuth, UnauthorizedError, NodaroError, LOCATION
|
|
|
13
13
|
import select from '@inquirer/select';
|
|
14
14
|
import checkbox from '@inquirer/checkbox';
|
|
15
15
|
import input from '@inquirer/input';
|
|
16
|
-
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, TRANSCRIBE_LANES, SUPPORTED_FONT_NAMES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, DEFAULT_TRANSCRIBE_PROVIDER, SOCIAL_PLATFORMS, collectionRecordHeadline, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, EDIT_PLAN_MODES, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES, RECAST_SEGMENT_PACKS } from '@nodaro/shared';
|
|
16
|
+
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, TRANSCRIBE_LANES, SUPPORTED_FONT_NAMES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, DEFAULT_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES, DEFAULT_TRANSCRIBE_PROVIDER, SOCIAL_PLATFORMS, collectionRecordHeadline, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, EDIT_PLAN_MODES, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES, RECAST_SEGMENT_PACKS } from '@nodaro/shared';
|
|
17
17
|
|
|
18
18
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
19
|
var __commonJS = (cb, mod) => function __require() {
|
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports$1, module) {
|
|
30
30
|
module.exports = {
|
|
31
31
|
name: "@nodaro/cli",
|
|
32
|
-
version: "1.
|
|
32
|
+
version: "1.28.0",
|
|
33
33
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
34
34
|
type: "module",
|
|
35
35
|
license: "Apache-2.0",
|
|
@@ -70,11 +70,11 @@ var require_package = __commonJS({
|
|
|
70
70
|
"@inquirer/confirm": "^6.0.12",
|
|
71
71
|
"@inquirer/input": "^5.0.12",
|
|
72
72
|
"@inquirer/select": "^5.1.4",
|
|
73
|
-
"@nodaro/sdk": "^2.
|
|
74
|
-
"@nodaro/shared": "^3.
|
|
73
|
+
"@nodaro/sdk": "^2.23.0",
|
|
74
|
+
"@nodaro/shared": "^3.28.0",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.36.0"
|
|
78
78
|
},
|
|
79
79
|
devDependencies: {
|
|
80
80
|
tsup: "^8.5.0",
|
|
@@ -398,7 +398,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/client.ts
|
|
401
|
-
var CLI_VERSION = "1.
|
|
401
|
+
var CLI_VERSION = "1.28.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -2900,6 +2900,77 @@ names).`).action(
|
|
|
2900
2900
|
}
|
|
2901
2901
|
}
|
|
2902
2902
|
);
|
|
2903
|
+
cmd.command("video-mask <videoUrl> <prompt>").description("track a subject described in text through a video (SAM 3.1, or --model sam-3 at half the price) and get a black-and-white mask video back (white = the subject)").option("--model <model>", `${VIDEO_MASK_PROVIDERS.join(" | ")} (default ${DEFAULT_VIDEO_MASK_PROVIDER})`).option("--threshold <n>", `detection confidence ${VIDEO_MASK_LIMITS.THRESHOLD_MIN}\u2013${VIDEO_MASK_LIMITS.THRESHOLD_MAX} (default ${VIDEO_MASK_LIMITS.THRESHOLD_DEFAULT}; lower finds more)`, parseFloat).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2904
|
+
Examples:
|
|
2905
|
+
$ nodaro media video-mask https://x/dance.mp4 "the dancer" --watch
|
|
2906
|
+
$ nodaro media video-mask https://x/street.mp4 "person, dog" --threshold 0.3 --watch
|
|
2907
|
+
$ nodaro media video-mask https://x/long-take.mp4 "the skater" --model sam-3 --watch
|
|
2908
|
+
|
|
2909
|
+
Clips up to ${VIDEO_MASK_LIMITS.MAX_BILLED_SEC} s at ${VIDEO_MASK_LIMITS.FPS_BASIS} fps (a faster clip counts proportionally longer); priced by the
|
|
2910
|
+
clip's length. Feed the mask to \`nodaro media mask-composite\`.`).action(async (videoUrl, prompt, opts) => {
|
|
2911
|
+
try {
|
|
2912
|
+
if (opts.model && !VIDEO_MASK_PROVIDERS.includes(opts.model)) {
|
|
2913
|
+
warn(`--model must be one of ${VIDEO_MASK_PROVIDERS.join(", ")} (got "${opts.model}")`);
|
|
2914
|
+
process.exit(1);
|
|
2915
|
+
}
|
|
2916
|
+
if (opts.threshold !== void 0 && !(opts.threshold >= VIDEO_MASK_LIMITS.THRESHOLD_MIN && opts.threshold <= VIDEO_MASK_LIMITS.THRESHOLD_MAX)) {
|
|
2917
|
+
warn(`--threshold must be between ${VIDEO_MASK_LIMITS.THRESHOLD_MIN} and ${VIDEO_MASK_LIMITS.THRESHOLD_MAX}`);
|
|
2918
|
+
process.exit(1);
|
|
2919
|
+
}
|
|
2920
|
+
const client = buildClient(opts.profile);
|
|
2921
|
+
const result = await client.media.videoMask({
|
|
2922
|
+
videoUrl,
|
|
2923
|
+
prompt,
|
|
2924
|
+
...opts.threshold !== void 0 ? { threshold: opts.threshold } : {},
|
|
2925
|
+
...opts.model ? { provider: opts.model } : {}
|
|
2926
|
+
});
|
|
2927
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "video mask" });
|
|
2928
|
+
} catch (err) {
|
|
2929
|
+
handleError(err);
|
|
2930
|
+
}
|
|
2931
|
+
});
|
|
2932
|
+
cmd.command("mask-composite <foregroundUrl> <backgroundUrl> <maskUrl>").description("put a foreground video over a background video through a mask video (white = foreground) \u2014 local compositor, no AI").option("--invert", "swap which side of the mask shows the foreground").option("--feather <px>", `edge softening ${MASK_COMPOSITE_BOUNDS.FEATHER_MIN}\u2013${MASK_COMPOSITE_BOUNDS.FEATHER_MAX} px (default ${MASK_COMPOSITE_DEFAULTS.feather})`, (v) => parseInt(v, 10)).option("--grow <px>", `grow (+) or shrink (\u2212) the foreground region, ${MASK_COMPOSITE_BOUNDS.GROW_MIN}\u2013${MASK_COMPOSITE_BOUNDS.GROW_MAX} px (default 0)`, (v) => parseInt(v, 10)).option("--background-fit <fit>", `${MASK_COMPOSITE_BACKGROUND_FITS.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.backgroundFit})`).option("--audio <source>", `${MASK_COMPOSITE_AUDIO_SOURCES.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.audioSource})`).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2933
|
+
Example:
|
|
2934
|
+
$ nodaro media mask-composite https://x/dance.mp4 https://x/beach.mp4 https://x/dance-mask.mp4 --feather 4 --grow -1 --watch
|
|
2935
|
+
|
|
2936
|
+
The result follows the FOREGROUND's size, frame rate and length; the background
|
|
2937
|
+
is fitted to that frame and loops when shorter; the mask holds its last frame.`).action(
|
|
2938
|
+
async (foregroundUrl, backgroundUrl, maskUrl, opts) => {
|
|
2939
|
+
try {
|
|
2940
|
+
const b = MASK_COMPOSITE_BOUNDS;
|
|
2941
|
+
if (opts.feather !== void 0 && !(Number.isInteger(opts.feather) && opts.feather >= b.FEATHER_MIN && opts.feather <= b.FEATHER_MAX)) {
|
|
2942
|
+
warn(`--feather must be a whole number from ${b.FEATHER_MIN} to ${b.FEATHER_MAX}`);
|
|
2943
|
+
process.exit(1);
|
|
2944
|
+
}
|
|
2945
|
+
if (opts.grow !== void 0 && !(Number.isInteger(opts.grow) && opts.grow >= b.GROW_MIN && opts.grow <= b.GROW_MAX)) {
|
|
2946
|
+
warn(`--grow must be a whole number from ${b.GROW_MIN} to ${b.GROW_MAX}`);
|
|
2947
|
+
process.exit(1);
|
|
2948
|
+
}
|
|
2949
|
+
if (opts.backgroundFit && !MASK_COMPOSITE_BACKGROUND_FITS.includes(opts.backgroundFit)) {
|
|
2950
|
+
warn(`--background-fit must be one of ${MASK_COMPOSITE_BACKGROUND_FITS.join(", ")} (got "${opts.backgroundFit}")`);
|
|
2951
|
+
process.exit(1);
|
|
2952
|
+
}
|
|
2953
|
+
if (opts.audio && !MASK_COMPOSITE_AUDIO_SOURCES.includes(opts.audio)) {
|
|
2954
|
+
warn(`--audio must be one of ${MASK_COMPOSITE_AUDIO_SOURCES.join(", ")} (got "${opts.audio}")`);
|
|
2955
|
+
process.exit(1);
|
|
2956
|
+
}
|
|
2957
|
+
const client = buildClient(opts.profile);
|
|
2958
|
+
const result = await client.media.maskComposite({
|
|
2959
|
+
foregroundUrl,
|
|
2960
|
+
backgroundUrl,
|
|
2961
|
+
maskUrl,
|
|
2962
|
+
...opts.invert ? { invertMask: true } : {},
|
|
2963
|
+
...opts.feather !== void 0 ? { feather: opts.feather } : {},
|
|
2964
|
+
...opts.grow !== void 0 ? { grow: opts.grow } : {},
|
|
2965
|
+
...opts.backgroundFit ? { backgroundFit: opts.backgroundFit } : {},
|
|
2966
|
+
...opts.audio ? { audioSource: opts.audio } : {}
|
|
2967
|
+
});
|
|
2968
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "mask composite" });
|
|
2969
|
+
} catch (err) {
|
|
2970
|
+
handleError(err);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
);
|
|
2903
2974
|
cmd.command("overlay-placement <imageUrl>").description("ask a vision model WHERE one overlay layer should sit \u2014 answers in `media overlay`'s own percent units").option("--intent <text>", 'what the layer is, in words \u2014 "a logo", "a price badge" (default a logo)').option("--aspect <ratio>", "the layer's width / height (1 = square, the default)", parseFloat).option("--safe-area <x,y,w,h>", "always-visible region as fractions 0..1; the placement is kept inside it").option("--profile <name>").option("--json").addHelpText("after", `
|
|
2904
2975
|
Example:
|
|
2905
2976
|
$ nodaro media overlay-placement https://x/base.png --intent "a logo" --aspect 2.5
|
|
@@ -3085,6 +3156,27 @@ Example:
|
|
|
3085
3156
|
}
|
|
3086
3157
|
}
|
|
3087
3158
|
);
|
|
3159
|
+
cmd.command("pitch-tempo").description("shift pitch by semitones and/or change tempo without changing pitch (Rubber Band); a video keeps its picture").option("--audio <url>", "audio URL to process").option("--video <url>", "video URL whose soundtrack to process (tempo stays 1x)").option("--semitones <n>", "pitch shift, -12..12 (12 = one octave up)", parseFloat).option("--tempo <x>", "speed factor 0.5..2 with the pitch kept", parseFloat).option("--no-preserve-formants", "let the timbre shift with the pitch (chipmunk / giant)").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").action(
|
|
3160
|
+
async (opts) => {
|
|
3161
|
+
try {
|
|
3162
|
+
if (Boolean(opts.audio) === Boolean(opts.video)) {
|
|
3163
|
+
warn("Provide exactly one of --audio <url> or --video <url>");
|
|
3164
|
+
process.exit(1);
|
|
3165
|
+
}
|
|
3166
|
+
const client = buildClient(opts.profile);
|
|
3167
|
+
const result = await client.audio.pitchTempo({
|
|
3168
|
+
...opts.audio ? { audioUrl: opts.audio } : {},
|
|
3169
|
+
...opts.video ? { videoUrl: opts.video } : {},
|
|
3170
|
+
...opts.semitones !== void 0 ? { semitones: opts.semitones } : {},
|
|
3171
|
+
...opts.tempo !== void 0 ? { tempo: opts.tempo } : {},
|
|
3172
|
+
...opts.preserveFormants === false ? { preserveFormants: false } : {}
|
|
3173
|
+
});
|
|
3174
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "pitch & tempo" });
|
|
3175
|
+
} catch (err) {
|
|
3176
|
+
handleError(err);
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
);
|
|
3088
3180
|
cmd.command("combine").description("concatenate audio segments end-to-end").option("--segment <url[@a-b]>", 'segment URL with an optional "@start-end" sub-range in seconds \u2014 repeat per segment, in order', collectVariadic).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3089
3181
|
Example:
|
|
3090
3182
|
$ nodaro audio combine --segment https://.../intro.mp3 --segment "https://.../talk.mp3@12-95" --watch`).action(
|
|
@@ -3374,6 +3466,16 @@ function parseFormat(raw) {
|
|
|
3374
3466
|
if (raw !== "csv" && raw !== "json") throw new Error("--format must be csv or json");
|
|
3375
3467
|
return raw;
|
|
3376
3468
|
}
|
|
3469
|
+
function parseCount2(flag, raw) {
|
|
3470
|
+
if (raw === void 0) return void 0;
|
|
3471
|
+
if (!/^\d+$/.test(raw)) throw new Error(`${flag} must be a whole number`);
|
|
3472
|
+
return Number(raw);
|
|
3473
|
+
}
|
|
3474
|
+
function parseUsage(raw) {
|
|
3475
|
+
if (raw === void 0 || raw === "all") return void 0;
|
|
3476
|
+
if (raw !== "unused" && raw !== "used") throw new Error("--usage must be all, unused or used");
|
|
3477
|
+
return raw;
|
|
3478
|
+
}
|
|
3377
3479
|
function shorten2(text, max) {
|
|
3378
3480
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
3379
3481
|
return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
|
|
@@ -3449,24 +3551,56 @@ function collectionsCommand() {
|
|
|
3449
3551
|
handleError(err);
|
|
3450
3552
|
}
|
|
3451
3553
|
});
|
|
3452
|
-
cmd.command("records <id>").description("a collection's records, newest first").option("--q <words>", "words in the title, text or link").option("--since <iso>", "only records saved at or after this time (ISO)").option("--limit <n>", "page size, 1-100 (default 50)").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(
|
|
3554
|
+
cmd.command("records <id>").description("a collection's records, newest first").option("--q <words>", "words in the title, text or link").option("--since <iso>", "only records saved at or after this time (ISO)").option("--until <iso>", "only records saved before this time (ISO)").option("--usage <which>", "all (default), unused (not used yet) or used").option("--order <order>", "newest (default) or oldest first").option("--status <which>", "active (default: the live records) or trash").option("--limit <n>", "page size, 1-100 (default 50)").option("--offset <n>", "skip this many records first (a numbered page); not with --cursor").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(
|
|
3555
|
+
async (id, opts) => {
|
|
3556
|
+
try {
|
|
3557
|
+
const usage = parseUsage(opts.usage);
|
|
3558
|
+
const order = opts.order === "oldest" ? "oldest" : opts.order === void 0 || opts.order === "newest" ? void 0 : null;
|
|
3559
|
+
if (order === null) throw new Error("--order must be newest or oldest");
|
|
3560
|
+
const status = opts.status === "trash" ? "trash" : opts.status === void 0 || opts.status === "active" ? void 0 : null;
|
|
3561
|
+
if (status === null) throw new Error("--status must be active or trash");
|
|
3562
|
+
const client = buildClient(opts.profile);
|
|
3563
|
+
const page = await client.collections.records(id, {
|
|
3564
|
+
q: opts.q,
|
|
3565
|
+
since: opts.since,
|
|
3566
|
+
until: opts.until,
|
|
3567
|
+
usage,
|
|
3568
|
+
status,
|
|
3569
|
+
order,
|
|
3570
|
+
limit: parseCount2("--limit", opts.limit),
|
|
3571
|
+
offset: parseCount2("--offset", opts.offset),
|
|
3572
|
+
cursor: opts.cursor
|
|
3573
|
+
});
|
|
3574
|
+
if (opts.json) {
|
|
3575
|
+
emit(page, opts);
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
table(
|
|
3579
|
+
page.data.map((r) => ({
|
|
3580
|
+
id: r.id,
|
|
3581
|
+
saved: r.createdAt.slice(0, 10),
|
|
3582
|
+
used: r.usedAt ? r.usedAt.slice(0, 10) : "",
|
|
3583
|
+
headline: shorten2(collectionRecordHeadline(r), 56),
|
|
3584
|
+
from: r.source.workflowName ?? r.source.via ?? "",
|
|
3585
|
+
url: r.url ?? ""
|
|
3586
|
+
})),
|
|
3587
|
+
["id", "saved", "used", "headline", "from", "url"]
|
|
3588
|
+
);
|
|
3589
|
+
if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
|
|
3590
|
+
} catch (err) {
|
|
3591
|
+
handleError(err);
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
);
|
|
3595
|
+
cmd.command("mark-used <id> <recordId>").description("mark a record used (--not-used marks it not used again)").option("--not-used", "undo: the record is not used").option("--profile <name>").option("--json").action(async (id, recordId, opts) => {
|
|
3453
3596
|
try {
|
|
3454
3597
|
const client = buildClient(opts.profile);
|
|
3455
|
-
const
|
|
3456
|
-
q: opts.q,
|
|
3457
|
-
since: opts.since,
|
|
3458
|
-
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
3459
|
-
cursor: opts.cursor
|
|
3460
|
-
});
|
|
3598
|
+
const record = await client.collections.setUsed(id, recordId, !opts.notUsed);
|
|
3461
3599
|
if (opts.json) {
|
|
3462
|
-
emit(
|
|
3600
|
+
emit(record, opts);
|
|
3463
3601
|
return;
|
|
3464
3602
|
}
|
|
3465
|
-
|
|
3466
|
-
page.data.map((r) => ({ id: r.id, saved: r.createdAt.slice(0, 10), headline: shorten2(collectionRecordHeadline(r), 56), url: r.url ?? "" })),
|
|
3467
|
-
["id", "saved", "headline", "url"]
|
|
3468
|
-
);
|
|
3469
|
-
if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
|
|
3603
|
+
success(record.usedAt ? `used ${record.usedAt.slice(0, 16).replace("T", " ")}: ${collectionRecordHeadline(record)}` : `not used: ${collectionRecordHeadline(record)}`);
|
|
3470
3604
|
} catch (err) {
|
|
3471
3605
|
handleError(err);
|
|
3472
3606
|
}
|
|
@@ -3502,20 +3636,39 @@ function collectionsCommand() {
|
|
|
3502
3636
|
}
|
|
3503
3637
|
}
|
|
3504
3638
|
);
|
|
3505
|
-
cmd.command("remove <id> <recordId>").description("
|
|
3639
|
+
cmd.command("remove <id> <recordId>").description("move one record to the collection's Trash (restore brings it back); --forever deletes a record already in the Trash for good").option("--forever", "delete for good \u2014 the record must already be in the Trash").option("--profile <name>").action(async (id, recordId, opts) => {
|
|
3506
3640
|
try {
|
|
3507
3641
|
const client = buildClient(opts.profile);
|
|
3642
|
+
if (opts.forever) {
|
|
3643
|
+
await client.collections.deleteRecordForever(id, recordId);
|
|
3644
|
+
success(`deleted ${recordId} for good`);
|
|
3645
|
+
return;
|
|
3646
|
+
}
|
|
3508
3647
|
await client.collections.deleteRecord(id, recordId);
|
|
3509
|
-
success(`
|
|
3648
|
+
success(`moved ${recordId} to the Trash`);
|
|
3649
|
+
} catch (err) {
|
|
3650
|
+
handleError(err);
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
cmd.command("restore <id> <recordId>").description("bring one record back from the collection's Trash").option("--profile <name>").option("--json").action(async (id, recordId, opts) => {
|
|
3654
|
+
try {
|
|
3655
|
+
const client = buildClient(opts.profile);
|
|
3656
|
+
const record = await client.collections.restoreRecord(id, recordId);
|
|
3657
|
+
if (opts.json) {
|
|
3658
|
+
emit(record, opts);
|
|
3659
|
+
return;
|
|
3660
|
+
}
|
|
3661
|
+
success(`restored: ${collectionRecordHeadline(record)}`);
|
|
3510
3662
|
} catch (err) {
|
|
3511
3663
|
handleError(err);
|
|
3512
3664
|
}
|
|
3513
3665
|
});
|
|
3514
|
-
cmd.command("export <id>").description("the whole collection as CSV (default) or JSON, to stdout or a file").option("--format <format>", "csv or json (default csv)").option("--since <iso>", "only records saved at or after this time (ISO)").option("--q <words>", "words in the title, text or link").option("--out <path>", "write to this file instead of stdout").option("--profile <name>").action(async (id, opts) => {
|
|
3666
|
+
cmd.command("export <id>").description("the whole collection as CSV (default) or JSON, to stdout or a file").option("--format <format>", "csv or json (default csv)").option("--since <iso>", "only records saved at or after this time (ISO)").option("--until <iso>", "only records saved before this time (ISO)").option("--usage <which>", "all (default), unused (not used yet) or used").option("--q <words>", "words in the title, text or link").option("--out <path>", "write to this file instead of stdout").option("--profile <name>").action(async (id, opts) => {
|
|
3515
3667
|
try {
|
|
3516
3668
|
const format2 = parseFormat(opts.format);
|
|
3669
|
+
const usage = parseUsage(opts.usage);
|
|
3517
3670
|
const client = buildClient(opts.profile);
|
|
3518
|
-
const body = await client.collections.export(id, { format: format2, since: opts.since, q: opts.q });
|
|
3671
|
+
const body = await client.collections.export(id, { format: format2, since: opts.since, until: opts.until, usage, q: opts.q });
|
|
3519
3672
|
if (opts.out) {
|
|
3520
3673
|
writeFileSync(opts.out, body, "utf8");
|
|
3521
3674
|
success(`wrote ${opts.out}`);
|