@malloydata/malloy 0.0.263-dev250414184158 → 0.0.263-dev250414204152
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/api/core.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type CompileResponse = {
|
|
|
18
18
|
compilerNeeds?: undefined;
|
|
19
19
|
logs: LogMessage[];
|
|
20
20
|
};
|
|
21
|
-
export declare function compileQuery(request: Malloy.CompileQueryRequest, state?:
|
|
21
|
+
export declare function compileQuery(request: Malloy.CompileQueryRequest, state?: CompileQueryState): Malloy.CompileQueryResponse;
|
|
22
22
|
export interface CompileModelState {
|
|
23
23
|
extending?: CompileModelState;
|
|
24
24
|
translator: MalloyTranslator;
|
|
@@ -34,5 +34,8 @@ export declare function _statedCompileModel(state: CompileModelState): CompileRe
|
|
|
34
34
|
export declare function compileModel(request: Malloy.CompileModelRequest, state?: CompileModelState): Malloy.CompileModelResponse;
|
|
35
35
|
export declare function compileSource(request: Malloy.CompileSourceRequest): Malloy.CompileSourceResponse;
|
|
36
36
|
export declare function hasErrors(log: Malloy.LogMessage[] | undefined): boolean;
|
|
37
|
-
export
|
|
38
|
-
|
|
37
|
+
export interface CompileQueryState extends CompileModelState {
|
|
38
|
+
defaultRowLimit?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function newCompileQueryState(request: Malloy.CompileQueryRequest): CompileQueryState;
|
|
41
|
+
export declare function statedCompileQuery(state: CompileQueryState): Malloy.CompileQueryResponse;
|
package/dist/api/core.js
CHANGED
|
@@ -384,10 +384,6 @@ function hasErrors(log) {
|
|
|
384
384
|
return (_a = log === null || log === void 0 ? void 0 : log.some(m => m.severity === 'error')) !== null && _a !== void 0 ? _a : false;
|
|
385
385
|
}
|
|
386
386
|
exports.hasErrors = hasErrors;
|
|
387
|
-
// Given a StableQueryDef and the URL to a model, run it and return a StableResult
|
|
388
|
-
// Given a StableQueryDef and the URL to a model, compile it and return a StableResultDef
|
|
389
|
-
// Given a StableQueryDef and the URL to a model, validate it and return a list of StableErrors
|
|
390
|
-
// Given a URL to a model and the name of a source, run the indexing query
|
|
391
387
|
function newCompileQueryState(request) {
|
|
392
388
|
var _a, _b;
|
|
393
389
|
const queryMalloy = Malloy.queryToMalloy(request.query);
|
|
@@ -402,7 +398,10 @@ function newCompileQueryState(request) {
|
|
|
402
398
|
},
|
|
403
399
|
...((_b = needs.files) !== null && _b !== void 0 ? _b : []),
|
|
404
400
|
];
|
|
405
|
-
return
|
|
401
|
+
return {
|
|
402
|
+
..._newCompileModelState(queryURL, needs, request.model_url),
|
|
403
|
+
defaultRowLimit: request.default_row_limit,
|
|
404
|
+
};
|
|
406
405
|
}
|
|
407
406
|
exports.newCompileQueryState = newCompileQueryState;
|
|
408
407
|
function statedCompileQuery(state) {
|
|
@@ -432,7 +431,9 @@ function statedCompileQuery(state) {
|
|
|
432
431
|
const annotations = (_a = result.model.anonymous_queries[index].annotations) !== null && _a !== void 0 ? _a : [];
|
|
433
432
|
try {
|
|
434
433
|
const queryModel = new model_1.QueryModel(result.modelDef);
|
|
435
|
-
const translatedQuery = queryModel.compileQuery(query
|
|
434
|
+
const translatedQuery = queryModel.compileQuery(query, {
|
|
435
|
+
defaultRowLimit: state.defaultRowLimit,
|
|
436
|
+
});
|
|
436
437
|
const modelAnnotations = (0, annotation_1.annotationToTaglines)(result.modelDef.annotation).map(l => ({
|
|
437
438
|
value: l,
|
|
438
439
|
}));
|
|
@@ -457,6 +458,7 @@ function statedCompileQuery(state) {
|
|
|
457
458
|
model_annotations: modelAnnotations.length > 0 ? modelAnnotations : undefined,
|
|
458
459
|
query_timezone: translatedQuery.queryTimezone,
|
|
459
460
|
},
|
|
461
|
+
default_row_limit_added: translatedQuery.defaultRowLimitAdded,
|
|
460
462
|
};
|
|
461
463
|
}
|
|
462
464
|
catch (error) {
|
|
@@ -377,7 +377,10 @@ 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):
|
|
380
|
+
addDefaultRowLimit(query: Query, defaultRowLimit?: number): {
|
|
381
|
+
query: Query;
|
|
382
|
+
addedDefaultRowLimit?: number;
|
|
383
|
+
};
|
|
381
384
|
compileQuery(query: Query, prepareResultOptions?: PrepareResultOptions, finalize?: boolean): CompiledQuery;
|
|
382
385
|
exploreSearchSQLMap: Map<any, any>;
|
|
383
386
|
searchIndex(connection: Connection, explore: string, searchValue: string, limit?: number, searchField?: string | undefined): Promise<SearchIndexResult[] | undefined>;
|
|
@@ -3760,28 +3760,34 @@ class QueryModel {
|
|
|
3760
3760
|
};
|
|
3761
3761
|
}
|
|
3762
3762
|
addDefaultRowLimit(query, defaultRowLimit) {
|
|
3763
|
+
const nope = { query, addedDefaultRowLimit: undefined };
|
|
3763
3764
|
if (defaultRowLimit === undefined)
|
|
3764
|
-
return
|
|
3765
|
+
return nope;
|
|
3765
3766
|
const lastSegment = query.pipeline[query.pipeline.length - 1];
|
|
3766
3767
|
if (lastSegment.type === 'raw')
|
|
3767
|
-
return
|
|
3768
|
+
return nope;
|
|
3768
3769
|
if (lastSegment.limit !== undefined)
|
|
3769
|
-
return
|
|
3770
|
+
return nope;
|
|
3770
3771
|
return {
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3772
|
+
query: {
|
|
3773
|
+
...query,
|
|
3774
|
+
pipeline: [
|
|
3775
|
+
...query.pipeline.slice(0, -1),
|
|
3776
|
+
{
|
|
3777
|
+
...lastSegment,
|
|
3778
|
+
limit: defaultRowLimit,
|
|
3779
|
+
},
|
|
3780
|
+
],
|
|
3781
|
+
},
|
|
3782
|
+
addedDefaultRowLimit: defaultRowLimit,
|
|
3779
3783
|
};
|
|
3780
3784
|
}
|
|
3781
3785
|
compileQuery(query, prepareResultOptions, finalize = true) {
|
|
3782
3786
|
var _a, _b;
|
|
3783
3787
|
let newModel;
|
|
3784
|
-
|
|
3788
|
+
const addDefaultRowLimit = this.addDefaultRowLimit(query, prepareResultOptions === null || prepareResultOptions === void 0 ? void 0 : prepareResultOptions.defaultRowLimit);
|
|
3789
|
+
query = addDefaultRowLimit.query;
|
|
3790
|
+
const addedDefaultRowLimit = addDefaultRowLimit.addedDefaultRowLimit;
|
|
3785
3791
|
const m = newModel || this;
|
|
3786
3792
|
const ret = m.loadQuery(query, undefined, prepareResultOptions, finalize, false);
|
|
3787
3793
|
const structRef = (_a = query.compositeResolvedSourceDef) !== null && _a !== void 0 ? _a : query.structRef;
|
|
@@ -3809,6 +3815,7 @@ class QueryModel {
|
|
|
3809
3815
|
connectionName: ret.connectionName,
|
|
3810
3816
|
annotation: query.annotation,
|
|
3811
3817
|
queryTimezone: ret.structs[0].queryTimezone,
|
|
3818
|
+
defaultRowLimitAdded: addedDefaultRowLimit,
|
|
3812
3819
|
};
|
|
3813
3820
|
}
|
|
3814
3821
|
async searchIndex(connection, explore, searchValue, limit = 1000, searchField = undefined) {
|
|
@@ -839,6 +839,7 @@ export interface CompiledQuery extends DrillSource {
|
|
|
839
839
|
annotation?: Annotation;
|
|
840
840
|
dependenciesToMaterialize?: Record<string, QueryToMaterialize>;
|
|
841
841
|
materialization?: QueryToMaterialize;
|
|
842
|
+
defaultRowLimitAdded?: number;
|
|
842
843
|
}
|
|
843
844
|
/** Result type for running a Malloy query. */
|
|
844
845
|
export interface QueryResult extends CompiledQuery {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.263-
|
|
3
|
+
"version": "0.0.263-dev250414204152",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@malloydata/malloy-filter": "^0.0.263-
|
|
45
|
-
"@malloydata/malloy-interfaces": "^0.0.263-
|
|
46
|
-
"@malloydata/malloy-tag": "^0.0.263-
|
|
44
|
+
"@malloydata/malloy-filter": "^0.0.263-dev250414204152",
|
|
45
|
+
"@malloydata/malloy-interfaces": "^0.0.263-dev250414204152",
|
|
46
|
+
"@malloydata/malloy-tag": "^0.0.263-dev250414204152",
|
|
47
47
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
48
48
|
"assert": "^2.0.0",
|
|
49
49
|
"jaro-winkler": "^0.2.8",
|