@insforge/cli 0.1.10 → 0.1.11
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 +38 -103
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -878,19 +878,6 @@ function registerDbTablesCommand(dbCmd2) {
|
|
|
878
878
|
}
|
|
879
879
|
|
|
880
880
|
// src/commands/db/functions.ts
|
|
881
|
-
function str(val) {
|
|
882
|
-
if (val === null || val === void 0) return "-";
|
|
883
|
-
if (Array.isArray(val)) return val.join(", ");
|
|
884
|
-
return String(val);
|
|
885
|
-
}
|
|
886
|
-
function extractArray(raw) {
|
|
887
|
-
if (Array.isArray(raw)) return raw;
|
|
888
|
-
if (raw && typeof raw === "object") {
|
|
889
|
-
const arr = Object.values(raw).find(Array.isArray);
|
|
890
|
-
if (arr) return arr;
|
|
891
|
-
}
|
|
892
|
-
return [];
|
|
893
|
-
}
|
|
894
881
|
function registerDbFunctionsCommand(dbCmd2) {
|
|
895
882
|
dbCmd2.command("functions").description("List all database functions").action(async (_opts, cmd) => {
|
|
896
883
|
const { json } = getRootOpts(cmd);
|
|
@@ -898,7 +885,7 @@ function registerDbFunctionsCommand(dbCmd2) {
|
|
|
898
885
|
await requireAuth();
|
|
899
886
|
const res = await ossFetch("/api/database/functions");
|
|
900
887
|
const raw = await res.json();
|
|
901
|
-
const functions =
|
|
888
|
+
const functions = Array.isArray(raw) ? raw : raw.functions ?? [];
|
|
902
889
|
if (json) {
|
|
903
890
|
outputJson(raw);
|
|
904
891
|
} else {
|
|
@@ -907,8 +894,8 @@ function registerDbFunctionsCommand(dbCmd2) {
|
|
|
907
894
|
return;
|
|
908
895
|
}
|
|
909
896
|
outputTable(
|
|
910
|
-
["Name", "
|
|
911
|
-
functions.map((f) => [
|
|
897
|
+
["Name", "Definition", "Kind"],
|
|
898
|
+
functions.map((f) => [f.functionName, f.functionDef, f.kind])
|
|
912
899
|
);
|
|
913
900
|
}
|
|
914
901
|
} catch (err) {
|
|
@@ -918,19 +905,6 @@ function registerDbFunctionsCommand(dbCmd2) {
|
|
|
918
905
|
}
|
|
919
906
|
|
|
920
907
|
// src/commands/db/indexes.ts
|
|
921
|
-
function str2(val) {
|
|
922
|
-
if (val === null || val === void 0) return "-";
|
|
923
|
-
if (Array.isArray(val)) return val.join(", ");
|
|
924
|
-
return String(val);
|
|
925
|
-
}
|
|
926
|
-
function extractArray2(raw) {
|
|
927
|
-
if (Array.isArray(raw)) return raw;
|
|
928
|
-
if (raw && typeof raw === "object") {
|
|
929
|
-
const arr = Object.values(raw).find(Array.isArray);
|
|
930
|
-
if (arr) return arr;
|
|
931
|
-
}
|
|
932
|
-
return [];
|
|
933
|
-
}
|
|
934
908
|
function registerDbIndexesCommand(dbCmd2) {
|
|
935
909
|
dbCmd2.command("indexes").description("List all database indexes").action(async (_opts, cmd) => {
|
|
936
910
|
const { json } = getRootOpts(cmd);
|
|
@@ -938,7 +912,7 @@ function registerDbIndexesCommand(dbCmd2) {
|
|
|
938
912
|
await requireAuth();
|
|
939
913
|
const res = await ossFetch("/api/database/indexes");
|
|
940
914
|
const raw = await res.json();
|
|
941
|
-
const indexes =
|
|
915
|
+
const indexes = Array.isArray(raw) ? raw : raw.indexes ?? [];
|
|
942
916
|
if (json) {
|
|
943
917
|
outputJson(raw);
|
|
944
918
|
} else {
|
|
@@ -949,9 +923,9 @@ function registerDbIndexesCommand(dbCmd2) {
|
|
|
949
923
|
outputTable(
|
|
950
924
|
["Table", "Index Name", "Definition", "Unique", "Primary"],
|
|
951
925
|
indexes.map((i) => [
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
926
|
+
i.tableName,
|
|
927
|
+
i.indexName,
|
|
928
|
+
i.indexDef,
|
|
955
929
|
i.isUnique ? "Yes" : "No",
|
|
956
930
|
i.isPrimary ? "Yes" : "No"
|
|
957
931
|
])
|
|
@@ -964,19 +938,6 @@ function registerDbIndexesCommand(dbCmd2) {
|
|
|
964
938
|
}
|
|
965
939
|
|
|
966
940
|
// src/commands/db/policies.ts
|
|
967
|
-
function str3(val) {
|
|
968
|
-
if (val === null || val === void 0) return "-";
|
|
969
|
-
if (Array.isArray(val)) return val.join(", ");
|
|
970
|
-
return String(val);
|
|
971
|
-
}
|
|
972
|
-
function extractArray3(raw) {
|
|
973
|
-
if (Array.isArray(raw)) return raw;
|
|
974
|
-
if (raw && typeof raw === "object") {
|
|
975
|
-
const arr = Object.values(raw).find(Array.isArray);
|
|
976
|
-
if (arr) return arr;
|
|
977
|
-
}
|
|
978
|
-
return [];
|
|
979
|
-
}
|
|
980
941
|
function registerDbPoliciesCommand(dbCmd2) {
|
|
981
942
|
dbCmd2.command("policies").description("List all RLS policies").action(async (_opts, cmd) => {
|
|
982
943
|
const { json } = getRootOpts(cmd);
|
|
@@ -984,7 +945,7 @@ function registerDbPoliciesCommand(dbCmd2) {
|
|
|
984
945
|
await requireAuth();
|
|
985
946
|
const res = await ossFetch("/api/database/policies");
|
|
986
947
|
const raw = await res.json();
|
|
987
|
-
const policies =
|
|
948
|
+
const policies = Array.isArray(raw) ? raw : raw.policies ?? [];
|
|
988
949
|
if (json) {
|
|
989
950
|
outputJson(raw);
|
|
990
951
|
} else {
|
|
@@ -995,12 +956,12 @@ function registerDbPoliciesCommand(dbCmd2) {
|
|
|
995
956
|
outputTable(
|
|
996
957
|
["Table", "Policy Name", "Command", "Roles", "Qual", "With Check"],
|
|
997
958
|
policies.map((p) => [
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
959
|
+
String(p.tableName ?? "-"),
|
|
960
|
+
String(p.policyName ?? "-"),
|
|
961
|
+
String(p.cmd ?? "-"),
|
|
962
|
+
Array.isArray(p.roles) ? p.roles.join(", ") : String(p.roles ?? "-"),
|
|
963
|
+
String(p.qual ?? "-"),
|
|
964
|
+
String(p.withCheck ?? "-")
|
|
1004
965
|
])
|
|
1005
966
|
);
|
|
1006
967
|
}
|
|
@@ -1011,19 +972,6 @@ function registerDbPoliciesCommand(dbCmd2) {
|
|
|
1011
972
|
}
|
|
1012
973
|
|
|
1013
974
|
// src/commands/db/triggers.ts
|
|
1014
|
-
function str4(val) {
|
|
1015
|
-
if (val === null || val === void 0) return "-";
|
|
1016
|
-
if (Array.isArray(val)) return val.join(", ");
|
|
1017
|
-
return String(val);
|
|
1018
|
-
}
|
|
1019
|
-
function extractArray4(raw) {
|
|
1020
|
-
if (Array.isArray(raw)) return raw;
|
|
1021
|
-
if (raw && typeof raw === "object") {
|
|
1022
|
-
const arr = Object.values(raw).find(Array.isArray);
|
|
1023
|
-
if (arr) return arr;
|
|
1024
|
-
}
|
|
1025
|
-
return [];
|
|
1026
|
-
}
|
|
1027
975
|
function registerDbTriggersCommand(dbCmd2) {
|
|
1028
976
|
dbCmd2.command("triggers").description("List all database triggers").action(async (_opts, cmd) => {
|
|
1029
977
|
const { json } = getRootOpts(cmd);
|
|
@@ -1031,7 +979,7 @@ function registerDbTriggersCommand(dbCmd2) {
|
|
|
1031
979
|
await requireAuth();
|
|
1032
980
|
const res = await ossFetch("/api/database/triggers");
|
|
1033
981
|
const raw = await res.json();
|
|
1034
|
-
const triggers =
|
|
982
|
+
const triggers = Array.isArray(raw) ? raw : raw.triggers ?? [];
|
|
1035
983
|
if (json) {
|
|
1036
984
|
outputJson(raw);
|
|
1037
985
|
} else {
|
|
@@ -1040,14 +988,15 @@ function registerDbTriggersCommand(dbCmd2) {
|
|
|
1040
988
|
return;
|
|
1041
989
|
}
|
|
1042
990
|
outputTable(
|
|
1043
|
-
["Name", "Table", "Timing", "Events", "
|
|
991
|
+
["Name", "Table", "Timing", "Events", "ActionOrientation", "ActionCondition", "ActionStatement"],
|
|
1044
992
|
triggers.map((t) => [
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
t.
|
|
993
|
+
t.triggerName,
|
|
994
|
+
t.tableName,
|
|
995
|
+
t.actionTiming,
|
|
996
|
+
t.eventManipulation,
|
|
997
|
+
t.actionOrientation,
|
|
998
|
+
t.actionCondition ?? "-",
|
|
999
|
+
t.actionStatement
|
|
1051
1000
|
])
|
|
1052
1001
|
);
|
|
1053
1002
|
}
|
|
@@ -1329,10 +1278,10 @@ function registerFunctionsCommands(functionsCmd2) {
|
|
|
1329
1278
|
try {
|
|
1330
1279
|
await requireAuth();
|
|
1331
1280
|
const res = await ossFetch("/api/functions");
|
|
1332
|
-
const
|
|
1333
|
-
const functions =
|
|
1281
|
+
const raw = await res.json();
|
|
1282
|
+
const functions = Array.isArray(raw) ? raw : raw && typeof raw === "object" && "functions" in raw ? raw.functions ?? [] : [];
|
|
1334
1283
|
if (json) {
|
|
1335
|
-
outputJson(
|
|
1284
|
+
outputJson(raw);
|
|
1336
1285
|
} else {
|
|
1337
1286
|
if (functions.length === 0) {
|
|
1338
1287
|
console.log("No functions found.");
|
|
@@ -1344,7 +1293,7 @@ function registerFunctionsCommands(functionsCmd2) {
|
|
|
1344
1293
|
f.slug,
|
|
1345
1294
|
f.name ?? "-",
|
|
1346
1295
|
f.status ?? "-",
|
|
1347
|
-
f.
|
|
1296
|
+
f.createdAt ? new Date(f.createdAt).toLocaleString() : "-"
|
|
1348
1297
|
])
|
|
1349
1298
|
);
|
|
1350
1299
|
}
|
|
@@ -1482,15 +1431,7 @@ function registerStorageBucketsCommand(storageCmd2) {
|
|
|
1482
1431
|
await requireAuth();
|
|
1483
1432
|
const res = await ossFetch("/api/storage/buckets");
|
|
1484
1433
|
const raw = await res.json();
|
|
1485
|
-
|
|
1486
|
-
if (Array.isArray(raw)) {
|
|
1487
|
-
buckets = raw;
|
|
1488
|
-
} else if (raw && typeof raw === "object" && "buckets" in raw && Array.isArray(raw.buckets)) {
|
|
1489
|
-
buckets = raw.buckets;
|
|
1490
|
-
} else {
|
|
1491
|
-
const arr = raw && typeof raw === "object" ? Object.values(raw).find(Array.isArray) : null;
|
|
1492
|
-
buckets = arr ?? [];
|
|
1493
|
-
}
|
|
1434
|
+
const buckets = Array.isArray(raw) ? raw : raw && typeof raw === "object" && "buckets" in raw ? raw.buckets ?? [] : [];
|
|
1494
1435
|
if (json) {
|
|
1495
1436
|
outputJson(raw);
|
|
1496
1437
|
} else {
|
|
@@ -1499,8 +1440,8 @@ function registerStorageBucketsCommand(storageCmd2) {
|
|
|
1499
1440
|
return;
|
|
1500
1441
|
}
|
|
1501
1442
|
outputTable(
|
|
1502
|
-
["Bucket Name"],
|
|
1503
|
-
buckets.map((b) => [
|
|
1443
|
+
["Bucket Name", "Public"],
|
|
1444
|
+
buckets.map((b) => [b.name, b.public ? "Yes" : "No"])
|
|
1504
1445
|
);
|
|
1505
1446
|
}
|
|
1506
1447
|
} catch (err) {
|
|
@@ -2179,14 +2120,7 @@ function registerDeploymentsListCommand(deploymentsCmd2) {
|
|
|
2179
2120
|
if (!getProjectConfig()) throw new ProjectNotLinkedError();
|
|
2180
2121
|
const res = await ossFetch(`/api/deployments?limit=${opts.limit}&offset=${opts.offset}`);
|
|
2181
2122
|
const raw = await res.json();
|
|
2182
|
-
|
|
2183
|
-
if (Array.isArray(raw)) {
|
|
2184
|
-
deployments = raw;
|
|
2185
|
-
} else if (raw && typeof raw === "object" && "data" in raw && Array.isArray(raw.data)) {
|
|
2186
|
-
deployments = raw.data;
|
|
2187
|
-
} else {
|
|
2188
|
-
deployments = [];
|
|
2189
|
-
}
|
|
2123
|
+
const deployments = Array.isArray(raw) ? raw : raw && typeof raw === "object" && "data" in raw ? raw.data ?? [] : [];
|
|
2190
2124
|
if (json) {
|
|
2191
2125
|
outputJson(raw);
|
|
2192
2126
|
} else {
|
|
@@ -2197,11 +2131,11 @@ function registerDeploymentsListCommand(deploymentsCmd2) {
|
|
|
2197
2131
|
outputTable(
|
|
2198
2132
|
["ID", "Status", "Provider", "URL", "Created"],
|
|
2199
2133
|
deployments.map((d) => [
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2134
|
+
d.id,
|
|
2135
|
+
d.status,
|
|
2136
|
+
d.provider,
|
|
2137
|
+
d.url ?? "-",
|
|
2138
|
+
new Date(d.createdAt).toLocaleString()
|
|
2205
2139
|
])
|
|
2206
2140
|
);
|
|
2207
2141
|
}
|
|
@@ -2388,10 +2322,11 @@ function registerSecretsGetCommand(secretsCmd2) {
|
|
|
2388
2322
|
await requireAuth();
|
|
2389
2323
|
const res = await ossFetch(`/api/secrets/${encodeURIComponent(key)}`);
|
|
2390
2324
|
const data = await res.json();
|
|
2325
|
+
const secret = data;
|
|
2391
2326
|
if (json) {
|
|
2392
2327
|
outputJson(data);
|
|
2393
2328
|
} else {
|
|
2394
|
-
console.log(`${
|
|
2329
|
+
console.log(`${secret.key} = ${secret.value}`);
|
|
2395
2330
|
}
|
|
2396
2331
|
} catch (err) {
|
|
2397
2332
|
handleError(err, json);
|