@columnus/api-cli 0.1.49 → 0.1.52

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 +53 -65
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7625,13 +7625,7 @@ function generateClientPullFiles(input) {
7625
7625
  "src/generated/proposal-api-refs.ts",
7626
7626
  generateProposalApiRefsTs(input.profileSlug, manifest.tables, accesses)
7627
7627
  );
7628
- files.set(
7629
- "src/generated/profile-proposal-refs.ts",
7630
- generateProfileProposalRefsTs(manifest.tables, accesses)
7631
- );
7632
- files.set("src/generated/editor-row-refs.ts", generateEditorRowRefsTs());
7633
- files.set("src/generated/editor-storage-refs.ts", generateEditorStorageRefsTs());
7634
- files.set("src/generated/editor-display-refs.ts", generateEditorDisplayRefsTs());
7628
+ files.set("src/generated/cms-host-refs.ts", generateCmsHostRefsTs(manifest.tables, accesses));
7635
7629
  files.set("src/generated/query.ts", emitQueryTs(READ_API_BANNER));
7636
7630
  files.set("src/generated/storage-helpers.ts", generateStorageHelpersTs());
7637
7631
  files.set(
@@ -7716,7 +7710,7 @@ import { readApiToken } from "./read-api-token.js";
7716
7710
  ${hooks.join("\n\n")}
7717
7711
  `;
7718
7712
  }
7719
- function generateProfileProposalRefsTs(tables, accesses) {
7713
+ function profileProposalPatchUnion(tables, accesses) {
7720
7714
  const byName = new Map(tables.map((table) => [table.name, table]));
7721
7715
  const arms = [];
7722
7716
  const docsUsed = /* @__PURE__ */ new Set();
@@ -7731,16 +7725,23 @@ function generateProfileProposalRefsTs(tables, accesses) {
7731
7725
  arms.push(`| { table: ${name}; op: "update"; rowId: string; fields: Partial<${base}> }`);
7732
7726
  arms.push(`| { table: ${name}; op: "delete"; rowId: string; fields: Record<string, never> }`);
7733
7727
  }
7734
- const union = arms.length ? `
7735
- ${arms.join("\n ")};` : " never;";
7736
- const docImport = docsUsed.size ? `import type { ${[...docsUsed].sort().join(", ")} } from "./documents.js";
7737
- ` : "";
7738
- return `${READ_API_BANNER}// Editor-session proposal API (plan 051 PR 10f): authenticate with the editor's
7739
- // Convex JWT (see @columnus/cms/server getConvexToken) from server code \u2014
7740
- // the public col_ token cannot call these. Patch tables require editorAccess;
7741
- // token propose ops / allowedFields do not apply.
7728
+ return {
7729
+ union: arms.length ? `
7730
+ ${arms.join("\n ")};` : " never;",
7731
+ docImport: docsUsed.size ? `import type { ${[...docsUsed].sort().join(", ")} } from "./documents.js";
7732
+ ` : ""
7733
+ };
7734
+ }
7735
+ function generateCmsHostRefsTs(tables, accesses) {
7736
+ const { union, docImport } = profileProposalPatchUnion(tables, accesses);
7737
+ return `${READ_API_BANNER}// Editor-session CMS host refs: authenticate with the editor Convex JWT
7738
+ // (see @columnus/cms/server getConvexToken) \u2014 the public col_ token cannot
7739
+ // call these. Patch tables require editorAccess; token propose ops /
7740
+ // allowedFields do not apply. Anonymous site rendering keeps
7741
+ // columnus/read/<profile>.* and columnus/read/storage.* .
7742
7742
  import { anyApi } from "convex/server";
7743
- import type { FunctionReference } from "convex/server";
7743
+ import type { FunctionReference, PaginationOptions } from "convex/server";
7744
+ import type { ListResult, Query } from "./query.js";
7744
7745
  ${docImport}
7745
7746
  export type ProfileProposalPatch =${union}
7746
7747
 
@@ -7781,46 +7782,6 @@ export const listProfileProposalsRef = anyApi.columnus.share.listProfileProposal
7781
7782
  export const publishMyProfileProposalRef = anyApi.columnus.share.publishMyProfileProposal as FunctionReference<"mutation", "public", { profileSlug: string }, ProfileProposalOutcome[]>;
7782
7783
 
7783
7784
  export const withdrawMyProfileProposalRef = anyApi.columnus.share.withdrawMyProfileProposal as FunctionReference<"mutation", "public", { profileSlug: string }, { id: string; status: "withdrawn" }>;
7784
- `;
7785
- }
7786
- function generateEditorRowRefsTs() {
7787
- return `${READ_API_BANNER}// Editor-session row reads (plan 051 X9): authenticate with the
7788
- // editor Convex JWT (useCmsEditorAuth / getConvexToken) \u2014 the public col_ token
7789
- // cannot call these. Prefer these refs for CMS editor lists / get-by-id;
7790
- // anonymous site rendering keeps columnus/read/<profile>.* .
7791
- import { anyApi } from "convex/server";
7792
- import type { FunctionReference, PaginationOptions } from "convex/server";
7793
- import type { ListResult, Query } from "./query.js";
7794
-
7795
- export const listRowsRef = anyApi.columnus.rows.listRows as FunctionReference<
7796
- "query",
7797
- "public",
7798
- { table: string; paginationOpts: PaginationOptions; query?: Query },
7799
- ListResult<Record<string, unknown>>
7800
- >;
7801
-
7802
- export const getRowRef = anyApi.columnus.rows.getRow as FunctionReference<
7803
- "query",
7804
- "public",
7805
- { table: string; id: string },
7806
- Record<string, unknown> | null
7807
- >;
7808
-
7809
- export const getRowsByIdsRef = anyApi.columnus.rows.getRowsByIds as FunctionReference<
7810
- "query",
7811
- "public",
7812
- { ids: string[] },
7813
- Record<string, Record<string, unknown>>
7814
- >;
7815
- `;
7816
- }
7817
- function generateEditorStorageRefsTs() {
7818
- return `${READ_API_BANNER}// Editor-session storage (plan 051 PR 10d): authenticate with the
7819
- // editor Convex JWT (useCmsEditorAuth / getConvexToken) \u2014 the public col_ token
7820
- // cannot call these. Prefer these refs for CMS stamp upload + draft media preview;
7821
- // anonymous site rendering keeps columnus/read/storage.* .
7822
- import { anyApi } from "convex/server";
7823
- import type { FunctionReference } from "convex/server";
7824
7785
 
7825
7786
  export const generateUploadUrlRef = anyApi.columnus.storage.generateUploadUrl as FunctionReference<
7826
7787
  "mutation",
@@ -7842,14 +7803,6 @@ export const getStorageMetadataRef = anyApi.columnus.storage.getStorageMetadata
7842
7803
  { fileIds: string[] },
7843
7804
  Array<{ fileId: string; contentType?: string; size: number }>
7844
7805
  >;
7845
- `;
7846
- }
7847
- function generateEditorDisplayRefsTs() {
7848
- return `${READ_API_BANNER}// Editor-session display values: authenticate with the editor Convex
7849
- // JWT (useCmsEditorAuth / getConvexToken). Used by CMS id-pickers for closed
7850
- // labels + search hit text via getDisplayValues.
7851
- import { anyApi } from "convex/server";
7852
- import type { FunctionReference } from "convex/server";
7853
7806
 
7854
7807
  export const getDisplayValuesRef = anyApi.columnus.display.getDisplayValues as FunctionReference<
7855
7808
  "query",
@@ -7857,6 +7810,41 @@ export const getDisplayValuesRef = anyApi.columnus.display.getDisplayValues as F
7857
7810
  { table: string; documentIds: string[] },
7858
7811
  Record<string, { id?: string; preview?: string }>
7859
7812
  >;
7813
+
7814
+ export const listRowsRef = anyApi.columnus.rows.listRows as FunctionReference<
7815
+ "query",
7816
+ "public",
7817
+ { table: string; paginationOpts: PaginationOptions; query?: Query },
7818
+ ListResult<Record<string, unknown>>
7819
+ >;
7820
+
7821
+ export const getRowRef = anyApi.columnus.rows.getRow as FunctionReference<
7822
+ "query",
7823
+ "public",
7824
+ { table: string; id: string },
7825
+ Record<string, unknown> | null
7826
+ >;
7827
+
7828
+ export const getRowsByIdsRef = anyApi.columnus.rows.getRowsByIds as FunctionReference<
7829
+ "query",
7830
+ "public",
7831
+ { ids: string[] },
7832
+ Record<string, Record<string, unknown>>
7833
+ >;
7834
+
7835
+ export const cmsHostRefs = {
7836
+ proposeProfileBatch: proposeProfileBatchRef,
7837
+ listProfileProposals: listProfileProposalsRef,
7838
+ publishMyProfileProposal: publishMyProfileProposalRef,
7839
+ withdrawMyProfileProposal: withdrawMyProfileProposalRef,
7840
+ generateUploadUrl: generateUploadUrlRef,
7841
+ getStorageUrls: getStorageUrlsRef,
7842
+ getStorageMetadata: getStorageMetadataRef,
7843
+ getDisplayValues: getDisplayValuesRef,
7844
+ listRows: listRowsRef,
7845
+ getRow: getRowRef,
7846
+ getRowsByIds: getRowsByIdsRef,
7847
+ };
7860
7848
  `;
7861
7849
  }
7862
7850
  function generateManifestTypesTs() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columnus/api-cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.52",
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",