@columnus/api-cli 0.2.4 → 0.2.6
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 +172 -80
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -22773,6 +22773,10 @@ function fieldShape(type) {
|
|
|
22773
22773
|
if (type.kind === "array" && hasKindTrait(type.element, "chipItem")) return "scalarList";
|
|
22774
22774
|
return type.kind;
|
|
22775
22775
|
}
|
|
22776
|
+
function linkTargetTable(type) {
|
|
22777
|
+
const ref = type.kind === "array" ? type.element : type;
|
|
22778
|
+
return ref.kind === "id" ? ref.table : void 0;
|
|
22779
|
+
}
|
|
22776
22780
|
var SHAPE_TRAITS = {
|
|
22777
22781
|
string: ["inline", "editable", "textScalar", "previewLabel", "chipItem"],
|
|
22778
22782
|
markdown: ["editable", "previewLabel"],
|
|
@@ -22809,6 +22813,7 @@ var PREDICATE_VARIANTS = [
|
|
|
22809
22813
|
{ op: "neq", label: "\u2260" }
|
|
22810
22814
|
]
|
|
22811
22815
|
},
|
|
22816
|
+
{ value: "string", ops: [{ op: "contains", label: "contains" }] },
|
|
22812
22817
|
{ value: "unknownArray", ops: [{ op: "in", label: "in" }] },
|
|
22813
22818
|
{
|
|
22814
22819
|
value: "unknown",
|
|
@@ -22841,9 +22846,46 @@ var PREDICATE_OPS = PREDICATE_VARIANTS.flatMap(
|
|
|
22841
22846
|
var PREDICATE_OP_LABELS = new Map(
|
|
22842
22847
|
PREDICATE_VARIANTS.flatMap((variant) => variant.ops.map(({ op, label }) => [op, label]))
|
|
22843
22848
|
);
|
|
22849
|
+
function subFields(type, throughLists) {
|
|
22850
|
+
if (type.kind === "object") return type.fields;
|
|
22851
|
+
return throughLists && type.kind === "array" && type.element.kind === "object" ? type.element.fields : [];
|
|
22852
|
+
}
|
|
22853
|
+
function fieldsAlongPath(table, path5, throughLists = false) {
|
|
22854
|
+
const chain = [];
|
|
22855
|
+
let fields = table.fields;
|
|
22856
|
+
for (const segment of path5.split(".")) {
|
|
22857
|
+
const field = fields.find((f) => f.name === segment);
|
|
22858
|
+
if (!field) return null;
|
|
22859
|
+
chain.push(field);
|
|
22860
|
+
fields = subFields(field.type, throughLists);
|
|
22861
|
+
}
|
|
22862
|
+
return chain;
|
|
22863
|
+
}
|
|
22864
|
+
function comparableUnionKind(t) {
|
|
22865
|
+
if (t.kind !== "union" || t.options.length === 0) return null;
|
|
22866
|
+
const first = t.options[0];
|
|
22867
|
+
if (!t.options.every((o) => o.kind === first.kind)) return null;
|
|
22868
|
+
if (first.kind === "string" || first.kind === "number" || first.kind === "bigint" || first.kind === "boolean" || first.kind === "date" || first.kind === "datetime" || first.kind === "id") {
|
|
22869
|
+
return first;
|
|
22870
|
+
}
|
|
22871
|
+
if (first.kind === "literal") {
|
|
22872
|
+
if (t.options.some((o) => o.kind === "literal" && typeof o.value !== typeof first.value)) {
|
|
22873
|
+
return first;
|
|
22874
|
+
}
|
|
22875
|
+
const v4 = first.value;
|
|
22876
|
+
if (typeof v4 === "string") return { kind: "string" };
|
|
22877
|
+
if (typeof v4 === "number") return { kind: "number" };
|
|
22878
|
+
if (typeof v4 === "boolean") return { kind: "boolean" };
|
|
22879
|
+
}
|
|
22880
|
+
return null;
|
|
22881
|
+
}
|
|
22882
|
+
function effectiveQueryFieldType(t) {
|
|
22883
|
+
if (t.kind === "union") return comparableUnionKind(t);
|
|
22884
|
+
return t;
|
|
22885
|
+
}
|
|
22844
22886
|
|
|
22845
22887
|
// ../shared/src/queryTypes.ts
|
|
22846
|
-
var listAccessKindSchema = external_exports.enum(["table", "index", "
|
|
22888
|
+
var listAccessKindSchema = external_exports.enum(["table", "index", "idList"]);
|
|
22847
22889
|
var listPageKindSchema = external_exports.enum(["paginate", "boundedSort"]);
|
|
22848
22890
|
var queryErrorCodeSchema = external_exports.enum([
|
|
22849
22891
|
"query_invalid",
|
|
@@ -22858,13 +22900,16 @@ var betweenValueSchema = external_exports.object({
|
|
|
22858
22900
|
(value) => Object.hasOwn(value, "min") && Object.hasOwn(value, "max"),
|
|
22859
22901
|
"Between requires min and max"
|
|
22860
22902
|
);
|
|
22903
|
+
var valueSchemas = {
|
|
22904
|
+
unknown: external_exports.unknown(),
|
|
22905
|
+
unknownArray: external_exports.array(external_exports.unknown()),
|
|
22906
|
+
between: betweenValueSchema,
|
|
22907
|
+
none: external_exports.null(),
|
|
22908
|
+
string: external_exports.string().min(1)
|
|
22909
|
+
};
|
|
22861
22910
|
var predicateSchemas = PREDICATE_VARIANTS.flatMap(
|
|
22862
22911
|
(variant) => variant.ops.map(
|
|
22863
|
-
({ op }) => external_exports.object({
|
|
22864
|
-
field: external_exports.string().min(1),
|
|
22865
|
-
op: external_exports.literal(op),
|
|
22866
|
-
value: variant.value === "unknownArray" ? external_exports.array(external_exports.unknown()) : variant.value === "between" ? betweenValueSchema : variant.value === "none" ? external_exports.null() : external_exports.unknown()
|
|
22867
|
-
})
|
|
22912
|
+
({ op }) => external_exports.object({ field: external_exports.string().min(1), op: external_exports.literal(op), value: valueSchemas[variant.value] })
|
|
22868
22913
|
)
|
|
22869
22914
|
);
|
|
22870
22915
|
var predicateSchema = external_exports.discriminatedUnion(
|
|
@@ -22902,34 +22947,21 @@ var queryOrderSchema = external_exports.object({
|
|
|
22902
22947
|
field: external_exports.string().min(1),
|
|
22903
22948
|
direction: external_exports.enum(["asc", "desc"])
|
|
22904
22949
|
});
|
|
22905
|
-
var querySearchSchema = external_exports.object({
|
|
22906
|
-
index: external_exports.string().min(1),
|
|
22907
|
-
query: external_exports.string()
|
|
22908
|
-
});
|
|
22909
22950
|
var querySchema = external_exports.object({
|
|
22910
22951
|
predicates: external_exports.array(conditionSchema).optional(),
|
|
22911
22952
|
order: queryOrderSchema.optional(),
|
|
22912
|
-
search: querySearchSchema.optional(),
|
|
22913
|
-
/** Reserved — rejected by the planner until vector indexes exist in the manifest. */
|
|
22914
|
-
vector: external_exports.unknown().optional(),
|
|
22915
22953
|
maxScan: external_exports.number().int().positive().optional(),
|
|
22916
22954
|
indexHint: external_exports.string().min(1).optional()
|
|
22917
22955
|
});
|
|
22918
22956
|
var clampQuerySchema = external_exports.object({
|
|
22919
22957
|
predicates: external_exports.array(conditionSchema).optional(),
|
|
22920
|
-
order: queryOrderSchema.optional()
|
|
22921
|
-
search: querySearchSchema.optional()
|
|
22958
|
+
order: queryOrderSchema.optional()
|
|
22922
22959
|
});
|
|
22923
|
-
var listMetaOrderSchema = external_exports.union([
|
|
22924
|
-
queryOrderSchema,
|
|
22925
|
-
external_exports.object({ kind: external_exports.literal("relevance") })
|
|
22926
|
-
]);
|
|
22927
22960
|
var listMetaSchema = external_exports.object({
|
|
22928
22961
|
access: listAccessKindSchema,
|
|
22929
22962
|
page: listPageKindSchema,
|
|
22930
|
-
order:
|
|
22963
|
+
order: queryOrderSchema.optional(),
|
|
22931
22964
|
indexName: external_exports.string().optional(),
|
|
22932
|
-
searchIndexName: external_exports.string().optional(),
|
|
22933
22965
|
scanned: external_exports.number().int().nonnegative().optional(),
|
|
22934
22966
|
truncated: external_exports.boolean().optional()
|
|
22935
22967
|
});
|
|
@@ -22953,7 +22985,7 @@ var apiTableAccessSchema = external_exports.object({
|
|
|
22953
22985
|
autoAccept: external_exports.boolean().optional(),
|
|
22954
22986
|
/**
|
|
22955
22987
|
* Opaque row clamp: AND-merged with caller Query on Read API / guest lists.
|
|
22956
|
-
* Sync membership uses `rowQuery.predicates` only (order
|
|
22988
|
+
* Sync membership uses `rowQuery.predicates` only (order and maxScanLimit ignored).
|
|
22957
22989
|
*/
|
|
22958
22990
|
rowQuery: clampQuerySchema.optional(),
|
|
22959
22991
|
/** Scan ceiling for Read/guest list plans; callers may only lower. Not applied to Sync/Resync. */
|
|
@@ -22984,6 +23016,8 @@ var apiProfileSnapshotSchema = external_exports.object({
|
|
|
22984
23016
|
autoAcceptProposals: external_exports.boolean().optional(),
|
|
22985
23017
|
/** Hosted MCP endpoint for this profile. Missing/undefined = disabled (opt-in). */
|
|
22986
23018
|
mcpEnabled: external_exports.boolean().optional(),
|
|
23019
|
+
/** Plan 108 D2: ✨ Meaning search for API callers. Missing/undefined = off (opt-in). */
|
|
23020
|
+
meaningSearch: external_exports.boolean().optional(),
|
|
22987
23021
|
apiVersion: external_exports.number(),
|
|
22988
23022
|
updatedAt: external_exports.number()
|
|
22989
23023
|
});
|
|
@@ -23171,6 +23205,7 @@ var bffErrorCodeSchema = external_exports.enum([
|
|
|
23171
23205
|
"unknown_host",
|
|
23172
23206
|
"disabled_host",
|
|
23173
23207
|
"conflict",
|
|
23208
|
+
"meaning_unavailable",
|
|
23174
23209
|
"executor_mismatch",
|
|
23175
23210
|
"executor_unavailable",
|
|
23176
23211
|
"validation_error",
|
|
@@ -23332,9 +23367,6 @@ var MCP_OAUTH_UNUSED_CLIENT_TTL_MS = 7 * 24 * 60 * MINUTE;
|
|
|
23332
23367
|
var MCP_ENDPOINT_PATH_PREFIX = `${COLUMNUS_BFF_API_PREFIX}/mcp/`;
|
|
23333
23368
|
var MCP_OAUTH_PATH_PREFIX = `${COLUMNUS_BFF_API_PREFIX}/oauth`;
|
|
23334
23369
|
|
|
23335
|
-
// ../shared/src/queryPlan.ts
|
|
23336
|
-
import { compareValues as compareValues2 } from "convex/values";
|
|
23337
|
-
|
|
23338
23370
|
// ../shared/src/queryBetween.ts
|
|
23339
23371
|
import { compareValues } from "convex/values";
|
|
23340
23372
|
|
|
@@ -23384,6 +23416,65 @@ function withTrashFields(table) {
|
|
|
23384
23416
|
};
|
|
23385
23417
|
}
|
|
23386
23418
|
|
|
23419
|
+
// ../shared/src/tableSearch.ts
|
|
23420
|
+
var SEARCH_BOOSTS = ["high", "normal", "low"];
|
|
23421
|
+
var MEANING_STRICTNESS = ["strict", "loose"];
|
|
23422
|
+
var tableSearchSchema = external_exports.object({
|
|
23423
|
+
fields: external_exports.array(
|
|
23424
|
+
external_exports.object({
|
|
23425
|
+
field: external_exports.string(),
|
|
23426
|
+
boost: external_exports.enum(SEARCH_BOOSTS).optional(),
|
|
23427
|
+
meaning: external_exports.boolean().optional()
|
|
23428
|
+
})
|
|
23429
|
+
),
|
|
23430
|
+
meaningStrictness: external_exports.enum(MEANING_STRICTNESS).optional()
|
|
23431
|
+
});
|
|
23432
|
+
var SHAPE_SEARCH = {
|
|
23433
|
+
string: () => "rawText",
|
|
23434
|
+
markdown: () => "text",
|
|
23435
|
+
// By the option's label, the literal itself.
|
|
23436
|
+
enum: () => "rawText",
|
|
23437
|
+
scalarList: (type) => type.kind === "array" && effectiveQueryFieldType(type.element)?.kind === "string" ? "text" : null,
|
|
23438
|
+
id: () => "link",
|
|
23439
|
+
idList: () => "link",
|
|
23440
|
+
number: () => null,
|
|
23441
|
+
bigint: () => null,
|
|
23442
|
+
boolean: () => null,
|
|
23443
|
+
null: () => null,
|
|
23444
|
+
any: () => null,
|
|
23445
|
+
bytes: () => null,
|
|
23446
|
+
file: () => null,
|
|
23447
|
+
image: () => null,
|
|
23448
|
+
date: () => null,
|
|
23449
|
+
datetime: () => null,
|
|
23450
|
+
literal: () => null,
|
|
23451
|
+
// Lists of objects are searched through their objects' raw text fields.
|
|
23452
|
+
array: () => null,
|
|
23453
|
+
// Searched through its leaves.
|
|
23454
|
+
object: () => null,
|
|
23455
|
+
union: () => null
|
|
23456
|
+
};
|
|
23457
|
+
function searchKind(table, path5, tables) {
|
|
23458
|
+
const type = fieldsAlongPath(table, path5, true)?.at(-1)?.type;
|
|
23459
|
+
if (!type) return null;
|
|
23460
|
+
const kind = SHAPE_SEARCH[fieldShape(type)](type);
|
|
23461
|
+
if (!fieldsAlongPath(table, path5)) return kind === "rawText" ? kind : null;
|
|
23462
|
+
if (kind !== "link") return kind;
|
|
23463
|
+
const target = linkTargetTable(type);
|
|
23464
|
+
return tables.some((t) => t.name === target && t.kind !== "asset") ? "link" : null;
|
|
23465
|
+
}
|
|
23466
|
+
function searchIssues(table, tables) {
|
|
23467
|
+
const issues = [];
|
|
23468
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23469
|
+
for (const { field } of table.search?.fields ?? []) {
|
|
23470
|
+
if (seen.has(field)) issues.push(`${table.name}.search lists ${field} twice`);
|
|
23471
|
+
else if (!searchKind(table, field, tables))
|
|
23472
|
+
issues.push(`${table.name}.search: ${field} is not a searchable field`);
|
|
23473
|
+
seen.add(field);
|
|
23474
|
+
}
|
|
23475
|
+
return issues;
|
|
23476
|
+
}
|
|
23477
|
+
|
|
23387
23478
|
// ../shared/src/schemaTypes.ts
|
|
23388
23479
|
var IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
23389
23480
|
var RESERVED_TABLE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -23493,11 +23584,6 @@ var indexSchema = external_exports.object({
|
|
|
23493
23584
|
name: external_exports.string().regex(IDENT),
|
|
23494
23585
|
fields: external_exports.array(external_exports.string().regex(IDENT)).min(1)
|
|
23495
23586
|
});
|
|
23496
|
-
var searchIndexSchema = external_exports.object({
|
|
23497
|
-
name: external_exports.string().regex(IDENT),
|
|
23498
|
-
searchField: external_exports.string().regex(IDENT),
|
|
23499
|
-
filterFields: external_exports.array(external_exports.string().regex(IDENT)).optional()
|
|
23500
|
-
});
|
|
23501
23587
|
var tableSchema = external_exports.object({
|
|
23502
23588
|
name: external_exports.string().regex(IDENT).refine((n) => !RESERVED_TABLE_NAMES.has(n), {
|
|
23503
23589
|
message: "table name is reserved by the studio"
|
|
@@ -23508,8 +23594,9 @@ var tableSchema = external_exports.object({
|
|
|
23508
23594
|
kind: tableKindSchema.optional().default("record"),
|
|
23509
23595
|
fields: external_exports.array(fieldSchema),
|
|
23510
23596
|
indexes: external_exports.array(indexSchema).default([]),
|
|
23511
|
-
|
|
23512
|
-
|
|
23597
|
+
displayTemplates: displayTemplatesSchema.optional(),
|
|
23598
|
+
/** The read model's search box (plan 106); absent: every searchable field. */
|
|
23599
|
+
search: tableSearchSchema.optional()
|
|
23513
23600
|
});
|
|
23514
23601
|
var manifestSchema = external_exports.object({
|
|
23515
23602
|
tables: external_exports.array(tableSchema)
|
|
@@ -23534,24 +23621,24 @@ var manifestSchema = external_exports.object({
|
|
|
23534
23621
|
path: ["tables"]
|
|
23535
23622
|
});
|
|
23536
23623
|
}
|
|
23537
|
-
if (t.
|
|
23624
|
+
if (t.displayTemplates !== void 0) {
|
|
23538
23625
|
ctx.addIssue({
|
|
23539
23626
|
code: external_exports.ZodIssueCode.custom,
|
|
23540
|
-
message: `${t.name} is an asset metadata table and cannot define
|
|
23627
|
+
message: `${t.name} is an asset metadata table and cannot define display templates`,
|
|
23541
23628
|
path: ["tables"]
|
|
23542
23629
|
});
|
|
23543
23630
|
}
|
|
23544
|
-
if (t.
|
|
23631
|
+
if (t.color !== void 0) {
|
|
23545
23632
|
ctx.addIssue({
|
|
23546
23633
|
code: external_exports.ZodIssueCode.custom,
|
|
23547
|
-
message: `${t.name} is an asset metadata table and cannot define
|
|
23634
|
+
message: `${t.name} is an asset metadata table and cannot define a color`,
|
|
23548
23635
|
path: ["tables"]
|
|
23549
23636
|
});
|
|
23550
23637
|
}
|
|
23551
|
-
if (t.
|
|
23638
|
+
if (t.search !== void 0) {
|
|
23552
23639
|
ctx.addIssue({
|
|
23553
23640
|
code: external_exports.ZodIssueCode.custom,
|
|
23554
|
-
message: `${t.name} is an asset metadata table and cannot define
|
|
23641
|
+
message: `${t.name} is an asset metadata table and cannot define search`,
|
|
23555
23642
|
path: ["tables"]
|
|
23556
23643
|
});
|
|
23557
23644
|
}
|
|
@@ -23575,7 +23662,7 @@ var manifestSchema = external_exports.object({
|
|
|
23575
23662
|
}
|
|
23576
23663
|
assertAssetBindingAllowed(ctx, t, f);
|
|
23577
23664
|
}
|
|
23578
|
-
for (const idx of
|
|
23665
|
+
for (const idx of t.indexes) {
|
|
23579
23666
|
if (idx.name === TRASH_INDEX_NAME) {
|
|
23580
23667
|
ctx.addIssue({
|
|
23581
23668
|
code: external_exports.ZodIssueCode.custom,
|
|
@@ -23586,6 +23673,8 @@ var manifestSchema = external_exports.object({
|
|
|
23586
23673
|
}
|
|
23587
23674
|
}
|
|
23588
23675
|
for (const t of manifest.tables) {
|
|
23676
|
+
for (const message of searchIssues(t, manifest.tables))
|
|
23677
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message, path: ["tables"] });
|
|
23589
23678
|
for (const f of t.fields) {
|
|
23590
23679
|
const invalidRef = findInvalidReference(f, tablesByName);
|
|
23591
23680
|
if (invalidRef) {
|
|
@@ -23887,7 +23976,7 @@ ${schemaBody}});
|
|
|
23887
23976
|
`;
|
|
23888
23977
|
}
|
|
23889
23978
|
function renderTable(t) {
|
|
23890
|
-
const { fields, indexes
|
|
23979
|
+
const { fields, indexes } = isAssetTable(t) ? {
|
|
23891
23980
|
fields: [
|
|
23892
23981
|
...t.fields,
|
|
23893
23982
|
{
|
|
@@ -23896,8 +23985,7 @@ function renderTable(t) {
|
|
|
23896
23985
|
optional: false
|
|
23897
23986
|
}
|
|
23898
23987
|
],
|
|
23899
|
-
indexes: [{ name: "by_assetId", fields: ["assetId"] }]
|
|
23900
|
-
searchIndexes: []
|
|
23988
|
+
indexes: [{ name: "by_assetId", fields: ["assetId"] }]
|
|
23901
23989
|
} : withTrashFields(t);
|
|
23902
23990
|
const fieldsBlock = fields.map((f) => {
|
|
23903
23991
|
const inner = renderType(f.type);
|
|
@@ -23907,20 +23995,12 @@ function renderTable(t) {
|
|
|
23907
23995
|
let out = `defineTable({
|
|
23908
23996
|
${fieldsBlock}
|
|
23909
23997
|
})`;
|
|
23910
|
-
const inlineSingleIndex = indexes.length === 1
|
|
23998
|
+
const inlineSingleIndex = indexes.length === 1;
|
|
23911
23999
|
for (const idx of indexes) {
|
|
23912
24000
|
const cols = idx.fields.map((c) => JSON.stringify(c)).join(", ");
|
|
23913
24001
|
const sep = inlineSingleIndex ? "" : "\n ";
|
|
23914
24002
|
out += `${sep}.index(${JSON.stringify(idx.name)}, [${cols}])`;
|
|
23915
24003
|
}
|
|
23916
|
-
for (const sx of searchIndexes) {
|
|
23917
|
-
const cfg = [`searchField: ${JSON.stringify(sx.searchField)}`];
|
|
23918
|
-
if (sx.filterFields && sx.filterFields.length > 0) {
|
|
23919
|
-
cfg.push(`filterFields: [${sx.filterFields.map((c) => JSON.stringify(c)).join(", ")}]`);
|
|
23920
|
-
}
|
|
23921
|
-
out += `
|
|
23922
|
-
.searchIndex(${JSON.stringify(sx.name)}, { ${cfg.join(", ")} })`;
|
|
23923
|
-
}
|
|
23924
24004
|
return out;
|
|
23925
24005
|
}
|
|
23926
24006
|
function renderLeaf(t) {
|
|
@@ -24025,9 +24105,16 @@ function quotedUnion(values) {
|
|
|
24025
24105
|
function multilineUnion(values) {
|
|
24026
24106
|
return values.map((value) => ` | ${JSON.stringify(value)}`).join("\n");
|
|
24027
24107
|
}
|
|
24108
|
+
var VALUE_TYPES = {
|
|
24109
|
+
unknown: "unknown",
|
|
24110
|
+
unknownArray: "unknown[]",
|
|
24111
|
+
between: "{ min: unknown; max: unknown }",
|
|
24112
|
+
none: "null",
|
|
24113
|
+
string: "string"
|
|
24114
|
+
};
|
|
24028
24115
|
function emitQueryTs(banner) {
|
|
24029
24116
|
const predicate = PREDICATE_VARIANTS.map((variant) => {
|
|
24030
|
-
const value = variant.value
|
|
24117
|
+
const value = VALUE_TYPES[variant.value];
|
|
24031
24118
|
return ` | { field: string; op: ${quotedUnion(variant.ops.map(({ op }) => op))}; value: ${value} }`;
|
|
24032
24119
|
}).join("\n");
|
|
24033
24120
|
let condition = "Predicate";
|
|
@@ -24042,8 +24129,6 @@ ${predicate};
|
|
|
24042
24129
|
|
|
24043
24130
|
export type QueryOrder = { field: string; direction: "asc" | "desc" };
|
|
24044
24131
|
|
|
24045
|
-
export type QuerySearch = { index: string; query: string };
|
|
24046
|
-
|
|
24047
24132
|
type Group<C> = { or: C[] } | { and: C[] };
|
|
24048
24133
|
|
|
24049
24134
|
/** A predicate, or an \`or\`/\`and\` group of conditions, up to ${MAX_GROUP_DEPTH} group levels deep. */
|
|
@@ -24053,18 +24138,15 @@ export type Query = {
|
|
|
24053
24138
|
/** ANDed. */
|
|
24054
24139
|
predicates?: Condition[];
|
|
24055
24140
|
order?: QueryOrder;
|
|
24056
|
-
search?: QuerySearch;
|
|
24057
24141
|
maxScan?: number;
|
|
24058
24142
|
indexHint?: string;
|
|
24059
|
-
vector?: unknown;
|
|
24060
24143
|
};
|
|
24061
24144
|
|
|
24062
24145
|
export type ListMeta = {
|
|
24063
|
-
access: "table" | "index" | "
|
|
24146
|
+
access: "table" | "index" | "idList";
|
|
24064
24147
|
page: "paginate" | "boundedSort";
|
|
24065
|
-
order?: QueryOrder
|
|
24148
|
+
order?: QueryOrder;
|
|
24066
24149
|
indexName?: string;
|
|
24067
|
-
searchIndexName?: string;
|
|
24068
24150
|
scanned?: number;
|
|
24069
24151
|
truncated?: boolean;
|
|
24070
24152
|
};
|
|
@@ -24307,6 +24389,10 @@ export type ProfileProposalSummary = {
|
|
|
24307
24389
|
createdAt: number;
|
|
24308
24390
|
/** Revision of a protected shared draft; pass it back when publishing. */
|
|
24309
24391
|
draftRevision?: number;
|
|
24392
|
+
/** The editor draft's key (absent: the default draft), label and author name. */
|
|
24393
|
+
draftKey?: string;
|
|
24394
|
+
draftLabel?: string;
|
|
24395
|
+
createdByName?: string;
|
|
24310
24396
|
patches: ProfileProposalPatchSummary[];
|
|
24311
24397
|
};
|
|
24312
24398
|
|
|
@@ -24325,13 +24411,16 @@ export type ProfileProposalOutcome = {
|
|
|
24325
24411
|
export const proposeProfileBatchRef = anyApi.columnus.share.proposeProfileBatch as FunctionReference<"mutation", "public", { profileSlug: string; patches: ProfileProposalPatch[]; expectedRevision?: number }, ProfileDraftSaveResult>;
|
|
24326
24412
|
|
|
24327
24413
|
/** Merge changed rows into the caller's shared draft (concurrent-safe Save). */
|
|
24328
|
-
export const saveMyProfileDraftRef = anyApi.columnus.share.saveMyProfileDraft as FunctionReference<"mutation", "public", { profileSlug: string; patches: Array<ProfileProposalPatch & { clearFields?: string[] }>; discard?: Array<{ table: string; rowId: string }
|
|
24414
|
+
export const saveMyProfileDraftRef = anyApi.columnus.share.saveMyProfileDraft as FunctionReference<"mutation", "public", { profileSlug: string; patches: Array<ProfileProposalPatch & { clearFields?: string[] }>; discard?: Array<{ table: string; rowId: string; fields?: string[] }>; draftKey?: string; draftLabel?: string }, ProfileDraftSaveResult>;
|
|
24329
24415
|
|
|
24330
24416
|
export const listProfileProposalsRef = anyApi.columnus.share.listProfileProposals as FunctionReference<"query", "public", { profileSlug: string }, ProfileProposalSummary[]>;
|
|
24331
24417
|
|
|
24332
|
-
export const publishMyProfileProposalRef = anyApi.columnus.share.publishMyProfileProposal as FunctionReference<"mutation", "public", { profileSlug: string; expectedRevision?: number }, ProfileProposalOutcome[]>;
|
|
24418
|
+
export const publishMyProfileProposalRef = anyApi.columnus.share.publishMyProfileProposal as FunctionReference<"mutation", "public", { profileSlug: string; expectedRevision?: number; draftKey?: string }, ProfileProposalOutcome[]>;
|
|
24419
|
+
|
|
24420
|
+
export const withdrawMyProfileProposalRef = anyApi.columnus.share.withdrawMyProfileProposal as FunctionReference<"mutation", "public", { profileSlug: string; draftKey?: string }, { id: string; status: "withdrawn" }>;
|
|
24333
24421
|
|
|
24334
|
-
|
|
24422
|
+
/** Keep mine or Use published per stale field of the caller's draft for the key. */
|
|
24423
|
+
export const resolveMyDraftRef = anyApi.columnus.share.resolveMyDraft as FunctionReference<"mutation", "public", { profileSlug: string; draftKey?: string; expectedRevision: number; choices: Array<{ table: string; rowId: string; field?: string; keep: "mine" | "published" }> }, ProfileDraftSaveResult>;
|
|
24335
24424
|
|
|
24336
24425
|
export const generateUploadUrlRef = anyApi.columnus.storage.generateUploadUrl as FunctionReference<
|
|
24337
24426
|
"mutation",
|
|
@@ -24463,6 +24552,7 @@ export const cmsHostRefs = {
|
|
|
24463
24552
|
listProfileProposals: listProfileProposalsRef,
|
|
24464
24553
|
publishMyProfileProposal: publishMyProfileProposalRef,
|
|
24465
24554
|
withdrawMyProfileProposal: withdrawMyProfileProposalRef,
|
|
24555
|
+
resolveMyDraft: resolveMyDraftRef,
|
|
24466
24556
|
generateUploadUrl: generateUploadUrlRef,
|
|
24467
24557
|
deleteStorageFile: deleteStorageFileRef,
|
|
24468
24558
|
createAssetFromStorage: createAssetFromStorageRef,
|
|
@@ -24518,7 +24608,6 @@ export type ManifestTable = {
|
|
|
24518
24608
|
label?: string;
|
|
24519
24609
|
fields: ManifestField[];
|
|
24520
24610
|
indexes: ManifestIndex[];
|
|
24521
|
-
searchIndexes: unknown[];
|
|
24522
24611
|
};
|
|
24523
24612
|
|
|
24524
24613
|
export type PulledManifest = { tables: ManifestTable[] };
|
|
@@ -24754,13 +24843,16 @@ var facetSpecSchema = external_exports.object({
|
|
|
24754
24843
|
var facetListSchema = external_exports.array(facetSpecSchema).max(FACET_LIMITS.perRequest);
|
|
24755
24844
|
|
|
24756
24845
|
// ../shared/src/queryValidators.ts
|
|
24846
|
+
var valueValidators = {
|
|
24847
|
+
unknown: v2.any(),
|
|
24848
|
+
unknownArray: v2.array(v2.any()),
|
|
24849
|
+
between: v2.object({ min: v2.any(), max: v2.any() }),
|
|
24850
|
+
none: v2.null(),
|
|
24851
|
+
string: v2.string()
|
|
24852
|
+
};
|
|
24757
24853
|
var predicateValidators = PREDICATE_VARIANTS.flatMap(
|
|
24758
24854
|
(variant) => variant.ops.map(
|
|
24759
|
-
({ op }) => v2.object({
|
|
24760
|
-
field: v2.string(),
|
|
24761
|
-
op: v2.literal(op),
|
|
24762
|
-
value: variant.value === "unknownArray" ? v2.array(v2.any()) : variant.value === "between" ? v2.object({ min: v2.any(), max: v2.any() }) : variant.value === "none" ? v2.null() : v2.any()
|
|
24763
|
-
})
|
|
24855
|
+
({ op }) => v2.object({ field: v2.string(), op: v2.literal(op), value: valueValidators[variant.value] })
|
|
24764
24856
|
)
|
|
24765
24857
|
);
|
|
24766
24858
|
var predicateValidator = v2.union(
|
|
@@ -24780,17 +24872,12 @@ var queryOrderValidator = v2.object({
|
|
|
24780
24872
|
field: v2.string(),
|
|
24781
24873
|
direction: v2.union(v2.literal("asc"), v2.literal("desc"))
|
|
24782
24874
|
});
|
|
24783
|
-
var
|
|
24784
|
-
index: v2.string(),
|
|
24785
|
-
query: v2.string()
|
|
24786
|
-
});
|
|
24875
|
+
var legacySearchValidator = v2.optional(v2.object({ index: v2.string(), query: v2.string() }));
|
|
24787
24876
|
var queryValidator = v2.object({
|
|
24788
24877
|
predicates: v2.optional(conditionsValidator),
|
|
24789
24878
|
order: v2.optional(queryOrderValidator),
|
|
24790
|
-
search: v2.optional(querySearchValidator),
|
|
24791
24879
|
maxScan: v2.optional(v2.number()),
|
|
24792
|
-
indexHint: v2.optional(v2.string())
|
|
24793
|
-
vector: v2.optional(v2.any())
|
|
24880
|
+
indexHint: v2.optional(v2.string())
|
|
24794
24881
|
});
|
|
24795
24882
|
function literals(values) {
|
|
24796
24883
|
return v2.union(
|
|
@@ -24811,6 +24898,11 @@ var gridQueryValidator = v2.object({
|
|
|
24811
24898
|
)
|
|
24812
24899
|
)
|
|
24813
24900
|
});
|
|
24901
|
+
var storedGridQueryValidator = v2.object({
|
|
24902
|
+
...gridQueryValidator.fields,
|
|
24903
|
+
search: legacySearchValidator,
|
|
24904
|
+
vector: v2.optional(v2.any())
|
|
24905
|
+
});
|
|
24814
24906
|
var facetSpecValidator = v2.object({
|
|
24815
24907
|
field: v2.string(),
|
|
24816
24908
|
bucket: v2.optional(groupBucketValidator),
|
|
@@ -24819,7 +24911,7 @@ var facetSpecValidator = v2.object({
|
|
|
24819
24911
|
var clampQueryValidator = v2.object({
|
|
24820
24912
|
predicates: v2.optional(conditionsValidator),
|
|
24821
24913
|
order: v2.optional(queryOrderValidator),
|
|
24822
|
-
search:
|
|
24914
|
+
search: legacySearchValidator
|
|
24823
24915
|
});
|
|
24824
24916
|
var queryArgValidator = v2.optional(queryValidator);
|
|
24825
24917
|
var maxScanLimitValidator = v2.optional(v2.number());
|
|
@@ -24890,7 +24982,8 @@ var REFS_RECOMPUTE_STALE_MS = 10 * 60 * 1e3;
|
|
|
24890
24982
|
var stagedApiAccessSchema = external_exports.array(
|
|
24891
24983
|
external_exports.object({
|
|
24892
24984
|
profile: external_exports.string().min(1),
|
|
24893
|
-
|
|
24985
|
+
// A pasted clamp is a write: a key it can't have (plan 106's `search`) is refused, not dropped (D8).
|
|
24986
|
+
tableAccess: external_exports.array(apiTableAccessSchema.extend({ rowQuery: clampQuerySchema.strict().optional() })).min(1)
|
|
24894
24987
|
}).strict()
|
|
24895
24988
|
);
|
|
24896
24989
|
|
|
@@ -25095,17 +25188,16 @@ async function runColumnusApiDev(config2) {
|
|
|
25095
25188
|
const client = new ConvexClient(config2.convexUrl, {
|
|
25096
25189
|
webSocketConstructor: ws
|
|
25097
25190
|
});
|
|
25098
|
-
let unsubscribe;
|
|
25099
25191
|
const stop = new Promise((resolve) => {
|
|
25100
25192
|
const onSignal = () => {
|
|
25101
|
-
unsubscribe
|
|
25193
|
+
unsubscribe();
|
|
25102
25194
|
client.close();
|
|
25103
25195
|
resolve();
|
|
25104
25196
|
};
|
|
25105
25197
|
process.once("SIGINT", onSignal);
|
|
25106
25198
|
process.once("SIGTERM", onSignal);
|
|
25107
25199
|
});
|
|
25108
|
-
unsubscribe = client.onUpdate(
|
|
25200
|
+
const unsubscribe = client.onUpdate(
|
|
25109
25201
|
anyApi2.columnus.read.introspect.introspect,
|
|
25110
25202
|
{ apiToken: config2.token },
|
|
25111
25203
|
(rawSnapshot) => {
|