@lotics/cli 0.286.0 → 0.287.0

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/src/cli.js +56 -45
  2. package/package.json +1 -1
package/dist/src/cli.js CHANGED
@@ -32715,7 +32715,7 @@ function validateContract(contract) {
32715
32715
  }
32716
32716
  }
32717
32717
  for (const entity of contract.entities) {
32718
- const ownFields = fieldsOnEntity(entity.alias);
32718
+ const ownFields2 = fieldsOnEntity(entity.alias);
32719
32719
  for (const field of entity.fields) {
32720
32720
  const fieldPath = `entities.${entity.alias}.fields.${field.alias}`;
32721
32721
  const stated = statedFigureSelect(field);
@@ -32815,7 +32815,7 @@ function validateContract(contract) {
32815
32815
  for (const token2 of parseFieldRefTokens(field.formula.expression)) {
32816
32816
  const option = contractOptionRef(token2);
32817
32817
  const ref = option?.field ?? token2;
32818
- if (!ownFields.has(ref)) {
32818
+ if (!ownFields2.has(ref)) {
32819
32819
  errors.push({
32820
32820
  severity: "error",
32821
32821
  rule: "field.formula",
@@ -34154,7 +34154,7 @@ function computedTypeFindings(entities) {
34154
34154
  }
34155
34155
 
34156
34156
  // ../shared/src/schemas/app_spec_version.ts
34157
- var APP_SPEC_VERSION = 14;
34157
+ var APP_SPEC_VERSION = 15;
34158
34158
 
34159
34159
  // ../shared/src/schemas/app_query_aggregate.ts
34160
34160
  var AGGREGATE_MAX_BY = 3;
@@ -34350,6 +34350,8 @@ var specEntitySchema = zod_default.object({
34350
34350
  figure: specColumnAliasSchema.optional(),
34351
34351
  /** Every row (register, picker). */
34352
34352
  list: specReadSchema,
34353
+ /** The fields a row of `list` carries, where fewer than `fields`: a record's own ride `one`. */
34354
+ listed: zod_default.array(specColumnAliasSchema).min(1).optional(),
34353
34355
  /** One row by its id; `param` names the id. */
34354
34356
  one: specReadSchema.optional(),
34355
34357
  /** The workflows that write this entity's rows; absent, this app does not. `fields` are what an add asks where nothing narrower is stated. */
@@ -35639,6 +35641,9 @@ var queryGroupNodeSchema = zod_default.object({
35639
35641
  by: zod_default.array(queryGroupKeySchema).describe(
35640
35642
  "Group keys: input column names, or `{ bucket: { source, granularity, output } }` date buckets. A bucket truncates a date/datetime column to the bucket START as a `date` column (wall-clock semantics; `week` starts on ISO Monday; null source \u2192 null bucket). Empty = single-row aggregate."
35641
35643
  ),
35644
+ sets: zod_default.array(zod_default.array(zod_default.string())).min(1).optional().describe(
35645
+ "Several groupings answered by one read: each lists the `by` outputs it groups by (`[]` = one row over every row). A key outside a row's set is null there, and `__grouping` holds the set's bits: one per `by` key it leaves out, the last key the lowest. Absent: one grouping by every key."
35646
+ ),
35642
35647
  aggregates: zod_default.array(queryAggregateColumnSchema).min(1)
35643
35648
  });
35644
35649
  var queryWindowNodeSchema = zod_default.object({
@@ -37870,15 +37875,15 @@ function listBack(model, record2, list2, rows) {
37870
37875
  const backs = rows.fields.filter((one) => one.type === "select_record_link" && one.target_entity === record2.alias && (list2.paired_field_alias === void 0 || one.alias === list2.paired_field_alias));
37871
37876
  return backs.length === 1 ? backs[0]?.alias : void 0;
37872
37877
  }
37873
- function actFields(act) {
37878
+ function actFields(act, record2 = true) {
37874
37879
  return [
37875
37880
  ...act.asks.flatMap((ask) => typeof ask === "string" ? [ask] : ask.default === void 0 ? [] : [ask.default]),
37876
37881
  ...act.requires,
37877
- ...act.recommends,
37882
+ ...record2 ? act.recommends : [],
37878
37883
  ...act.when.map((gate) => gate.field),
37879
37884
  ...(act.templates ?? []).flatMap((one) => one.when.map((gate) => gate.field)),
37880
37885
  ...Object.keys(act.set),
37881
- ...act.into === void 0 ? [] : [act.into],
37886
+ ...record2 && act.into !== void 0 ? [act.into] : [],
37882
37887
  ...act.intake === void 0 ? [] : [...act.intake.fields, ...act.intake.parties.map((party) => party.link)]
37883
37888
  ];
37884
37889
  }
@@ -37899,36 +37904,7 @@ function appDrawnFields(given, app) {
37899
37904
  const add = (alias2, fields) => {
37900
37905
  drawn.set(alias2, unique2([...drawn.get(alias2) ?? [], ...fields]));
37901
37906
  };
37902
- const own2 = [
37903
- ...app.scope === void 0 ? [] : [app.scope.field],
37904
- ...app.register.columns,
37905
- ...app.register.filters.map(filterField),
37906
- ...app.register.search ?? [],
37907
- ...(app.register.sort ?? []).map((key) => key.field),
37908
- ...app.register.group === void 0 ? [] : [app.register.group],
37909
- ...app.register.create ?? [],
37910
- // A chip it opens on narrows the rows in view by a column the read returns, and an add writes what `where` keeps;
37911
- // a lane is the row its link names.
37912
- ...[...app.register.where, ...app.register.opens].map((one) => one.field),
37913
- ...app.register.lanes === void 0 ? [] : [app.register.lanes.field, app.register.lanes.start, ...app.register.lanes.end === void 0 ? [] : [app.register.lanes.end], ...(app.register.lanes.loads ?? []).map((load) => load.value)],
37914
- ...app.register.roster?.of === void 0 ? [] : [app.register.roster.of],
37915
- ...app.register.gantt === void 0 ? [] : ganttFields(app.register.gantt),
37916
- ...app.register.readings.flatMap(readingFields),
37917
- // A tab narrows, bounds and orders the rows by columns the read returns.
37918
- ...app.register.tabs.flatMap((tab) => [
37919
- ...tab.term === void 0 ? [] : tab.term.kind === "in" ? [tab.term.field] : [tab.term.from, tab.term.to],
37920
- ...tab.where.map((one) => one.field),
37921
- ...(tab.sort ?? []).map((key) => key.field)
37922
- ]),
37923
- ...app.record.sections.flatMap((section) => [...section.fields, ...section.when.map((gate) => gate.field)]),
37924
- ...resolvedBlocks(app.record).flatMap((block) => [
37925
- ...block.kind === "files" ? block.fields : block.kind === "text" ? [block.field] : [],
37926
- ...block.when.map((gate) => gate.field)
37927
- ]),
37928
- ...app.acts.flatMap((act) => act.of === void 0 ? actFields(act) : []),
37929
- ...app.checks.flatMap((check2) => check2.of === void 0 ? [check2.field] : [])
37930
- ];
37931
- add(app.entity, own2);
37907
+ add(app.entity, ownFields(app, true));
37932
37908
  for (const alias2 of [app.entity, ...resolvedBlocks(app.record).flatMap((block) => block.kind === "rows" ? [block.entity] : [])]) {
37933
37909
  const about = recordDisplay(model, alias2)?.description;
37934
37910
  if (about !== void 0) add(alias2, [about]);
@@ -38006,22 +37982,57 @@ function appDrawnFields(given, app) {
38006
37982
  for (const [alias2, writes] of plan) {
38007
37983
  add(alias2, [...writes.create ?? [], ...writes.update, ...writes.stamps.map((stamp) => stamp.field)]);
38008
37984
  const written = /* @__PURE__ */ new Set([...writes.create ?? [], ...writes.update]);
38009
- const entity = entityOf(model, alias2);
38010
37985
  for (const [field, rule] of Object.entries(model.write_rules?.[alias2]?.fields ?? {})) {
38011
37986
  if (rule.suggest !== void 0 && written.has(field)) {
38012
37987
  const offered = suggestRef(rule.suggest);
38013
37988
  add(offered.entity, [offered.field]);
38014
37989
  }
38015
- if (rule.default_from === void 0 || !written.has(field) || entity === void 0) continue;
38016
- const [via = "", source = ""] = rule.default_from.split(".");
38017
- const link = fieldOf(entity, via);
38018
- if (link?.type !== "select_record_link") continue;
38019
- add(alias2, [via]);
38020
- add(link.target_entity, [source]);
37990
+ const start = written.has(field) ? startOf(model, alias2, rule) : void 0;
37991
+ if (start === void 0) continue;
37992
+ add(alias2, [start.via]);
37993
+ add(start.target, [start.source]);
38021
37994
  }
38022
37995
  }
38023
37996
  return followLinks(model, drawn);
38024
37997
  }
37998
+ function ownFields(app, record2) {
37999
+ return [
38000
+ ...app.scope === void 0 ? [] : [app.scope.field],
38001
+ ...app.register.columns,
38002
+ ...app.register.filters.map(filterField),
38003
+ ...app.register.search ?? [],
38004
+ ...(app.register.sort ?? []).map((key) => key.field),
38005
+ ...app.register.group === void 0 ? [] : [app.register.group],
38006
+ ...record2 ? app.register.create ?? [] : [],
38007
+ // A chip it opens on narrows the rows in view by a column the read returns, and an add writes what `where` keeps;
38008
+ // a lane is the row its link names.
38009
+ ...[...app.register.where, ...app.register.opens].map((one) => one.field),
38010
+ ...app.register.lanes === void 0 ? [] : [app.register.lanes.field, app.register.lanes.start, ...app.register.lanes.end === void 0 ? [] : [app.register.lanes.end], ...(app.register.lanes.loads ?? []).map((load) => load.value)],
38011
+ ...app.register.roster?.of === void 0 ? [] : [app.register.roster.of],
38012
+ ...app.register.gantt === void 0 ? [] : ganttFields(app.register.gantt),
38013
+ ...app.register.readings.flatMap(readingFields),
38014
+ // A tab narrows, bounds and orders the rows by columns the read returns.
38015
+ ...app.register.tabs.flatMap((tab) => [
38016
+ ...tab.term === void 0 ? [] : tab.term.kind === "in" ? [tab.term.field] : [tab.term.from, tab.term.to],
38017
+ ...tab.where.map((one) => one.field),
38018
+ ...(tab.sort ?? []).map((key) => key.field)
38019
+ ]),
38020
+ // A report narrows the rows in view by what it states, as a chip does, and one file per value splits them.
38021
+ ...app.register.export === void 0 || app.register.export === true ? [] : app.register.export.flatMap((report) => [...report.where.map((one) => one.field), ...report.per === void 0 ? [] : [report.per]]),
38022
+ // A section's condition gates, on a row, an act that states none of its own.
38023
+ ...app.record.sections.flatMap((section) => [...record2 ? section.fields : [], ...section.when.map((gate) => gate.field)]),
38024
+ ...record2 ? resolvedBlocks(app.record).flatMap((block) => [...block.kind === "files" ? block.fields : block.kind === "text" ? [block.field] : [], ...block.when.map((gate) => gate.field)]) : [],
38025
+ ...app.acts.flatMap((act) => act.of === void 0 ? actFields(act, record2) : []),
38026
+ ...app.checks.flatMap((check2) => check2.of === void 0 ? [check2.field] : [])
38027
+ ];
38028
+ }
38029
+ function startOf(model, alias2, rule) {
38030
+ const entity = entityOf(model, alias2);
38031
+ if (rule.default_from === void 0 || entity === void 0) return void 0;
38032
+ const [via = "", source = ""] = rule.default_from.split(".");
38033
+ const link = fieldOf(entity, via);
38034
+ return link?.type === "select_record_link" ? { via, target: link.target_entity, source } : void 0;
38035
+ }
38025
38036
  function readingsDrawnFields(model, readings) {
38026
38037
  const drawn = /* @__PURE__ */ new Map();
38027
38038
  for (const reading of readings) drawn.set(reading.entity, unique2([...drawn.get(reading.entity) ?? [], ...readingFields(reading)]));
@@ -41966,8 +41977,8 @@ function resultSideEffects(result) {
41966
41977
  }
41967
41978
 
41968
41979
  // src/version.ts
41969
- var VERSION = "0.286.0";
41970
- var APP_SDK_VERSION = "0.112.0";
41980
+ var VERSION = "0.287.0";
41981
+ var APP_SDK_VERSION = "0.113.0";
41971
41982
 
41972
41983
  // src/timezone.ts
41973
41984
  function machineTimezone() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.286.0",
3
+ "version": "0.287.0",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {