@columnus/api-cli 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +147 -30
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1754,7 +1754,7 @@ var require_react_production = __commonJS({
|
|
|
1754
1754
|
exports.useTransition = function() {
|
|
1755
1755
|
return ReactSharedInternals.H.useTransition();
|
|
1756
1756
|
};
|
|
1757
|
-
exports.version = "19.3.
|
|
1757
|
+
exports.version = "19.3.1";
|
|
1758
1758
|
}
|
|
1759
1759
|
});
|
|
1760
1760
|
|
|
@@ -2749,7 +2749,7 @@ var require_react_development = __commonJS({
|
|
|
2749
2749
|
exports.useTransition = function() {
|
|
2750
2750
|
return resolveDispatcher().useTransition();
|
|
2751
2751
|
};
|
|
2752
|
-
exports.version = "19.3.
|
|
2752
|
+
exports.version = "19.3.1";
|
|
2753
2753
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
2754
2754
|
})();
|
|
2755
2755
|
}
|
|
@@ -3684,6 +3684,7 @@ __export(util_exports, {
|
|
|
3684
3684
|
required: () => required,
|
|
3685
3685
|
safeExtend: () => safeExtend,
|
|
3686
3686
|
shallowClone: () => shallowClone,
|
|
3687
|
+
sizeCaps: () => sizeCaps,
|
|
3687
3688
|
slugify: () => slugify,
|
|
3688
3689
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
3689
3690
|
toZod: () => toZod,
|
|
@@ -4203,6 +4204,18 @@ function prefixIssues(path5, issues) {
|
|
|
4203
4204
|
function unwrapMessage(message) {
|
|
4204
4205
|
return typeof message === "string" ? message : message?.message;
|
|
4205
4206
|
}
|
|
4207
|
+
function sizeCaps(defChecks) {
|
|
4208
|
+
const caps = [];
|
|
4209
|
+
for (const ch of defChecks ?? []) {
|
|
4210
|
+
const d = ch._zod.def;
|
|
4211
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
4212
|
+
break;
|
|
4213
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
4214
|
+
if (max >= 0)
|
|
4215
|
+
caps.push([max, ch]);
|
|
4216
|
+
}
|
|
4217
|
+
return caps;
|
|
4218
|
+
}
|
|
4206
4219
|
function attachSchema(issues, start, inst) {
|
|
4207
4220
|
var _a3;
|
|
4208
4221
|
for (let i = start; i < issues.length; i++) {
|
|
@@ -5623,7 +5636,7 @@ ${content.join("\n")}
|
|
|
5623
5636
|
var version = {
|
|
5624
5637
|
major: 4,
|
|
5625
5638
|
minor: 6,
|
|
5626
|
-
patch:
|
|
5639
|
+
patch: 7
|
|
5627
5640
|
};
|
|
5628
5641
|
|
|
5629
5642
|
// ../../../node_modules/zod/v4/core/schemas.js
|
|
@@ -6379,6 +6392,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
6379
6392
|
return payload;
|
|
6380
6393
|
};
|
|
6381
6394
|
});
|
|
6395
|
+
function capSize(inst, size) {
|
|
6396
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
6397
|
+
if (!caps.length)
|
|
6398
|
+
return;
|
|
6399
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
6400
|
+
const parse3 = inst._zod.parse;
|
|
6401
|
+
inst._zod.parse = (payload, ctx) => {
|
|
6402
|
+
const n = size(payload.value);
|
|
6403
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
6404
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
6405
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
6406
|
+
const start = payload.issues.length;
|
|
6407
|
+
ch._zod.check(payload);
|
|
6408
|
+
payload.issues[start].continue = false;
|
|
6409
|
+
attachSchema(payload.issues, start, inst);
|
|
6410
|
+
return payload;
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
return parse3(payload, ctx);
|
|
6415
|
+
};
|
|
6416
|
+
}
|
|
6417
|
+
var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
|
|
6418
|
+
var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
|
|
6419
|
+
var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
|
|
6382
6420
|
function handleArrayResult(result, final, index) {
|
|
6383
6421
|
if (result.issues.length) {
|
|
6384
6422
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
@@ -6422,6 +6460,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
6422
6460
|
}
|
|
6423
6461
|
return payload;
|
|
6424
6462
|
};
|
|
6463
|
+
capSize(inst, arraySize);
|
|
6425
6464
|
});
|
|
6426
6465
|
function handlePropertyResult(result, final, key, input2, optin, optout) {
|
|
6427
6466
|
const isPresent = key in input2;
|
|
@@ -7378,6 +7417,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
7378
7417
|
return Promise.all(proms).then(() => payload);
|
|
7379
7418
|
return payload;
|
|
7380
7419
|
};
|
|
7420
|
+
capSize(inst, mapSize);
|
|
7381
7421
|
});
|
|
7382
7422
|
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
7383
7423
|
if (keyResult.issues.length) {
|
|
@@ -7444,6 +7484,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
7444
7484
|
return Promise.all(proms).then(() => payload);
|
|
7445
7485
|
return payload;
|
|
7446
7486
|
};
|
|
7487
|
+
capSize(inst, setSize);
|
|
7447
7488
|
});
|
|
7448
7489
|
function handleSetResult(result, final) {
|
|
7449
7490
|
if (result.issues.length) {
|
|
@@ -16974,9 +17015,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
16974
17015
|
doc.write(`}`);
|
|
16975
17016
|
return outputVar;
|
|
16976
17017
|
}
|
|
17018
|
+
function generateSizeGate(doc, schema, size) {
|
|
17019
|
+
for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
|
|
17020
|
+
doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
|
|
17021
|
+
}
|
|
17022
|
+
}
|
|
16977
17023
|
function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
16978
17024
|
const def = schema._zod.def;
|
|
16979
17025
|
doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
|
|
17026
|
+
generateSizeGate(doc, schema, `${accessor}.length`);
|
|
16980
17027
|
const outputVar = buildsValue ? newVar(ctx) : null;
|
|
16981
17028
|
const iVar = newVar(ctx);
|
|
16982
17029
|
const elemVar = newVar(ctx);
|
|
@@ -17376,6 +17423,7 @@ function literalPropertyKey(ctx, key) {
|
|
|
17376
17423
|
function generateMapCheck(doc, ctx, schema, accessor) {
|
|
17377
17424
|
const def = schema._zod.def;
|
|
17378
17425
|
doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
|
|
17426
|
+
generateSizeGate(doc, schema, `${accessor}.size`);
|
|
17379
17427
|
const outputVar = newVar(ctx);
|
|
17380
17428
|
const kVar = newVar(ctx);
|
|
17381
17429
|
const valVar = newVar(ctx);
|
|
@@ -17392,6 +17440,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
|
|
|
17392
17440
|
function generateSetCheck(doc, ctx, schema, accessor) {
|
|
17393
17441
|
const def = schema._zod.def;
|
|
17394
17442
|
doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
|
|
17443
|
+
generateSizeGate(doc, schema, `${accessor}.size`);
|
|
17395
17444
|
const outputVar = newVar(ctx);
|
|
17396
17445
|
const valVar = newVar(ctx);
|
|
17397
17446
|
doc.write(`const ${outputVar} = new Set();`);
|
|
@@ -22997,6 +23046,7 @@ function isProtectedTransferTable(table) {
|
|
|
22997
23046
|
// ../shared/src/bffProtocol.ts
|
|
22998
23047
|
var COLUMNUS_BFF_PROTOCOL_VERSION = 1;
|
|
22999
23048
|
var COLUMNUS_BFF_API_PREFIX = "/api/columnus/v1";
|
|
23049
|
+
var READ_MODEL_API_PREFIX = `${COLUMNUS_BFF_API_PREFIX}/read-model`;
|
|
23000
23050
|
var OPERATION_ID_RE = /^[A-Za-z0-9_-]{16,128}$/;
|
|
23001
23051
|
var TRANSFER_ID_RE = /^[A-Za-z0-9_-]{16,64}$/;
|
|
23002
23052
|
var MANIFEST_HASH_RE = /^[0-9a-f]{64}$/;
|
|
@@ -23246,20 +23296,9 @@ var deployInternalTransferCreateResponseSchema = external_exports.object({
|
|
|
23246
23296
|
expiresAt: external_exports.number().int().positive(),
|
|
23247
23297
|
bytes: external_exports.number().int().nonnegative().optional()
|
|
23248
23298
|
});
|
|
23249
|
-
var deployInternalSchemaDeployResponseSchema = external_exports.object({
|
|
23250
|
-
ok: external_exports.boolean(),
|
|
23251
|
-
durationMs: external_exports.number(),
|
|
23252
|
-
prepareMs: external_exports.number().optional(),
|
|
23253
|
-
cliMs: external_exports.number().optional(),
|
|
23254
|
-
kernelCommit: external_exports.string().optional(),
|
|
23255
|
-
error: external_exports.string().optional(),
|
|
23256
|
-
logTail: external_exports.string().optional()
|
|
23257
|
-
});
|
|
23258
23299
|
var deployHealthResponseSchema = external_exports.object({
|
|
23259
23300
|
ok: external_exports.boolean(),
|
|
23260
|
-
commit: external_exports.string().optional()
|
|
23261
|
-
/** ISO-8601 deployment/image bake time (BRU-76 preview supersede). */
|
|
23262
|
-
deployedAt: external_exports.string().optional()
|
|
23301
|
+
commit: external_exports.string().optional()
|
|
23263
23302
|
});
|
|
23264
23303
|
var BFF_JSON_BODY_LIMIT_BYTES = 2 * 1024 * 1024;
|
|
23265
23304
|
|
|
@@ -23279,6 +23318,9 @@ var MCP_ENDPOINT_PATH_PREFIX = `${COLUMNUS_BFF_API_PREFIX}/mcp/`;
|
|
|
23279
23318
|
var MCP_OAUTH_PATH_PREFIX = `${COLUMNUS_BFF_API_PREFIX}/oauth`;
|
|
23280
23319
|
|
|
23281
23320
|
// ../shared/src/queryPlan.ts
|
|
23321
|
+
import { compareValues as compareValues2 } from "convex/values";
|
|
23322
|
+
|
|
23323
|
+
// ../shared/src/queryBetween.ts
|
|
23282
23324
|
import { compareValues } from "convex/values";
|
|
23283
23325
|
|
|
23284
23326
|
// ../shared/src/richDoc.ts
|
|
@@ -23304,6 +23346,29 @@ var EMPTY_RICH_DOC = JSON.stringify({
|
|
|
23304
23346
|
blocks: [emptyParagraphBlock()]
|
|
23305
23347
|
});
|
|
23306
23348
|
|
|
23349
|
+
// ../shared/src/rowTrash.ts
|
|
23350
|
+
import { ConvexError } from "convex/values";
|
|
23351
|
+
var TRASH_DELETED_AT_FIELD = "columnusDeletedAt";
|
|
23352
|
+
var TRASH_DELETED_BY_FIELD = "columnusDeletedBy";
|
|
23353
|
+
var TRASH_FIELD_NAMES = [
|
|
23354
|
+
TRASH_DELETED_AT_FIELD,
|
|
23355
|
+
TRASH_DELETED_BY_FIELD
|
|
23356
|
+
];
|
|
23357
|
+
var TRASH_INDEX_NAME = "by_columnusDeletedAt";
|
|
23358
|
+
var TRASH_RETENTION_DAYS = 30;
|
|
23359
|
+
var TRASH_RETENTION_MS = TRASH_RETENTION_DAYS * 24 * 60 * 60 * 1e3;
|
|
23360
|
+
function withTrashFields(table) {
|
|
23361
|
+
return {
|
|
23362
|
+
...table,
|
|
23363
|
+
fields: [
|
|
23364
|
+
...table.fields,
|
|
23365
|
+
{ name: TRASH_DELETED_AT_FIELD, type: { kind: "number" }, optional: true },
|
|
23366
|
+
{ name: TRASH_DELETED_BY_FIELD, type: { kind: "string" }, optional: true }
|
|
23367
|
+
],
|
|
23368
|
+
indexes: [...table.indexes, { name: TRASH_INDEX_NAME, fields: [TRASH_DELETED_AT_FIELD] }]
|
|
23369
|
+
};
|
|
23370
|
+
}
|
|
23371
|
+
|
|
23307
23372
|
// ../shared/src/schemaTypes.ts
|
|
23308
23373
|
var IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
23309
23374
|
var RESERVED_TABLE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -23486,8 +23551,24 @@ var manifestSchema = external_exports.object({
|
|
|
23486
23551
|
});
|
|
23487
23552
|
}
|
|
23488
23553
|
fieldNames.add(f.name);
|
|
23554
|
+
if (TRASH_FIELD_NAMES.includes(f.name)) {
|
|
23555
|
+
ctx.addIssue({
|
|
23556
|
+
code: external_exports.ZodIssueCode.custom,
|
|
23557
|
+
message: `${t.name}.${f.name}: field name is reserved for row trash`,
|
|
23558
|
+
path: ["tables"]
|
|
23559
|
+
});
|
|
23560
|
+
}
|
|
23489
23561
|
assertAssetBindingAllowed(ctx, t, f);
|
|
23490
23562
|
}
|
|
23563
|
+
for (const idx of [...t.indexes, ...t.searchIndexes]) {
|
|
23564
|
+
if (idx.name === TRASH_INDEX_NAME) {
|
|
23565
|
+
ctx.addIssue({
|
|
23566
|
+
code: external_exports.ZodIssueCode.custom,
|
|
23567
|
+
message: `${t.name}.${idx.name}: index name is reserved for row trash`,
|
|
23568
|
+
path: ["tables"]
|
|
23569
|
+
});
|
|
23570
|
+
}
|
|
23571
|
+
}
|
|
23491
23572
|
}
|
|
23492
23573
|
for (const t of manifest.tables) {
|
|
23493
23574
|
for (const f of t.fields) {
|
|
@@ -23791,24 +23872,26 @@ ${schemaBody}});
|
|
|
23791
23872
|
`;
|
|
23792
23873
|
}
|
|
23793
23874
|
function renderTable(t) {
|
|
23794
|
-
const fields = isAssetTable(t) ?
|
|
23795
|
-
|
|
23796
|
-
|
|
23797
|
-
|
|
23798
|
-
|
|
23799
|
-
|
|
23800
|
-
|
|
23801
|
-
|
|
23802
|
-
|
|
23803
|
-
|
|
23875
|
+
const { fields, indexes, searchIndexes } = isAssetTable(t) ? {
|
|
23876
|
+
fields: [
|
|
23877
|
+
...t.fields,
|
|
23878
|
+
{
|
|
23879
|
+
name: "assetId",
|
|
23880
|
+
type: { kind: "id", table: ASSETS_TABLE_NAME },
|
|
23881
|
+
optional: false
|
|
23882
|
+
}
|
|
23883
|
+
],
|
|
23884
|
+
indexes: [{ name: "by_assetId", fields: ["assetId"] }],
|
|
23885
|
+
searchIndexes: []
|
|
23886
|
+
} : withTrashFields(t);
|
|
23887
|
+
const fieldsBlock = fields.map((f) => {
|
|
23804
23888
|
const inner = renderType(f.type);
|
|
23805
23889
|
const value = f.optional ? `v.optional(${inner})` : inner;
|
|
23806
23890
|
return ` ${f.name}: ${value},`;
|
|
23807
|
-
}).join("\n")
|
|
23808
|
-
|
|
23809
|
-
|
|
23810
|
-
|
|
23811
|
-
const searchIndexes = isAssetTable(t) ? [] : t.searchIndexes;
|
|
23891
|
+
}).join("\n");
|
|
23892
|
+
let out = `defineTable({
|
|
23893
|
+
${fieldsBlock}
|
|
23894
|
+
})`;
|
|
23812
23895
|
const inlineSingleIndex = indexes.length === 1 && searchIndexes.length === 0;
|
|
23813
23896
|
for (const idx of indexes) {
|
|
23814
23897
|
const cols = idx.fields.map((c) => JSON.stringify(c)).join(", ");
|
|
@@ -24609,6 +24692,20 @@ var DEFAULT_MEDIA_REJECT_BYTES = 100 * 1024 * 1024 * 1024;
|
|
|
24609
24692
|
// ../shared/src/csv.ts
|
|
24610
24693
|
var import_papaparse = __toESM(require_papaparse(), 1);
|
|
24611
24694
|
|
|
24695
|
+
// ../shared/src/gridQuery.ts
|
|
24696
|
+
var GROUP_BUCKETS = ["day", "week", "month", "quarter", "year"];
|
|
24697
|
+
var MAX_GRID_KEYS = 3;
|
|
24698
|
+
var gridGroupBySchema = external_exports.object({
|
|
24699
|
+
field: external_exports.string().min(1),
|
|
24700
|
+
direction: external_exports.enum(["asc", "desc"]).optional(),
|
|
24701
|
+
/** Date and date-time fields only; buckets start in the request's timezone. */
|
|
24702
|
+
bucket: external_exports.enum(GROUP_BUCKETS).optional()
|
|
24703
|
+
});
|
|
24704
|
+
var gridQuerySchema = querySchema.extend({
|
|
24705
|
+
order: external_exports.union([queryOrderSchema, external_exports.array(queryOrderSchema).max(MAX_GRID_KEYS)]).optional(),
|
|
24706
|
+
groupBy: external_exports.array(gridGroupBySchema).max(MAX_GRID_KEYS).optional()
|
|
24707
|
+
});
|
|
24708
|
+
|
|
24612
24709
|
// ../shared/src/queryValidators.ts
|
|
24613
24710
|
import { v as v2 } from "convex/values";
|
|
24614
24711
|
var predicateValidators = PREDICATE_VARIANTS.flatMap(
|
|
@@ -24639,6 +24736,23 @@ var queryValidator = v2.object({
|
|
|
24639
24736
|
indexHint: v2.optional(v2.string()),
|
|
24640
24737
|
vector: v2.optional(v2.any())
|
|
24641
24738
|
});
|
|
24739
|
+
var gridQueryValidator = v2.object({
|
|
24740
|
+
...queryValidator.fields,
|
|
24741
|
+
order: v2.optional(v2.union(queryOrderValidator, v2.array(queryOrderValidator))),
|
|
24742
|
+
groupBy: v2.optional(
|
|
24743
|
+
v2.array(
|
|
24744
|
+
v2.object({
|
|
24745
|
+
field: v2.string(),
|
|
24746
|
+
direction: v2.optional(v2.union(v2.literal("asc"), v2.literal("desc"))),
|
|
24747
|
+
bucket: v2.optional(
|
|
24748
|
+
v2.union(
|
|
24749
|
+
...GROUP_BUCKETS.map((bucket) => v2.literal(bucket))
|
|
24750
|
+
)
|
|
24751
|
+
)
|
|
24752
|
+
})
|
|
24753
|
+
)
|
|
24754
|
+
)
|
|
24755
|
+
});
|
|
24642
24756
|
var clampQueryValidator = v2.object({
|
|
24643
24757
|
predicates: v2.optional(v2.array(predicateValidator)),
|
|
24644
24758
|
order: v2.optional(queryOrderValidator),
|
|
@@ -24703,6 +24817,9 @@ var stagedApiAccessValidator = v3.array(
|
|
|
24703
24817
|
})
|
|
24704
24818
|
);
|
|
24705
24819
|
|
|
24820
|
+
// ../shared/src/failureMessage.ts
|
|
24821
|
+
import { ConvexError as ConvexError2 } from "convex/values";
|
|
24822
|
+
|
|
24706
24823
|
// ../shared/src/refsRecompute.ts
|
|
24707
24824
|
var REFS_RECOMPUTE_STALE_MS = 10 * 60 * 1e3;
|
|
24708
24825
|
|