@columnus/api-cli 0.1.58 → 0.1.59

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.
Files changed (2) hide show
  1. package/dist/cli.js +9 -24
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7576,9 +7576,8 @@ function generateSchemaTs(manifest, opts) {
7576
7576
  const includeManifestTable = opts?.includeManifestTable ?? true;
7577
7577
  const includeAuditTable = opts?.includeAuditTable ?? true;
7578
7578
  const includeDisplayValuesTable = opts?.includeDisplayValuesTable ?? true;
7579
- const assetFieldIds = opts?.assetFieldIds ?? "assets";
7580
7579
  const userTables = [...manifest.tables].sort((a, b) => a.name.localeCompare(b.name));
7581
- const userBody = userTables.map((t) => ` ${t.name}: ${renderTable(t, assetFieldIds)},`).join("\n");
7580
+ const userBody = userTables.map((t) => ` ${t.name}: ${renderTable(t)},`).join("\n");
7582
7581
  let body;
7583
7582
  if (includeColumnusTables) {
7584
7583
  const columnusSource = columnusTablesSource({
@@ -7594,15 +7593,14 @@ function generateSchemaTs(manifest, opts) {
7594
7593
  const banner = includeColumnusTables ? BANNER : CONSUMER_BANNER;
7595
7594
  const schemaBody = body ? `${body}
7596
7595
  ` : "";
7597
- const schemaOpts = opts?.schemaValidation === false ? ", { schemaValidation: false }" : "";
7598
7596
  return `${banner}import { defineSchema, defineTable } from "convex/server";
7599
7597
  import { v } from "convex/values";
7600
7598
 
7601
7599
  export default defineSchema({
7602
- ${schemaBody}}${schemaOpts});
7600
+ ${schemaBody}});
7603
7601
  `;
7604
7602
  }
7605
- function renderTable(t, assetFieldIds) {
7603
+ function renderTable(t) {
7606
7604
  const fields = isAssetTable(t) ? [
7607
7605
  ...t.fields,
7608
7606
  {
@@ -7613,7 +7611,7 @@ function renderTable(t, assetFieldIds) {
7613
7611
  ] : t.fields;
7614
7612
  const fieldsBlock = fields.length ? `{
7615
7613
  ${fields.map((f) => {
7616
- const inner = renderType(f.type, assetFieldIds);
7614
+ const inner = renderType(f.type);
7617
7615
  const value = f.optional ? `v.optional(${inner})` : inner;
7618
7616
  return ` ${f.name}: ${value},`;
7619
7617
  }).join("\n")}
@@ -7637,20 +7635,7 @@ ${fields.map((f) => {
7637
7635
  }
7638
7636
  return out;
7639
7637
  }
7640
- function renderAssetIdType(assetFieldIds) {
7641
- const assetId = `v.id(${JSON.stringify(ASSETS_TABLE_NAME)})`;
7642
- switch (assetFieldIds) {
7643
- case "storage-or-assets":
7644
- return `v.union(v.id("_storage"), ${assetId})`;
7645
- case "assets":
7646
- return assetId;
7647
- default: {
7648
- const _exhaustive = assetFieldIds;
7649
- return _exhaustive;
7650
- }
7651
- }
7652
- }
7653
- function renderType(t, assetFieldIds) {
7638
+ function renderType(t) {
7654
7639
  switch (t.kind) {
7655
7640
  case "string":
7656
7641
  case "markdown":
@@ -7672,24 +7657,24 @@ function renderType(t, assetFieldIds) {
7672
7657
  return "v.bytes()";
7673
7658
  case "file":
7674
7659
  case "image":
7675
- return renderAssetIdType(assetFieldIds);
7660
+ return `v.id(${JSON.stringify(ASSETS_TABLE_NAME)})`;
7676
7661
  case "id":
7677
7662
  return `v.id(${JSON.stringify(t.table)})`;
7678
7663
  case "literal":
7679
7664
  return `v.literal(${JSON.stringify(t.value)})`;
7680
7665
  case "array":
7681
- return `v.array(${renderType(t.element, assetFieldIds)})`;
7666
+ return `v.array(${renderType(t.element)})`;
7682
7667
  case "object": {
7683
7668
  if (t.fields.length === 0) return `v.object({})`;
7684
7669
  const inner = t.fields.map((f) => {
7685
- const inner2 = renderType(f.type, assetFieldIds);
7670
+ const inner2 = renderType(f.type);
7686
7671
  const value = f.optional ? `v.optional(${inner2})` : inner2;
7687
7672
  return `${f.name}: ${value}`;
7688
7673
  }).join(", ");
7689
7674
  return `v.object({ ${inner} })`;
7690
7675
  }
7691
7676
  case "union":
7692
- return `v.union(${t.options.map((option) => renderType(option, assetFieldIds)).join(", ")})`;
7677
+ return `v.union(${t.options.map((option) => renderType(option)).join(", ")})`;
7693
7678
  }
7694
7679
  throw new Error(`unknown field kind: ${t.kind}`);
7695
7680
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columnus/api-cli",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "columnus-api pull and dev — live-sync read API codegen for Columnus consumer apps",