@datarails-ai/dr-appspace-cli 0.12.76 → 0.12.77
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/cli.js +72 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@datarails-ai/dr-appspace-cli",
|
|
16
|
-
version: "0.12.
|
|
16
|
+
version: "0.12.77",
|
|
17
17
|
description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
|
|
18
18
|
type: "module",
|
|
19
19
|
engines: {
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/buildInfo.ts
|
|
60
|
-
var BUILD_TIME = "2026-11-
|
|
60
|
+
var BUILD_TIME = "2026-11-09T20:17:25.971Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -2845,7 +2845,7 @@ function formatUtc(unix) {
|
|
|
2845
2845
|
}
|
|
2846
2846
|
|
|
2847
2847
|
// src/commands/appspace/compile.ts
|
|
2848
|
-
import { mkdir as mkdir6, mkdtemp as mkdtemp3, readdir as
|
|
2848
|
+
import { mkdir as mkdir6, mkdtemp as mkdtemp3, readdir as readdir3, readFile as readFile10, rm as rm4, writeFile as writeFile7 } from "fs/promises";
|
|
2849
2849
|
import { tmpdir as tmpdir4 } from "os";
|
|
2850
2850
|
import { basename, dirname as dirname7, isAbsolute, join as join15, resolve as resolve13, sep as sep4 } from "path";
|
|
2851
2851
|
|
|
@@ -21521,6 +21521,37 @@ import { join as join6 } from "path";
|
|
|
21521
21521
|
// src/commands/appspace/_folder.ts
|
|
21522
21522
|
import { readFile as readFile3, readdir, stat, writeFile as writeFile2 } from "fs/promises";
|
|
21523
21523
|
import { join as join5 } from "path";
|
|
21524
|
+
|
|
21525
|
+
// src/commands/appspace/_handlerNames.ts
|
|
21526
|
+
var MAX_HANDLER_NAME_LENGTH = 128;
|
|
21527
|
+
var UNSAFE_CHAR = /[\p{Cc}\p{Cs}\p{Cf}\p{Z}]/u;
|
|
21528
|
+
function handlerNameProblem(name) {
|
|
21529
|
+
if (name === "") return "the name is empty";
|
|
21530
|
+
if ([...name].length > MAX_HANDLER_NAME_LENGTH) {
|
|
21531
|
+
return `the name is longer than ${MAX_HANDLER_NAME_LENGTH} characters`;
|
|
21532
|
+
}
|
|
21533
|
+
if (name.includes("/") || name.includes("\\")) {
|
|
21534
|
+
return "the name contains a path separator ('/' or '\\')";
|
|
21535
|
+
}
|
|
21536
|
+
if (name === "." || name === "..") return "the name is '.' or '..'";
|
|
21537
|
+
if (UNSAFE_CHAR.test(name)) {
|
|
21538
|
+
return "the name contains whitespace, a control character or an invisible format character";
|
|
21539
|
+
}
|
|
21540
|
+
return null;
|
|
21541
|
+
}
|
|
21542
|
+
function handlerFileProblem(file) {
|
|
21543
|
+
const name = file.endsWith(".py") ? file.slice(0, -3) : file;
|
|
21544
|
+
const why = handlerNameProblem(name);
|
|
21545
|
+
if (why === null) return null;
|
|
21546
|
+
const cut3 = [...file].length > 80 ? `${[...file].slice(0, 80).join("")}...` : file;
|
|
21547
|
+
const shown2 = cut3.replace(
|
|
21548
|
+
/[\p{Cc}\p{Cs}\p{Cf}\p{Z}]/gu,
|
|
21549
|
+
(c) => c === " " ? " " : `\\u{${c.codePointAt(0).toString(16)}}`
|
|
21550
|
+
);
|
|
21551
|
+
return `handlers/${shown2}: ${why}. The handler name is the file name without ".py". Rename the file (for example with letters, digits, "_" and "-"), then run the command again. Nothing was sent.`;
|
|
21552
|
+
}
|
|
21553
|
+
|
|
21554
|
+
// src/commands/appspace/_folder.ts
|
|
21524
21555
|
async function readIfPresent(path3) {
|
|
21525
21556
|
try {
|
|
21526
21557
|
return await readFile3(path3, "utf8");
|
|
@@ -21599,6 +21630,8 @@ async function readHandlers(handlersDir, state) {
|
|
|
21599
21630
|
const handlers = {};
|
|
21600
21631
|
for (const file of await readDirIfPresent(handlersDir)) {
|
|
21601
21632
|
if (!file.endsWith(".py")) continue;
|
|
21633
|
+
const refused = handlerFileProblem(file);
|
|
21634
|
+
if (refused !== null) throw new Error(refused);
|
|
21602
21635
|
const name = file.slice(0, -3);
|
|
21603
21636
|
const method = recorded?.[name];
|
|
21604
21637
|
handlers[name] = {
|
|
@@ -25053,11 +25086,23 @@ function registerGetCommand(parent) {
|
|
|
25053
25086
|
}
|
|
25054
25087
|
|
|
25055
25088
|
// src/commands/appspace/packageCheck.ts
|
|
25056
|
-
import { cp, mkdir as mkdir5, mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile6 } from "fs/promises";
|
|
25089
|
+
import { cp, mkdir as mkdir5, mkdtemp as mkdtemp2, readdir as readdir2, rm as rm3, writeFile as writeFile6 } from "fs/promises";
|
|
25057
25090
|
import { tmpdir as tmpdir3 } from "os";
|
|
25058
25091
|
import { dirname as dirname4, join as join11, resolve as resolve5, sep as sep2 } from "path";
|
|
25059
25092
|
var WHAT = "package";
|
|
25060
25093
|
async function checkPackage(dir, files, contract, opts, online, pendingMetricKeys = []) {
|
|
25094
|
+
const badName = await handlerNameProblems(dir, files);
|
|
25095
|
+
if (badName.length > 0) {
|
|
25096
|
+
return {
|
|
25097
|
+
problems: badName.map((message) => ({
|
|
25098
|
+
code: "handler-name",
|
|
25099
|
+
pointer: "/",
|
|
25100
|
+
message,
|
|
25101
|
+
fix: "Rename the handler file, then run the check again."
|
|
25102
|
+
})),
|
|
25103
|
+
skipped: []
|
|
25104
|
+
};
|
|
25105
|
+
}
|
|
25061
25106
|
if (!online) {
|
|
25062
25107
|
return skip("no -s server to run the push's own checks against; the push is the first to run them");
|
|
25063
25108
|
}
|
|
@@ -25098,6 +25143,24 @@ async function checkPackage(dir, files, contract, opts, online, pendingMetricKey
|
|
|
25098
25143
|
await rm3(scratch, { recursive: true, force: true });
|
|
25099
25144
|
}
|
|
25100
25145
|
}
|
|
25146
|
+
async function handlerNameProblems(dir, files) {
|
|
25147
|
+
const names = /* @__PURE__ */ new Set();
|
|
25148
|
+
try {
|
|
25149
|
+
for (const file of await readdir2(join11(dir, "handlers"))) names.add(file);
|
|
25150
|
+
} catch {
|
|
25151
|
+
}
|
|
25152
|
+
for (const path3 of Object.keys(files)) {
|
|
25153
|
+
const match = /^handlers\/([^/]+)$/.exec(path3);
|
|
25154
|
+
if (match !== null) names.add(match[1]);
|
|
25155
|
+
}
|
|
25156
|
+
const out = [];
|
|
25157
|
+
for (const file of [...names].sort()) {
|
|
25158
|
+
if (!file.endsWith(".py")) continue;
|
|
25159
|
+
const problem6 = handlerFileProblem(file);
|
|
25160
|
+
if (problem6 !== null) out.push(problem6);
|
|
25161
|
+
}
|
|
25162
|
+
return out;
|
|
25163
|
+
}
|
|
25101
25164
|
function setAsidePending(check5, pending) {
|
|
25102
25165
|
if (pending.length === 0) return check5;
|
|
25103
25166
|
const mentions3 = (message) => pending.some((key) => new RegExp(`metric_bindings\\.${key.replace(/[^a-z0-9_]/g, "")}(?![a-z0-9_])`).test(message));
|
|
@@ -34373,7 +34436,7 @@ async function landWithRetries(tryOnce, opts, sleep3 = (ms) => new Promise((done
|
|
|
34373
34436
|
async function claimFolder(dir) {
|
|
34374
34437
|
let names;
|
|
34375
34438
|
try {
|
|
34376
|
-
names = await
|
|
34439
|
+
names = await readdir3(dir);
|
|
34377
34440
|
} catch {
|
|
34378
34441
|
await mkdir6(dir, { recursive: true });
|
|
34379
34442
|
names = [];
|
|
@@ -37827,7 +37890,7 @@ async function runUiSmoke(opts) {
|
|
|
37827
37890
|
// src/commands/appspace/_screenshot.ts
|
|
37828
37891
|
import { spawn } from "child_process";
|
|
37829
37892
|
import { existsSync as existsSync3, statSync as statSync3 } from "fs";
|
|
37830
|
-
import { mkdir as mkdir8, mkdtemp as mkdtemp4, readFile as readFile13, readdir as
|
|
37893
|
+
import { mkdir as mkdir8, mkdtemp as mkdtemp4, readFile as readFile13, readdir as readdir4, rm as rm6, stat as stat2, writeFile as writeFile10 } from "fs/promises";
|
|
37831
37894
|
import { createServer } from "http";
|
|
37832
37895
|
import { tmpdir as tmpdir5 } from "os";
|
|
37833
37896
|
import { delimiter, extname as extname2, join as join18, relative as relative3, resolve as resolve15, sep as sep7 } from "path";
|
|
@@ -39543,7 +39606,7 @@ async function readLocalUi(dir) {
|
|
|
39543
39606
|
const walk5 = async (folder) => {
|
|
39544
39607
|
let names;
|
|
39545
39608
|
try {
|
|
39546
|
-
names = await
|
|
39609
|
+
names = await readdir4(folder, { withFileTypes: true });
|
|
39547
39610
|
} catch {
|
|
39548
39611
|
return;
|
|
39549
39612
|
}
|
|
@@ -42661,7 +42724,7 @@ function registerPublishCommands(parent) {
|
|
|
42661
42724
|
}
|
|
42662
42725
|
|
|
42663
42726
|
// src/commands/appspace/scaffold.ts
|
|
42664
|
-
import { mkdir as mkdir9, readdir as
|
|
42727
|
+
import { mkdir as mkdir9, readdir as readdir5, stat as stat3, writeFile as writeFile11 } from "fs/promises";
|
|
42665
42728
|
import { dirname as dirname10, join as join21 } from "path";
|
|
42666
42729
|
|
|
42667
42730
|
// src/commands/appspace/starters.ts
|
|
@@ -42999,7 +43062,7 @@ async function checkTarget(dir, force) {
|
|
|
42999
43062
|
if (force) return;
|
|
43000
43063
|
let entries;
|
|
43001
43064
|
try {
|
|
43002
|
-
entries = await
|
|
43065
|
+
entries = await readdir5(dir);
|
|
43003
43066
|
} catch (err) {
|
|
43004
43067
|
if (err.code === "ENOENT") return;
|
|
43005
43068
|
throw new Error(
|