@spotto/contract 1.0.70-alpha.20 → 1.0.70-alpha.22

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.
@@ -7,6 +7,7 @@
7
7
  * refining a query made seconds ago, one saved last month, or one built by
8
8
  * clicking filter pills are all the identical call.
9
9
  */
10
+ import { SemanticQueryEntityType } from '../../semantic-queries/shared';
10
11
  export interface PostAiSemanticQueryRequest {
11
12
  /**
12
13
  * What the user asked for, in natural language — a fresh query ("blood
@@ -21,6 +22,18 @@ export interface PostAiSemanticQueryRequest {
21
22
  * `query`-kind records refine; anything else starts fresh.
22
23
  */
23
24
  baseQueryId?: string;
25
+ /**
26
+ * WHICH list to build a query for — which vocabulary the model is shown and
27
+ * the compiler gates against. Defaults to `asset`, what this endpoint has
28
+ * always meant.
29
+ *
30
+ * Only entities the language actually speaks are accepted, and the refusal
31
+ * is loud. Falling back to assets for an entity with no preamble would
32
+ * generate a valid ASSET query from a location question: it compiles, it
33
+ * runs, and it returns a plausible list of the wrong kind of record — the
34
+ * silent-wrong-rows failure this whole surface is built to prevent.
35
+ */
36
+ entityType?: SemanticQueryEntityType;
24
37
  /**
25
38
  * IANA timezone for "today" in the prompt and for the draft's relative-date
26
39
  * resolution — recorded on the registered record exactly as a hand-built
@@ -1,5 +1,6 @@
1
1
  import { SortOrders } from '../shared';
2
2
  import { AssetSortField } from '../assets/get/query';
3
+ import { LocationSortField } from '../locations/get/query';
3
4
  import { LocationStatus, LocationType } from '../locations/constants';
4
5
  import { FieldDataType } from '../fields/constants';
5
6
  /**
@@ -375,7 +376,7 @@ export declare const semanticConditionTypesByEntity: Record<SemanticQueryEntityT
375
376
  * validator, which knows the entity and can say "'readiness' is an asset
376
377
  * condition" instead of "not allowed".
377
378
  */
378
- export declare const semanticConditionTypes: readonly ("telemetry" | "readiness" | "location" | "manifest" | "and" | "or" | "assetType" | "homeLocation" | "withAsset" | "customField" | "createdDate" | "lastUpdated" | "lastChanged" | "lastSeen" | "firstSeen" | "geolocation" | "tags" | "kit" | "locationStatus" | "path" | "locationType" | "hasReaders" | "geofence")[];
379
+ export declare const semanticConditionTypes: readonly ("telemetry" | "readiness" | "path" | "location" | "manifest" | "and" | "or" | "assetType" | "homeLocation" | "withAsset" | "customField" | "createdDate" | "lastUpdated" | "lastChanged" | "lastSeen" | "firstSeen" | "geolocation" | "tags" | "kit" | "locationStatus" | "locationType" | "hasReaders" | "geofence")[];
379
380
  export declare type SemanticConditionType = (typeof semanticConditionTypes)[number];
380
381
  /**
381
382
  * Query size bounds, shared by the boundary schema (which refuses an oversized
@@ -486,10 +487,29 @@ export declare type SemanticQueryViewType = (typeof semanticQueryViewTypes)[numb
486
487
  * legacy view persisted it on `filters.search` — the one member of that object
487
488
  * that was never really a filter — and that is the behaviour being dropped.
488
489
  */
490
+ /**
491
+ * Every sort field a saved list can remember, across entities.
492
+ *
493
+ * This was `AssetSortField` — written when assets were the only thing the
494
+ * language spoke, and missed when the vocabulary was split per entity. A
495
+ * location list sorts by `path`, which no asset has, so saving a location view
496
+ * was rejected at the boundary with a message naming only the asset fields.
497
+ *
498
+ * A UNION rather than a per-entity type, deliberately, and the reasoning is
499
+ * the opposite of the one that made CONDITIONS per-entity. A condition from
500
+ * the wrong vocabulary runs and returns the wrong rows silently — that had to
501
+ * be undecidable-proof. A sort from the wrong entity just names a field the
502
+ * documents do not have: the order falls back, nothing is hidden, and no row
503
+ * is wrongly included or excluded. Splitting `display` per entity to prevent a
504
+ * harmless odd ordering would cost a discriminated union on every read path
505
+ * for no safety gained.
506
+ */
507
+ export declare type SemanticQuerySortField = AssetSortField | LocationSortField;
508
+ export declare const semanticQuerySortFields: SemanticQuerySortField[];
489
509
  export interface SemanticQueryDisplay {
490
510
  columnVisibility?: Record<string, boolean>;
491
511
  columnOrder?: string[];
492
- sort?: AssetSortField;
512
+ sort?: SemanticQuerySortField;
493
513
  sortOrder?: SortOrders;
494
514
  /** Absent means the client's default rendering. */
495
515
  viewType?: SemanticQueryViewType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.semanticQueryViewTypes = exports.SEMANTIC_QUERY_VERSION = exports.SEMANTIC_QUERY_LIMITS = exports.semanticConditionTypes = exports.semanticConditionTypesByEntity = exports.semanticLocationConditionTypes = exports.semanticAssetConditionTypes = exports.semanticGroupConditionTypes = exports.semanticReadinessLevels = exports.semanticTelemetryFields = exports.semanticSetOperators = exports.semanticComparisonOperators = exports.semanticTimestampOperators = exports.semanticFieldOperators = exports.semanticRelativeDatePositions = exports.semanticRelativeDateBases = exports.semanticQueryVisibilities = exports.semanticQueryKinds = exports.semanticQueryEntityTypes = void 0;
3
+ exports.semanticQuerySortFields = exports.semanticQueryViewTypes = exports.SEMANTIC_QUERY_VERSION = exports.SEMANTIC_QUERY_LIMITS = exports.semanticConditionTypes = exports.semanticConditionTypesByEntity = exports.semanticLocationConditionTypes = exports.semanticAssetConditionTypes = exports.semanticGroupConditionTypes = exports.semanticReadinessLevels = exports.semanticTelemetryFields = exports.semanticSetOperators = exports.semanticComparisonOperators = exports.semanticTimestampOperators = exports.semanticFieldOperators = exports.semanticRelativeDatePositions = exports.semanticRelativeDateBases = exports.semanticQueryVisibilities = exports.semanticQueryKinds = exports.semanticQueryEntityTypes = void 0;
4
4
  /**
5
5
  * SEMANTIC QUERIES — the portable query language.
6
6
  *
@@ -221,4 +221,24 @@ exports.SEMANTIC_QUERY_VERSION = 2;
221
221
  // --- Stored-record display config -----------------------------------------
222
222
  /** Which rendering of the asset list a saved query opens in. */
223
223
  exports.semanticQueryViewTypes = ['table', 'map', 'tree'];
224
+ /**
225
+ * The same list as VALUES, for the boundary schema.
226
+ *
227
+ * Keyed as a Record so the compiler enforces it BOTH ways: a field missing
228
+ * here is a build error, and one that is not a real sort field is too. The
229
+ * validator hand-wrote `searchableSortFields, 'battery', 'ready'` — which was
230
+ * correct when assets were the only entity and became a rejection of every
231
+ * location view the moment they were not. A hand-kept copy of a type is a copy
232
+ * that drifts; this one cannot.
233
+ */
234
+ const SEMANTIC_QUERY_SORT_FIELD_SET = {
235
+ name: true,
236
+ updated: true,
237
+ created: true,
238
+ relevancy: true,
239
+ battery: true,
240
+ ready: true,
241
+ path: true,
242
+ };
243
+ exports.semanticQuerySortFields = Object.keys(SEMANTIC_QUERY_SORT_FIELD_SET);
224
244
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/semantic-queries/shared.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,6EAA6E;AAE7E;;;GAGG;AACU,QAAA,wBAAwB,GAAG;IACtC,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;CACF,CAAA;AAGV;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,CAAC,OAAO,EAAE,WAAW,CAAU,CAAA;AAGpD,QAAA,yBAAyB,GAAG,CAAC,SAAS,EAAE,cAAc,CAAU,CAAA;AAG7E,6EAA6E;AAEhE,QAAA,yBAAyB,GAAG;IACvC,KAAK;IACL,MAAM;IACN,OAAO;IACP,SAAS;IACT,MAAM;CACE,CAAA;AAGG,QAAA,6BAA6B,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA;AAwC9E,6EAA6E;AAEhE,QAAA,sBAAsB,GAAG;IACpC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,UAAU;IACV,QAAQ;IACR,WAAW;CACH,CAAA;AAGG,QAAA,0BAA0B,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAA;AAIhE,QAAA,2BAA2B,GAAG;IACzC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;CACG,CAAA;AAIG,QAAA,oBAAoB,GAAG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sB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA;AAsCvE;;;;;;;;;GASG;AACH,MAAM,6BAA6B,GAAyC;IAC1E,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;CACX,CAAA;AACY,QAAA,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAChD,6BAA6B,CACF,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotto/contract",
3
3
  "license": "ISC",
4
- "version": "1.0.70-alpha.20",
4
+ "version": "1.0.70-alpha.22",
5
5
  "description": "Spotto's API Contract type definitions",
6
6
  "main": "./dist/index.js",
7
7
  "files": [
@@ -18,5 +18,5 @@
18
18
  "@types/geojson": "^7946.0.11",
19
19
  "shx": "^0.3.4"
20
20
  },
21
- "gitHead": "76c7272f0c6ec68cc60a268988d86064851b652b"
21
+ "gitHead": "408ff86c771a08a0212019f79fb80bea2902587b"
22
22
  }