@lotics/app-sdk 0.112.0 → 0.113.1

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/index.js CHANGED
@@ -25542,6 +25542,9 @@ var queryGroupNodeSchema = zod_default.object({
25542
25542
  by: zod_default.array(queryGroupKeySchema).describe(
25543
25543
  "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."
25544
25544
  ),
25545
+ sets: zod_default.array(zod_default.array(zod_default.string())).min(1).optional().describe(
25546
+ "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."
25547
+ ),
25545
25548
  aggregates: zod_default.array(queryAggregateColumnSchema).min(1)
25546
25549
  });
25547
25550
  var queryWindowNodeSchema = zod_default.object({
@@ -30526,21 +30529,15 @@ function compareFieldValues(aValue, bValue, field, blankPosition = "bottom", ord
30526
30529
 
30527
30530
  // ../shared/src/formula_references.ts
30528
30531
  var FIELD_REF_TOKEN = /\{([^{}]+)\}/g;
30529
- function buildRefIndex(fields) {
30530
- const index = /* @__PURE__ */ new Map();
30531
- for (const field of fields) index.set(field.name, field.key);
30532
- for (const field of fields) index.set(field.key, field.key);
30533
- return index;
30534
- }
30535
30532
  function prepareFormulaExpression(expression, fields) {
30536
- const index = buildRefIndex(fields);
30533
+ const keys2 = new Set(fields.map((field) => field.key));
30537
30534
  const referencedKeys = [];
30538
30535
  const unresolved = [];
30539
30536
  const seenKeys = /* @__PURE__ */ new Set();
30540
30537
  const seenRefs = /* @__PURE__ */ new Set();
30541
30538
  const lowered = expression.replace(FIELD_REF_TOKEN, (_raw, inner) => {
30542
30539
  const ref = inner.trim();
30543
- const key = index.get(ref);
30540
+ const key = keys2.has(ref) ? ref : void 0;
30544
30541
  if (key === void 0) {
30545
30542
  if (!seenRefs.has(ref)) {
30546
30543
  seenRefs.add(ref);
package/docs/queries.md CHANGED
@@ -279,6 +279,11 @@ Full semantics in §8. `by` may be empty (a single-row aggregate); `aggregates`
279
279
  Aggregate operation × input-column type is validated at bind. Grouping collapses rows —
280
280
  addressing is `null`. An aggregate's `filter` limits it to the rows that match (§8).
281
281
 
282
+ `sets` answers several groupings in one read: `"sets": [["status", "period"], ["status"], []]`
283
+ groups by both keys, by `status` alone, and over every row, in one pass. A key a set leaves out
284
+ is `null` on its rows, and `__grouping` names each row's set — a bit per `by` key it leaves out,
285
+ the last key the lowest bit (`["status"]` above is `1`, `[]` is `3`).
286
+
282
287
  ### `window` — aggregate without collapsing
283
288
 
284
289
  ```jsonc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.112.0",
3
+ "version": "0.113.1",
4
4
  "description": "The SDK a Lotics custom-code app reads and writes through \u2014 typed hooks over the host bridge, cell readers, mount() and AppRouter",
5
5
  "type": "module",
6
6
  "exports": {