@popina/cli 0.0.1 → 0.1.2
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 +9 -0
- package/build/index.js +817 -488
- package/build/index.js.map +1 -1
- package/package.json +5 -4
package/build/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { Command as
|
|
10
|
-
import { $ as $
|
|
9
|
+
import { Command as Command15 } from "@commander-js/extra-typings";
|
|
10
|
+
import { $ as $27 } from "zx/core";
|
|
11
11
|
|
|
12
12
|
// src/cmd/backup.ts
|
|
13
13
|
import * as p14 from "@clack/prompts";
|
|
@@ -41,15 +41,15 @@ async function getGitBranch() {
|
|
|
41
41
|
// src/utils/check-node.ts
|
|
42
42
|
import * as p2 from "@clack/prompts";
|
|
43
43
|
import { $ as $3 } from "zx/core";
|
|
44
|
-
async function
|
|
44
|
+
async function checkNode24() {
|
|
45
45
|
const { stdout: nodeVersion } = await $3`node --version`;
|
|
46
|
-
if (!nodeVersion.includes("
|
|
46
|
+
if (!nodeVersion.includes("24")) {
|
|
47
47
|
p2.log.warn(
|
|
48
|
-
`You're currently using Node ${nodeVersion}. Please use Node
|
|
48
|
+
`You're currently using Node ${nodeVersion}. Please use Node v24.`
|
|
49
49
|
);
|
|
50
50
|
process.exit(0);
|
|
51
51
|
}
|
|
52
|
-
p2.log.step(`\u2705 Node
|
|
52
|
+
p2.log.step(`\u2705 Node v24 is installed.`);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// src/utils/database/push-database-schema.ts
|
|
@@ -322,7 +322,7 @@ var removeEnvConfig = (envConfigCopyPath) => {
|
|
|
322
322
|
removeDirectory(envConfigCopyPath);
|
|
323
323
|
};
|
|
324
324
|
|
|
325
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
325
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
|
|
326
326
|
var external_exports = {};
|
|
327
327
|
__export(external_exports, {
|
|
328
328
|
$brand: () => $brand,
|
|
@@ -534,7 +534,7 @@ __export(external_exports, {
|
|
|
534
534
|
xid: () => xid2
|
|
535
535
|
});
|
|
536
536
|
|
|
537
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
537
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/index.js
|
|
538
538
|
var core_exports2 = {};
|
|
539
539
|
__export(core_exports2, {
|
|
540
540
|
$ZodAny: () => $ZodAny,
|
|
@@ -778,7 +778,7 @@ __export(core_exports2, {
|
|
|
778
778
|
version: () => version
|
|
779
779
|
});
|
|
780
780
|
|
|
781
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
781
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js
|
|
782
782
|
var NEVER = Object.freeze({
|
|
783
783
|
status: "aborted"
|
|
784
784
|
});
|
|
@@ -838,7 +838,7 @@ function config(newConfig) {
|
|
|
838
838
|
return globalConfig;
|
|
839
839
|
}
|
|
840
840
|
|
|
841
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
841
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js
|
|
842
842
|
var util_exports = {};
|
|
843
843
|
__export(util_exports, {
|
|
844
844
|
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
|
|
@@ -1359,7 +1359,7 @@ var Class = class {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
};
|
|
1361
1361
|
|
|
1362
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
1362
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/errors.js
|
|
1363
1363
|
var initializer = (inst, def) => {
|
|
1364
1364
|
inst.name = "$ZodError";
|
|
1365
1365
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -1377,6 +1377,10 @@ var initializer = (inst, def) => {
|
|
|
1377
1377
|
enumerable: true
|
|
1378
1378
|
// configurable: false,
|
|
1379
1379
|
});
|
|
1380
|
+
Object.defineProperty(inst, "toString", {
|
|
1381
|
+
value: () => inst.message,
|
|
1382
|
+
enumerable: false
|
|
1383
|
+
});
|
|
1380
1384
|
};
|
|
1381
1385
|
var $ZodError = $constructor("$ZodError", initializer);
|
|
1382
1386
|
var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
@@ -1502,7 +1506,7 @@ function prettifyError(error40) {
|
|
|
1502
1506
|
return lines.join("\n");
|
|
1503
1507
|
}
|
|
1504
1508
|
|
|
1505
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
1509
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js
|
|
1506
1510
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1507
1511
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
1508
1512
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -1554,7 +1558,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1554
1558
|
};
|
|
1555
1559
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
1556
1560
|
|
|
1557
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
1561
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js
|
|
1558
1562
|
var regexes_exports = {};
|
|
1559
1563
|
__export(regexes_exports, {
|
|
1560
1564
|
_emoji: () => _emoji,
|
|
@@ -1667,7 +1671,7 @@ var _undefined = /undefined/i;
|
|
|
1667
1671
|
var lowercase = /^[^A-Z]*$/;
|
|
1668
1672
|
var uppercase = /^[^a-z]*$/;
|
|
1669
1673
|
|
|
1670
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
1674
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/checks.js
|
|
1671
1675
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
1672
1676
|
var _a;
|
|
1673
1677
|
inst._zod ?? (inst._zod = {});
|
|
@@ -1865,11 +1869,12 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
1865
1869
|
};
|
|
1866
1870
|
});
|
|
1867
1871
|
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
1872
|
+
var _a;
|
|
1868
1873
|
$ZodCheck.init(inst, def);
|
|
1869
|
-
inst._zod.when = (payload) => {
|
|
1874
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
1870
1875
|
const val = payload.value;
|
|
1871
1876
|
return !nullish(val) && val.size !== void 0;
|
|
1872
|
-
};
|
|
1877
|
+
});
|
|
1873
1878
|
inst._zod.onattach.push((inst2) => {
|
|
1874
1879
|
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1875
1880
|
if (def.maximum < curr)
|
|
@@ -1891,11 +1896,12 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
1891
1896
|
};
|
|
1892
1897
|
});
|
|
1893
1898
|
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
1899
|
+
var _a;
|
|
1894
1900
|
$ZodCheck.init(inst, def);
|
|
1895
|
-
inst._zod.when = (payload) => {
|
|
1901
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
1896
1902
|
const val = payload.value;
|
|
1897
1903
|
return !nullish(val) && val.size !== void 0;
|
|
1898
|
-
};
|
|
1904
|
+
});
|
|
1899
1905
|
inst._zod.onattach.push((inst2) => {
|
|
1900
1906
|
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1901
1907
|
if (def.minimum > curr)
|
|
@@ -1917,11 +1923,12 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
1917
1923
|
};
|
|
1918
1924
|
});
|
|
1919
1925
|
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
1926
|
+
var _a;
|
|
1920
1927
|
$ZodCheck.init(inst, def);
|
|
1921
|
-
inst._zod.when = (payload) => {
|
|
1928
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
1922
1929
|
const val = payload.value;
|
|
1923
1930
|
return !nullish(val) && val.size !== void 0;
|
|
1924
|
-
};
|
|
1931
|
+
});
|
|
1925
1932
|
inst._zod.onattach.push((inst2) => {
|
|
1926
1933
|
const bag = inst2._zod.bag;
|
|
1927
1934
|
bag.minimum = def.size;
|
|
@@ -1946,11 +1953,12 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
1946
1953
|
};
|
|
1947
1954
|
});
|
|
1948
1955
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
1956
|
+
var _a;
|
|
1949
1957
|
$ZodCheck.init(inst, def);
|
|
1950
|
-
inst._zod.when = (payload) => {
|
|
1958
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
1951
1959
|
const val = payload.value;
|
|
1952
1960
|
return !nullish(val) && val.length !== void 0;
|
|
1953
|
-
};
|
|
1961
|
+
});
|
|
1954
1962
|
inst._zod.onattach.push((inst2) => {
|
|
1955
1963
|
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1956
1964
|
if (def.maximum < curr)
|
|
@@ -1974,11 +1982,12 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
1974
1982
|
};
|
|
1975
1983
|
});
|
|
1976
1984
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
1985
|
+
var _a;
|
|
1977
1986
|
$ZodCheck.init(inst, def);
|
|
1978
|
-
inst._zod.when = (payload) => {
|
|
1987
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
1979
1988
|
const val = payload.value;
|
|
1980
1989
|
return !nullish(val) && val.length !== void 0;
|
|
1981
|
-
};
|
|
1990
|
+
});
|
|
1982
1991
|
inst._zod.onattach.push((inst2) => {
|
|
1983
1992
|
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1984
1993
|
if (def.minimum > curr)
|
|
@@ -2002,11 +2011,12 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2002
2011
|
};
|
|
2003
2012
|
});
|
|
2004
2013
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
2014
|
+
var _a;
|
|
2005
2015
|
$ZodCheck.init(inst, def);
|
|
2006
|
-
inst._zod.when = (payload) => {
|
|
2016
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
2007
2017
|
const val = payload.value;
|
|
2008
2018
|
return !nullish(val) && val.length !== void 0;
|
|
2009
|
-
};
|
|
2019
|
+
});
|
|
2010
2020
|
inst._zod.onattach.push((inst2) => {
|
|
2011
2021
|
const bag = inst2._zod.bag;
|
|
2012
2022
|
bag.minimum = def.length;
|
|
@@ -2199,7 +2209,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
2199
2209
|
};
|
|
2200
2210
|
});
|
|
2201
2211
|
|
|
2202
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
2212
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js
|
|
2203
2213
|
var Doc = class {
|
|
2204
2214
|
constructor(args = []) {
|
|
2205
2215
|
this.content = [];
|
|
@@ -2235,14 +2245,14 @@ var Doc = class {
|
|
|
2235
2245
|
}
|
|
2236
2246
|
};
|
|
2237
2247
|
|
|
2238
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
2248
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/versions.js
|
|
2239
2249
|
var version = {
|
|
2240
2250
|
major: 4,
|
|
2241
2251
|
minor: 0,
|
|
2242
2252
|
patch: 0
|
|
2243
2253
|
};
|
|
2244
2254
|
|
|
2245
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
2255
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.js
|
|
2246
2256
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
2247
2257
|
var _a;
|
|
2248
2258
|
inst ?? (inst = {});
|
|
@@ -2268,8 +2278,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2268
2278
|
let isAborted = aborted(payload);
|
|
2269
2279
|
let asyncResult;
|
|
2270
2280
|
for (const ch of checks2) {
|
|
2271
|
-
if (ch._zod.when) {
|
|
2272
|
-
const shouldRun = ch._zod.when(payload);
|
|
2281
|
+
if (ch._zod.def.when) {
|
|
2282
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
2273
2283
|
if (!shouldRun)
|
|
2274
2284
|
continue;
|
|
2275
2285
|
} else if (isAborted) {
|
|
@@ -3076,7 +3086,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
3076
3086
|
defineLazy(inst._zod, "pattern", () => {
|
|
3077
3087
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
3078
3088
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
3079
|
-
return new RegExp(`^(${patterns.map((
|
|
3089
|
+
return new RegExp(`^(${patterns.map((p26) => cleanRegex(p26.source)).join("|")})$`);
|
|
3080
3090
|
}
|
|
3081
3091
|
return void 0;
|
|
3082
3092
|
});
|
|
@@ -3869,7 +3879,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
3869
3879
|
}
|
|
3870
3880
|
}
|
|
3871
3881
|
|
|
3872
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
3882
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/index.js
|
|
3873
3883
|
var locales_exports = {};
|
|
3874
3884
|
__export(locales_exports, {
|
|
3875
3885
|
ar: () => ar_default,
|
|
@@ -3913,7 +3923,7 @@ __export(locales_exports, {
|
|
|
3913
3923
|
zhTW: () => zh_TW_default
|
|
3914
3924
|
});
|
|
3915
3925
|
|
|
3916
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
3926
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ar.js
|
|
3917
3927
|
var error = () => {
|
|
3918
3928
|
const Sizable = {
|
|
3919
3929
|
string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
|
|
@@ -4030,7 +4040,7 @@ function ar_default() {
|
|
|
4030
4040
|
};
|
|
4031
4041
|
}
|
|
4032
4042
|
|
|
4033
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4043
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/az.js
|
|
4034
4044
|
var error2 = () => {
|
|
4035
4045
|
const Sizable = {
|
|
4036
4046
|
string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
|
|
@@ -4146,7 +4156,7 @@ function az_default() {
|
|
|
4146
4156
|
};
|
|
4147
4157
|
}
|
|
4148
4158
|
|
|
4149
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4159
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/be.js
|
|
4150
4160
|
function getBelarusianPlural(count, one, few, many) {
|
|
4151
4161
|
const absCount = Math.abs(count);
|
|
4152
4162
|
const lastDigit = absCount % 10;
|
|
@@ -4311,7 +4321,7 @@ function be_default() {
|
|
|
4311
4321
|
};
|
|
4312
4322
|
}
|
|
4313
4323
|
|
|
4314
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4324
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ca.js
|
|
4315
4325
|
var error4 = () => {
|
|
4316
4326
|
const Sizable = {
|
|
4317
4327
|
string: { unit: "car\xE0cters", verb: "contenir" },
|
|
@@ -4431,7 +4441,7 @@ function ca_default() {
|
|
|
4431
4441
|
};
|
|
4432
4442
|
}
|
|
4433
4443
|
|
|
4434
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4444
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/cs.js
|
|
4435
4445
|
var error5 = () => {
|
|
4436
4446
|
const Sizable = {
|
|
4437
4447
|
string: { unit: "znak\u016F", verb: "m\xEDt" },
|
|
@@ -4567,7 +4577,7 @@ function cs_default() {
|
|
|
4567
4577
|
};
|
|
4568
4578
|
}
|
|
4569
4579
|
|
|
4570
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4580
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/de.js
|
|
4571
4581
|
var error6 = () => {
|
|
4572
4582
|
const Sizable = {
|
|
4573
4583
|
string: { unit: "Zeichen", verb: "zu haben" },
|
|
@@ -4684,7 +4694,7 @@ function de_default() {
|
|
|
4684
4694
|
};
|
|
4685
4695
|
}
|
|
4686
4696
|
|
|
4687
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4697
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/en.js
|
|
4688
4698
|
var parsedType = (data) => {
|
|
4689
4699
|
const t = typeof data;
|
|
4690
4700
|
switch (t) {
|
|
@@ -4802,7 +4812,7 @@ function en_default() {
|
|
|
4802
4812
|
};
|
|
4803
4813
|
}
|
|
4804
4814
|
|
|
4805
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4815
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/eo.js
|
|
4806
4816
|
var parsedType2 = (data) => {
|
|
4807
4817
|
const t = typeof data;
|
|
4808
4818
|
switch (t) {
|
|
@@ -4919,7 +4929,7 @@ function eo_default() {
|
|
|
4919
4929
|
};
|
|
4920
4930
|
}
|
|
4921
4931
|
|
|
4922
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
4932
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/es.js
|
|
4923
4933
|
var error9 = () => {
|
|
4924
4934
|
const Sizable = {
|
|
4925
4935
|
string: { unit: "caracteres", verb: "tener" },
|
|
@@ -5037,7 +5047,7 @@ function es_default() {
|
|
|
5037
5047
|
};
|
|
5038
5048
|
}
|
|
5039
5049
|
|
|
5040
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5050
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/fa.js
|
|
5041
5051
|
var error10 = () => {
|
|
5042
5052
|
const Sizable = {
|
|
5043
5053
|
string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
|
|
@@ -5160,7 +5170,7 @@ function fa_default() {
|
|
|
5160
5170
|
};
|
|
5161
5171
|
}
|
|
5162
5172
|
|
|
5163
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5173
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/fi.js
|
|
5164
5174
|
var error11 = () => {
|
|
5165
5175
|
const Sizable = {
|
|
5166
5176
|
string: { unit: "merkki\xE4", subject: "merkkijonon" },
|
|
@@ -5283,7 +5293,7 @@ function fi_default() {
|
|
|
5283
5293
|
};
|
|
5284
5294
|
}
|
|
5285
5295
|
|
|
5286
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5296
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/fr.js
|
|
5287
5297
|
var error12 = () => {
|
|
5288
5298
|
const Sizable = {
|
|
5289
5299
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -5400,7 +5410,7 @@ function fr_default() {
|
|
|
5400
5410
|
};
|
|
5401
5411
|
}
|
|
5402
5412
|
|
|
5403
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5413
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/fr-CA.js
|
|
5404
5414
|
var error13 = () => {
|
|
5405
5415
|
const Sizable = {
|
|
5406
5416
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -5518,7 +5528,7 @@ function fr_CA_default() {
|
|
|
5518
5528
|
};
|
|
5519
5529
|
}
|
|
5520
5530
|
|
|
5521
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5531
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/he.js
|
|
5522
5532
|
var error14 = () => {
|
|
5523
5533
|
const Sizable = {
|
|
5524
5534
|
string: { unit: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" },
|
|
@@ -5636,7 +5646,7 @@ function he_default() {
|
|
|
5636
5646
|
};
|
|
5637
5647
|
}
|
|
5638
5648
|
|
|
5639
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5649
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/hu.js
|
|
5640
5650
|
var error15 = () => {
|
|
5641
5651
|
const Sizable = {
|
|
5642
5652
|
string: { unit: "karakter", verb: "legyen" },
|
|
@@ -5754,7 +5764,7 @@ function hu_default() {
|
|
|
5754
5764
|
};
|
|
5755
5765
|
}
|
|
5756
5766
|
|
|
5757
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5767
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/id.js
|
|
5758
5768
|
var error16 = () => {
|
|
5759
5769
|
const Sizable = {
|
|
5760
5770
|
string: { unit: "karakter", verb: "memiliki" },
|
|
@@ -5871,7 +5881,7 @@ function id_default() {
|
|
|
5871
5881
|
};
|
|
5872
5882
|
}
|
|
5873
5883
|
|
|
5874
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
5884
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/it.js
|
|
5875
5885
|
var error17 = () => {
|
|
5876
5886
|
const Sizable = {
|
|
5877
5887
|
string: { unit: "caratteri", verb: "avere" },
|
|
@@ -5989,7 +5999,7 @@ function it_default() {
|
|
|
5989
5999
|
};
|
|
5990
6000
|
}
|
|
5991
6001
|
|
|
5992
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6002
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ja.js
|
|
5993
6003
|
var error18 = () => {
|
|
5994
6004
|
const Sizable = {
|
|
5995
6005
|
string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
|
|
@@ -6105,7 +6115,7 @@ function ja_default() {
|
|
|
6105
6115
|
};
|
|
6106
6116
|
}
|
|
6107
6117
|
|
|
6108
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6118
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/kh.js
|
|
6109
6119
|
var error19 = () => {
|
|
6110
6120
|
const Sizable = {
|
|
6111
6121
|
string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
|
|
@@ -6223,7 +6233,7 @@ function kh_default() {
|
|
|
6223
6233
|
};
|
|
6224
6234
|
}
|
|
6225
6235
|
|
|
6226
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6236
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ko.js
|
|
6227
6237
|
var error20 = () => {
|
|
6228
6238
|
const Sizable = {
|
|
6229
6239
|
string: { unit: "\uBB38\uC790", verb: "to have" },
|
|
@@ -6345,7 +6355,7 @@ function ko_default() {
|
|
|
6345
6355
|
};
|
|
6346
6356
|
}
|
|
6347
6357
|
|
|
6348
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6358
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/mk.js
|
|
6349
6359
|
var error21 = () => {
|
|
6350
6360
|
const Sizable = {
|
|
6351
6361
|
string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
|
|
@@ -6464,7 +6474,7 @@ function mk_default() {
|
|
|
6464
6474
|
};
|
|
6465
6475
|
}
|
|
6466
6476
|
|
|
6467
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6477
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ms.js
|
|
6468
6478
|
var error22 = () => {
|
|
6469
6479
|
const Sizable = {
|
|
6470
6480
|
string: { unit: "aksara", verb: "mempunyai" },
|
|
@@ -6581,7 +6591,7 @@ function ms_default() {
|
|
|
6581
6591
|
};
|
|
6582
6592
|
}
|
|
6583
6593
|
|
|
6584
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6594
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/nl.js
|
|
6585
6595
|
var error23 = () => {
|
|
6586
6596
|
const Sizable = {
|
|
6587
6597
|
string: { unit: "tekens" },
|
|
@@ -6699,7 +6709,7 @@ function nl_default() {
|
|
|
6699
6709
|
};
|
|
6700
6710
|
}
|
|
6701
6711
|
|
|
6702
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6712
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/no.js
|
|
6703
6713
|
var error24 = () => {
|
|
6704
6714
|
const Sizable = {
|
|
6705
6715
|
string: { unit: "tegn", verb: "\xE5 ha" },
|
|
@@ -6816,7 +6826,7 @@ function no_default() {
|
|
|
6816
6826
|
};
|
|
6817
6827
|
}
|
|
6818
6828
|
|
|
6819
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6829
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ota.js
|
|
6820
6830
|
var error25 = () => {
|
|
6821
6831
|
const Sizable = {
|
|
6822
6832
|
string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
|
|
@@ -6934,7 +6944,7 @@ function ota_default() {
|
|
|
6934
6944
|
};
|
|
6935
6945
|
}
|
|
6936
6946
|
|
|
6937
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
6947
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ps.js
|
|
6938
6948
|
var error26 = () => {
|
|
6939
6949
|
const Sizable = {
|
|
6940
6950
|
string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
|
|
@@ -7057,7 +7067,7 @@ function ps_default() {
|
|
|
7057
7067
|
};
|
|
7058
7068
|
}
|
|
7059
7069
|
|
|
7060
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7070
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/pl.js
|
|
7061
7071
|
var error27 = () => {
|
|
7062
7072
|
const Sizable = {
|
|
7063
7073
|
string: { unit: "znak\xF3w", verb: "mie\u0107" },
|
|
@@ -7175,7 +7185,7 @@ function pl_default() {
|
|
|
7175
7185
|
};
|
|
7176
7186
|
}
|
|
7177
7187
|
|
|
7178
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7188
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/pt.js
|
|
7179
7189
|
var error28 = () => {
|
|
7180
7190
|
const Sizable = {
|
|
7181
7191
|
string: { unit: "caracteres", verb: "ter" },
|
|
@@ -7292,7 +7302,7 @@ function pt_default() {
|
|
|
7292
7302
|
};
|
|
7293
7303
|
}
|
|
7294
7304
|
|
|
7295
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7305
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ru.js
|
|
7296
7306
|
function getRussianPlural(count, one, few, many) {
|
|
7297
7307
|
const absCount = Math.abs(count);
|
|
7298
7308
|
const lastDigit = absCount % 10;
|
|
@@ -7457,7 +7467,7 @@ function ru_default() {
|
|
|
7457
7467
|
};
|
|
7458
7468
|
}
|
|
7459
7469
|
|
|
7460
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7470
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/sl.js
|
|
7461
7471
|
var error30 = () => {
|
|
7462
7472
|
const Sizable = {
|
|
7463
7473
|
string: { unit: "znakov", verb: "imeti" },
|
|
@@ -7575,7 +7585,7 @@ function sl_default() {
|
|
|
7575
7585
|
};
|
|
7576
7586
|
}
|
|
7577
7587
|
|
|
7578
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7588
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/sv.js
|
|
7579
7589
|
var error31 = () => {
|
|
7580
7590
|
const Sizable = {
|
|
7581
7591
|
string: { unit: "tecken", verb: "att ha" },
|
|
@@ -7694,7 +7704,7 @@ function sv_default() {
|
|
|
7694
7704
|
};
|
|
7695
7705
|
}
|
|
7696
7706
|
|
|
7697
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7707
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ta.js
|
|
7698
7708
|
var error32 = () => {
|
|
7699
7709
|
const Sizable = {
|
|
7700
7710
|
string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
|
|
@@ -7812,7 +7822,7 @@ function ta_default() {
|
|
|
7812
7822
|
};
|
|
7813
7823
|
}
|
|
7814
7824
|
|
|
7815
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7825
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/th.js
|
|
7816
7826
|
var error33 = () => {
|
|
7817
7827
|
const Sizable = {
|
|
7818
7828
|
string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
|
|
@@ -7930,7 +7940,7 @@ function th_default() {
|
|
|
7930
7940
|
};
|
|
7931
7941
|
}
|
|
7932
7942
|
|
|
7933
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
7943
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/tr.js
|
|
7934
7944
|
var parsedType3 = (data) => {
|
|
7935
7945
|
const t = typeof data;
|
|
7936
7946
|
switch (t) {
|
|
@@ -8046,7 +8056,7 @@ function tr_default() {
|
|
|
8046
8056
|
};
|
|
8047
8057
|
}
|
|
8048
8058
|
|
|
8049
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8059
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ua.js
|
|
8050
8060
|
var error35 = () => {
|
|
8051
8061
|
const Sizable = {
|
|
8052
8062
|
string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
|
|
@@ -8164,7 +8174,7 @@ function ua_default() {
|
|
|
8164
8174
|
};
|
|
8165
8175
|
}
|
|
8166
8176
|
|
|
8167
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8177
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/ur.js
|
|
8168
8178
|
var error36 = () => {
|
|
8169
8179
|
const Sizable = {
|
|
8170
8180
|
string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
|
|
@@ -8282,7 +8292,7 @@ function ur_default() {
|
|
|
8282
8292
|
};
|
|
8283
8293
|
}
|
|
8284
8294
|
|
|
8285
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8295
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/vi.js
|
|
8286
8296
|
var error37 = () => {
|
|
8287
8297
|
const Sizable = {
|
|
8288
8298
|
string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
|
|
@@ -8399,7 +8409,7 @@ function vi_default() {
|
|
|
8399
8409
|
};
|
|
8400
8410
|
}
|
|
8401
8411
|
|
|
8402
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8412
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/zh-CN.js
|
|
8403
8413
|
var error38 = () => {
|
|
8404
8414
|
const Sizable = {
|
|
8405
8415
|
string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
|
|
@@ -8516,7 +8526,7 @@ function zh_CN_default() {
|
|
|
8516
8526
|
};
|
|
8517
8527
|
}
|
|
8518
8528
|
|
|
8519
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8529
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/locales/zh-TW.js
|
|
8520
8530
|
var error39 = () => {
|
|
8521
8531
|
const Sizable = {
|
|
8522
8532
|
string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
|
|
@@ -8634,12 +8644,12 @@ function zh_TW_default() {
|
|
|
8634
8644
|
};
|
|
8635
8645
|
}
|
|
8636
8646
|
|
|
8637
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8647
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/registries.js
|
|
8638
8648
|
var $output = Symbol("ZodOutput");
|
|
8639
8649
|
var $input = Symbol("ZodInput");
|
|
8640
8650
|
var $ZodRegistry = class {
|
|
8641
8651
|
constructor() {
|
|
8642
|
-
this._map = /* @__PURE__ */ new
|
|
8652
|
+
this._map = /* @__PURE__ */ new Map();
|
|
8643
8653
|
this._idmap = /* @__PURE__ */ new Map();
|
|
8644
8654
|
}
|
|
8645
8655
|
add(schema, ..._meta) {
|
|
@@ -8653,14 +8663,23 @@ var $ZodRegistry = class {
|
|
|
8653
8663
|
}
|
|
8654
8664
|
return this;
|
|
8655
8665
|
}
|
|
8666
|
+
clear() {
|
|
8667
|
+
this._map = /* @__PURE__ */ new Map();
|
|
8668
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
8669
|
+
return this;
|
|
8670
|
+
}
|
|
8656
8671
|
remove(schema) {
|
|
8672
|
+
const meta = this._map.get(schema);
|
|
8673
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
8674
|
+
this._idmap.delete(meta.id);
|
|
8675
|
+
}
|
|
8657
8676
|
this._map.delete(schema);
|
|
8658
8677
|
return this;
|
|
8659
8678
|
}
|
|
8660
8679
|
get(schema) {
|
|
8661
|
-
const
|
|
8662
|
-
if (
|
|
8663
|
-
const pm = { ...this.get(
|
|
8680
|
+
const p26 = schema._zod.parent;
|
|
8681
|
+
if (p26) {
|
|
8682
|
+
const pm = { ...this.get(p26) ?? {} };
|
|
8664
8683
|
delete pm.id;
|
|
8665
8684
|
return { ...pm, ...this._map.get(schema) };
|
|
8666
8685
|
}
|
|
@@ -8675,7 +8694,7 @@ function registry() {
|
|
|
8675
8694
|
}
|
|
8676
8695
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
8677
8696
|
|
|
8678
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
8697
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/api.js
|
|
8679
8698
|
function _string(Class2, params) {
|
|
8680
8699
|
return new Class2({
|
|
8681
8700
|
type: "string",
|
|
@@ -9533,7 +9552,7 @@ function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
|
|
|
9533
9552
|
return inst;
|
|
9534
9553
|
}
|
|
9535
9554
|
|
|
9536
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
9555
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/function.js
|
|
9537
9556
|
var $ZodFunction = class {
|
|
9538
9557
|
constructor(def) {
|
|
9539
9558
|
this._def = def;
|
|
@@ -9543,28 +9562,28 @@ var $ZodFunction = class {
|
|
|
9543
9562
|
if (typeof func !== "function") {
|
|
9544
9563
|
throw new Error("implement() must be called with a function");
|
|
9545
9564
|
}
|
|
9546
|
-
const impl = (...args) => {
|
|
9565
|
+
const impl = ((...args) => {
|
|
9547
9566
|
const parsedArgs = this._def.input ? parse(this._def.input, args, void 0, { callee: impl }) : args;
|
|
9548
9567
|
if (!Array.isArray(parsedArgs)) {
|
|
9549
9568
|
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
|
9550
9569
|
}
|
|
9551
9570
|
const output = func(...parsedArgs);
|
|
9552
9571
|
return this._def.output ? parse(this._def.output, output, void 0, { callee: impl }) : output;
|
|
9553
|
-
};
|
|
9572
|
+
});
|
|
9554
9573
|
return impl;
|
|
9555
9574
|
}
|
|
9556
9575
|
implementAsync(func) {
|
|
9557
9576
|
if (typeof func !== "function") {
|
|
9558
9577
|
throw new Error("implement() must be called with a function");
|
|
9559
9578
|
}
|
|
9560
|
-
const impl = async (...args) => {
|
|
9579
|
+
const impl = (async (...args) => {
|
|
9561
9580
|
const parsedArgs = this._def.input ? await parseAsync(this._def.input, args, void 0, { callee: impl }) : args;
|
|
9562
9581
|
if (!Array.isArray(parsedArgs)) {
|
|
9563
9582
|
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
|
9564
9583
|
}
|
|
9565
9584
|
const output = await func(...parsedArgs);
|
|
9566
9585
|
return this._def.output ? parseAsync(this._def.output, output, void 0, { callee: impl }) : output;
|
|
9567
|
-
};
|
|
9586
|
+
});
|
|
9568
9587
|
return impl;
|
|
9569
9588
|
}
|
|
9570
9589
|
input(...args) {
|
|
@@ -9603,7 +9622,7 @@ function _function(params) {
|
|
|
9603
9622
|
});
|
|
9604
9623
|
}
|
|
9605
9624
|
|
|
9606
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
9625
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js
|
|
9607
9626
|
var JSONSchemaGenerator = class {
|
|
9608
9627
|
constructor(params) {
|
|
9609
9628
|
this.counter = 0;
|
|
@@ -9744,9 +9763,10 @@ var JSONSchemaGenerator = class {
|
|
|
9744
9763
|
case "unknown": {
|
|
9745
9764
|
break;
|
|
9746
9765
|
}
|
|
9747
|
-
case "undefined":
|
|
9748
|
-
|
|
9749
|
-
|
|
9766
|
+
case "undefined": {
|
|
9767
|
+
if (this.unrepresentable === "throw") {
|
|
9768
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
9769
|
+
}
|
|
9750
9770
|
break;
|
|
9751
9771
|
}
|
|
9752
9772
|
case "void": {
|
|
@@ -9755,6 +9775,10 @@ var JSONSchemaGenerator = class {
|
|
|
9755
9775
|
}
|
|
9756
9776
|
break;
|
|
9757
9777
|
}
|
|
9778
|
+
case "never": {
|
|
9779
|
+
_json.not = {};
|
|
9780
|
+
break;
|
|
9781
|
+
}
|
|
9758
9782
|
case "date": {
|
|
9759
9783
|
if (this.unrepresentable === "throw") {
|
|
9760
9784
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
@@ -10093,11 +10117,13 @@ var JSONSchemaGenerator = class {
|
|
|
10093
10117
|
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
10094
10118
|
if (params.external) {
|
|
10095
10119
|
const externalId = params.external.registry.get(entry[0])?.id;
|
|
10096
|
-
|
|
10097
|
-
|
|
10120
|
+
const uriGenerator = params.external.uri ?? ((id2) => id2);
|
|
10121
|
+
if (externalId) {
|
|
10122
|
+
return { ref: uriGenerator(externalId) };
|
|
10123
|
+
}
|
|
10098
10124
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
|
|
10099
10125
|
entry[1].defId = id;
|
|
10100
|
-
return { defId: id, ref: `${
|
|
10126
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
10101
10127
|
}
|
|
10102
10128
|
if (entry[1] === root) {
|
|
10103
10129
|
return { ref: "#" };
|
|
@@ -10122,6 +10148,16 @@ var JSONSchemaGenerator = class {
|
|
|
10122
10148
|
}
|
|
10123
10149
|
schema2.$ref = ref;
|
|
10124
10150
|
};
|
|
10151
|
+
if (params.cycles === "throw") {
|
|
10152
|
+
for (const entry of this.seen.entries()) {
|
|
10153
|
+
const seen = entry[1];
|
|
10154
|
+
if (seen.cycle) {
|
|
10155
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
10156
|
+
|
|
10157
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
10158
|
+
}
|
|
10159
|
+
}
|
|
10160
|
+
}
|
|
10125
10161
|
for (const entry of this.seen.entries()) {
|
|
10126
10162
|
const seen = entry[1];
|
|
10127
10163
|
if (schema === entry[0]) {
|
|
@@ -10141,13 +10177,7 @@ var JSONSchemaGenerator = class {
|
|
|
10141
10177
|
continue;
|
|
10142
10178
|
}
|
|
10143
10179
|
if (seen.cycle) {
|
|
10144
|
-
|
|
10145
|
-
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
10146
|
-
|
|
10147
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
10148
|
-
} else if (params.cycles === "ref") {
|
|
10149
|
-
extractToDef(entry);
|
|
10150
|
-
}
|
|
10180
|
+
extractToDef(entry);
|
|
10151
10181
|
continue;
|
|
10152
10182
|
}
|
|
10153
10183
|
if (seen.count > 1) {
|
|
@@ -10195,6 +10225,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10195
10225
|
} else {
|
|
10196
10226
|
console.warn(`Invalid target: ${this.target}`);
|
|
10197
10227
|
}
|
|
10228
|
+
if (params.external?.uri) {
|
|
10229
|
+
const id = params.external.registry.get(schema)?.id;
|
|
10230
|
+
if (!id)
|
|
10231
|
+
throw new Error("Schema is missing an `id` property");
|
|
10232
|
+
result.$id = params.external.uri(id);
|
|
10233
|
+
}
|
|
10198
10234
|
Object.assign(result, root.def);
|
|
10199
10235
|
const defs = params.external?.defs ?? {};
|
|
10200
10236
|
for (const entry of this.seen.entries()) {
|
|
@@ -10203,11 +10239,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10203
10239
|
defs[seen.defId] = seen.def;
|
|
10204
10240
|
}
|
|
10205
10241
|
}
|
|
10206
|
-
if (
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10242
|
+
if (params.external) {
|
|
10243
|
+
} else {
|
|
10244
|
+
if (Object.keys(defs).length > 0) {
|
|
10245
|
+
if (this.target === "draft-2020-12") {
|
|
10246
|
+
result.$defs = defs;
|
|
10247
|
+
} else {
|
|
10248
|
+
result.definitions = defs;
|
|
10249
|
+
}
|
|
10211
10250
|
}
|
|
10212
10251
|
}
|
|
10213
10252
|
try {
|
|
@@ -10228,7 +10267,7 @@ function toJSONSchema(input, _params) {
|
|
|
10228
10267
|
const schemas = {};
|
|
10229
10268
|
const external = {
|
|
10230
10269
|
registry: input,
|
|
10231
|
-
uri: _params?.uri
|
|
10270
|
+
uri: _params?.uri,
|
|
10232
10271
|
defs
|
|
10233
10272
|
};
|
|
10234
10273
|
for (const entry of input._idmap.entries()) {
|
|
@@ -10350,10 +10389,10 @@ function isTransforming(_schema, _ctx) {
|
|
|
10350
10389
|
throw new Error(`Unknown schema type: ${def.type}`);
|
|
10351
10390
|
}
|
|
10352
10391
|
|
|
10353
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
10392
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/json-schema.js
|
|
10354
10393
|
var json_schema_exports = {};
|
|
10355
10394
|
|
|
10356
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
10395
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/iso.js
|
|
10357
10396
|
var iso_exports = {};
|
|
10358
10397
|
__export(iso_exports, {
|
|
10359
10398
|
ZodISODate: () => ZodISODate,
|
|
@@ -10394,7 +10433,7 @@ function duration2(params) {
|
|
|
10394
10433
|
return _isoDuration(ZodISODuration, params);
|
|
10395
10434
|
}
|
|
10396
10435
|
|
|
10397
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
10436
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/errors.js
|
|
10398
10437
|
var initializer2 = (inst, issues) => {
|
|
10399
10438
|
$ZodError.init(inst, issues);
|
|
10400
10439
|
inst.name = "ZodError";
|
|
@@ -10428,13 +10467,13 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
10428
10467
|
Parent: Error
|
|
10429
10468
|
});
|
|
10430
10469
|
|
|
10431
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
10470
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js
|
|
10432
10471
|
var parse2 = /* @__PURE__ */ _parse(ZodRealError);
|
|
10433
10472
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
10434
10473
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
10435
10474
|
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
10436
10475
|
|
|
10437
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
10476
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js
|
|
10438
10477
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
10439
10478
|
$ZodType.init(inst, def);
|
|
10440
10479
|
inst.def = def;
|
|
@@ -10453,10 +10492,10 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
10453
10492
|
};
|
|
10454
10493
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
10455
10494
|
inst.brand = () => inst;
|
|
10456
|
-
inst.register = (reg, meta) => {
|
|
10495
|
+
inst.register = ((reg, meta) => {
|
|
10457
10496
|
reg.add(inst, meta);
|
|
10458
10497
|
return inst;
|
|
10459
|
-
};
|
|
10498
|
+
});
|
|
10460
10499
|
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
10461
10500
|
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
10462
10501
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -11000,7 +11039,7 @@ function partialRecord(keyType, valueType, params) {
|
|
|
11000
11039
|
return new ZodRecord({
|
|
11001
11040
|
type: "record",
|
|
11002
11041
|
keyType: union([keyType, never()]),
|
|
11003
|
-
valueType
|
|
11042
|
+
valueType,
|
|
11004
11043
|
...util_exports.normalizeParams(params)
|
|
11005
11044
|
});
|
|
11006
11045
|
}
|
|
@@ -11308,10 +11347,10 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
11308
11347
|
$ZodCustom.init(inst, def);
|
|
11309
11348
|
ZodType.init(inst, def);
|
|
11310
11349
|
});
|
|
11311
|
-
function check(fn
|
|
11350
|
+
function check(fn) {
|
|
11312
11351
|
const ch = new $ZodCheck({
|
|
11313
|
-
check: "custom"
|
|
11314
|
-
...
|
|
11352
|
+
check: "custom"
|
|
11353
|
+
// ...util.normalizeParams(params),
|
|
11315
11354
|
});
|
|
11316
11355
|
ch._zod.check = fn;
|
|
11317
11356
|
return ch;
|
|
@@ -11322,7 +11361,7 @@ function custom(fn, _params) {
|
|
|
11322
11361
|
function refine(fn, _params = {}) {
|
|
11323
11362
|
return _refine(ZodCustom, fn, _params);
|
|
11324
11363
|
}
|
|
11325
|
-
function superRefine(fn
|
|
11364
|
+
function superRefine(fn) {
|
|
11326
11365
|
const ch = check((payload) => {
|
|
11327
11366
|
payload.addIssue = (issue2) => {
|
|
11328
11367
|
if (typeof issue2 === "string") {
|
|
@@ -11339,7 +11378,7 @@ function superRefine(fn, params) {
|
|
|
11339
11378
|
}
|
|
11340
11379
|
};
|
|
11341
11380
|
return fn(payload.value, payload);
|
|
11342
|
-
}
|
|
11381
|
+
});
|
|
11343
11382
|
return ch;
|
|
11344
11383
|
}
|
|
11345
11384
|
function _instanceof(cls, params = {
|
|
@@ -11371,7 +11410,7 @@ function preprocess(fn, schema) {
|
|
|
11371
11410
|
return pipe(transform(fn), schema);
|
|
11372
11411
|
}
|
|
11373
11412
|
|
|
11374
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
11413
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/compat.js
|
|
11375
11414
|
var ZodIssueCode = {
|
|
11376
11415
|
invalid_type: "invalid_type",
|
|
11377
11416
|
too_big: "too_big",
|
|
@@ -11394,7 +11433,7 @@ function getErrorMap() {
|
|
|
11394
11433
|
return config().customError;
|
|
11395
11434
|
}
|
|
11396
11435
|
|
|
11397
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
11436
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/coerce.js
|
|
11398
11437
|
var coerce_exports = {};
|
|
11399
11438
|
__export(coerce_exports, {
|
|
11400
11439
|
bigint: () => bigint3,
|
|
@@ -11419,11 +11458,11 @@ function date4(params) {
|
|
|
11419
11458
|
return _coercedDate(ZodDate, params);
|
|
11420
11459
|
}
|
|
11421
11460
|
|
|
11422
|
-
// ../../node_modules/.pnpm/zod@3.25.
|
|
11461
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
|
|
11423
11462
|
config(en_default());
|
|
11424
11463
|
|
|
11425
11464
|
// package.json
|
|
11426
|
-
var version2 = "0.
|
|
11465
|
+
var version2 = "0.1.2";
|
|
11427
11466
|
|
|
11428
11467
|
// src/utils/get-package-info.ts
|
|
11429
11468
|
async function getPackageInfo() {
|
|
@@ -11579,12 +11618,12 @@ var backup = new Command().name("backup").description("Back up the database to a
|
|
|
11579
11618
|
);
|
|
11580
11619
|
process.exit(0);
|
|
11581
11620
|
}
|
|
11582
|
-
const
|
|
11621
|
+
const spinner10 = p14.spinner();
|
|
11583
11622
|
const startTime = Date.now();
|
|
11584
|
-
|
|
11623
|
+
spinner10.start(`\u{1F4E6} Creating backup`);
|
|
11585
11624
|
await fse3.mkdir(backupDir, { recursive: true });
|
|
11586
11625
|
await compressDir("./cockroach-data", backupFilePath);
|
|
11587
|
-
|
|
11626
|
+
spinner10.stop(`\u2705 Backup created`);
|
|
11588
11627
|
const endTime = Date.now();
|
|
11589
11628
|
const elapsedTime = ((endTime - startTime) / 1e3).toFixed(2);
|
|
11590
11629
|
const backupStats = await fse3.stat(backupFilePath);
|
|
@@ -11596,16 +11635,466 @@ var backup = new Command().name("backup").description("Back up the database to a
|
|
|
11596
11635
|
p14.outro("\u2728 Database backup complete!");
|
|
11597
11636
|
});
|
|
11598
11637
|
|
|
11638
|
+
// src/cmd/dev.ts
|
|
11639
|
+
import * as p15 from "@clack/prompts";
|
|
11640
|
+
import { Command as Command2 } from "@commander-js/extra-typings";
|
|
11641
|
+
import clipboardy from "clipboardy";
|
|
11642
|
+
import color2 from "picocolors";
|
|
11643
|
+
import { $ as $18 } from "zx/core";
|
|
11644
|
+
|
|
11645
|
+
// src/utils/service-selector.ts
|
|
11646
|
+
import { readFile } from "fs/promises";
|
|
11647
|
+
import glob from "tiny-glob";
|
|
11648
|
+
|
|
11649
|
+
// src/schemas/template.schema.ts
|
|
11650
|
+
var printDescriptionSchema = external_exports.object({
|
|
11651
|
+
name: external_exports.string(),
|
|
11652
|
+
description: external_exports.string(),
|
|
11653
|
+
version: external_exports.string()
|
|
11654
|
+
});
|
|
11655
|
+
var printUsageSchema = external_exports.object({
|
|
11656
|
+
usageCommand: external_exports.string()
|
|
11657
|
+
});
|
|
11658
|
+
var appsListSchema = external_exports.array(
|
|
11659
|
+
external_exports.object({
|
|
11660
|
+
name: external_exports.string(),
|
|
11661
|
+
url: external_exports.url(),
|
|
11662
|
+
description: external_exports.string(),
|
|
11663
|
+
path: external_exports.string()
|
|
11664
|
+
})
|
|
11665
|
+
);
|
|
11666
|
+
var serviceGroupSchema = external_exports.enum(["api", "app", "docs", "other"]);
|
|
11667
|
+
var serviceSchema = external_exports.object({
|
|
11668
|
+
packageName: external_exports.string(),
|
|
11669
|
+
displayName: external_exports.string(),
|
|
11670
|
+
path: external_exports.string(),
|
|
11671
|
+
group: serviceGroupSchema,
|
|
11672
|
+
description: external_exports.string().optional()
|
|
11673
|
+
});
|
|
11674
|
+
var serviceListSchema = external_exports.array(serviceSchema);
|
|
11675
|
+
|
|
11676
|
+
// src/utils/service-registry.ts
|
|
11677
|
+
var SERVICE_REGISTRY = [
|
|
11678
|
+
// API Services
|
|
11679
|
+
{
|
|
11680
|
+
name: "API",
|
|
11681
|
+
packageName: "@pragma/api",
|
|
11682
|
+
url: "http://localhost:4000",
|
|
11683
|
+
description: "Pragma API for third parties",
|
|
11684
|
+
path: "apps/api",
|
|
11685
|
+
group: "api"
|
|
11686
|
+
},
|
|
11687
|
+
{
|
|
11688
|
+
name: "Sync API",
|
|
11689
|
+
packageName: "@pragma/api-sync",
|
|
11690
|
+
url: "http://localhost:4001",
|
|
11691
|
+
description: "Manages POS configuration synchronization",
|
|
11692
|
+
path: "apps/api-sync",
|
|
11693
|
+
group: "api"
|
|
11694
|
+
},
|
|
11695
|
+
{
|
|
11696
|
+
name: "Order API",
|
|
11697
|
+
packageName: "@pragma/api-order",
|
|
11698
|
+
url: "http://localhost:4003",
|
|
11699
|
+
description: "Receives and processes live orders from POS systems",
|
|
11700
|
+
path: "apps/api-order",
|
|
11701
|
+
group: "api"
|
|
11702
|
+
},
|
|
11703
|
+
{
|
|
11704
|
+
name: "POS API",
|
|
11705
|
+
packageName: "@pragma/api-pos",
|
|
11706
|
+
url: "http://localhost:4004",
|
|
11707
|
+
description: "Processes requests from POS devices",
|
|
11708
|
+
path: "apps/api-pos",
|
|
11709
|
+
group: "api"
|
|
11710
|
+
},
|
|
11711
|
+
{
|
|
11712
|
+
name: "WebSocket",
|
|
11713
|
+
packageName: "@pragma/ws",
|
|
11714
|
+
url: "http://localhost:4005",
|
|
11715
|
+
description: "WebSocket server for real-time communication",
|
|
11716
|
+
path: "apps/ws",
|
|
11717
|
+
group: "api"
|
|
11718
|
+
},
|
|
11719
|
+
{
|
|
11720
|
+
name: "Payment API",
|
|
11721
|
+
packageName: "@pragma/api-payment",
|
|
11722
|
+
url: "http://localhost:4006",
|
|
11723
|
+
description: "Manages payment transactions",
|
|
11724
|
+
path: "apps/api-payment",
|
|
11725
|
+
group: "api"
|
|
11726
|
+
},
|
|
11727
|
+
{
|
|
11728
|
+
name: "Webhook API",
|
|
11729
|
+
packageName: "@pragma/api-webhook",
|
|
11730
|
+
url: "http://localhost:4007",
|
|
11731
|
+
description: "Manages and sends webhooks to external services",
|
|
11732
|
+
path: "apps/api-webhook",
|
|
11733
|
+
group: "api"
|
|
11734
|
+
},
|
|
11735
|
+
{
|
|
11736
|
+
name: "Booking API",
|
|
11737
|
+
packageName: "@pragma/api-booking",
|
|
11738
|
+
url: "http://localhost:4008",
|
|
11739
|
+
description: "Manages bookings",
|
|
11740
|
+
path: "apps/api-booking",
|
|
11741
|
+
group: "api"
|
|
11742
|
+
},
|
|
11743
|
+
{
|
|
11744
|
+
name: "Dataflow API",
|
|
11745
|
+
packageName: "@pragma/api-dataflow",
|
|
11746
|
+
url: "http://localhost:4009",
|
|
11747
|
+
description: "Retrieve, transform, and send data",
|
|
11748
|
+
path: "apps/api-dataflow",
|
|
11749
|
+
group: "api"
|
|
11750
|
+
},
|
|
11751
|
+
{
|
|
11752
|
+
name: "Loyalty API",
|
|
11753
|
+
packageName: "@pragma/api-loyalty",
|
|
11754
|
+
url: "http://localhost:4010",
|
|
11755
|
+
description: "Third-parties loyalty POS integration",
|
|
11756
|
+
path: "apps/api-loyalty",
|
|
11757
|
+
group: "api"
|
|
11758
|
+
},
|
|
11759
|
+
{
|
|
11760
|
+
name: "Customer API",
|
|
11761
|
+
packageName: "@pragma/api-customer",
|
|
11762
|
+
url: "http://localhost:4012",
|
|
11763
|
+
description: "Manages customers",
|
|
11764
|
+
path: "apps/api-customer",
|
|
11765
|
+
group: "api"
|
|
11766
|
+
},
|
|
11767
|
+
// Web Applications
|
|
11768
|
+
{
|
|
11769
|
+
name: "Admin",
|
|
11770
|
+
packageName: "@pragma/admin",
|
|
11771
|
+
url: "http://localhost:3000",
|
|
11772
|
+
description: "Manage, monitor and configure Pragma API!",
|
|
11773
|
+
path: "apps/admin",
|
|
11774
|
+
group: "app"
|
|
11775
|
+
},
|
|
11776
|
+
{
|
|
11777
|
+
name: "Generic",
|
|
11778
|
+
packageName: "@pragma/generic",
|
|
11779
|
+
url: "http://localhost:3002",
|
|
11780
|
+
description: "A showcase for our Frontend features",
|
|
11781
|
+
path: "apps/generic",
|
|
11782
|
+
group: "app"
|
|
11783
|
+
},
|
|
11784
|
+
{
|
|
11785
|
+
name: "Auth POS",
|
|
11786
|
+
packageName: "@pragma/auth-pos",
|
|
11787
|
+
url: "http://localhost:3003",
|
|
11788
|
+
description: "Authenticates POS devices for API access",
|
|
11789
|
+
path: "apps/auth-pos",
|
|
11790
|
+
group: "app"
|
|
11791
|
+
},
|
|
11792
|
+
{
|
|
11793
|
+
name: "Backoffice",
|
|
11794
|
+
packageName: "@pragma/backoffice",
|
|
11795
|
+
url: "http://localhost:3005",
|
|
11796
|
+
description: "Backoffice is a frontend service that enables customers to efficiently manage their stores through a cloud-based web application.",
|
|
11797
|
+
path: "apps/backoffice",
|
|
11798
|
+
group: "app"
|
|
11799
|
+
},
|
|
11800
|
+
{
|
|
11801
|
+
name: "Auth Proxy",
|
|
11802
|
+
packageName: "@pragma/auth-proxy",
|
|
11803
|
+
url: "http://localhost:3007",
|
|
11804
|
+
description: "Manages OAuth provider authentication callbacks",
|
|
11805
|
+
path: "apps/auth-proxy",
|
|
11806
|
+
group: "app"
|
|
11807
|
+
},
|
|
11808
|
+
{
|
|
11809
|
+
name: "Table Payment",
|
|
11810
|
+
packageName: "@pragma/table-payment",
|
|
11811
|
+
url: "http://localhost:3008",
|
|
11812
|
+
description: "Web app to pay a table order in a restaurant from a QR Code",
|
|
11813
|
+
path: "apps/table-payment",
|
|
11814
|
+
group: "app"
|
|
11815
|
+
},
|
|
11816
|
+
{
|
|
11817
|
+
name: "Accounting",
|
|
11818
|
+
packageName: "@pragma/accounting",
|
|
11819
|
+
url: "http://localhost:80",
|
|
11820
|
+
description: "Quickly setup an accounting configuration",
|
|
11821
|
+
path: "apps/accounting",
|
|
11822
|
+
group: "app"
|
|
11823
|
+
},
|
|
11824
|
+
// Documentation
|
|
11825
|
+
{
|
|
11826
|
+
name: "Public Docs",
|
|
11827
|
+
packageName: "@pragma/public-docs",
|
|
11828
|
+
url: "http://localhost:3001",
|
|
11829
|
+
description: "Public documentation for Pragma API",
|
|
11830
|
+
path: "apps/docs",
|
|
11831
|
+
group: "docs"
|
|
11832
|
+
},
|
|
11833
|
+
{
|
|
11834
|
+
name: "Internal Docs",
|
|
11835
|
+
packageName: "@pragma/internal-docs",
|
|
11836
|
+
url: "http://localhost:3006",
|
|
11837
|
+
description: "Internal documentation for Pragma API",
|
|
11838
|
+
path: "apps/admin",
|
|
11839
|
+
group: "docs"
|
|
11840
|
+
},
|
|
11841
|
+
{
|
|
11842
|
+
name: "Workshop",
|
|
11843
|
+
packageName: "@pragma/workshop",
|
|
11844
|
+
url: "http://localhost:6006",
|
|
11845
|
+
description: "Design System and Components library",
|
|
11846
|
+
path: "apps/workshop",
|
|
11847
|
+
group: "docs"
|
|
11848
|
+
},
|
|
11849
|
+
{
|
|
11850
|
+
name: "Knowledge Documentation",
|
|
11851
|
+
packageName: "@pragma/knowledge",
|
|
11852
|
+
url: "http://localhost:3009",
|
|
11853
|
+
description: "Knowledge documentation for Pragma API",
|
|
11854
|
+
path: "apps/knowledge",
|
|
11855
|
+
group: "docs"
|
|
11856
|
+
},
|
|
11857
|
+
// Jobs
|
|
11858
|
+
{
|
|
11859
|
+
name: "Jobs",
|
|
11860
|
+
packageName: "@pragma/jobs",
|
|
11861
|
+
url: "http://localhost:5000",
|
|
11862
|
+
description: "Background job processing",
|
|
11863
|
+
path: "apps/jobs",
|
|
11864
|
+
group: "other"
|
|
11865
|
+
},
|
|
11866
|
+
{
|
|
11867
|
+
name: "Automated Jobs",
|
|
11868
|
+
packageName: "@pragma/automated-jobs",
|
|
11869
|
+
url: "http://localhost:5001",
|
|
11870
|
+
description: "Automated job scheduling and execution",
|
|
11871
|
+
path: "apps/automated-jobs",
|
|
11872
|
+
group: "other"
|
|
11873
|
+
}
|
|
11874
|
+
];
|
|
11875
|
+
var DATABASE_TOOLS = [
|
|
11876
|
+
{
|
|
11877
|
+
name: "Prisma Studio",
|
|
11878
|
+
url: "http://localhost:5555",
|
|
11879
|
+
description: "Easily explore and manipulate the database",
|
|
11880
|
+
path: "packages/database"
|
|
11881
|
+
},
|
|
11882
|
+
{
|
|
11883
|
+
name: "CockroachDB",
|
|
11884
|
+
url: "http://localhost:8080",
|
|
11885
|
+
description: "Web Admin for monitoring CockroachDB",
|
|
11886
|
+
path: "docker-compose.yml"
|
|
11887
|
+
},
|
|
11888
|
+
{
|
|
11889
|
+
name: "Redis Commander",
|
|
11890
|
+
url: "http://localhost:8081",
|
|
11891
|
+
description: "Web Admin to explore Redis",
|
|
11892
|
+
path: "docker-compose.yml"
|
|
11893
|
+
}
|
|
11894
|
+
];
|
|
11895
|
+
function getServicesByGroup(group5) {
|
|
11896
|
+
return SERVICE_REGISTRY.filter((service) => service.group === group5).map(
|
|
11897
|
+
({ name, url: url2, description, path: path2 }) => ({
|
|
11898
|
+
name,
|
|
11899
|
+
url: url2,
|
|
11900
|
+
description,
|
|
11901
|
+
path: path2
|
|
11902
|
+
})
|
|
11903
|
+
);
|
|
11904
|
+
}
|
|
11905
|
+
function getAPIServices() {
|
|
11906
|
+
return getServicesByGroup("api");
|
|
11907
|
+
}
|
|
11908
|
+
function getAppServices() {
|
|
11909
|
+
return getServicesByGroup("app");
|
|
11910
|
+
}
|
|
11911
|
+
function getDocServices() {
|
|
11912
|
+
return getServicesByGroup("docs");
|
|
11913
|
+
}
|
|
11914
|
+
function getDatabaseTools() {
|
|
11915
|
+
return DATABASE_TOOLS;
|
|
11916
|
+
}
|
|
11917
|
+
function getServiceMetadata() {
|
|
11918
|
+
return SERVICE_REGISTRY.reduce(
|
|
11919
|
+
(acc, service) => {
|
|
11920
|
+
acc[service.packageName] = {
|
|
11921
|
+
description: service.description,
|
|
11922
|
+
group: service.group
|
|
11923
|
+
};
|
|
11924
|
+
return acc;
|
|
11925
|
+
},
|
|
11926
|
+
{}
|
|
11927
|
+
);
|
|
11928
|
+
}
|
|
11929
|
+
|
|
11930
|
+
// src/utils/service-selector.ts
|
|
11931
|
+
async function discoverServices() {
|
|
11932
|
+
try {
|
|
11933
|
+
const serviceMetadata = getServiceMetadata();
|
|
11934
|
+
const packagePaths = await glob("apps/*/package.json", {
|
|
11935
|
+
cwd: process.cwd(),
|
|
11936
|
+
absolute: false
|
|
11937
|
+
});
|
|
11938
|
+
const services = [];
|
|
11939
|
+
for (const pkgPath of packagePaths) {
|
|
11940
|
+
try {
|
|
11941
|
+
const content = await readFile(pkgPath, "utf-8");
|
|
11942
|
+
const pkg = JSON.parse(content);
|
|
11943
|
+
if (!pkg.scripts?.dev) continue;
|
|
11944
|
+
const packageName = pkg.name;
|
|
11945
|
+
const path2 = pkgPath.replace("/package.json", "");
|
|
11946
|
+
const metadata = serviceMetadata[packageName];
|
|
11947
|
+
const displayName = packageName ? packageName.replace("@pragma/", "").replace(/-/g, " ") : path2.split("/").pop() || "Unknown";
|
|
11948
|
+
let group5 = metadata?.group || "other";
|
|
11949
|
+
if (!metadata) {
|
|
11950
|
+
if (packageName?.startsWith("@pragma/api-")) {
|
|
11951
|
+
group5 = "api";
|
|
11952
|
+
} else if (packageName?.includes("docs") || packageName?.includes("workshop") || packageName?.includes("knowledge")) {
|
|
11953
|
+
group5 = "docs";
|
|
11954
|
+
} else if (packageName?.startsWith("@pragma/")) {
|
|
11955
|
+
group5 = "app";
|
|
11956
|
+
}
|
|
11957
|
+
}
|
|
11958
|
+
services.push({
|
|
11959
|
+
packageName,
|
|
11960
|
+
displayName: displayName.charAt(0).toUpperCase() + displayName.slice(1),
|
|
11961
|
+
path: path2,
|
|
11962
|
+
group: group5,
|
|
11963
|
+
description: metadata?.description || pkg.description || ""
|
|
11964
|
+
});
|
|
11965
|
+
} catch (err) {
|
|
11966
|
+
console.warn(`Warning: Could not parse ${pkgPath}`, err);
|
|
11967
|
+
continue;
|
|
11968
|
+
}
|
|
11969
|
+
}
|
|
11970
|
+
return serviceListSchema.parse(services);
|
|
11971
|
+
} catch (err) {
|
|
11972
|
+
throw new Error(
|
|
11973
|
+
`Failed to discover services: ${err instanceof Error ? err.message : String(err)}`
|
|
11974
|
+
);
|
|
11975
|
+
}
|
|
11976
|
+
}
|
|
11977
|
+
function groupServices(services, groups) {
|
|
11978
|
+
const filtered = groups ? services.filter((s) => groups.includes(s.group)) : services;
|
|
11979
|
+
const groupedServices = {
|
|
11980
|
+
api: filtered.filter((s) => s.group === "api"),
|
|
11981
|
+
app: filtered.filter((s) => s.group === "app"),
|
|
11982
|
+
docs: filtered.filter((s) => s.group === "docs"),
|
|
11983
|
+
other: filtered.filter((s) => s.group === "other")
|
|
11984
|
+
};
|
|
11985
|
+
return [
|
|
11986
|
+
...groupedServices.app.sort(
|
|
11987
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
11988
|
+
),
|
|
11989
|
+
...groupedServices.api.sort(
|
|
11990
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
11991
|
+
),
|
|
11992
|
+
...groupedServices.docs.sort(
|
|
11993
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
11994
|
+
),
|
|
11995
|
+
...groupedServices.other.sort(
|
|
11996
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
11997
|
+
)
|
|
11998
|
+
];
|
|
11999
|
+
}
|
|
12000
|
+
|
|
12001
|
+
// src/cmd/dev.ts
|
|
12002
|
+
$18.verbose = false;
|
|
12003
|
+
function buildCommand(selectedPackages, logOrder) {
|
|
12004
|
+
const filters = selectedPackages.map((pkg) => `--filter ${pkg}`).join(" ");
|
|
12005
|
+
return `pnpm dev${logOrder !== "tui" ? ` --log-order=${logOrder}` : ""} ${filters}`;
|
|
12006
|
+
}
|
|
12007
|
+
var dev = new Command2().name("dev").description(
|
|
12008
|
+
"Interactively select which apps and services to run in development mode"
|
|
12009
|
+
).action(async () => {
|
|
12010
|
+
console.clear();
|
|
12011
|
+
p15.intro(
|
|
12012
|
+
`${color2.bgCyan(color2.black(" Pragma CLI - Dev command generator "))}
|
|
12013
|
+
`
|
|
12014
|
+
);
|
|
12015
|
+
const s = p15.spinner();
|
|
12016
|
+
try {
|
|
12017
|
+
const services = await discoverServices();
|
|
12018
|
+
if (services.length === 0) {
|
|
12019
|
+
p15.log.error("No services found with dev scripts");
|
|
12020
|
+
p15.outro("Please check your apps directory");
|
|
12021
|
+
process.exit(1);
|
|
12022
|
+
}
|
|
12023
|
+
const sortedServices = groupServices(services);
|
|
12024
|
+
const options = sortedServices.map((service) => ({
|
|
12025
|
+
value: service.packageName,
|
|
12026
|
+
label: `${service.displayName}`,
|
|
12027
|
+
hint: service.description || service.path
|
|
12028
|
+
}));
|
|
12029
|
+
const selected = await p15.multiselect({
|
|
12030
|
+
message: "Select services to start:",
|
|
12031
|
+
options,
|
|
12032
|
+
required: true
|
|
12033
|
+
});
|
|
12034
|
+
if (p15.isCancel(selected)) {
|
|
12035
|
+
p15.cancel("Operation cancelled");
|
|
12036
|
+
process.exit(0);
|
|
12037
|
+
}
|
|
12038
|
+
const selectedPackages = selected;
|
|
12039
|
+
const logOrder = await p15.select({
|
|
12040
|
+
message: "Select log UI:",
|
|
12041
|
+
options: [
|
|
12042
|
+
{
|
|
12043
|
+
value: "tui",
|
|
12044
|
+
label: "TUI (Terminal UI)",
|
|
12045
|
+
hint: "Interactive terminal UI"
|
|
12046
|
+
},
|
|
12047
|
+
{
|
|
12048
|
+
value: "stream",
|
|
12049
|
+
label: "Stream",
|
|
12050
|
+
hint: "Show output as soon as it is available"
|
|
12051
|
+
},
|
|
12052
|
+
{
|
|
12053
|
+
value: "auto",
|
|
12054
|
+
label: "Auto",
|
|
12055
|
+
hint: "turbo decides based on its own heuristics"
|
|
12056
|
+
}
|
|
12057
|
+
],
|
|
12058
|
+
initialValue: "tui"
|
|
12059
|
+
});
|
|
12060
|
+
if (p15.isCancel(logOrder)) {
|
|
12061
|
+
p15.cancel("Operation cancelled");
|
|
12062
|
+
process.exit(0);
|
|
12063
|
+
}
|
|
12064
|
+
const command = buildCommand(selectedPackages, logOrder);
|
|
12065
|
+
try {
|
|
12066
|
+
await clipboardy.write(command);
|
|
12067
|
+
} catch (err) {
|
|
12068
|
+
}
|
|
12069
|
+
p15.log.message(
|
|
12070
|
+
`
|
|
12071
|
+
${color2.bold("Generated command:")}
|
|
12072
|
+
${color2.cyan(command)}
|
|
12073
|
+
`
|
|
12074
|
+
);
|
|
12075
|
+
p15.outro(`${color2.green("\u2713")} Command copied to clipboard`);
|
|
12076
|
+
} catch (err) {
|
|
12077
|
+
s.stop("Error occurred");
|
|
12078
|
+
p15.log.error(
|
|
12079
|
+
`Failed to discover services: ${err instanceof Error ? err.message : String(err)}`
|
|
12080
|
+
);
|
|
12081
|
+
p15.outro(
|
|
12082
|
+
`Problems? ${color2.underline(color2.cyan("https://linear.new/team/web/new?labels=cli"))}`
|
|
12083
|
+
);
|
|
12084
|
+
process.exit(1);
|
|
12085
|
+
}
|
|
12086
|
+
});
|
|
12087
|
+
|
|
11599
12088
|
// src/cmd/env.ts
|
|
11600
|
-
import * as
|
|
11601
|
-
import { Command as
|
|
11602
|
-
import
|
|
12089
|
+
import * as p19 from "@clack/prompts";
|
|
12090
|
+
import { Command as Command6 } from "@commander-js/extra-typings";
|
|
12091
|
+
import color4 from "picocolors";
|
|
11603
12092
|
|
|
11604
12093
|
// src/cmd/env-app.ts
|
|
11605
|
-
import * as
|
|
11606
|
-
import { Command as
|
|
12094
|
+
import * as p16 from "@clack/prompts";
|
|
12095
|
+
import { Command as Command3 } from "@commander-js/extra-typings";
|
|
11607
12096
|
import fse4 from "fs-extra";
|
|
11608
|
-
import
|
|
12097
|
+
import glob2 from "tiny-glob";
|
|
11609
12098
|
var CURRENT_DIR = process.cwd();
|
|
11610
12099
|
var TEMP_DIR_PATH = `${CURRENT_DIR}/packages/cli/temp/`;
|
|
11611
12100
|
var getAppDirList = () => fse4.readdirSync("./apps").filter((dir) => fse4.statSync(`${CURRENT_DIR}/apps/${dir}`).isDirectory());
|
|
@@ -11620,21 +12109,21 @@ var getPragmaDependencies = (packageJsonPath) => {
|
|
|
11620
12109
|
}
|
|
11621
12110
|
return [];
|
|
11622
12111
|
} catch (error40) {
|
|
11623
|
-
|
|
12112
|
+
p16.log.error(`Error reading or parsing ${packageJsonPath}: ${error40}`);
|
|
11624
12113
|
process.exit(1);
|
|
11625
12114
|
}
|
|
11626
12115
|
};
|
|
11627
12116
|
var explorePackagesDependencies = (packages) => {
|
|
11628
12117
|
const newPackages = [
|
|
11629
12118
|
...packages,
|
|
11630
|
-
...packages.map((
|
|
11631
|
-
const packageJsonPath = `${CURRENT_DIR}/packages/${
|
|
12119
|
+
...packages.map((p26) => {
|
|
12120
|
+
const packageJsonPath = `${CURRENT_DIR}/packages/${p26}/package.json`;
|
|
11632
12121
|
return getPragmaDependencies(packageJsonPath);
|
|
11633
|
-
}).flat().filter((
|
|
12122
|
+
}).flat().filter((p26) => !packages.includes(p26))
|
|
11634
12123
|
];
|
|
11635
12124
|
return newPackages.length === packages.length ? newPackages : explorePackagesDependencies(newPackages);
|
|
11636
12125
|
};
|
|
11637
|
-
var envApp = new
|
|
12126
|
+
var envApp = new Command3().command("app").description("Generate a list of environment variables for selected app").argument("[app]", "App name").action((app) => {
|
|
11638
12127
|
const parsedAppName = external_exports.string().optional().parse(app);
|
|
11639
12128
|
getAppEnvList(parsedAppName);
|
|
11640
12129
|
});
|
|
@@ -11643,7 +12132,7 @@ var getSingleAppOrPackageEnvList = async (appOrPackage) => {
|
|
|
11643
12132
|
let envKeysList = [];
|
|
11644
12133
|
const isApp = apps.includes(appOrPackage);
|
|
11645
12134
|
const appOrPackagePath = isApp ? `${CURRENT_DIR}/apps/${appOrPackage}` : `${CURRENT_DIR}/packages/${appOrPackage}`;
|
|
11646
|
-
const envTsFiles = await
|
|
12135
|
+
const envTsFiles = await glob2(`${appOrPackagePath}/**/env.{ts,mjs}`);
|
|
11647
12136
|
for (const envTsPath of envTsFiles) {
|
|
11648
12137
|
const CreatedEnvConfig = fse4.readFileSync(envTsPath, "utf-8");
|
|
11649
12138
|
const regex = /envConfig\.(\w+(?:\.\w+)*)/g;
|
|
@@ -11678,13 +12167,13 @@ var getSingleAppOrPackageEnvList = async (appOrPackage) => {
|
|
|
11678
12167
|
async function getAppEnvList(app) {
|
|
11679
12168
|
const apps = getAppDirList();
|
|
11680
12169
|
if (!app) {
|
|
11681
|
-
app = await
|
|
12170
|
+
app = await p16.select({
|
|
11682
12171
|
message: "Select an app:",
|
|
11683
12172
|
options: apps.map((app2) => ({ value: app2, label: app2 }))
|
|
11684
12173
|
});
|
|
11685
12174
|
}
|
|
11686
12175
|
if (app && !apps.includes(app)) {
|
|
11687
|
-
|
|
12176
|
+
p16.log.error(`App ${app} does not exist in the code base.`);
|
|
11688
12177
|
process.exit(1);
|
|
11689
12178
|
}
|
|
11690
12179
|
const packageJsonPath = `./apps/${app}/package.json`;
|
|
@@ -11692,7 +12181,7 @@ async function getAppEnvList(app) {
|
|
|
11692
12181
|
const packageList = Array.from(
|
|
11693
12182
|
/* @__PURE__ */ new Set([...explorePackagesDependencies(packagesLvl0)])
|
|
11694
12183
|
).sort();
|
|
11695
|
-
|
|
12184
|
+
p16.log.info(`List of pragma dependencies:
|
|
11696
12185
|
${packageList.join(" \n")}`);
|
|
11697
12186
|
const appAndPackagesToExplore = [app, ...packageList];
|
|
11698
12187
|
let envKeysList = [];
|
|
@@ -11703,23 +12192,23 @@ ${packageList.join(" \n")}`);
|
|
|
11703
12192
|
envList = Array.from(/* @__PURE__ */ new Set([...envList, ...currentEnvList]));
|
|
11704
12193
|
}
|
|
11705
12194
|
envKeysList = envKeysList.filter((curr, index, self) => self.indexOf(curr) === index).sort();
|
|
11706
|
-
|
|
12195
|
+
p16.log.info(
|
|
11707
12196
|
`List of env keys from @pragma/config/env:
|
|
11708
12197
|
${envKeysList.join(" \n")}`
|
|
11709
12198
|
);
|
|
11710
12199
|
envList = envList.filter((curr, index, self) => self.indexOf(curr) === index).sort();
|
|
11711
|
-
|
|
12200
|
+
p16.log.info(`Environment variables for ${app}:
|
|
11712
12201
|
${envList.join("\n")}`);
|
|
11713
|
-
|
|
12202
|
+
p16.outro("\u2728 Done!");
|
|
11714
12203
|
}
|
|
11715
12204
|
|
|
11716
12205
|
// src/cmd/env-diff.ts
|
|
11717
|
-
import * as
|
|
11718
|
-
import { Command as
|
|
12206
|
+
import * as p17 from "@clack/prompts";
|
|
12207
|
+
import { Command as Command4 } from "@commander-js/extra-typings";
|
|
11719
12208
|
import fse5 from "fs-extra";
|
|
11720
|
-
import
|
|
11721
|
-
var envDiff = new
|
|
11722
|
-
async () =>
|
|
12209
|
+
import glob3 from "tiny-glob";
|
|
12210
|
+
var envDiff = new Command4().command("diff").description("Diff relative commands").action(
|
|
12211
|
+
async () => p17.select({
|
|
11723
12212
|
message: "Select a microservice:",
|
|
11724
12213
|
options: [...getAppDirList(), ...getPackagesDirList()].map(
|
|
11725
12214
|
(microService) => ({
|
|
@@ -11738,8 +12227,8 @@ var getEnvFromCode = async (microServiceName) => {
|
|
|
11738
12227
|
const isApp = apps.includes(microServiceName);
|
|
11739
12228
|
const appOrPackagePath = isApp ? `./apps/${microServiceName}` : `./packages/${microServiceName}`;
|
|
11740
12229
|
const fileList = [
|
|
11741
|
-
...await
|
|
11742
|
-
...await
|
|
12230
|
+
...await glob3(`${appOrPackagePath}/*.{ts,tsx,js,mjs,jsx}`),
|
|
12231
|
+
...await glob3(`${appOrPackagePath}/**/*.{ts,tsx,js,mjs,jsx}`)
|
|
11743
12232
|
];
|
|
11744
12233
|
for (const filePath of fileList) {
|
|
11745
12234
|
const code = fse5.readFileSync(filePath, "utf-8");
|
|
@@ -11762,7 +12251,7 @@ var getEnvFromCode = async (microServiceName) => {
|
|
|
11762
12251
|
};
|
|
11763
12252
|
var getEnvDiff = async (microServiceName) => {
|
|
11764
12253
|
if (!microServiceName) {
|
|
11765
|
-
microServiceName = await
|
|
12254
|
+
microServiceName = await p17.select({
|
|
11766
12255
|
message: "Select a microservice:",
|
|
11767
12256
|
options: [...getAppDirList(), ...getPackagesDirList()].map(
|
|
11768
12257
|
(microService) => ({
|
|
@@ -11773,7 +12262,7 @@ var getEnvDiff = async (microServiceName) => {
|
|
|
11773
12262
|
});
|
|
11774
12263
|
}
|
|
11775
12264
|
const { envList: importedEnv } = await getSingleAppOrPackageEnvList(microServiceName);
|
|
11776
|
-
|
|
12265
|
+
p17.log.info(
|
|
11777
12266
|
`[ ${microServiceName} ] Imported env variables:
|
|
11778
12267
|
${importedEnv.join(
|
|
11779
12268
|
"\n"
|
|
@@ -11781,7 +12270,7 @@ ${importedEnv.join(
|
|
|
11781
12270
|
Total imported env var: ${importedEnv.length}`
|
|
11782
12271
|
);
|
|
11783
12272
|
const envUsed = await getEnvFromCode(microServiceName);
|
|
11784
|
-
|
|
12273
|
+
p17.log.info(
|
|
11785
12274
|
`[ ${microServiceName} ] Used env variables:
|
|
11786
12275
|
${envUsed.join(
|
|
11787
12276
|
"\n"
|
|
@@ -11790,45 +12279,45 @@ Total used env var: ${envUsed.length}`
|
|
|
11790
12279
|
);
|
|
11791
12280
|
const unusedEnvList = importedEnv.filter((env2) => !envUsed.includes(env2));
|
|
11792
12281
|
if (unusedEnvList.length > 0) {
|
|
11793
|
-
|
|
12282
|
+
p17.log.warning(
|
|
11794
12283
|
`[ ${microServiceName} ] \u2757\uFE0F Unused env variables in the app:
|
|
11795
12284
|
${unusedEnvList.join(
|
|
11796
12285
|
" \n"
|
|
11797
12286
|
)}`
|
|
11798
12287
|
);
|
|
11799
|
-
|
|
12288
|
+
p17.log.warning(`Total unused env var: ${unusedEnvList.length}`);
|
|
11800
12289
|
} else {
|
|
11801
|
-
|
|
12290
|
+
p17.log.success(`[ ${microServiceName} ] \u2705 No unused env variables found!`);
|
|
11802
12291
|
}
|
|
11803
12292
|
};
|
|
11804
12293
|
|
|
11805
12294
|
// src/cmd/env-pull.ts
|
|
11806
|
-
import * as
|
|
11807
|
-
import { Command as
|
|
11808
|
-
import
|
|
11809
|
-
var envPull = new
|
|
12295
|
+
import * as p18 from "@clack/prompts";
|
|
12296
|
+
import { Command as Command5 } from "@commander-js/extra-typings";
|
|
12297
|
+
import color3 from "picocolors";
|
|
12298
|
+
var envPull = new Command5().name("pull").description("Fetch environment variables from Google Cloud Secret Manager").action(getEnvPull);
|
|
11810
12299
|
async function getEnvPull() {
|
|
11811
|
-
|
|
11812
|
-
const
|
|
11813
|
-
|
|
12300
|
+
p18.intro(`${color3.bgCyan(color3.black(" Pragma CLI - Env "))}`);
|
|
12301
|
+
const spinner10 = p18.spinner();
|
|
12302
|
+
spinner10.start("\u{1F4C1} Check if you are in the root of a Pragma project.");
|
|
11814
12303
|
await checkRootProjectDirectory();
|
|
11815
|
-
|
|
11816
|
-
|
|
12304
|
+
spinner10.stop("\u2705 You are in the root of a Pragma project.");
|
|
12305
|
+
spinner10.start("\u{1F4E6} Check if you have gcloud installed.");
|
|
11817
12306
|
await checkGCloud();
|
|
11818
|
-
|
|
11819
|
-
|
|
12307
|
+
spinner10.stop("\u2705 You have gcloud installed.");
|
|
12308
|
+
spinner10.start("\u{1F510} Please authenticate with Google ...");
|
|
11820
12309
|
const email3 = await loginGoogle();
|
|
11821
|
-
|
|
11822
|
-
|
|
12310
|
+
spinner10.stop("\u2705 You are now authenticated with Google.");
|
|
12311
|
+
spinner10.start("\u{1F511} Fetching secrets from Google Cloud Secret Manager ...");
|
|
11823
12312
|
await fetchEnv(email3);
|
|
11824
|
-
|
|
11825
|
-
|
|
12313
|
+
spinner10.stop("\u2705 Secrets fetched from Google Cloud Secret Manager.");
|
|
12314
|
+
p18.outro("\u2705 Environment variables are ready to use!");
|
|
11826
12315
|
}
|
|
11827
12316
|
|
|
11828
12317
|
// src/cmd/env.ts
|
|
11829
|
-
var env = new
|
|
11830
|
-
|
|
11831
|
-
await
|
|
12318
|
+
var env = new Command6().name("env").description("Env relative commands").action(async () => {
|
|
12319
|
+
p19.intro(`${color4.bgCyan(color4.black(" Pragma CLI - Env "))}`);
|
|
12320
|
+
await p19.select({
|
|
11832
12321
|
message: "Select an action:",
|
|
11833
12322
|
options: [
|
|
11834
12323
|
{ label: "Pull", value: "pull", hint: "Pull env vars from google" },
|
|
@@ -11845,7 +12334,7 @@ var env = new Command5().name("env").description("Env relative commands").action
|
|
|
11845
12334
|
]
|
|
11846
12335
|
}).then(async (action) => {
|
|
11847
12336
|
const selectedAction = action;
|
|
11848
|
-
|
|
12337
|
+
p19.log.info(`You selected: ${selectedAction}`);
|
|
11849
12338
|
switch (selectedAction) {
|
|
11850
12339
|
case "pull":
|
|
11851
12340
|
await getEnvPull();
|
|
@@ -11862,14 +12351,14 @@ var env = new Command5().name("env").description("Env relative commands").action
|
|
|
11862
12351
|
env.addCommand(envApp).addCommand(envPull).addCommand(envDiff);
|
|
11863
12352
|
|
|
11864
12353
|
// src/cmd/gen.ts
|
|
11865
|
-
import { Command as
|
|
11866
|
-
import { $ as $
|
|
12354
|
+
import { Command as Command11 } from "@commander-js/extra-typings";
|
|
12355
|
+
import { $ as $23 } from "zx/core";
|
|
11867
12356
|
|
|
11868
12357
|
// src/cmd/generators/api.ts
|
|
11869
|
-
import { Command as
|
|
11870
|
-
import { $ as $
|
|
11871
|
-
var api = new
|
|
11872
|
-
$
|
|
12358
|
+
import { Command as Command7 } from "@commander-js/extra-typings";
|
|
12359
|
+
import { $ as $19 } from "zx/core";
|
|
12360
|
+
var api = new Command7().name("api").description("Generate a new API endpoint / module").action(async () => {
|
|
12361
|
+
$19.spawn(
|
|
11873
12362
|
// Run the generator then parse the output (untracked files and schema registers) with git status
|
|
11874
12363
|
`pnpx turbo gen api && git status --porcelain | awk '/(\\?\\?|M .*schemas.ts|M .*index.ts)/ {print $2}' | xargs pnpm prettier -w`,
|
|
11875
12364
|
{
|
|
@@ -11880,14 +12369,14 @@ var api = new Command6().name("api").description("Generate a new API endpoint /
|
|
|
11880
12369
|
});
|
|
11881
12370
|
|
|
11882
12371
|
// src/cmd/generators/ui.ts
|
|
11883
|
-
import { Command as
|
|
11884
|
-
import { $ as $
|
|
12372
|
+
import { Command as Command10 } from "@commander-js/extra-typings";
|
|
12373
|
+
import { $ as $22 } from "zx/core";
|
|
11885
12374
|
|
|
11886
12375
|
// src/cmd/generators/ui/component.ts
|
|
11887
|
-
import { Command as
|
|
11888
|
-
import { $ as $
|
|
11889
|
-
var component = new
|
|
11890
|
-
$
|
|
12376
|
+
import { Command as Command8 } from "@commander-js/extra-typings";
|
|
12377
|
+
import { $ as $20 } from "zx/core";
|
|
12378
|
+
var component = new Command8().name("component").description("Generate a new UI component").action(async () => {
|
|
12379
|
+
$20.spawn(
|
|
11891
12380
|
// Run the generator then parse the output (untracked files and schema registers) with git status
|
|
11892
12381
|
`pnpx turbo gen ui component && git status --porcelain | awk '{print $2}' | xargs pnpm prettier -w`,
|
|
11893
12382
|
{
|
|
@@ -11898,10 +12387,10 @@ var component = new Command7().name("component").description("Generate a new UI
|
|
|
11898
12387
|
});
|
|
11899
12388
|
|
|
11900
12389
|
// src/cmd/generators/ui/icon.ts
|
|
11901
|
-
import { Command as
|
|
11902
|
-
import { $ as $
|
|
11903
|
-
var icon = new
|
|
11904
|
-
$
|
|
12390
|
+
import { Command as Command9 } from "@commander-js/extra-typings";
|
|
12391
|
+
import { $ as $21 } from "zx/core";
|
|
12392
|
+
var icon = new Command9().name("icon").description("Generate a new UI icon").action(async () => {
|
|
12393
|
+
$21.spawn(
|
|
11905
12394
|
// Run the generator then parse the output (untracked files and schema registers) with git status
|
|
11906
12395
|
`pnpx turbo gen ui icon && git status --porcelain | awk '{print $2}' | xargs pnpm prettier -w`,
|
|
11907
12396
|
{
|
|
@@ -11912,104 +12401,104 @@ var icon = new Command8().name("icon").description("Generate a new UI icon").act
|
|
|
11912
12401
|
});
|
|
11913
12402
|
|
|
11914
12403
|
// src/cmd/generators/ui.ts
|
|
11915
|
-
$
|
|
11916
|
-
var ui = new
|
|
11917
|
-
$
|
|
12404
|
+
$22.shell = true;
|
|
12405
|
+
var ui = new Command10().name("ui").description("Generate a new UI component").action(() => {
|
|
12406
|
+
$22.spawn(`npx turbo gen ui`, { stdio: "inherit", shell: true });
|
|
11918
12407
|
});
|
|
11919
12408
|
ui.addCommand(component).addCommand(icon);
|
|
11920
12409
|
|
|
11921
12410
|
// src/cmd/gen.ts
|
|
11922
|
-
$
|
|
11923
|
-
var gen = new
|
|
11924
|
-
$
|
|
12411
|
+
$23.shell = true;
|
|
12412
|
+
var gen = new Command11().name("gen").alias("g").description("Generate a new component").action(() => {
|
|
12413
|
+
$23.spawn(`npx turbo gen`, { stdio: "inherit", shell: true });
|
|
11925
12414
|
});
|
|
11926
12415
|
gen.addCommand(ui).addCommand(api);
|
|
11927
12416
|
|
|
11928
12417
|
// src/cmd/init.ts
|
|
11929
|
-
import * as
|
|
11930
|
-
import { Command as
|
|
11931
|
-
import
|
|
12418
|
+
import * as p20 from "@clack/prompts";
|
|
12419
|
+
import { Command as Command12 } from "@commander-js/extra-typings";
|
|
12420
|
+
import color5 from "picocolors";
|
|
11932
12421
|
import { cd, sleep as sleep3 } from "zx";
|
|
11933
|
-
var init = new
|
|
12422
|
+
var init = new Command12().name("init").alias("i").description(
|
|
11934
12423
|
"Create a new Pragma project: clone repo, install deps, fetch secrets and database setup"
|
|
11935
12424
|
).action(async () => {
|
|
11936
12425
|
console.clear();
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
12426
|
+
p20.intro(`${color5.bgCyan(color5.black(" Pragma CLI - Setup "))}`);
|
|
12427
|
+
p20.log.step("Welcome on the Pragma setup wizard! \u{1F389}");
|
|
12428
|
+
p20.log.step("I'll help you setup your local development environment");
|
|
12429
|
+
p20.log.step("First, I will check that you've got all the requirements");
|
|
11941
12430
|
await checkGitHubAccess().catch((err) => {
|
|
11942
|
-
|
|
12431
|
+
p20.log.error(err);
|
|
11943
12432
|
process.exit(1);
|
|
11944
12433
|
});
|
|
11945
|
-
await
|
|
11946
|
-
|
|
12434
|
+
await checkNode24().catch((err) => {
|
|
12435
|
+
p20.log.error(err);
|
|
11947
12436
|
process.exit(1);
|
|
11948
12437
|
});
|
|
11949
12438
|
await checkPnpm().catch((err) => {
|
|
11950
|
-
|
|
12439
|
+
p20.log.error(err);
|
|
11951
12440
|
process.exit(1);
|
|
11952
12441
|
});
|
|
11953
12442
|
await checkDocker().catch((err) => {
|
|
11954
|
-
|
|
12443
|
+
p20.log.error(err);
|
|
11955
12444
|
process.exit(1);
|
|
11956
12445
|
});
|
|
11957
12446
|
await checkGCloud().catch((err) => {
|
|
11958
|
-
|
|
12447
|
+
p20.log.error(err);
|
|
11959
12448
|
process.exit(1);
|
|
11960
12449
|
});
|
|
11961
|
-
const init2 = await
|
|
12450
|
+
const init2 = await p20.group(
|
|
11962
12451
|
{
|
|
11963
|
-
name: () =>
|
|
12452
|
+
name: () => p20.text({
|
|
11964
12453
|
message: "Where should I install the project?",
|
|
11965
12454
|
defaultValue: "pragma-project",
|
|
11966
12455
|
placeholder: "pragma-project"
|
|
11967
12456
|
}),
|
|
11968
|
-
install: () =>
|
|
12457
|
+
install: () => p20.confirm({
|
|
11969
12458
|
message: "Should I install the dependencies?",
|
|
11970
12459
|
initialValue: true
|
|
11971
12460
|
})
|
|
11972
12461
|
},
|
|
11973
12462
|
{
|
|
11974
12463
|
onCancel: () => {
|
|
11975
|
-
|
|
12464
|
+
p20.cancel("Initialization step was canceled");
|
|
11976
12465
|
process.exit(0);
|
|
11977
12466
|
}
|
|
11978
12467
|
}
|
|
11979
12468
|
);
|
|
11980
|
-
const s =
|
|
12469
|
+
const s = p20.spinner();
|
|
11981
12470
|
if (init2.name) {
|
|
11982
12471
|
const dirExist = await dirAlreadyExist(init2.name);
|
|
11983
12472
|
if (dirExist) {
|
|
11984
|
-
|
|
12473
|
+
p20.log.warn(`Directory ${init2.name} already exist.`);
|
|
11985
12474
|
process.exit(0);
|
|
11986
12475
|
}
|
|
11987
|
-
|
|
12476
|
+
p20.log.step(`\u2728 Cloning Pragma repository in ${init2.name}...`);
|
|
11988
12477
|
await cloneProject(init2.name).catch((err) => {
|
|
11989
|
-
|
|
12478
|
+
p20.log.error(err);
|
|
11990
12479
|
process.exit(1);
|
|
11991
12480
|
});
|
|
11992
|
-
|
|
12481
|
+
p20.log.info(`\u2728 Pragma repository was successfully cloned in ${init2.name}`);
|
|
11993
12482
|
}
|
|
11994
12483
|
cd(init2.name);
|
|
11995
12484
|
if (init2.install) {
|
|
11996
12485
|
s.start("\u{1F4E6} Trying to install all dependencies using pnpm...");
|
|
11997
12486
|
await installDeps().catch((err) => {
|
|
11998
|
-
|
|
12487
|
+
p20.log.error(err);
|
|
11999
12488
|
process.exit(1);
|
|
12000
12489
|
});
|
|
12001
12490
|
s.stop("\u{1F4E6} All dependencies were successfully installed!");
|
|
12002
12491
|
}
|
|
12003
|
-
const env2 = await
|
|
12492
|
+
const env2 = await p20.group(
|
|
12004
12493
|
{
|
|
12005
|
-
fetch: () =>
|
|
12494
|
+
fetch: () => p20.confirm({
|
|
12006
12495
|
message: "Should I fetch secrets dev environment?",
|
|
12007
12496
|
initialValue: true
|
|
12008
12497
|
})
|
|
12009
12498
|
},
|
|
12010
12499
|
{
|
|
12011
12500
|
onCancel: () => {
|
|
12012
|
-
|
|
12501
|
+
p20.cancel("Secrets fetching was canceled");
|
|
12013
12502
|
process.exit(0);
|
|
12014
12503
|
}
|
|
12015
12504
|
}
|
|
@@ -12017,26 +12506,26 @@ var init = new Command11().name("init").alias("i").description(
|
|
|
12017
12506
|
if (env2.fetch) {
|
|
12018
12507
|
s.start("\u{1F511} Please authenticate with Google");
|
|
12019
12508
|
const email3 = await loginGoogle().catch((err) => {
|
|
12020
|
-
|
|
12509
|
+
p20.log.error(err);
|
|
12021
12510
|
process.exit(1);
|
|
12022
12511
|
});
|
|
12023
|
-
|
|
12512
|
+
p20.log.step("\u{1F512} Getting these secrets right now!");
|
|
12024
12513
|
await fetchEnv(email3).catch((err) => {
|
|
12025
|
-
|
|
12514
|
+
p20.log.error(err);
|
|
12026
12515
|
process.exit(1);
|
|
12027
12516
|
});
|
|
12028
12517
|
s.stop(`\u{1F512} Environment variables are all set for your local environment!`);
|
|
12029
12518
|
}
|
|
12030
|
-
const db = await
|
|
12519
|
+
const db = await p20.group(
|
|
12031
12520
|
{
|
|
12032
|
-
database: () =>
|
|
12521
|
+
database: () => p20.confirm({
|
|
12033
12522
|
message: "Should I start, migrate and seed the database?",
|
|
12034
12523
|
initialValue: true
|
|
12035
12524
|
})
|
|
12036
12525
|
},
|
|
12037
12526
|
{
|
|
12038
12527
|
onCancel: () => {
|
|
12039
|
-
|
|
12528
|
+
p20.cancel("Database setup step was canceled");
|
|
12040
12529
|
process.exit(0);
|
|
12041
12530
|
}
|
|
12042
12531
|
}
|
|
@@ -12044,26 +12533,26 @@ var init = new Command11().name("init").alias("i").description(
|
|
|
12044
12533
|
if (db.database) {
|
|
12045
12534
|
s.start("\u{1F433} Starting database");
|
|
12046
12535
|
await startDB().catch((err) => {
|
|
12047
|
-
|
|
12536
|
+
p20.log.error(err);
|
|
12048
12537
|
process.exit(0);
|
|
12049
12538
|
});
|
|
12050
12539
|
s.stop("\u{1F433} Successfully started database");
|
|
12051
12540
|
s.start("\u{1F552} Waiting for database initialization...");
|
|
12052
12541
|
await waitForDB().catch((err) => {
|
|
12053
|
-
|
|
12542
|
+
p20.log.error(err);
|
|
12054
12543
|
process.exit(1);
|
|
12055
12544
|
});
|
|
12056
12545
|
await sleep3(5e3);
|
|
12057
12546
|
s.stop("\u2728 The database is up and running!");
|
|
12058
12547
|
s.start("\u{1F5C4}\uFE0F Applying database schema");
|
|
12059
12548
|
await pushDBSchema().catch((err) => {
|
|
12060
|
-
|
|
12549
|
+
p20.log.error(err);
|
|
12061
12550
|
process.exit(1);
|
|
12062
12551
|
});
|
|
12063
12552
|
s.stop("\u{1F5C4}\uFE0F Successfully pushed the database schema");
|
|
12064
12553
|
s.start("\u{1F331} Seeding the database");
|
|
12065
12554
|
await seedDB().catch((err) => {
|
|
12066
|
-
|
|
12555
|
+
p20.log.error(err);
|
|
12067
12556
|
process.exit(1);
|
|
12068
12557
|
});
|
|
12069
12558
|
s.stop(`\u{1F331} We added some data to your database! You're ready to go!`);
|
|
@@ -12072,8 +12561,8 @@ var init = new Command11().name("init").alias("i").description(
|
|
|
12072
12561
|
${init2.install ? "" : "pnpm\n"}
|
|
12073
12562
|
${db.database ? "" : "pnpm db:start && pnpm db:migrate && db:seed\n"}${env2.fetch ? "" : "cp .env.example > .env # You need to manually add some env vars\n"}pnpm dev
|
|
12074
12563
|
`;
|
|
12075
|
-
|
|
12076
|
-
|
|
12564
|
+
p20.note(nextSteps, `Discover Pragma \u{1F50D}`);
|
|
12565
|
+
p20.note(
|
|
12077
12566
|
`Check out Linear : https://linear.app/pragmapos/team/WEB
|
|
12078
12567
|
- Issues with label "good-first-issue" -> for newcomers \u{1F920}
|
|
12079
12568
|
- CONTRIBUTING.md contains all infos to send your first PR!
|
|
@@ -12081,241 +12570,81 @@ ${init2.install ? "" : "pnpm\n"}
|
|
|
12081
12570
|
Happy hacking!`,
|
|
12082
12571
|
"What next? \u{1F525}"
|
|
12083
12572
|
);
|
|
12084
|
-
|
|
12085
|
-
`Problems? ${
|
|
12086
|
-
|
|
12573
|
+
p20.outro(
|
|
12574
|
+
`Problems? ${color5.underline(
|
|
12575
|
+
color5.cyan("https://linear.new/team/web/new?labels=cli")
|
|
12087
12576
|
)}`
|
|
12088
12577
|
);
|
|
12089
12578
|
});
|
|
12090
12579
|
|
|
12091
12580
|
// src/cmd/list.ts
|
|
12092
|
-
import * as
|
|
12093
|
-
import { Command as
|
|
12094
|
-
import
|
|
12581
|
+
import * as p22 from "@clack/prompts";
|
|
12582
|
+
import { Command as Command13 } from "@commander-js/extra-typings";
|
|
12583
|
+
import color7 from "picocolors";
|
|
12095
12584
|
|
|
12096
12585
|
// src/template.ts
|
|
12097
|
-
import * as
|
|
12098
|
-
import
|
|
12586
|
+
import * as p21 from "@clack/prompts";
|
|
12587
|
+
import color6 from "picocolors";
|
|
12099
12588
|
var MARGIN = ` `;
|
|
12100
12589
|
function printAppsList(apps) {
|
|
12101
|
-
const appRow = ({ name, url: url2, description, path: path2 }) => `${
|
|
12102
|
-
|
|
12590
|
+
const appRow = ({ name, url: url2, description, path: path2 }) => `${color6.bold(
|
|
12591
|
+
color6.green(name)
|
|
12103
12592
|
)}
|
|
12104
12593
|
${MARGIN}${description}
|
|
12105
|
-
${MARGIN}${
|
|
12106
|
-
|
|
12107
|
-
)} - ${
|
|
12108
|
-
return
|
|
12594
|
+
${MARGIN}${color6.underline(
|
|
12595
|
+
color6.blue(url2)
|
|
12596
|
+
)} - ${color6.italic(color6.blue(path2))}`;
|
|
12597
|
+
return p21.log.message(`${apps.map(appRow).join("\n")}`);
|
|
12109
12598
|
}
|
|
12110
12599
|
|
|
12111
12600
|
// src/cmd/list.ts
|
|
12112
|
-
var cmdList = new
|
|
12601
|
+
var cmdList = new Command13().name("list").description(
|
|
12113
12602
|
"List all available application url served when the development server is running"
|
|
12114
12603
|
).alias("ls").alias("l").alias("ll").action(() => {
|
|
12115
12604
|
console.clear();
|
|
12116
|
-
const apiList =
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
{
|
|
12124
|
-
name: "Sync API",
|
|
12125
|
-
url: "http://localhost:4001",
|
|
12126
|
-
description: "Manages POS configuration synchronization",
|
|
12127
|
-
path: "apps/api-sync"
|
|
12128
|
-
},
|
|
12129
|
-
/*{
|
|
12130
|
-
name: 'Till API',
|
|
12131
|
-
url: 'http://localhost:4002',
|
|
12132
|
-
description: '',
|
|
12133
|
-
path: 'apps/api-till',
|
|
12134
|
-
},*/
|
|
12135
|
-
{
|
|
12136
|
-
name: "Order Live API",
|
|
12137
|
-
url: "http://localhost:4003",
|
|
12138
|
-
description: "Receives and processes live orders from POS systems",
|
|
12139
|
-
path: "apps/api-order"
|
|
12140
|
-
},
|
|
12141
|
-
{
|
|
12142
|
-
name: "POS API",
|
|
12143
|
-
url: "http://localhost:4004",
|
|
12144
|
-
description: "Processes requests from POS devices",
|
|
12145
|
-
path: "apps/api-pos"
|
|
12146
|
-
},
|
|
12147
|
-
{
|
|
12148
|
-
name: "WebSocket",
|
|
12149
|
-
url: "http://localhost:4005",
|
|
12150
|
-
description: "WebSocket server for real-time communication",
|
|
12151
|
-
path: "apps/ws"
|
|
12152
|
-
},
|
|
12153
|
-
{
|
|
12154
|
-
name: "Payment API",
|
|
12155
|
-
url: "http://localhost:4006",
|
|
12156
|
-
description: "Manages payment transactions",
|
|
12157
|
-
path: "apps/api-payment"
|
|
12158
|
-
},
|
|
12159
|
-
{
|
|
12160
|
-
name: "Webhook API",
|
|
12161
|
-
url: "http://localhost:4007",
|
|
12162
|
-
description: "Manages and sends webhooks to external services",
|
|
12163
|
-
path: "apps/api-webhook"
|
|
12164
|
-
},
|
|
12165
|
-
{
|
|
12166
|
-
name: "Booking API",
|
|
12167
|
-
url: "http://localhost:4008",
|
|
12168
|
-
description: "Manages bookings.",
|
|
12169
|
-
path: "apps/api-booking"
|
|
12170
|
-
},
|
|
12171
|
-
{
|
|
12172
|
-
name: "Dataflow API",
|
|
12173
|
-
url: "http://localhost:4009",
|
|
12174
|
-
description: "Retrieve, transform, and send data",
|
|
12175
|
-
path: "apps/api-dataflow"
|
|
12176
|
-
},
|
|
12177
|
-
{
|
|
12178
|
-
name: "Loyalty API",
|
|
12179
|
-
url: "http://localhost:4010",
|
|
12180
|
-
description: "Third-parties loyalty POS integration",
|
|
12181
|
-
path: "apps/api-loyalty"
|
|
12182
|
-
},
|
|
12183
|
-
{
|
|
12184
|
-
name: "Customer API",
|
|
12185
|
-
url: "http://localhost:4012",
|
|
12186
|
-
description: "Manages customers",
|
|
12187
|
-
path: "apps/api-customer"
|
|
12188
|
-
}
|
|
12189
|
-
];
|
|
12190
|
-
const appsList = [
|
|
12191
|
-
{
|
|
12192
|
-
name: "Admin",
|
|
12193
|
-
url: "http://localhost:3000",
|
|
12194
|
-
description: "Manage, monitor and configure Pragma API!",
|
|
12195
|
-
path: "apps/admin"
|
|
12196
|
-
},
|
|
12197
|
-
{
|
|
12198
|
-
name: "Generic",
|
|
12199
|
-
url: "http://localhost:3002",
|
|
12200
|
-
description: "A showcase for our Frontend features",
|
|
12201
|
-
path: "apps/generic"
|
|
12202
|
-
},
|
|
12203
|
-
{
|
|
12204
|
-
name: "Auth POS",
|
|
12205
|
-
url: "http://localhost:3003",
|
|
12206
|
-
description: "Authenticates POS devices for API access",
|
|
12207
|
-
path: "apps/auth-pos"
|
|
12208
|
-
},
|
|
12209
|
-
{
|
|
12210
|
-
name: "Backoffice",
|
|
12211
|
-
url: "http://localhost:3005",
|
|
12212
|
-
description: "Backoffice is a frontend service that enables customers to efficiently manage their stores through a cloud-based web application.",
|
|
12213
|
-
path: "apps/backoffice"
|
|
12214
|
-
},
|
|
12215
|
-
{
|
|
12216
|
-
name: "Auth Proxy",
|
|
12217
|
-
url: "http://localhost:3007",
|
|
12218
|
-
description: "Manages OAuth provider authentication callbacks",
|
|
12219
|
-
path: "apps/auth-proxy"
|
|
12220
|
-
},
|
|
12221
|
-
{
|
|
12222
|
-
name: "Table Payment",
|
|
12223
|
-
url: "http://localhost:3008",
|
|
12224
|
-
description: "Web app to pay a table order in a restaurant from a QR Code",
|
|
12225
|
-
path: "apps/table-payment"
|
|
12226
|
-
},
|
|
12227
|
-
{
|
|
12228
|
-
name: "Accounting",
|
|
12229
|
-
url: "http://localhost:80",
|
|
12230
|
-
description: "Quickly setup an accounting configuration",
|
|
12231
|
-
path: "apps/accounting"
|
|
12232
|
-
}
|
|
12233
|
-
];
|
|
12234
|
-
const docList = [
|
|
12235
|
-
{
|
|
12236
|
-
name: "Public Docs",
|
|
12237
|
-
url: "http://localhost:3001",
|
|
12238
|
-
description: "Public documentation for Pragma API",
|
|
12239
|
-
path: "apps/docs"
|
|
12240
|
-
},
|
|
12241
|
-
{
|
|
12242
|
-
name: "Internal Docs",
|
|
12243
|
-
url: "http://localhost:3006",
|
|
12244
|
-
description: "Internal documentation for Pragma API",
|
|
12245
|
-
path: "apps/admin"
|
|
12246
|
-
},
|
|
12247
|
-
{
|
|
12248
|
-
name: "Workshop",
|
|
12249
|
-
url: "http://localhost:6006",
|
|
12250
|
-
description: "Design System and Components library",
|
|
12251
|
-
path: "apps/workshop"
|
|
12252
|
-
},
|
|
12253
|
-
{
|
|
12254
|
-
name: "Knowledge Documentation",
|
|
12255
|
-
url: "http://localhost:3009",
|
|
12256
|
-
description: "Knowledge documentation for Pragma API",
|
|
12257
|
-
path: "apps/knowledge"
|
|
12258
|
-
}
|
|
12259
|
-
];
|
|
12260
|
-
const databaseList = [
|
|
12261
|
-
{
|
|
12262
|
-
name: "Prisma Studio",
|
|
12263
|
-
url: "http://localhost:5555",
|
|
12264
|
-
description: "Easily explore and manipulate the database",
|
|
12265
|
-
path: "packages/database"
|
|
12266
|
-
},
|
|
12267
|
-
{
|
|
12268
|
-
name: "CockroachDB",
|
|
12269
|
-
url: "http://localhost:8080",
|
|
12270
|
-
description: "Web Admin for monitoring CockroachDB",
|
|
12271
|
-
path: "docker-compose.yml"
|
|
12272
|
-
},
|
|
12273
|
-
{
|
|
12274
|
-
name: "Redis Commander",
|
|
12275
|
-
url: "http://localhost:8081",
|
|
12276
|
-
description: "Web Admin to explore Redis",
|
|
12277
|
-
path: "docker-compose.yml"
|
|
12278
|
-
}
|
|
12279
|
-
];
|
|
12280
|
-
p21.intro(`${color6.bgCyan(color6.black(` Pragma CLI - list `))}`);
|
|
12281
|
-
p21.log.message(`
|
|
12282
|
-
${color6.bold("API Services:")}`);
|
|
12605
|
+
const apiList = getAPIServices();
|
|
12606
|
+
const appsList = getAppServices();
|
|
12607
|
+
const docList = getDocServices();
|
|
12608
|
+
const databaseList = getDatabaseTools();
|
|
12609
|
+
p22.intro(`${color7.bgCyan(color7.black(` Pragma CLI - list `))}`);
|
|
12610
|
+
p22.log.message(`
|
|
12611
|
+
${color7.bold("API Services:")}`);
|
|
12283
12612
|
printAppsList(apiList);
|
|
12284
|
-
|
|
12285
|
-
${
|
|
12613
|
+
p22.log.message(`
|
|
12614
|
+
${color7.bold("Web Applications:")}`);
|
|
12286
12615
|
printAppsList(appsList);
|
|
12287
|
-
|
|
12288
|
-
${
|
|
12616
|
+
p22.log.message(`
|
|
12617
|
+
${color7.bold("Documentations:")}`);
|
|
12289
12618
|
printAppsList(docList);
|
|
12290
|
-
|
|
12291
|
-
${
|
|
12619
|
+
p22.log.message(`
|
|
12620
|
+
${color7.bold("Database tools:")}`);
|
|
12292
12621
|
printAppsList(databaseList);
|
|
12293
|
-
|
|
12294
|
-
`Problems? ${
|
|
12295
|
-
|
|
12622
|
+
p22.outro(
|
|
12623
|
+
`Problems? ${color7.underline(
|
|
12624
|
+
color7.cyan("https://linear.new/team/web/new?labels=cli")
|
|
12296
12625
|
)}`
|
|
12297
12626
|
);
|
|
12298
12627
|
});
|
|
12299
12628
|
|
|
12300
12629
|
// src/cmd/restore.ts
|
|
12301
|
-
import * as
|
|
12302
|
-
import { Argument, Command as
|
|
12630
|
+
import * as p25 from "@clack/prompts";
|
|
12631
|
+
import { Argument, Command as Command14, Option } from "@commander-js/extra-typings";
|
|
12303
12632
|
import fse8 from "fs-extra";
|
|
12304
|
-
import
|
|
12305
|
-
import { $ as $
|
|
12633
|
+
import color8 from "picocolors";
|
|
12634
|
+
import { $ as $26 } from "zx/core";
|
|
12306
12635
|
|
|
12307
12636
|
// src/cmd/restore-local.ts
|
|
12308
|
-
import * as
|
|
12637
|
+
import * as p23 from "@clack/prompts";
|
|
12309
12638
|
import fse6 from "fs-extra";
|
|
12310
|
-
import { $ as $
|
|
12311
|
-
var
|
|
12639
|
+
import { $ as $24 } from "zx/core";
|
|
12640
|
+
var spinner6 = p23.spinner();
|
|
12312
12641
|
async function restoreLocal() {
|
|
12313
12642
|
const backupDir = "./docker/database/backups";
|
|
12314
12643
|
const backups = await fse6.readdir(backupDir);
|
|
12315
12644
|
const tarGzBackups = backups.filter((b) => b.endsWith(".tar.gz"));
|
|
12316
12645
|
if (tarGzBackups.length === 0) {
|
|
12317
|
-
|
|
12318
|
-
|
|
12646
|
+
p23.log.warn("No backup files found to restore.");
|
|
12647
|
+
p23.log.warn(
|
|
12319
12648
|
`Database backup files should be placed in the '${backupDir}' folder.`
|
|
12320
12649
|
);
|
|
12321
12650
|
process.exit(0);
|
|
@@ -12332,9 +12661,9 @@ async function restoreLocal() {
|
|
|
12332
12661
|
};
|
|
12333
12662
|
})
|
|
12334
12663
|
);
|
|
12335
|
-
const userChoices = await
|
|
12664
|
+
const userChoices = await p23.group(
|
|
12336
12665
|
{
|
|
12337
|
-
selectedBackup: () =>
|
|
12666
|
+
selectedBackup: () => p23.select({
|
|
12338
12667
|
message: "Select a backup to restore:",
|
|
12339
12668
|
options: backupDetails,
|
|
12340
12669
|
initialValue: backupDetails[0]?.value
|
|
@@ -12342,60 +12671,60 @@ async function restoreLocal() {
|
|
|
12342
12671
|
},
|
|
12343
12672
|
{
|
|
12344
12673
|
onCancel: () => {
|
|
12345
|
-
|
|
12674
|
+
p23.cancel("Restore process was canceled.");
|
|
12346
12675
|
process.exit(0);
|
|
12347
12676
|
}
|
|
12348
12677
|
}
|
|
12349
12678
|
);
|
|
12350
12679
|
const startTime = Date.now();
|
|
12351
12680
|
const branchName = await getGitBranch();
|
|
12352
|
-
|
|
12353
|
-
await $
|
|
12681
|
+
spinner6.start(`\u{1F504} Restoring database from ${userChoices.selectedBackup}`);
|
|
12682
|
+
await $24`docker stop pragma-project-cockroach-dev`;
|
|
12354
12683
|
await fse6.rm("./cockroach-data", { recursive: true, force: true });
|
|
12355
12684
|
await fse6.mkdir("./cockroach-data", { recursive: true });
|
|
12356
|
-
await $
|
|
12357
|
-
await $
|
|
12685
|
+
await $24`tar -xzf ${backupDir}/${userChoices.selectedBackup} -C ./cockroach-data`;
|
|
12686
|
+
await $24`docker start pragma-project-cockroach-dev`;
|
|
12358
12687
|
const endTime = Date.now();
|
|
12359
12688
|
const elapsedTime = ((endTime - startTime) / 1e3).toFixed(2);
|
|
12360
12689
|
const restoreStats = await fse6.stat(
|
|
12361
12690
|
`${backupDir}/${userChoices.selectedBackup}`
|
|
12362
12691
|
);
|
|
12363
12692
|
const restoreSize = (restoreStats.size / 1024 / 1024).toFixed(2);
|
|
12364
|
-
|
|
12693
|
+
spinner6.stop(
|
|
12365
12694
|
`\u{1F331} Database restored successfully from ${userChoices.selectedBackup}`
|
|
12366
12695
|
);
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12696
|
+
p23.log.info(`Elapsed time: ${elapsedTime} seconds`);
|
|
12697
|
+
p23.log.info(`Restore date: ${formatDate(/* @__PURE__ */ new Date())}`);
|
|
12698
|
+
p23.log.info(`Restored DB size: ${restoreSize} MB`);
|
|
12699
|
+
p23.log.info(`Branch name: ${branchName}`);
|
|
12371
12700
|
}
|
|
12372
12701
|
|
|
12373
12702
|
// src/cmd/restore-remote.ts
|
|
12374
|
-
import * as
|
|
12703
|
+
import * as p24 from "@clack/prompts";
|
|
12375
12704
|
import fse7 from "fs-extra";
|
|
12376
|
-
import { $ as $
|
|
12705
|
+
import { $ as $25 } from "zx/core";
|
|
12377
12706
|
var STAGING_BACKUP_BUCKET = "staging";
|
|
12378
|
-
var
|
|
12707
|
+
var spinner8 = p24.spinner();
|
|
12379
12708
|
async function restoreRemote() {
|
|
12380
12709
|
await checkCockroach();
|
|
12381
12710
|
await checkGCloud();
|
|
12382
|
-
const keyFilePath = await $
|
|
12711
|
+
const keyFilePath = await $25`gcloud auth application-default login 2>&1`.then((res) => {
|
|
12383
12712
|
if (res.exitCode !== 0) {
|
|
12384
|
-
|
|
12713
|
+
p24.cancel(`\u274C Couldn't authenticate with gcloud, ${res.stdout}`);
|
|
12385
12714
|
process.exit(0);
|
|
12386
12715
|
}
|
|
12387
|
-
|
|
12716
|
+
p24.log.success(`\u{1F513} Successfully authenticated with gcloud.`);
|
|
12388
12717
|
const parsedFilePath = external_exports.string().min(1).safeParse(res.stdout.match(/\[(?<filepath>.*)\]/)?.groups?.filepath);
|
|
12389
12718
|
if (parsedFilePath.success) {
|
|
12390
12719
|
return parsedFilePath.data;
|
|
12391
12720
|
} else {
|
|
12392
|
-
|
|
12721
|
+
p24.cancel(
|
|
12393
12722
|
`\u274C Couldn't find the key's file path from the gcloud response, err: ${parsedFilePath.error}`
|
|
12394
12723
|
);
|
|
12395
12724
|
process.exit(0);
|
|
12396
12725
|
}
|
|
12397
12726
|
});
|
|
12398
|
-
|
|
12727
|
+
p24.log.success(`\u2705 Successfully parsed the backup file path: ${keyFilePath}`);
|
|
12399
12728
|
const base64Key = await fse7.readJson(keyFilePath, "utf-8").then((keyJson) => {
|
|
12400
12729
|
const parsedKey = external_exports.object({
|
|
12401
12730
|
account: external_exports.string(),
|
|
@@ -12407,7 +12736,7 @@ async function restoreRemote() {
|
|
|
12407
12736
|
universe_domain: external_exports.string()
|
|
12408
12737
|
}).safeParse(keyJson);
|
|
12409
12738
|
if (!parsedKey.success) {
|
|
12410
|
-
|
|
12739
|
+
p24.log.error(
|
|
12411
12740
|
`\u274C Couldn't parse the key file: ${keyFilePath}: ${parsedKey.error}`
|
|
12412
12741
|
);
|
|
12413
12742
|
process.exit(0);
|
|
@@ -12415,36 +12744,36 @@ async function restoreRemote() {
|
|
|
12415
12744
|
return btoa(JSON.stringify(parsedKey.data));
|
|
12416
12745
|
}
|
|
12417
12746
|
}).catch((err) => {
|
|
12418
|
-
|
|
12747
|
+
p24.log.error(`\u274C Couldn't read the key file: ${keyFilePath}: ${err}`);
|
|
12419
12748
|
process.exit(0);
|
|
12420
12749
|
});
|
|
12421
|
-
|
|
12422
|
-
|
|
12750
|
+
p24.log.success(`\u2705 Successfully parsed the key file.`);
|
|
12751
|
+
spinner8.start(
|
|
12423
12752
|
"\u{1F504} Restoring database from latest staging backup in GCP bucket."
|
|
12424
12753
|
);
|
|
12425
|
-
|
|
12426
|
-
await $
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
const restoreFeedBack = await $
|
|
12754
|
+
spinner8.message(`\u{1F52B} Dropping the current "dev" database`);
|
|
12755
|
+
await $25`cockroach sql --url="postgresql://root@127.0.0.1:26257?sslmode=disable" -e "DROP DATABASE IF EXISTS dev;"`;
|
|
12756
|
+
p24.log.success(`\u2705 Successfully reset the current database.`);
|
|
12757
|
+
spinner8.message(`\u{1F6B0} Restoring`);
|
|
12758
|
+
const restoreFeedBack = await $25`cockroach sql --url="postgresql://root@localhost:26257?sslmode=disable" -e "RESTORE DATABASE \\"pragma\-api\\" FROM LATEST IN 'gs://pragma-cockroach-backup/${STAGING_BACKUP_BUCKET}?AUTH=specified&CREDENTIALS=${base64Key}' WITH new_db_name = 'dev';"`.then((res) => {
|
|
12430
12759
|
if (res.stderr) {
|
|
12431
|
-
|
|
12432
|
-
|
|
12760
|
+
spinner8.stop("\u274C Failed to restore the database.");
|
|
12761
|
+
p24.log.error(`\u274C Couldn't restore the database: ${res.stderr}`);
|
|
12433
12762
|
process.exit(0);
|
|
12434
12763
|
}
|
|
12435
12764
|
return res.stdout;
|
|
12436
12765
|
}).catch((err) => {
|
|
12437
|
-
|
|
12438
|
-
|
|
12766
|
+
spinner8.stop("\u274C Failed to restore the database.");
|
|
12767
|
+
p24.log.error(`\u274C Couldn't restore the database: ${err}`);
|
|
12439
12768
|
process.exit(0);
|
|
12440
12769
|
});
|
|
12441
|
-
|
|
12442
|
-
|
|
12770
|
+
spinner8.stop("\u{1F331} Database restored successfully from GCP Bucket.");
|
|
12771
|
+
p24.log.success(String(restoreFeedBack));
|
|
12443
12772
|
}
|
|
12444
12773
|
|
|
12445
12774
|
// src/cmd/restore.ts
|
|
12446
12775
|
var sourceSchema = external_exports.union([external_exports.literal("local"), external_exports.literal("remote")]);
|
|
12447
|
-
var restore = new
|
|
12776
|
+
var restore = new Command14().name("restore").description("Restore the database from a backup file").addOption(
|
|
12448
12777
|
new Option(
|
|
12449
12778
|
"--skip-archive",
|
|
12450
12779
|
"Skip the archiving of the the current database before restoring"
|
|
@@ -12453,37 +12782,37 @@ var restore = new Command13().name("restore").description("Restore the database
|
|
|
12453
12782
|
new Argument("[source]", "Source to restore the DB from").choices(["local", "remote"]).argParser((source) => sourceSchema.optional().parse(source))
|
|
12454
12783
|
).action(async (source, option) => {
|
|
12455
12784
|
console.clear();
|
|
12456
|
-
|
|
12457
|
-
|
|
12785
|
+
p25.intro(`${color8.bgCyan(color8.black(" Pragma CLI - DB Restore "))}`);
|
|
12786
|
+
p25.log.step("Restoring database from backup...");
|
|
12458
12787
|
await checkDocker();
|
|
12459
12788
|
if (!await isContainerUp("pragma-project-cockroach-dev")) {
|
|
12460
|
-
|
|
12789
|
+
p25.log.error(
|
|
12461
12790
|
"Cockroach container is not running. Please start it and try again."
|
|
12462
12791
|
);
|
|
12463
12792
|
process.exit(1);
|
|
12464
12793
|
}
|
|
12465
|
-
const
|
|
12794
|
+
const spinner10 = p25.spinner();
|
|
12466
12795
|
if (option.skipArchive) {
|
|
12467
|
-
|
|
12796
|
+
p25.log.info("Skipping archiving of the current database");
|
|
12468
12797
|
} else {
|
|
12469
|
-
await
|
|
12798
|
+
await p25.confirm({
|
|
12470
12799
|
message: "\u{1F4BE} Do you want to archive the current database before restoring?",
|
|
12471
12800
|
initialValue: true
|
|
12472
12801
|
}).then(async (archive) => {
|
|
12473
12802
|
if (String(archive) === "Symbol(clack:cancel)") {
|
|
12474
|
-
|
|
12803
|
+
p25.log.info("Cancelled... \u{1F44B}.");
|
|
12475
12804
|
process.exit(0);
|
|
12476
12805
|
}
|
|
12477
12806
|
if (archive === false) {
|
|
12478
|
-
|
|
12807
|
+
p25.log.info("Current database will not be archived");
|
|
12479
12808
|
} else {
|
|
12480
|
-
|
|
12809
|
+
spinner10.start(`\u{1F4E6} Archiving current database...`);
|
|
12481
12810
|
const timestamp = getTimestamp();
|
|
12482
12811
|
const archiveDir = "./docker/database/archives";
|
|
12483
12812
|
await fse8.mkdir(archiveDir, { recursive: true });
|
|
12484
12813
|
const archiveFilePath = `${archiveDir}/backup-${timestamp}.tar.gz`;
|
|
12485
|
-
await $
|
|
12486
|
-
|
|
12814
|
+
await $26`tar -czf ${archiveFilePath} -C ./cockroach-data .`;
|
|
12815
|
+
spinner10.stop(`\u{1F4BE} Current data archived at ${archiveFilePath}`);
|
|
12487
12816
|
}
|
|
12488
12817
|
});
|
|
12489
12818
|
}
|
|
@@ -12493,7 +12822,7 @@ var restore = new Command13().name("restore").description("Restore the database
|
|
|
12493
12822
|
case "remote":
|
|
12494
12823
|
return await restoreRemote();
|
|
12495
12824
|
case void 0:
|
|
12496
|
-
await
|
|
12825
|
+
await p25.select({
|
|
12497
12826
|
message: "Choose the source to restore the database from:",
|
|
12498
12827
|
options: [
|
|
12499
12828
|
{ label: "\u{1F4BD} Local backup", value: "local" },
|
|
@@ -12502,7 +12831,7 @@ var restore = new Command13().name("restore").description("Restore the database
|
|
|
12502
12831
|
initialValue: "local"
|
|
12503
12832
|
}).then(async (s) => {
|
|
12504
12833
|
if (typeof s === "symbol" || String(s) === "Symbol(clack:cancel)") {
|
|
12505
|
-
|
|
12834
|
+
p25.log.info("Canceled... \u{1F44B}");
|
|
12506
12835
|
process.exit(0);
|
|
12507
12836
|
} else {
|
|
12508
12837
|
const parsedSource = sourceSchema.parse(s);
|
|
@@ -12514,18 +12843,18 @@ var restore = new Command13().name("restore").description("Restore the database
|
|
|
12514
12843
|
}
|
|
12515
12844
|
});
|
|
12516
12845
|
}
|
|
12517
|
-
|
|
12518
|
-
`\u{1F9DA}\u2728${
|
|
12846
|
+
p25.outro(
|
|
12847
|
+
`\u{1F9DA}\u2728${color8.bgCyan(color8.black(" Database restore complete! "))}\u2728\u{1F9DA}`
|
|
12519
12848
|
);
|
|
12520
12849
|
});
|
|
12521
12850
|
|
|
12522
12851
|
// src/index.ts
|
|
12523
|
-
$
|
|
12852
|
+
$27.verbose = false;
|
|
12524
12853
|
console.clear();
|
|
12525
12854
|
async function main() {
|
|
12526
12855
|
const packageVersion = await getPackageInfo();
|
|
12527
|
-
const program = new
|
|
12528
|
-
program.addCommand(cmdList).addCommand(env).addCommand(init).addCommand(gen).addCommand(backup).addCommand(restore);
|
|
12856
|
+
const program = new Command15().name("pragma").description("").version(packageVersion, "-v, --version", "display the current version");
|
|
12857
|
+
program.addCommand(cmdList).addCommand(dev).addCommand(env).addCommand(init).addCommand(gen).addCommand(backup).addCommand(restore);
|
|
12529
12858
|
program.parse();
|
|
12530
12859
|
}
|
|
12531
12860
|
main();
|