@malloydata/malloy 0.0.226 → 0.0.227-dev250116181727

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/malloy.d.ts CHANGED
@@ -28,6 +28,7 @@ interface CompileQueryOptions {
28
28
  replaceMaterializedReferences?: boolean;
29
29
  materializedTablePrefix?: string;
30
30
  eventStream?: EventStream;
31
+ defaultRowLimit?: number;
31
32
  }
32
33
  export declare class Malloy {
33
34
  static get version(): string;
package/dist/malloy.js CHANGED
@@ -232,7 +232,10 @@ class Malloy {
232
232
  }
233
233
  queryModel = new model_1.QueryModel(partialModel, options === null || options === void 0 ? void 0 : options.eventStream);
234
234
  }
235
- const compiledSql = queryModel.compileQuery(segment, options, false).sql;
235
+ const compiledSql = queryModel.compileQuery(segment, {
236
+ ...options,
237
+ defaultRowLimit: undefined,
238
+ }, false).sql;
236
239
  selectStr += parenAlready ? compiledSql : `(${compiledSql})`;
237
240
  parenAlready = false;
238
241
  }
@@ -377,6 +377,7 @@ export declare class QueryModel {
377
377
  getStructByName(name: string): QueryStruct;
378
378
  getStructFromRef(structRef: StructRef, sourceArguments: Record<string, Argument> | undefined, prepareResultOptions?: PrepareResultOptions): QueryStruct;
379
379
  loadQuery(query: Query, stageWriter: StageWriter | undefined, prepareResultOptions?: PrepareResultOptions, emitFinalStage?: boolean, isJoinedSubquery?: boolean): QueryResults;
380
+ addDefaultRowLimit(query: Query, defaultRowLimit?: number): Query;
380
381
  compileQuery(query: Query, prepareResultOptions?: PrepareResultOptions, finalize?: boolean): CompiledQuery;
381
382
  exploreSearchSQLMap: Map<any, any>;
382
383
  searchIndex(connection: Connection, explore: string, searchValue: string, limit?: number, searchField?: string | undefined): Promise<SearchIndexResult[] | undefined>;
@@ -3637,9 +3637,29 @@ class QueryModel {
3637
3637
  connectionName: q.parent.connectionName,
3638
3638
  };
3639
3639
  }
3640
+ addDefaultRowLimit(query, defaultRowLimit) {
3641
+ if (defaultRowLimit === undefined)
3642
+ return query;
3643
+ const lastSegment = query.pipeline[query.pipeline.length - 1];
3644
+ if (lastSegment.type === 'raw')
3645
+ return query;
3646
+ if (lastSegment.limit !== undefined)
3647
+ return query;
3648
+ return {
3649
+ ...query,
3650
+ pipeline: [
3651
+ ...query.pipeline.slice(0, -1),
3652
+ {
3653
+ ...lastSegment,
3654
+ limit: defaultRowLimit,
3655
+ },
3656
+ ],
3657
+ };
3658
+ }
3640
3659
  compileQuery(query, prepareResultOptions, finalize = true) {
3641
3660
  var _a, _b;
3642
3661
  let newModel;
3662
+ query = this.addDefaultRowLimit(query, prepareResultOptions === null || prepareResultOptions === void 0 ? void 0 : prepareResultOptions.defaultRowLimit);
3643
3663
  const m = newModel || this;
3644
3664
  const ret = m.loadQuery(query, undefined, prepareResultOptions, finalize, false);
3645
3665
  const structRef = (_a = query.compositeResolvedSourceDef) !== null && _a !== void 0 ? _a : query.structRef;
@@ -861,6 +861,7 @@ export interface SearchValueMapResult {
861
861
  export interface PrepareResultOptions {
862
862
  replaceMaterializedReferences?: boolean;
863
863
  materializedTablePrefix?: string;
864
+ defaultRowLimit?: number;
864
865
  }
865
866
  type UTD = AtomicTypeDef | TypedDef | FunctionParameterTypeDef | FunctionReturnTypeDef | undefined;
866
867
  /**
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.226";
1
+ export declare const MALLOY_VERSION = "0.0.227";
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MALLOY_VERSION = void 0;
4
4
  // generated with 'generate-version-file' script; do not edit manually
5
- exports.MALLOY_VERSION = '0.0.226';
5
+ exports.MALLOY_VERSION = '0.0.227';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.226",
3
+ "version": "0.0.227-dev250116181727",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",