@holistics/anfra-sdk 0.11.0 → 0.12.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.
@@ -51,7 +51,12 @@ interface paths {
51
51
  };
52
52
  get?: never;
53
53
  put?: never;
54
- /** Run a query: its rows, and the SQL that produced them */
54
+ /**
55
+ * Run a query: its rows, and the SQL that produced them
56
+ * @description Answers one page of rows: page_size's, or without it the first 10000, with has_more saying whether there may be more.
57
+ * Ask the query for what you need (aggregate, filter, a limit: directive) rather than paging through rows; for every row of a large result, export it.
58
+ * Over HTTP, a request that accepts application/x-ndjson is answered as the query runs: its phase, its SQL, its columns, then its rows in batches — every row without page_size, up to the server's maximum.
59
+ */
55
60
  post: operations["core.query"];
56
61
  delete?: never;
57
62
  options?: never;
@@ -407,6 +412,19 @@ interface components {
407
412
  /** @constant */
408
413
  status: 400;
409
414
  };
415
+ /** @description The page is larger than this server answers at once. */
416
+ ErrorBodyPageTooLarge: {
417
+ /** @constant */
418
+ code: "page_too_large";
419
+ context?: components["schemas"]["ContextEntry"][];
420
+ details?: components["schemas"]["PageLimit"];
421
+ message: string;
422
+ request_id: string;
423
+ /** @constant */
424
+ scope: "user";
425
+ /** @constant */
426
+ status: 422;
427
+ };
410
428
  /** @description The query failed to run on its data source. */
411
429
  ErrorBodyQueryFailed: {
412
430
  /** @constant */
@@ -415,9 +433,9 @@ interface components {
415
433
  message: string;
416
434
  request_id: string;
417
435
  /** @constant */
418
- scope: "server";
436
+ scope: "user";
419
437
  /** @constant */
420
- status: 502;
438
+ status: 422;
421
439
  };
422
440
  /** @description The query is invalid. */
423
441
  ErrorBodyQueryInvalid: {
@@ -432,6 +450,19 @@ interface components {
432
450
  /** @constant */
433
451
  status: 422;
434
452
  };
453
+ /** @description The query's result is larger than this server allows. */
454
+ ErrorBodyResultTooLarge: {
455
+ /** @constant */
456
+ code: "result_too_large";
457
+ context?: components["schemas"]["ContextEntry"][];
458
+ details?: components["schemas"]["ResultLimit"];
459
+ message: string;
460
+ request_id: string;
461
+ /** @constant */
462
+ scope: "user";
463
+ /** @constant */
464
+ status: 422;
465
+ };
435
466
  /** @description A sidecar is unavailable. */
436
467
  ErrorBodySidecarUnavailable: {
437
468
  /** @constant */
@@ -550,6 +581,20 @@ interface components {
550
581
  parent: string;
551
582
  };
552
583
  NoInput: Record<string, never>;
584
+ PageLimit: {
585
+ /** Format: int64 */
586
+ max_bytes: number;
587
+ };
588
+ QueryCompiled: {
589
+ /** @description the AQL that runs: the query with its Query Input applied; absent for a SQL query */
590
+ aql?: string;
591
+ sql: string;
592
+ /**
593
+ * @description discriminator enum property added by openapi-typescript
594
+ * @enum {string}
595
+ */
596
+ type: "compiled";
597
+ };
553
598
  QueryCondition: {
554
599
  /** @description an AQL condition */
555
600
  expr: string;
@@ -572,6 +617,16 @@ interface components {
572
617
  /** @description the operator's values, by the field's type: a number as a string in JSON's number syntax, such as "9007199254740993" (a JSON number is refused, since it may have lost digits before it was sent); true or false; a date or text as a string. Empty for an operator that takes none */
573
618
  values: unknown[];
574
619
  };
620
+ QueryHeader: {
621
+ /** @description one per field, in order */
622
+ columns: components["schemas"]["Column"][];
623
+ fields: string[];
624
+ /**
625
+ * @description discriminator enum property added by openapi-typescript
626
+ * @enum {string}
627
+ */
628
+ type: "header";
629
+ };
575
630
  QueryInput: {
576
631
  /** @description the data source a SQL query runs against */
577
632
  data_source?: string;
@@ -586,13 +641,26 @@ interface components {
586
641
  /** @description the query */
587
642
  query: string;
588
643
  };
644
+ QueryRecords: {
645
+ /** @description one array per row, its values in fields' order, written as a page's records are */
646
+ records: unknown[][];
647
+ /**
648
+ * @description discriminator enum property added by openapi-typescript
649
+ * @enum {string}
650
+ */
651
+ type: "rows";
652
+ };
589
653
  QueryResult: {
590
654
  /** @description the AQL that ran: the query with its Query Input applied; absent for a SQL query */
591
655
  aql?: string;
592
656
  /** @description one per field of result, in order */
593
657
  columns: components["schemas"]["Column"][];
658
+ /** @description there may be rows after this page: ask for the next page, or stream the query (without page_size) for every row */
659
+ has_more: boolean;
594
660
  result: components["schemas"]["QueryRows"];
595
661
  sql: string;
662
+ /** @description the query's steps: compiling_query, for AQL; canal-query's own (connecting_to_dw, executing_query, fetching_query_result, and their children, as <parent>.<child>); retrying_query, the wait before canal-query attempts the query again */
663
+ timings: components["schemas"]["Timings"];
596
664
  };
597
665
  QueryRows: {
598
666
  fields: string[];
@@ -636,6 +704,24 @@ interface components {
636
704
  /** @description a result column's name */
637
705
  field: string;
638
706
  };
707
+ QuerySummary: {
708
+ /**
709
+ * Format: int64
710
+ * @description the bytes the warehouse read to run the query, where it reports them (BigQuery, Athena)
711
+ */
712
+ bytes_scanned?: number;
713
+ /** @description a page that may not be the last: there may be rows after it. Without page_size, every row was sent, and this is false */
714
+ has_more: boolean;
715
+ /** Format: int64 */
716
+ row_count: number;
717
+ /** @description the query's steps: compiling_query, for AQL; canal-query's own (connecting_to_dw, executing_query, fetching_query_result, and their children, as <parent>.<child>); retrying_query, the wait before canal-query attempts the query again */
718
+ timings: components["schemas"]["Timings"];
719
+ /**
720
+ * @description discriminator enum property added by openapi-typescript
721
+ * @enum {string}
722
+ */
723
+ type: "summary";
724
+ };
639
725
  QueryTransforms: {
640
726
  /** @description AQL conditions ANDed with the query's own filters */
641
727
  conditions?: components["schemas"]["QueryCondition"][];
@@ -650,6 +736,15 @@ interface components {
650
736
  diagnostics: components["schemas"]["AQLDiagnostic"][];
651
737
  valid: boolean;
652
738
  };
739
+ QueryWarehouse: {
740
+ /** @description the warehouse's own id of the query; for Postgres, the process id of the backend running it */
741
+ id: string;
742
+ /**
743
+ * @description discriminator enum property added by openapi-typescript
744
+ * @enum {string}
745
+ */
746
+ type: "warehouse_query";
747
+ };
653
748
  RepoValidation: {
654
749
  diagnostics: components["schemas"]["CompileError"][];
655
750
  reports: components["schemas"]["ValidationReport"][];
@@ -667,6 +762,22 @@ interface components {
667
762
  /** Format: int64 */
668
763
  line?: number;
669
764
  };
765
+ Response: {
766
+ code: string;
767
+ context?: components["schemas"]["ContextEntry"][];
768
+ details?: unknown;
769
+ message: string;
770
+ request_id: string;
771
+ scope: string;
772
+ /** Format: int64 */
773
+ status?: number;
774
+ };
775
+ ResultLimit: {
776
+ /** Format: int64 */
777
+ max_bytes?: number;
778
+ /** Format: int64 */
779
+ max_rows?: number;
780
+ };
670
781
  SearchInput: {
671
782
  /** @description search query */
672
783
  query?: string[];
@@ -756,6 +867,63 @@ interface components {
756
867
  /** @enum {string} */
757
868
  state: "healthy" | "degraded" | "not_running";
758
869
  };
870
+ StreamEnd: {
871
+ error?: components["schemas"]["Response"];
872
+ /** @enum {string} */
873
+ status: "succeeded" | "failed";
874
+ /**
875
+ * @description discriminator enum property added by openapi-typescript
876
+ * @enum {string}
877
+ */
878
+ type: "end";
879
+ };
880
+ StreamPing: {
881
+ /**
882
+ * @description discriminator enum property added by openapi-typescript
883
+ * @enum {string}
884
+ */
885
+ type: "ping";
886
+ };
887
+ StreamStart: {
888
+ /** @description the run's id, on a host that keeps a record of runs */
889
+ id?: string;
890
+ /**
891
+ * @description discriminator enum property added by openapi-typescript
892
+ * @enum {string}
893
+ */
894
+ type: "start";
895
+ };
896
+ StreamStatus: {
897
+ phase: string;
898
+ /**
899
+ * Format: int64
900
+ * @description while queued: how many runs are ahead of this one, 0 being next; absent otherwise
901
+ */
902
+ position?: number;
903
+ /**
904
+ * @description discriminator enum property added by openapi-typescript
905
+ * @enum {string}
906
+ */
907
+ type: "status";
908
+ };
909
+ TimedStep: {
910
+ /**
911
+ * Format: int64
912
+ * @description when it started, in ms since the run started
913
+ */
914
+ start_ms: number;
915
+ /** @description the step's name, as what ran names it; a child step as <parent>.<child>, within its parent */
916
+ step: string;
917
+ };
918
+ Timings: {
919
+ /**
920
+ * Format: int64
921
+ * @description when the run ended, in ms since it started: its total time, and where its last steps end
922
+ */
923
+ end_ms: number;
924
+ /** @description each step as it started, in order; a step run again is here again */
925
+ steps: components["schemas"]["TimedStep"][];
926
+ };
759
927
  UpdateInfo: {
760
928
  available: boolean;
761
929
  latest: string;
@@ -950,6 +1118,7 @@ interface operations {
950
1118
  };
951
1119
  content: {
952
1120
  "application/json": components["schemas"]["QueryResult"];
1121
+ "application/x-ndjson": components["schemas"]["QueryCompiled"] | components["schemas"]["QueryWarehouse"] | components["schemas"]["QueryHeader"] | components["schemas"]["QueryRecords"] | components["schemas"]["QuerySummary"] | components["schemas"]["StreamStart"] | components["schemas"]["StreamStatus"] | components["schemas"]["StreamEnd"] | components["schemas"]["StreamPing"];
953
1122
  };
954
1123
  };
955
1124
  /** @description invalid_request */
@@ -963,14 +1132,14 @@ interface operations {
963
1132
  };
964
1133
  };
965
1134
  };
966
- /** @description validation_failed, query_invalid */
1135
+ /** @description validation_failed, query_invalid, query_failed, result_too_large, page_too_large */
967
1136
  422: {
968
1137
  headers: {
969
1138
  [name: string]: unknown;
970
1139
  };
971
1140
  content: {
972
1141
  "application/json": {
973
- error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"];
1142
+ error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"] | components["schemas"]["ErrorBodyQueryFailed"] | components["schemas"]["ErrorBodyResultTooLarge"] | components["schemas"]["ErrorBodyPageTooLarge"];
974
1143
  };
975
1144
  };
976
1145
  };
@@ -985,17 +1154,6 @@ interface operations {
985
1154
  };
986
1155
  };
987
1156
  };
988
- /** @description query_failed */
989
- 502: {
990
- headers: {
991
- [name: string]: unknown;
992
- };
993
- content: {
994
- "application/json": {
995
- error: components["schemas"]["ErrorBodyQueryFailed"];
996
- };
997
- };
998
- };
999
1157
  /** @description sidecar_unavailable */
1000
1158
  503: {
1001
1159
  headers: {
@@ -1110,14 +1268,14 @@ interface operations {
1110
1268
  };
1111
1269
  };
1112
1270
  };
1113
- /** @description validation_failed, query_invalid */
1271
+ /** @description validation_failed, query_invalid, query_failed */
1114
1272
  422: {
1115
1273
  headers: {
1116
1274
  [name: string]: unknown;
1117
1275
  };
1118
1276
  content: {
1119
1277
  "application/json": {
1120
- error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"];
1278
+ error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"] | components["schemas"]["ErrorBodyQueryFailed"];
1121
1279
  };
1122
1280
  };
1123
1281
  };
@@ -1143,17 +1301,6 @@ interface operations {
1143
1301
  };
1144
1302
  };
1145
1303
  };
1146
- /** @description query_failed */
1147
- 502: {
1148
- headers: {
1149
- [name: string]: unknown;
1150
- };
1151
- content: {
1152
- "application/json": {
1153
- error: components["schemas"]["ErrorBodyQueryFailed"];
1154
- };
1155
- };
1156
- };
1157
1304
  /** @description sidecar_unavailable */
1158
1305
  503: {
1159
1306
  headers: {
@@ -1842,6 +1989,22 @@ interface QueryDebug {
1842
1989
  executedSql?: string;
1843
1990
  fromCache: boolean;
1844
1991
  executedAt?: Date;
1992
+ /** How the run's time went, where the server reports it. */
1993
+ timings?: QueryTimings;
1994
+ }
1995
+ /**
1996
+ * When each step of a query's run started, in order, in milliseconds since the run started; and
1997
+ * when it ended. A step ends where the next step at its level or above starts — a child step,
1998
+ * `executing_query.poll_query`, is within its parent — or at `endMs`. A step run again after a
1999
+ * retry is listed again. Steps: `compiling_query`; canal-query's `connecting_to_dw`,
2000
+ * `executing_query`, `fetching_query_result` and their children; `retrying_query`.
2001
+ */
2002
+ interface QueryTimings {
2003
+ steps: {
2004
+ step: string;
2005
+ startMs: number;
2006
+ }[];
2007
+ endMs: number;
1845
2008
  }
1846
2009
  interface QueryResult {
1847
2010
  columns: ColumnMeta[];
@@ -1852,6 +2015,12 @@ interface QueryResult {
1852
2015
  /** Present only for a query that declares a `pageSize`. */
1853
2016
  pageSize?: number;
1854
2017
  numRows: number;
2018
+ /**
2019
+ * For a query that declares a `pageSize`: whether rows may follow this page, as its backend
2020
+ * knows it. Absent when the backend does not say; `query.hasMore` then takes a full page to
2021
+ * mean more may follow.
2022
+ */
2023
+ hasMore?: boolean;
1855
2024
  };
1856
2025
  debug?: QueryDebug;
1857
2026
  }
@@ -2112,6 +2281,8 @@ interface BackendQueryResult {
2112
2281
  page?: number;
2113
2282
  pageSize?: number;
2114
2283
  numRows?: number;
2284
+ /** For a paged query: whether rows may follow this page. Omit it when not known. */
2285
+ hasMore?: boolean;
2115
2286
  };
2116
2287
  debug?: QueryDebug;
2117
2288
  }
@@ -2220,4 +2391,5 @@ interface Backend {
2220
2391
  lineage?(request: BackendLineageRequest, signal: AbortSignal): Promise<LineageResult>;
2221
2392
  }
2222
2393
 
2223
- export { type Operator as $, type Aggregation as A, type Backend as B, type ColumnMeta as C, type DatasetDescriptor as D, type EntityKind as E, FILTER_AGGREGATIONS as F, type FieldLineage as G, type FieldSuggestionsRequest as H, type FilterAggregation as I, type FilterDeclaration as J, type FilterValueType as K, type InspectedApp as L, type InspectedControl as M, type InspectedError as N, type InspectedQuery as O, type InspectedSelection as P, type InspectedStructure as Q, type LineageCard as R, type LineageDiagram as S, type LineageNode as T, type LineageOptions as U, type LineageResult as V, type LineageTarget as W, type Listener as X, type LocateKind as Y, type LocateTarget as Z, type MappingJson as _, type AppDeclaration as a, type QueryDebug as a0, type QueryDeclaration as a1, type QueryInput as a2, type QueryResult as a3, type QuerySort as a4, type QueryState as a5, type RenderFormat as a6, type RenderRequest as a7, type Rendering as a8, type Row as a9, type SdkEnvironment as aa, type SdkFeatures as ab, type Selection as ac, type SelectionCondition as ad, type SemanticType as ae, type StructureKind as af, type StructureNode as ag, type Unsubscribe as ah, type User as ai, type paths as aj, type components as ak, type AppJson as b, type ArrowType as c, type BackendCondition as d, type BackendDateDrill as e, type BackendExportRequest as f, type BackendFilter as g, type BackendLineageRequest as h, type BackendQueryRequest as i, type BackendQueryResult as j, type BackendSort as k, type Condition as l, type ConditionValue as m, type ControlMappingJson as n, type CrossFilterJson as o, type DateDrillDeclaration as p, type DateGrain as q, type DateTransformation as r, type EntityRef as s, type EntityUsage as t, type ExecuteOptions as u, type ExecuteSummary as v, type ExportFormat as w, type ExportFormatOptions as x, type ExportOptions as y, type ExportResult as z };
2394
+ export { FILTER_AGGREGATIONS as F };
2395
+ export type { Operator as $, Aggregation as A, Backend as B, ColumnMeta as C, DatasetDescriptor as D, EntityKind as E, FieldLineage as G, FieldSuggestionsRequest as H, FilterAggregation as I, FilterDeclaration as J, FilterValueType as K, InspectedApp as L, InspectedControl as M, InspectedError as N, InspectedQuery as O, InspectedSelection as P, InspectedStructure as Q, LineageCard as R, LineageDiagram as S, LineageNode as T, LineageOptions as U, LineageResult as V, LineageTarget as W, Listener as X, LocateKind as Y, LocateTarget as Z, MappingJson as _, AppDeclaration as a, QueryDebug as a0, QueryDeclaration as a1, QueryInput as a2, QueryResult as a3, QuerySort as a4, QueryState as a5, QueryTimings as a6, RenderFormat as a7, RenderRequest as a8, Rendering as a9, Row as aa, SdkEnvironment as ab, SdkFeatures as ac, Selection as ad, SelectionCondition as ae, SemanticType as af, StructureKind as ag, StructureNode as ah, Unsubscribe as ai, User as aj, paths as ak, components as al, AppJson as b, ArrowType as c, BackendCondition as d, BackendDateDrill as e, BackendExportRequest as f, BackendFilter as g, BackendLineageRequest as h, BackendQueryRequest as i, BackendQueryResult as j, BackendSort as k, Condition as l, ConditionValue as m, ControlMappingJson as n, CrossFilterJson as o, DateDrillDeclaration as p, DateGrain as q, DateTransformation as r, EntityRef as s, EntityUsage as t, ExecuteOptions as u, ExecuteSummary as v, ExportFormat as w, ExportFormatOptions as x, ExportOptions as y, ExportResult as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holistics/anfra-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Data Apps on anfra: the authoring layer (app), what hosts one (host), anfra's plugins (plugins), the core API client (api), and their shared contract (common)",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -66,7 +66,7 @@
66
66
  "html-to-image": "1.11.13",
67
67
  "jsdom": "^26.1.0",
68
68
  "openapi-typescript": "^7.13.0",
69
- "tsup": "^8.5.1",
69
+ "tsup": "^9.0.0",
70
70
  "typescript": "^5.9.3",
71
71
  "vitest": "^4.1.11"
72
72
  },