flowdular 0.2.1 → 0.2.3
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/distribution.js +1 -1
- package/dist/index.js +72 -28
- package/package.json +2 -2
package/dist/distribution.js
CHANGED
|
@@ -3405,7 +3405,7 @@ import { dirname as dirname6, join as join6, relative as relative5 } from "node:
|
|
|
3405
3405
|
import { createRequire } from "node:module";
|
|
3406
3406
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
3407
3407
|
import { dirname as dirname4, join as join3 } from "node:path";
|
|
3408
|
-
var SDK_VERSION = "0.2.
|
|
3408
|
+
var SDK_VERSION = "0.2.3";
|
|
3409
3409
|
function npmPackage(specifier) {
|
|
3410
3410
|
return specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
|
|
3411
3411
|
}
|
package/dist/index.js
CHANGED
|
@@ -1992,13 +1992,15 @@ function stringFlag(arguments_, name) {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
|
|
1994
1994
|
// src/output.ts
|
|
1995
|
+
import { styleText } from "node:util";
|
|
1995
1996
|
function isCapabilityList(values2) {
|
|
1996
1997
|
return values2.every(
|
|
1997
1998
|
(value) => typeof value === "object" && value !== null && typeof value.id === "string" && typeof value.risk === "string" && typeof value.summary === "string"
|
|
1998
1999
|
);
|
|
1999
2000
|
}
|
|
2000
|
-
function renderOutput(envelope, json2) {
|
|
2001
|
+
function renderOutput(envelope, json2, color = false) {
|
|
2001
2002
|
if (json2) return JSON.stringify(envelope, null, 2);
|
|
2003
|
+
const paint = (text, format) => color ? styleText(format, text, { validateStream: false }) : text;
|
|
2002
2004
|
if (!envelope.ok) {
|
|
2003
2005
|
const heading = `ERROR ${envelope.error?.code ?? "UNKNOWN"}
|
|
2004
2006
|
${envelope.error?.message ?? "Command failed."}`;
|
|
@@ -2021,19 +2023,34 @@ ${envelope.error?.message ?? "Command failed."}`;
|
|
|
2021
2023
|
const data2 = envelope.data;
|
|
2022
2024
|
if (data2?.cancelled === true) return decorate("Setup cancelled.");
|
|
2023
2025
|
if (data2?.setup === "postgresql")
|
|
2024
|
-
return
|
|
2025
|
-
"
|
|
2026
|
-
|
|
2026
|
+
return [
|
|
2027
|
+
"",
|
|
2028
|
+
` ${paint("FLOWDULAR", "bold")} ${paint("PostgreSQL configured", "green")}`,
|
|
2029
|
+
"",
|
|
2030
|
+
" PostgreSQL settings saved to .env.",
|
|
2031
|
+
"",
|
|
2032
|
+
` Start app ${paint("pnpm dev", "bold")}`,
|
|
2033
|
+
` Local URL ${paint("http://localhost:4310", "cyan")}`,
|
|
2034
|
+
" Open the app to create an account.",
|
|
2035
|
+
"",
|
|
2036
|
+
...envelope.warnings.map((warning) => ` ${warning}`),
|
|
2037
|
+
""
|
|
2038
|
+
].join("\n");
|
|
2027
2039
|
if (data2?.setup === "local") {
|
|
2028
2040
|
const admin = data2.accounts?.admin;
|
|
2029
|
-
return
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2041
|
+
return [
|
|
2042
|
+
"",
|
|
2043
|
+
` ${paint("FLOWDULAR", "bold")} ${paint("Local demo is ready.", "green")}`,
|
|
2044
|
+
"",
|
|
2045
|
+
` Start app ${paint("pnpm dev", "bold")}`,
|
|
2046
|
+
` Local URL ${paint("http://localhost:4310", "cyan")}`,
|
|
2047
|
+
"",
|
|
2048
|
+
...admin?.email ? [` Demo login ${admin.email}`] : [],
|
|
2049
|
+
...admin?.password ? [` Password ${admin.password}`] : [],
|
|
2050
|
+
"",
|
|
2051
|
+
...envelope.warnings.map((warning) => ` ${warning}`),
|
|
2052
|
+
""
|
|
2053
|
+
].join("\n");
|
|
2037
2054
|
}
|
|
2038
2055
|
if (data2 && Array.isArray(data2.checks)) {
|
|
2039
2056
|
return decorate(
|
|
@@ -3546,7 +3563,7 @@ import { dirname as dirname6, join as join5, relative as relative5 } from "node:
|
|
|
3546
3563
|
import { createRequire } from "node:module";
|
|
3547
3564
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
3548
3565
|
import { dirname as dirname4, join as join2 } from "node:path";
|
|
3549
|
-
var SDK_VERSION = "0.2.
|
|
3566
|
+
var SDK_VERSION = "0.2.3";
|
|
3550
3567
|
var LIBRARIES = /* @__PURE__ */ new Set([
|
|
3551
3568
|
"ai-provider",
|
|
3552
3569
|
"cli-protocol",
|
|
@@ -6021,6 +6038,7 @@ function capability(id) {
|
|
|
6021
6038
|
|
|
6022
6039
|
// ../database-pglite/src/driver.ts
|
|
6023
6040
|
import { PGlite } from "@electric-sql/pglite";
|
|
6041
|
+
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
6024
6042
|
var ROLE = /^[a-z_][a-z0-9_]{0,62}$/;
|
|
6025
6043
|
var INT8_OID = 20;
|
|
6026
6044
|
var SERVER_PARSERS = Object.freeze({ [INT8_OID]: (value) => value });
|
|
@@ -6060,8 +6078,7 @@ function createPgliteCluster(options = {}) {
|
|
|
6060
6078
|
const database = async () => {
|
|
6061
6079
|
databasePromise ??= (async () => {
|
|
6062
6080
|
if (options.dataDirectory) {
|
|
6063
|
-
|
|
6064
|
-
await mkdir6(options.dataDirectory, { recursive: true, mode: 448 });
|
|
6081
|
+
await mkdir2(options.dataDirectory, { recursive: true, mode: 448 });
|
|
6065
6082
|
}
|
|
6066
6083
|
const created = options.dataDirectory ? await PGlite.create({
|
|
6067
6084
|
dataDir: options.dataDirectory,
|
|
@@ -6220,7 +6237,7 @@ import { readFile as readFile8 } from "node:fs/promises";
|
|
|
6220
6237
|
import { dirname as dirname7 } from "node:path";
|
|
6221
6238
|
|
|
6222
6239
|
// src/migration-scaffold.ts
|
|
6223
|
-
import { mkdir as
|
|
6240
|
+
import { mkdir as mkdir3, readdir as readdir4, writeFile as writeFile2 } from "node:fs/promises";
|
|
6224
6241
|
import { join as join6 } from "node:path";
|
|
6225
6242
|
var NAME = /^[a-z][a-z0-9_]{2,48}$/;
|
|
6226
6243
|
function nextNumber(existing) {
|
|
@@ -6271,7 +6288,7 @@ DROP TABLE IF EXISTS ${table};
|
|
|
6271
6288
|
}
|
|
6272
6289
|
];
|
|
6273
6290
|
if (apply) {
|
|
6274
|
-
await
|
|
6291
|
+
await mkdir3(directory, { recursive: true });
|
|
6275
6292
|
for (const file of files) {
|
|
6276
6293
|
await writeFile2(file.path, file.body, { flag: "wx" });
|
|
6277
6294
|
}
|
|
@@ -6319,7 +6336,7 @@ import { join as join9, relative as relative6 } from "node:path";
|
|
|
6319
6336
|
|
|
6320
6337
|
// src/module-sync.ts
|
|
6321
6338
|
import { spawnSync } from "node:child_process";
|
|
6322
|
-
import { access as access3, mkdir as
|
|
6339
|
+
import { access as access3, mkdir as mkdir4, readFile as readFile9, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
|
|
6323
6340
|
import { dirname as dirname8, join as join8 } from "node:path";
|
|
6324
6341
|
|
|
6325
6342
|
// src/format.ts
|
|
@@ -6536,7 +6553,7 @@ async function restoreSnapshots(snapshots) {
|
|
|
6536
6553
|
await rm2(snapshot.path, { force: true });
|
|
6537
6554
|
continue;
|
|
6538
6555
|
}
|
|
6539
|
-
await
|
|
6556
|
+
await mkdir4(dirname8(snapshot.path), { recursive: true });
|
|
6540
6557
|
await writeFile3(snapshot.path, snapshot.content);
|
|
6541
6558
|
}
|
|
6542
6559
|
}
|
|
@@ -6583,7 +6600,7 @@ async function syncPlatformModules(workspace, apply, enabledOverride) {
|
|
|
6583
6600
|
}
|
|
6584
6601
|
const changed = current !== target.content;
|
|
6585
6602
|
if (apply && changed) {
|
|
6586
|
-
await
|
|
6603
|
+
await mkdir4(dirname8(absolute), { recursive: true });
|
|
6587
6604
|
await writeFile3(absolute, target.content);
|
|
6588
6605
|
}
|
|
6589
6606
|
files.push({ path: target.path, changed });
|
|
@@ -7439,7 +7456,7 @@ async function migrationVerify(workspace) {
|
|
|
7439
7456
|
// src/module-scaffold.ts
|
|
7440
7457
|
import {
|
|
7441
7458
|
access as access5,
|
|
7442
|
-
mkdir as
|
|
7459
|
+
mkdir as mkdir5,
|
|
7443
7460
|
readdir as readdir6,
|
|
7444
7461
|
readFile as readFile14,
|
|
7445
7462
|
realpath as realpath2,
|
|
@@ -8815,7 +8832,7 @@ async function writeScaffold(moduleDirectory, files, target) {
|
|
|
8815
8832
|
for (const [path, source] of files) {
|
|
8816
8833
|
if (target.present.has(path)) continue;
|
|
8817
8834
|
const absolute = join12(moduleDirectory, path);
|
|
8818
|
-
const created = await
|
|
8835
|
+
const created = await mkdir5(dirname12(absolute), { recursive: true });
|
|
8819
8836
|
if (created) createdDirectories.push(created);
|
|
8820
8837
|
await writeFile4(absolute, source, { encoding: "utf8", flag: "wx" });
|
|
8821
8838
|
written.push(absolute);
|
|
@@ -8912,7 +8929,7 @@ import {
|
|
|
8912
8929
|
chmod,
|
|
8913
8930
|
copyFile,
|
|
8914
8931
|
lstat as lstat3,
|
|
8915
|
-
mkdir as
|
|
8932
|
+
mkdir as mkdir6,
|
|
8916
8933
|
readFile as readFile15,
|
|
8917
8934
|
rm as rm4,
|
|
8918
8935
|
stat as stat3
|
|
@@ -9029,7 +9046,7 @@ async function digest(path) {
|
|
|
9029
9046
|
}
|
|
9030
9047
|
async function ensurePrivateDirectory(path) {
|
|
9031
9048
|
try {
|
|
9032
|
-
await
|
|
9049
|
+
await mkdir6(path, { mode: 448 });
|
|
9033
9050
|
} catch (error) {
|
|
9034
9051
|
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
9035
9052
|
throw error;
|
|
@@ -9296,10 +9313,37 @@ async function runCommand(arguments_) {
|
|
|
9296
9313
|
const greenfield = extensionCommands.find(
|
|
9297
9314
|
(entry) => entry.command.capability.id === "auth.greenfield.reset"
|
|
9298
9315
|
);
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9316
|
+
if (!greenfield)
|
|
9317
|
+
return failure(
|
|
9318
|
+
"AUTH_MODULE_REQUIRED",
|
|
9319
|
+
"Quick setup requires the enabled auth.core module."
|
|
9320
|
+
);
|
|
9321
|
+
const result2 = await runExtensionCommand(
|
|
9322
|
+
workspace,
|
|
9323
|
+
greenfield,
|
|
9324
|
+
arguments_
|
|
9302
9325
|
);
|
|
9326
|
+
if (!result2.ok || !arguments_.flags.has("apply")) return result2;
|
|
9327
|
+
const sync = extensionCommands.find(
|
|
9328
|
+
(entry) => entry.command.capability.id === "auth.scopes.sync"
|
|
9329
|
+
);
|
|
9330
|
+
if (!sync)
|
|
9331
|
+
return failure(
|
|
9332
|
+
"AUTH_SCOPE_SYNC_REQUIRED",
|
|
9333
|
+
"The demo was created but module permissions could not be synchronized."
|
|
9334
|
+
);
|
|
9335
|
+
const enabled = workspace.config.modules.enabled ?? [];
|
|
9336
|
+
for (const moduleId of enabled) {
|
|
9337
|
+
const granted = await runExtensionCommand(workspace, sync, {
|
|
9338
|
+
positionals: ["auth", "sync-scopes"],
|
|
9339
|
+
flags: /* @__PURE__ */ new Map([
|
|
9340
|
+
["module", moduleId],
|
|
9341
|
+
["apply", true]
|
|
9342
|
+
])
|
|
9343
|
+
});
|
|
9344
|
+
if (!granted.ok) return granted;
|
|
9345
|
+
}
|
|
9346
|
+
return result2;
|
|
9303
9347
|
}
|
|
9304
9348
|
if (group === "setup" && action === "migrate-state") {
|
|
9305
9349
|
const descriptor = capability("workspace.state.migrate");
|
|
@@ -9910,7 +9954,7 @@ if (invokedAsProgram) {
|
|
|
9910
9954
|
const interactive = arguments_.positionals.length === 1 && arguments_.positionals[0] === "setup" && !arguments_.flags.has("json") && !arguments_.flags.has("help") && process.stdin.isTTY && process.stdout.isTTY;
|
|
9911
9955
|
const envelope = await (interactive ? runSetupWizard(arguments_) : runProgram(arguments_));
|
|
9912
9956
|
process.stdout.write(
|
|
9913
|
-
`${renderOutput(envelope, arguments_.flags.has("json"))}
|
|
9957
|
+
`${renderOutput(envelope, arguments_.flags.has("json"), Boolean(process.stdout.isTTY && process.stdout.hasColors?.() && !("NO_COLOR" in process.env) && !process.env.CI))}
|
|
9914
9958
|
`
|
|
9915
9959
|
);
|
|
9916
9960
|
if (!envelope.ok) process.exitCode = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowdular",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"flowdular": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ajv": "8.20.0",
|
|
17
17
|
"pg": "8.23.0",
|
|
18
18
|
"yaml": "2.9.0",
|
|
19
|
-
"@flowdular/sdk": "0.2.
|
|
19
|
+
"@flowdular/sdk": "0.2.3"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|