@spotto/contract 1.0.70-alpha.17 → 1.0.70-alpha.19

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 (67) hide show
  1. package/dist/ai/chat/index.d.ts +2 -0
  2. package/dist/ai/chat/index.js +19 -0
  3. package/dist/ai/chat/index.js.map +1 -0
  4. package/dist/ai/chat/request.d.ts +27 -0
  5. package/dist/ai/chat/request.js +3 -0
  6. package/dist/ai/chat/request.js.map +1 -0
  7. package/dist/ai/chat/response.d.ts +57 -0
  8. package/dist/ai/chat/response.js +11 -0
  9. package/dist/ai/chat/response.js.map +1 -0
  10. package/dist/ai/expression/request.d.ts +3 -1
  11. package/dist/ai/index.d.ts +3 -0
  12. package/dist/ai/index.js +3 -0
  13. package/dist/ai/index.js.map +1 -1
  14. package/dist/ai/semantic-query/index.d.ts +2 -0
  15. package/dist/ai/semantic-query/index.js +19 -0
  16. package/dist/ai/semantic-query/index.js.map +1 -0
  17. package/dist/ai/semantic-query/request.d.ts +30 -0
  18. package/dist/ai/semantic-query/request.js +3 -0
  19. package/dist/ai/semantic-query/request.js.map +1 -0
  20. package/dist/ai/semantic-query/response.d.ts +40 -0
  21. package/dist/ai/semantic-query/response.js +3 -0
  22. package/dist/ai/semantic-query/response.js.map +1 -0
  23. package/dist/ai/shared.d.ts +22 -0
  24. package/dist/ai/shared.js +11 -0
  25. package/dist/ai/shared.js.map +1 -0
  26. package/dist/assets/count/query.d.ts +16 -1
  27. package/dist/assets/get/query.d.ts +9 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/semantic-queries/[id]/index.d.ts +1 -0
  32. package/dist/semantic-queries/[id]/index.js +18 -0
  33. package/dist/semantic-queries/[id]/index.js.map +1 -0
  34. package/dist/semantic-queries/[id]/patch/index.d.ts +2 -0
  35. package/dist/semantic-queries/[id]/patch/index.js +19 -0
  36. package/dist/semantic-queries/[id]/patch/index.js.map +1 -0
  37. package/dist/semantic-queries/[id]/patch/request.d.ts +20 -0
  38. package/dist/semantic-queries/[id]/patch/request.js +3 -0
  39. package/dist/semantic-queries/[id]/patch/request.js.map +1 -0
  40. package/dist/semantic-queries/[id]/patch/response.d.ts +1 -0
  41. package/dist/semantic-queries/[id]/patch/response.js +3 -0
  42. package/dist/semantic-queries/[id]/patch/response.js.map +1 -0
  43. package/dist/semantic-queries/get/index.d.ts +2 -0
  44. package/dist/semantic-queries/get/index.js +19 -0
  45. package/dist/semantic-queries/get/index.js.map +1 -0
  46. package/dist/semantic-queries/get/query.d.ts +18 -0
  47. package/dist/semantic-queries/get/query.js +3 -0
  48. package/dist/semantic-queries/get/query.js.map +1 -0
  49. package/dist/semantic-queries/get/response.d.ts +40 -0
  50. package/dist/semantic-queries/get/response.js +3 -0
  51. package/dist/semantic-queries/get/response.js.map +1 -0
  52. package/dist/semantic-queries/index.d.ts +4 -0
  53. package/dist/semantic-queries/index.js +21 -0
  54. package/dist/semantic-queries/index.js.map +1 -0
  55. package/dist/semantic-queries/post/index.d.ts +2 -0
  56. package/dist/semantic-queries/post/index.js +19 -0
  57. package/dist/semantic-queries/post/index.js.map +1 -0
  58. package/dist/semantic-queries/post/request.d.ts +56 -0
  59. package/dist/semantic-queries/post/request.js +3 -0
  60. package/dist/semantic-queries/post/request.js.map +1 -0
  61. package/dist/semantic-queries/post/response.d.ts +1 -0
  62. package/dist/semantic-queries/post/response.js +3 -0
  63. package/dist/semantic-queries/post/response.js.map +1 -0
  64. package/dist/semantic-queries/shared.d.ts +373 -0
  65. package/dist/semantic-queries/shared.js +136 -0
  66. package/dist/semantic-queries/shared.js.map +1 -0
  67. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/chat/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,27 @@
1
+ import { SemanticQueryEntityType } from '../../semantic-queries';
2
+ /**
3
+ * The chat entry point (POST /ai/chat) — one door, intent-routed.
4
+ *
5
+ * Every message is classified by a cheap model first (two tiers on purpose:
6
+ * classification costs a fraction of generation, and generation only runs once
7
+ * the intent is known). Only a supported intent goes on to pay for the big
8
+ * model; everything else is answered honestly as recognised-but-not-built.
9
+ */
10
+ export interface PostAiChatRequest {
11
+ /** The user's chat message, verbatim. */
12
+ message: string;
13
+ /**
14
+ * Id of the stored query the user currently has open, if any. Context for
15
+ * the classifier (an instruction fragment refines the open query) and the
16
+ * refinement base when the turn generates.
17
+ */
18
+ baseQueryId?: string;
19
+ /**
20
+ * Which entity list is on screen. A bare refinement ("last 30 days") typed
21
+ * while viewing one list refines THAT list — without this hint it would be
22
+ * classified as an asset query and answer a different question entirely.
23
+ */
24
+ viewing?: SemanticQueryEntityType;
25
+ /** IANA timezone, forwarded to generation (see PostAiSemanticQueryRequest). */
26
+ timezone?: string;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/ai/chat/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import { SemanticQueryEntityType } from '../../semantic-queries';
2
+ import { AiTokenUsage } from '../shared';
3
+ import { PostAiSemanticQueryResponse } from '../semantic-query';
4
+ export declare const aiChatActions: readonly ["filter", "edit", "help", "general"];
5
+ /** What the user wants to DO: see records, change records, learn the product, or chat. */
6
+ export declare type AiChatAction = (typeof aiChatActions)[number];
7
+ /**
8
+ * What the classifier understood — returned on EVERY response so the client
9
+ * can show what was understood and the misroutes are visible, not silent.
10
+ */
11
+ export interface AiChatIntent {
12
+ action: AiChatAction;
13
+ /**
14
+ * What the action applies to (what the user wants BACK, not what is
15
+ * mentioned in passing). Null for help/general. This is what a saved query
16
+ * stores as `entityType` — the classifier speaks the same vocabulary.
17
+ */
18
+ entity: SemanticQueryEntityType | null;
19
+ /** The classifier's one-line restatement of the request. */
20
+ summary: string;
21
+ /** False for intents recognised but not yet built (they answer honestly). */
22
+ supported: boolean;
23
+ }
24
+ /**
25
+ * Which shape the client got. `query` executes today; `help`, `general` and
26
+ * `unsupported` carry an honest text reply — help content and bulk-operation
27
+ * crafting are recognised by the classifier but deliberately deferred.
28
+ */
29
+ export declare const aiChatResponseKinds: readonly ["query", "help", "general", "unsupported"];
30
+ export declare type AiChatResponseKind = (typeof aiChatResponseKinds)[number];
31
+ interface AiChatResponseBase {
32
+ /** Discriminator for the payload shape. */
33
+ kind: AiChatResponseKind;
34
+ /** What the classifier understood. */
35
+ intent: AiChatIntent;
36
+ /** The classifier model that routed the turn (server-side config). */
37
+ classifierModel: string;
38
+ /**
39
+ * Whole-turn usage: classifier plus (for `query`) generation. The embedded
40
+ * generation result carries its own generation-only figure.
41
+ */
42
+ tokens: AiTokenUsage;
43
+ }
44
+ /** A filter turn that went to generation — the full generation result, embedded. */
45
+ export interface AiChatQueryResponse extends AiChatResponseBase {
46
+ kind: 'query';
47
+ /** The generation outcome, identical to POST /ai/semantic-query. */
48
+ result: PostAiSemanticQueryResponse;
49
+ }
50
+ /** A text-only turn: product help, general chat, or recognised-but-not-built. */
51
+ export interface AiChatReplyResponse extends AiChatResponseBase {
52
+ kind: 'help' | 'general' | 'unsupported';
53
+ /** The reply to show, markdown-safe plain text. */
54
+ reply: string;
55
+ }
56
+ export declare type PostAiChatResponse = AiChatQueryResponse | AiChatReplyResponse;
57
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aiChatResponseKinds = exports.aiChatActions = void 0;
4
+ exports.aiChatActions = ['filter', 'edit', 'help', 'general'];
5
+ /**
6
+ * Which shape the client got. `query` executes today; `help`, `general` and
7
+ * `unsupported` carry an honest text reply — help content and bulk-operation
8
+ * crafting are recognised by the classifier but deliberately deferred.
9
+ */
10
+ exports.aiChatResponseKinds = ['query', 'help', 'general', 'unsupported'];
11
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/ai/chat/response.ts"],"names":[],"mappings":";;;AAIa,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAU,CAAA;AAsB3E;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAU,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import { FieldDataType, FieldInputType, FieldSource } from '../../fields';
2
+ import { AiProvider } from '../shared';
2
3
  export declare type AiExpressionMode = 'readinessRule' | 'computedField';
3
- export declare type AiExpressionProvider = 'openai' | 'anthropic';
4
+ /** Kept under its original name; the general union now lives in ai/shared.ts. */
5
+ export declare type AiExpressionProvider = AiProvider;
4
6
  /**
5
7
  * A field the AI may reference, supplied inline by the client (which already
6
8
  * holds the type's resolved fields). A trimmed view of `GetFieldResponse` — the
@@ -1 +1,4 @@
1
+ export * from './shared';
1
2
  export * from './expression';
3
+ export * from './semantic-query';
4
+ export * from './chat';
package/dist/ai/index.js CHANGED
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared"), exports);
17
18
  __exportStar(require("./expression"), exports);
19
+ __exportStar(require("./semantic-query"), exports);
20
+ __exportStar(require("./chat"), exports);
18
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B;AAC5B,mDAAgC;AAChC,yCAAsB"}
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/semantic-query/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Natural language → semantic query (POST /ai/semantic-query).
3
+ *
4
+ * The compiler is the gate: nothing is returned or stored unless it compiles
5
+ * against the org's real vocabulary. Refinement is IR-as-state — `baseQueryId`
6
+ * points at the stored record being refined; there is no transcript, so
7
+ * refining a query made seconds ago, one saved last month, or one built by
8
+ * clicking filter pills are all the identical call.
9
+ */
10
+ export interface PostAiSemanticQueryRequest {
11
+ /**
12
+ * What the user asked for, in natural language — a fresh query ("blood
13
+ * analysers that aren't ready") or a refinement instruction ("just the
14
+ * Brisbane ones") when `baseQueryId` is set.
15
+ */
16
+ prompt: string;
17
+ /**
18
+ * Id of the stored semantic query being refined. The stored record IS the
19
+ * conversation state: generation returns a NEW draft whose `derivedFrom`
20
+ * points here, and undo walks that chain with no AI call. Only same-entity
21
+ * `query`-kind records refine; anything else starts fresh.
22
+ */
23
+ baseQueryId?: string;
24
+ /**
25
+ * IANA timezone for "today" in the prompt and for the draft's relative-date
26
+ * resolution — recorded on the registered record exactly as a hand-built
27
+ * registration would.
28
+ */
29
+ timezone?: string;
30
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/ai/semantic-query/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { GetSemanticQueryResponse } from '../../semantic-queries';
2
+ import { AiTokenUsage } from '../shared';
3
+ /**
4
+ * One thing the generation could not do, written to be shown to a user.
5
+ * Two sources, one shape: the MODEL declining honestly ("no such field —
6
+ * did you mean X?") and the COMPILER rejecting what the model produced after
7
+ * its one repair attempt. An honest issue always beats a plausible query —
8
+ * every failure class this feature guards against runs successfully and
9
+ * returns the wrong rows.
10
+ */
11
+ export interface AiSemanticQueryIssue {
12
+ /** Machine code (`MODEL_DECLINED`, or a compiler code like `UNKNOWN_FIELD`). */
13
+ code: string;
14
+ /** Human-readable explanation, shown to the user unchanged. */
15
+ message: string;
16
+ /** Where in the generated query the problem sits, when known (compiler issues). */
17
+ path?: string;
18
+ /** Nearest real vocabulary ("Did you mean 'SerialNumber'?"), when one exists. */
19
+ suggestion?: string;
20
+ }
21
+ /**
22
+ * `ok: true` → the query compiled and was registered as a draft; `record` is
23
+ * the stored record, identical in shape to `GET /semantic-queries/{id}` (the
24
+ * caller reads/refines/promotes it by `record.id` from here on).
25
+ * `ok: false` → nothing was stored; `issues` say why.
26
+ */
27
+ export interface PostAiSemanticQueryResponse {
28
+ /** Whether a validated draft was registered. */
29
+ ok: boolean;
30
+ /** The registered draft (null when `ok` is false). */
31
+ record: GetSemanticQueryResponse | null;
32
+ /** Why generation declined or failed (empty when `ok` is true). */
33
+ issues: AiSemanticQueryIssue[];
34
+ /** True when the first attempt failed validation and the model's repair passed. */
35
+ repaired: boolean;
36
+ /** The generation model that answered (server-side config). */
37
+ model: string;
38
+ /** Token usage across all generation calls this turn (repair included). */
39
+ tokens: AiTokenUsage;
40
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/ai/semantic-query/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared shapes for the AI endpoints (expression helper, semantic-query
3
+ * generation, chat). Provider and model are always SERVER-SIDE config — no
4
+ * request shape may carry them, because the caller must never choose which
5
+ * vendor or model spends Spotto's key.
6
+ */
7
+ export declare const aiProviders: readonly ["openai", "anthropic"];
8
+ /** An LLM vendor Spotto can call. */
9
+ export declare type AiProvider = (typeof aiProviders)[number];
10
+ /**
11
+ * Token usage for one AI turn, for observability and offline costing. No
12
+ * dollar figure on the wire — unit prices drift, so cost is derived from
13
+ * model + tokens where the prices are maintained, not baked into responses.
14
+ */
15
+ export interface AiTokenUsage {
16
+ /** Prompt-side tokens, cached included. */
17
+ in: number;
18
+ /** Completion-side tokens. */
19
+ out: number;
20
+ /** The part of `in` served from the provider's prompt cache. */
21
+ cached: number;
22
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Shared shapes for the AI endpoints (expression helper, semantic-query
4
+ * generation, chat). Provider and model are always SERVER-SIDE config — no
5
+ * request shape may carry them, because the caller must never choose which
6
+ * vendor or model spends Spotto's key.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.aiProviders = void 0;
10
+ exports.aiProviders = ['openai', 'anthropic'];
11
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/ai/shared.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,WAAW,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAU,CAAA"}
@@ -1 +1,16 @@
1
- export { AssetFilters as CountAssetsQuery } from '../get/query';
1
+ import { AssetFilters } from '../get/query';
2
+ export interface CountAssetsQuery extends AssetFilters {
3
+ /**
4
+ * Count a stored semantic query by reference instead of the flat filters.
5
+ * Must NOT be combined with any filter member — the combination is
6
+ * rejected, never merged. An expired or unknown id returns a distinct
7
+ * "gone" error, never a zero count.
8
+ */
9
+ semanticQueryId?: string;
10
+ /**
11
+ * IANA timezone for resolving relative date conditions. The list endpoint
12
+ * has always accepted this; count needs it too, or the same query counted
13
+ * and listed can resolve "today" in two different zones and disagree.
14
+ */
15
+ timezone?: string;
16
+ }
@@ -70,5 +70,14 @@ export interface GetAssetsQuery extends AssetFilters {
70
70
  sortOrder?: SortOrders;
71
71
  embed?: Array<AssetEmbedField>;
72
72
  timezone?: string;
73
+ /**
74
+ * Execute a stored semantic query by reference — the new-client read path.
75
+ * Must NOT be combined with any of the `AssetFilters` members above: the
76
+ * stored query is the whole filter, and the controller rejects the
77
+ * combination rather than silently merging two filter systems. Pagination,
78
+ * sort, embed and timezone still apply. An expired or unknown id returns a
79
+ * distinct "gone" error, never an empty page.
80
+ */
81
+ semanticQueryId?: string;
73
82
  }
74
83
  export {};
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from './system';
22
22
  export * from './reports';
23
23
  export * from './sso';
24
24
  export * from './views';
25
+ export * from './semantic-queries';
25
26
  export * from './forms';
26
27
  export * from './actions';
27
28
  export * from './submissions';
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ __exportStar(require("./system"), exports);
38
38
  __exportStar(require("./reports"), exports);
39
39
  __exportStar(require("./sso"), exports);
40
40
  __exportStar(require("./views"), exports);
41
+ __exportStar(require("./semantic-queries"), exports);
41
42
  __exportStar(require("./forms"), exports);
42
43
  __exportStar(require("./actions"), exports);
43
44
  __exportStar(require("./submissions"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uCAAoB;AACpB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB;AACvB,0CAAuB;AACvB,4CAAyB;AACzB,gDAA6B;AAC7B,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uCAAoB;AACpB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB;AACvB,qDAAkC;AAClC,0CAAuB;AACvB,4CAAyB;AACzB,gDAA6B;AAC7B,+CAA4B"}
@@ -0,0 +1 @@
1
+ export * from './patch';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./patch"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/semantic-queries/[id]/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB"}
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/semantic-queries/[id]/patch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,20 @@
1
+ import { SemanticQuery, SemanticQueryVisibility, SemanticQueryDisplay } from '../../shared';
2
+ /**
3
+ * Update a stored record. Setting `name` on a draft PROMOTES it: the expiry is
4
+ * cleared and the same record — same id — becomes a saved query. There is no
5
+ * copy and no second store; save is a lifecycle change, not a relocation.
6
+ *
7
+ * On an already-saved record this is the rename/update path: `semanticQuery`
8
+ * replaces the stored query (the save-back after editing via a linked draft),
9
+ * `display` the table config, and so on. Fields omitted are left unchanged.
10
+ */
11
+ export interface PatchSemanticQueryRequest {
12
+ name?: string;
13
+ description?: string;
14
+ /** `organisation` requires the share permission. */
15
+ visibility?: SemanticQueryVisibility;
16
+ semanticQuery?: SemanticQuery;
17
+ display?: SemanticQueryDisplay;
18
+ /** IANA timezone the query's relative dates resolve against. */
19
+ timezone?: string;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/semantic-queries/[id]/patch/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { GetSemanticQueryResponse as PatchSemanticQueryResponse } from '../../get/response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/semantic-queries/[id]/patch/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './query';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./query"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/semantic-queries/get/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,6CAA0B"}
@@ -0,0 +1,18 @@
1
+ import { StandardSortFields, SortOrders } from '../../shared';
2
+ import { SemanticQueryEntityType, SemanticQueryKind } from '../shared';
3
+ export declare type SemanticQueryEmbedField = 'meta';
4
+ /**
5
+ * Lists SAVED records only — drafts are session state, addressed by id, and
6
+ * never appear in listings.
7
+ */
8
+ export interface GetSemanticQueriesQuery {
9
+ page?: number;
10
+ limit?: number;
11
+ ids?: string[];
12
+ sort?: StandardSortFields;
13
+ sortOrder?: SortOrders;
14
+ embed?: Array<SemanticQueryEmbedField>;
15
+ entityType?: SemanticQueryEntityType;
16
+ /** `query` (saved views) or `operation` (saved commands). Both when absent. */
17
+ kind?: SemanticQueryKind;
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/semantic-queries/get/query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { IEntityMeta } from '../../shared';
2
+ import { SemanticQuery, SemanticQueryEntityType, SemanticQueryKind, SemanticQueryVisibility, SemanticQueryDisplay, SemanticOperationPayload } from '../shared';
3
+ import { GetSemanticQueriesQuery } from './query';
4
+ /**
5
+ * A stored semantic query — draft or saved, one record either way.
6
+ *
7
+ * `expiresAt` tells the lifecycle stage: a millisecond timestamp on drafts
8
+ * (sliding — each use pushes it out, so expiry genuinely means abandonment),
9
+ * `null` once saved. `name` is present exactly when saved.
10
+ */
11
+ export interface GetSemanticQueryResponse {
12
+ id: string;
13
+ kind: SemanticQueryKind;
14
+ entityType: SemanticQueryEntityType;
15
+ semanticQuery: SemanticQuery;
16
+ /** Present only when kind is `operation`. */
17
+ operation?: SemanticOperationPayload;
18
+ /** Present exactly when the record is saved. */
19
+ name?: string;
20
+ description?: string;
21
+ /** The natural-language prompt this query was generated from, if any. */
22
+ prompt?: string;
23
+ /** Id of the record this one refined — the undo chain. Drafts only. */
24
+ derivedFrom?: string;
25
+ createdBy: string;
26
+ /** `private` (creator only) or `organisation` (shared org-wide). */
27
+ visibility: SemanticQueryVisibility;
28
+ /** Table display config. Populated on save; absent on drafts. */
29
+ display?: SemanticQueryDisplay;
30
+ /** IANA timezone the query's relative dates resolve against. */
31
+ timezone?: string;
32
+ /** Draft expiry (ms since epoch), or null once saved. */
33
+ expiresAt: number | null;
34
+ meta?: IEntityMeta;
35
+ }
36
+ export interface GetSemanticQueriesResponse {
37
+ query: GetSemanticQueriesQuery | null;
38
+ total: number;
39
+ items: GetSemanticQueryResponse[];
40
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/semantic-queries/get/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './shared';
2
+ export * from './get';
3
+ export * from './post';
4
+ export * from './[id]';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared"), exports);
18
+ __exportStar(require("./get"), exports);
19
+ __exportStar(require("./post"), exports);
20
+ __exportStar(require("./[id]"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/semantic-queries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,wCAAqB;AACrB,yCAAsB;AACtB,yCAAsB"}