@caelo-cms/provisioning 0.11.8 → 0.11.9

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/agent-db.js +21 -1
  2. package/package.json +2 -2
package/dist/agent-db.js CHANGED
@@ -6717,10 +6717,25 @@ var pageQuerySchema = object({
6717
6717
  limit: number2().int().min(1).max(LIST_QUERY_MAX_LIMIT)
6718
6718
  }).strict();
6719
6719
  var pageQueryPartialSchema = pageQuerySchema.partial();
6720
+ var QUERY_SOURCE_EXAMPLE = '{kind:"query", defaults:{page_type:"<slug>", order:"published_desc", limit:10}}';
6721
+ var PAGINATED_QUERY_SOURCE_EXAMPLE = '{kind:"query", defaults:{page_type:"<slug>", order:"published_desc"}} with paginate:{} on the field (no limit; paginate.per_page is the page size)';
6722
+ function missingQueryDefaults(defaults, where) {
6723
+ const missing = [];
6724
+ if (defaults.order === undefined) {
6725
+ missing.push('order ("published_desc", "published_asc", "title_asc", or "prop_desc:<property>" / "prop_asc:<property>")');
6726
+ }
6727
+ if (where !== "paginated" && defaults.limit === undefined) {
6728
+ missing.push(where === "field" ? "limit (1\u201350; for an overview of every matching page instead: no limit and `paginate:{}` on the list field)" : "limit (1\u201350)");
6729
+ }
6730
+ if (missing.length === 0)
6731
+ return null;
6732
+ const example = where === "paginated" ? PAGINATED_QUERY_SOURCE_EXAMPLE : QUERY_SOURCE_EXAMPLE;
6733
+ return `a query source needs ${missing.join(" and ")} in source.defaults \u2014 e.g. ${example}.`;
6734
+ }
6720
6735
  var sourceDefSchema = discriminatedUnion("kind", [
6721
6736
  object({
6722
6737
  kind: literal("query"),
6723
- editable: array(_enum(QUERY_KNOBS)).max(QUERY_KNOBS.length),
6738
+ editable: array(_enum(QUERY_KNOBS)).max(QUERY_KNOBS.length).default([]),
6724
6739
  defaults: pageQueryPartialSchema
6725
6740
  }).strict(),
6726
6741
  object({
@@ -6937,6 +6952,11 @@ function listFieldIssues(f) {
6937
6952
  }
6938
6953
  if (f.paginate !== undefined)
6939
6954
  issues.push(...paginateIssues(f));
6955
+ if (bind === "source" && f.source?.kind === "query") {
6956
+ const missing = missingQueryDefaults(f.source.defaults, f.paginate !== undefined ? "paginated" : "field");
6957
+ if (missing !== null)
6958
+ issues.push(`list field "${f.name}": ${missing}`);
6959
+ }
6940
6960
  return issues;
6941
6961
  }
6942
6962
  function paginateIssues(f) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caelo-cms/provisioning",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
6
  "description": "Pulumi-driven provisioning for Caelo CMS — `bunx @caelo-cms/provisioning --provider <self-hosted|gcp|aws|azure>` brings up a TLS-served install with Postgres + storage + secrets manager + the admin + the API gateway.",
@@ -40,7 +40,7 @@
40
40
  "prepublishOnly": "tsc -b --force && bun build ../platform-updater/src/agent-db.ts --target=bun --outfile=dist/agent-db.js && tsc --project stacks/gcp/tsconfig.json && tsc --project stacks/gcp-firebase/tsconfig.json"
41
41
  },
42
42
  "dependencies": {
43
- "@caelo-cms/shared": "^0.11.8",
43
+ "@caelo-cms/shared": "^0.11.9",
44
44
  "@clack/prompts": "1.8.1",
45
45
  "@pulumi/command": "^1",
46
46
  "@pulumi/gcp": "^10",