@malloydata/malloy 0.0.404 → 0.0.405
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/LICENSE +77 -0
- package/dist/api/asynchronous.js +2 -4
- package/dist/api/connection.js +2 -4
- package/dist/api/core.js +5 -6
- package/dist/api/foundation/annotation.js +3 -11
- package/dist/api/foundation/compile.js +15 -8
- package/dist/api/foundation/core.d.ts +44 -6
- package/dist/api/foundation/core.js +106 -31
- package/dist/api/foundation/runtime.js +9 -19
- package/dist/api/foundation/taggable.d.ts +5 -0
- package/dist/api/foundation/types.d.ts +15 -0
- package/dist/api/index.js +4 -6
- package/dist/api/sessioned.js +2 -4
- package/dist/api/stateless.js +2 -4
- package/dist/api/util.js +2 -4
- package/dist/connection/base_connection.js +2 -4
- package/dist/connection/types.d.ts +1 -3
- package/dist/connection_utils.js +2 -20
- package/dist/dialect/dialect.js +2 -20
- package/dist/dialect/dialect_map.js +2 -20
- package/dist/dialect/duckdb/dialect_functions.js +2 -4
- package/dist/dialect/duckdb/duckdb.js +2 -20
- package/dist/dialect/duckdb/function_overrides.js +2 -4
- package/dist/dialect/duckdb/index.js +2 -20
- package/dist/dialect/duckdb/table-path-parser.js +4 -4
- package/dist/dialect/functions/index.js +2 -20
- package/dist/dialect/functions/malloy_standard_functions.js +2 -4
- package/dist/dialect/functions/util.js +2 -21
- package/dist/dialect/index.js +2 -20
- package/dist/dialect/mysql/dialect_functions.js +2 -4
- package/dist/dialect/mysql/function_overrides.js +2 -4
- package/dist/dialect/mysql/index.js +2 -4
- package/dist/dialect/mysql/mysql.js +2 -20
- package/dist/dialect/pg_impl.js +2 -4
- package/dist/dialect/postgres/dialect_functions.js +2 -4
- package/dist/dialect/postgres/function_overrides.js +2 -4
- package/dist/dialect/postgres/index.js +2 -20
- package/dist/dialect/postgres/postgres.js +2 -20
- package/dist/dialect/snowflake/dialect_functions.js +2 -4
- package/dist/dialect/snowflake/function_overrides.js +2 -4
- package/dist/dialect/snowflake/index.js +2 -20
- package/dist/dialect/snowflake/snowflake.js +2 -20
- package/dist/dialect/standardsql/dialect_functions.js +2 -4
- package/dist/dialect/standardsql/function_overrides.js +2 -4
- package/dist/dialect/standardsql/index.js +2 -20
- package/dist/dialect/standardsql/standardsql.js +2 -20
- package/dist/dialect/tiny_parser.js +2 -4
- package/dist/dialect/trino/dialect_functions.js +2 -4
- package/dist/dialect/trino/function_overrides.js +2 -4
- package/dist/dialect/trino/index.js +2 -20
- package/dist/dialect/trino/trino.js +2 -20
- package/dist/index.js +4 -22
- package/dist/lang/ast/ast-utils.js +2 -20
- package/dist/lang/ast/error-factory.js +2 -20
- package/dist/lang/ast/expressions/apply.js +2 -20
- package/dist/lang/ast/expressions/binary-boolean.js +2 -20
- package/dist/lang/ast/expressions/binary-numeric.js +2 -20
- package/dist/lang/ast/expressions/boolean.js +2 -20
- package/dist/lang/ast/expressions/case.js +2 -4
- package/dist/lang/ast/expressions/constant-expression.js +2 -20
- package/dist/lang/ast/expressions/expr-add-sub.js +2 -20
- package/dist/lang/ast/expressions/expr-aggregate-function.js +2 -20
- package/dist/lang/ast/expressions/expr-alternation-tree.js +2 -20
- package/dist/lang/ast/expressions/expr-array-literal.js +2 -4
- package/dist/lang/ast/expressions/expr-asymmetric.js +2 -20
- package/dist/lang/ast/expressions/expr-avg.js +2 -20
- package/dist/lang/ast/expressions/expr-cast.js +2 -20
- package/dist/lang/ast/expressions/expr-coalesce.js +2 -20
- package/dist/lang/ast/expressions/expr-compare.js +2 -20
- package/dist/lang/ast/expressions/expr-count-distinct.js +2 -20
- package/dist/lang/ast/expressions/expr-count.js +2 -20
- package/dist/lang/ast/expressions/expr-filter-expr.js +2 -4
- package/dist/lang/ast/expressions/expr-func.js +2 -20
- package/dist/lang/ast/expressions/expr-granular-time.js +2 -20
- package/dist/lang/ast/expressions/expr-id-reference.js +2 -20
- package/dist/lang/ast/expressions/expr-logical-op.js +2 -20
- package/dist/lang/ast/expressions/expr-max.js +2 -20
- package/dist/lang/ast/expressions/expr-min.js +2 -20
- package/dist/lang/ast/expressions/expr-minus.js +2 -20
- package/dist/lang/ast/expressions/expr-mul-div.js +2 -20
- package/dist/lang/ast/expressions/expr-not.js +2 -20
- package/dist/lang/ast/expressions/expr-now.js +2 -20
- package/dist/lang/ast/expressions/expr-null.js +2 -20
- package/dist/lang/ast/expressions/expr-number.js +2 -20
- package/dist/lang/ast/expressions/expr-parens.js +2 -20
- package/dist/lang/ast/expressions/expr-props.js +2 -20
- package/dist/lang/ast/expressions/expr-record-literal.js +2 -4
- package/dist/lang/ast/expressions/expr-regex.js +2 -20
- package/dist/lang/ast/expressions/expr-string.js +4 -0
- package/dist/lang/ast/expressions/expr-sum.js +2 -20
- package/dist/lang/ast/expressions/expr-time-extract.js +2 -20
- package/dist/lang/ast/expressions/expr-time.js +2 -20
- package/dist/lang/ast/expressions/expr-ungroup.js +2 -20
- package/dist/lang/ast/expressions/for-range.js +2 -20
- package/dist/lang/ast/expressions/function-ordering.js +2 -20
- package/dist/lang/ast/expressions/grouped_by.js +2 -4
- package/dist/lang/ast/expressions/partial-compare.js +2 -20
- package/dist/lang/ast/expressions/partition_by.js +2 -20
- package/dist/lang/ast/expressions/pick-when.js +2 -20
- package/dist/lang/ast/expressions/range.js +2 -20
- package/dist/lang/ast/expressions/time-frame.js +2 -20
- package/dist/lang/ast/expressions/time-literal.js +2 -20
- package/dist/lang/ast/expressions/unary.js +2 -20
- package/dist/lang/ast/field-space/ast-view-field.js +2 -20
- package/dist/lang/ast/field-space/column-space-field.js +2 -20
- package/dist/lang/ast/field-space/def-space.js +2 -4
- package/dist/lang/ast/field-space/dynamic-space.js +2 -20
- package/dist/lang/ast/field-space/include-utils.js +2 -4
- package/dist/lang/ast/field-space/index-field-space.js +2 -20
- package/dist/lang/ast/field-space/ir-view-field.js +2 -20
- package/dist/lang/ast/field-space/join-space-field.js +2 -20
- package/dist/lang/ast/field-space/parameter-space.js +2 -4
- package/dist/lang/ast/field-space/passthrough-space.js +2 -4
- package/dist/lang/ast/field-space/permissive-space.js +2 -4
- package/dist/lang/ast/field-space/project-field-space.js +2 -20
- package/dist/lang/ast/field-space/query-input-space.js +2 -20
- package/dist/lang/ast/field-space/query-spaces.js +2 -20
- package/dist/lang/ast/field-space/reference-field.js +5 -21
- package/dist/lang/ast/field-space/refine-from-space-field.js +2 -4
- package/dist/lang/ast/field-space/refined-space.js +2 -20
- package/dist/lang/ast/field-space/rename-space-field.js +2 -20
- package/dist/lang/ast/field-space/static-space.js +2 -20
- package/dist/lang/ast/field-space/struct-space-field-base.js +2 -20
- package/dist/lang/ast/field-space/view-field.js +2 -20
- package/dist/lang/ast/index.js +2 -20
- package/dist/lang/ast/parameters/argument.js +2 -4
- package/dist/lang/ast/parameters/has-parameter.js +2 -20
- package/dist/lang/ast/query-builders/index-builder.js +2 -20
- package/dist/lang/ast/query-builders/partial-builder.js +4 -0
- package/dist/lang/ast/query-builders/project-builder.js +2 -20
- package/dist/lang/ast/query-builders/reduce-builder.js +2 -20
- package/dist/lang/ast/query-elements/anonymous-query.js +3 -21
- package/dist/lang/ast/query-elements/query-arrow.js +2 -20
- package/dist/lang/ast/query-elements/query-base.js +2 -20
- package/dist/lang/ast/query-elements/query-head-struct.js +2 -20
- package/dist/lang/ast/query-elements/query-raw.js +2 -20
- package/dist/lang/ast/query-elements/query-reference.js +2 -20
- package/dist/lang/ast/query-elements/query-refine.js +2 -20
- package/dist/lang/ast/query-items/field-declaration.js +3 -21
- package/dist/lang/ast/query-items/field-references.js +2 -20
- package/dist/lang/ast/query-items/typecheck_utils.js +2 -20
- package/dist/lang/ast/query-properties/aggregate.js +2 -20
- package/dist/lang/ast/query-properties/calculate.js +2 -20
- package/dist/lang/ast/query-properties/declare-fields.js +2 -20
- package/dist/lang/ast/query-properties/drill.js +2 -4
- package/dist/lang/ast/query-properties/extend.js +2 -20
- package/dist/lang/ast/query-properties/filters.js +2 -20
- package/dist/lang/ast/query-properties/group-by.js +2 -20
- package/dist/lang/ast/query-properties/indexing.js +2 -20
- package/dist/lang/ast/query-properties/limit.js +2 -20
- package/dist/lang/ast/query-properties/nest.js +6 -21
- package/dist/lang/ast/query-properties/nests.js +2 -20
- package/dist/lang/ast/query-properties/ordering.js +2 -20
- package/dist/lang/ast/query-properties/project-statement.js +2 -20
- package/dist/lang/ast/query-properties/qop-desc.js +2 -20
- package/dist/lang/ast/query-properties/sampling.js +2 -20
- package/dist/lang/ast/query-utils.js +2 -20
- package/dist/lang/ast/source-elements/composite-source.js +2 -4
- package/dist/lang/ast/source-elements/named-source.js +2 -23
- package/dist/lang/ast/source-elements/query-source.js +2 -22
- package/dist/lang/ast/source-elements/refined-source.js +2 -22
- package/dist/lang/ast/source-elements/source.js +2 -20
- package/dist/lang/ast/source-elements/sql-source.js +2 -25
- package/dist/lang/ast/source-elements/table-source.js +3 -22
- package/dist/lang/ast/source-elements/virtual-source.js +1 -2
- package/dist/lang/ast/source-properties/dimensions.js +2 -20
- package/dist/lang/ast/source-properties/field-list-edit.js +2 -20
- package/dist/lang/ast/source-properties/join.js +4 -26
- package/dist/lang/ast/source-properties/measures.js +2 -20
- package/dist/lang/ast/source-properties/primary-key.js +2 -20
- package/dist/lang/ast/source-properties/renames.js +3 -21
- package/dist/lang/ast/source-properties/timezone-statement.js +2 -20
- package/dist/lang/ast/source-properties/user-type-shape.js +9 -4
- package/dist/lang/ast/source-properties/view-field-declaration.js +6 -21
- package/dist/lang/ast/source-properties/views.js +2 -20
- package/dist/lang/ast/source-query-elements/include-item.js +2 -4
- package/dist/lang/ast/source-query-elements/source-query-element.js +2 -20
- package/dist/lang/ast/source-query-elements/sq-arrow.js +2 -20
- package/dist/lang/ast/source-query-elements/sq-compose.js +2 -4
- package/dist/lang/ast/source-query-elements/sq-extend.js +2 -20
- package/dist/lang/ast/source-query-elements/sq-reference.js +2 -20
- package/dist/lang/ast/source-query-elements/sq-refine.js +2 -20
- package/dist/lang/ast/source-query-elements/sq-source.js +2 -20
- package/dist/lang/ast/sql-elements/sql-string.js +2 -20
- package/dist/lang/ast/statements/define-given.js +2 -2
- package/dist/lang/ast/statements/define-query.js +3 -21
- package/dist/lang/ast/statements/define-source.js +7 -22
- package/dist/lang/ast/statements/define-user-type.js +1 -1
- package/dist/lang/ast/statements/import-statement.js +7 -20
- package/dist/lang/ast/time-utils.js +2 -20
- package/dist/lang/ast/typedesc-utils.js +2 -20
- package/dist/lang/ast/types/annotation-elements.js +2 -20
- package/dist/lang/ast/types/binary_operators.js +2 -4
- package/dist/lang/ast/types/definition-list.js +2 -20
- package/dist/lang/ast/types/dialect-name-space.js +2 -4
- package/dist/lang/ast/types/document-compile-result.js +2 -20
- package/dist/lang/ast/types/expr-result.js +2 -20
- package/dist/lang/ast/types/expr-value.js +2 -20
- package/dist/lang/ast/types/expression-def.js +2 -20
- package/dist/lang/ast/types/field-collection-member.js +2 -20
- package/dist/lang/ast/types/field-prop-statement.js +2 -20
- package/dist/lang/ast/types/field-space.js +2 -20
- package/dist/lang/ast/types/global-name-space.js +2 -20
- package/dist/lang/ast/types/granular-result.js +2 -20
- package/dist/lang/ast/types/literal.d.ts +1 -1
- package/dist/lang/ast/types/literal.js +2 -4
- package/dist/lang/ast/types/lookup-result.js +2 -20
- package/dist/lang/ast/types/malloy-element.d.ts +27 -4
- package/dist/lang/ast/types/malloy-element.js +54 -70
- package/dist/lang/ast/types/model-entry.js +2 -20
- package/dist/lang/ast/types/name-space.js +2 -20
- package/dist/lang/ast/types/noteable.js +2 -20
- package/dist/lang/ast/types/op-desc.js +2 -20
- package/dist/lang/ast/types/pipeline-comp.js +2 -20
- package/dist/lang/ast/types/query-builder.js +2 -20
- package/dist/lang/ast/types/query-comp.js +2 -20
- package/dist/lang/ast/types/query-element.js +2 -20
- package/dist/lang/ast/types/query-extend-property.js +2 -20
- package/dist/lang/ast/types/query-item.js +2 -20
- package/dist/lang/ast/types/query-property-interface.js +2 -20
- package/dist/lang/ast/types/query-property.js +2 -20
- package/dist/lang/ast/types/source-desc.js +2 -20
- package/dist/lang/ast/types/source-property.js +2 -20
- package/dist/lang/ast/types/space-entry.js +2 -20
- package/dist/lang/ast/types/space-field.js +2 -20
- package/dist/lang/ast/types/space-param.js +2 -20
- package/dist/lang/ast/types/time-result.js +2 -20
- package/dist/lang/ast/view-elements/qop-desc-view.js +2 -20
- package/dist/lang/ast/view-elements/reference-view.js +2 -20
- package/dist/lang/ast/view-elements/refine-utils.js +2 -20
- package/dist/lang/ast/view-elements/view-arrow.js +2 -20
- package/dist/lang/ast/view-elements/view-refine.js +2 -20
- package/dist/lang/ast/view-elements/view.js +2 -20
- package/dist/lang/composite-source-utils.js +2 -4
- package/dist/lang/field-utils.js +2 -20
- package/dist/lang/index.js +2 -20
- package/dist/lang/malloy-parse-info.js +2 -20
- package/dist/lang/malloy-to-ast.d.ts +1 -1
- package/dist/lang/malloy-to-ast.js +2 -21
- package/dist/lang/malloy-to-stable-query.js +2 -4
- package/dist/lang/parse-log.js +2 -20
- package/dist/lang/parse-malloy.d.ts +1 -9
- package/dist/lang/parse-malloy.js +8 -50
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +2 -20
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +2 -20
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +2 -20
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +2 -20
- package/dist/lang/parse-tree-walkers/find-external-references.js +2 -20
- package/dist/lang/parse-tree-walkers/find-table-path-walker.js +2 -20
- package/dist/lang/parse-utils.js +2 -20
- package/dist/lang/reference-list.js +2 -20
- package/dist/lang/run-malloy-parser.js +2 -4
- package/dist/lang/syntax-errors/custom-error-messages.js +2 -4
- package/dist/lang/syntax-errors/malloy-error-strategy.js +2 -4
- package/dist/lang/syntax-errors/malloy-parser-error-listener.js +2 -4
- package/dist/lang/test/expr-to-str.js +2 -4
- package/dist/lang/test/parse-expects.js +2 -20
- package/dist/lang/test/test-translator.js +4 -25
- package/dist/lang/translate-response.d.ts +1 -5
- package/dist/lang/translate-response.js +2 -20
- package/dist/lang/utils.js +2 -20
- package/dist/lang/zone.js +2 -20
- package/dist/model/annotation_utils.d.ts +37 -0
- package/dist/model/annotation_utils.js +85 -0
- package/dist/model/filter_compilers.js +2 -4
- package/dist/model/index.d.ts +2 -1
- package/dist/model/index.js +6 -21
- package/dist/model/malloy_types.d.ts +36 -7
- package/dist/model/malloy_types.js +2 -21
- package/dist/model/query_node.d.ts +0 -3
- package/dist/model/query_node.js +0 -10
- package/dist/model/query_query.js +2 -16
- package/dist/model/source_def_utils.js +0 -2
- package/dist/model/sql_block.js +2 -20
- package/dist/model/utils.d.ts +9 -2
- package/dist/model/utils.js +15 -21
- package/dist/run_sql_options.d.ts +0 -5
- package/dist/run_sql_options.js +2 -20
- package/dist/runtime_types.js +2 -20
- package/dist/test/cellsToObject.js +2 -4
- package/dist/timing.js +2 -4
- package/dist/to_stable.js +2 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/lang/parse-tree-walkers/model-annotation-walker.d.ts +0 -5
- package/dist/lang/parse-tree-walkers/model-annotation-walker.js +0 -50
package/LICENSE
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Malloy Project License
|
|
2
|
+
SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
Copyright Contributors to the Malloy project
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
========================================================================
|
|
25
|
+
SOURCE FILE HEADER
|
|
26
|
+
========================================================================
|
|
27
|
+
|
|
28
|
+
Every source file in this project carries the following header (shown here
|
|
29
|
+
in C/Java/JavaScript comment style; equivalent comment styles are used for
|
|
30
|
+
other languages):
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Copyright Contributors to the Malloy project
|
|
34
|
+
* SPDX-License-Identifier: MIT
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
========================================================================
|
|
38
|
+
HISTORICAL ATTRIBUTIONS & NOTICES
|
|
39
|
+
========================================================================
|
|
40
|
+
|
|
41
|
+
Portions of this software were originally contributed by Google LLC and
|
|
42
|
+
Meta Platforms, Inc. and affiliates under the MIT License. For ease of
|
|
43
|
+
maintenance, individual file headers have been updated to the current
|
|
44
|
+
standard header. The full historical attribution and authorship for
|
|
45
|
+
individual files remains completely preserved and accessible via the Git
|
|
46
|
+
repository history.
|
|
47
|
+
|
|
48
|
+
The original copyright and permission notices for those contributions
|
|
49
|
+
are preserved below:
|
|
50
|
+
|
|
51
|
+
------------------------------------------------------------------------
|
|
52
|
+
Copyright 2023 Google LLC
|
|
53
|
+
|
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
55
|
+
a copy of this software and associated documentation files (the
|
|
56
|
+
"Software"), to deal in the Software without restriction, including
|
|
57
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
58
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
59
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
60
|
+
the following conditions:
|
|
61
|
+
|
|
62
|
+
The above copyright notice and this permission notice shall be
|
|
63
|
+
included in all copies or substantial portions of the Software.
|
|
64
|
+
|
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
66
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
67
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
68
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
69
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
70
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
71
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
72
|
+
------------------------------------------------------------------------
|
|
73
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
74
|
+
|
|
75
|
+
This source code is licensed under the MIT license found in the
|
|
76
|
+
LICENSE file in the root directory of this source tree.
|
|
77
|
+
------------------------------------------------------------------------
|
package/dist/api/asynchronous.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
3
|
+
* Copyright Contributors to the Malloy project
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
7
5
|
*/
|
|
8
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
7
|
if (k2 === undefined) k2 = k;
|
package/dist/api/connection.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
3
|
+
* Copyright Contributors to the Malloy project
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
7
5
|
*/
|
|
8
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
7
|
//# sourceMappingURL=connection.js.map
|
package/dist/api/core.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
3
|
+
* Copyright Contributors to the Malloy project
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
7
5
|
*/
|
|
8
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
7
|
if (k2 === undefined) k2 = k;
|
|
@@ -52,6 +50,7 @@ exports.hasErrors = hasErrors;
|
|
|
52
50
|
exports.newCompileQueryState = newCompileQueryState;
|
|
53
51
|
exports.statedCompileQuery = statedCompileQuery;
|
|
54
52
|
const Malloy = __importStar(require("@malloydata/malloy-interfaces"));
|
|
53
|
+
const uuid_1 = require("uuid");
|
|
55
54
|
const lang_1 = require("../lang");
|
|
56
55
|
const model_1 = require("../model");
|
|
57
56
|
const to_stable_1 = require("../to_stable");
|
|
@@ -457,7 +456,7 @@ function newCompileQueryState(request) {
|
|
|
457
456
|
const needs = {
|
|
458
457
|
...((_b = request.compiler_needs) !== null && _b !== void 0 ? _b : {}),
|
|
459
458
|
};
|
|
460
|
-
const queryURL =
|
|
459
|
+
const queryURL = `internal://query/${(0, uuid_1.v4)()}`;
|
|
461
460
|
needs.files = [
|
|
462
461
|
{
|
|
463
462
|
url: queryURL,
|
|
@@ -505,7 +504,7 @@ function statedCompileQuery(state) {
|
|
|
505
504
|
defaultRowLimit: state.defaultRowLimit,
|
|
506
505
|
});
|
|
507
506
|
timer.contribute([sqlTimer.stop()]);
|
|
508
|
-
const modelAnnotations = (0, to_stable_1.toStableAnnotations)(result.modelDef
|
|
507
|
+
const modelAnnotations = (0, to_stable_1.toStableAnnotations)((0, model_1.getModelAnnotations)(result.modelDef));
|
|
509
508
|
let source;
|
|
510
509
|
if (query.compositeResolvedSourceDef) {
|
|
511
510
|
source = query.compositeResolvedSourceDef;
|
|
@@ -9,6 +9,7 @@ exports.collectAnnotations = collectAnnotations;
|
|
|
9
9
|
exports.annotationToTaglines = annotationToTaglines;
|
|
10
10
|
exports.annotationToTag = annotationToTag;
|
|
11
11
|
const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
12
|
+
const annotation_utils_1 = require("../../model/annotation_utils");
|
|
12
13
|
const annotation_prefix_1 = require("../../lang/annotation-prefix");
|
|
13
14
|
/**
|
|
14
15
|
* One annotation, returned by {@link Annotations.forRoute} — wraps an IR
|
|
@@ -56,15 +57,6 @@ class RoutedNote {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
exports.RoutedNote = RoutedNote;
|
|
59
|
-
/** Every Note of an annotation, inherited first, in document order. */
|
|
60
|
-
function* notesInOrder(annote) {
|
|
61
|
-
if (annote.inherits)
|
|
62
|
-
yield* notesInOrder(annote.inherits);
|
|
63
|
-
if (annote.blockNotes)
|
|
64
|
-
yield* annote.blockNotes;
|
|
65
|
-
if (annote.notes)
|
|
66
|
-
yield* annote.notes;
|
|
67
|
-
}
|
|
68
60
|
/**
|
|
69
61
|
* Collect annotations, using the shared prefix parser.
|
|
70
62
|
* - no `route`: every annotation, each carrying its own `route` (the only
|
|
@@ -73,7 +65,7 @@ function* notesInOrder(annote) {
|
|
|
73
65
|
*/
|
|
74
66
|
function collectAnnotations(annote, route) {
|
|
75
67
|
const matching = [];
|
|
76
|
-
for (const note of notesInOrder(annote !== null && annote !== void 0 ? annote : {})) {
|
|
68
|
+
for (const note of (0, annotation_utils_1.notesInOrder)(annote !== null && annote !== void 0 ? annote : {})) {
|
|
77
69
|
const parsed = (0, annotation_prefix_1.parsePrefix)(note.text);
|
|
78
70
|
if (route === undefined) {
|
|
79
71
|
matching.push(new RoutedNote(note, parsed.route, parsed.contentIndex));
|
|
@@ -92,7 +84,7 @@ function collectAnnotations(annote, route) {
|
|
|
92
84
|
* @deprecated RegExp prefix matching; use {@link collectAnnotations} with a route.
|
|
93
85
|
*/
|
|
94
86
|
function collectNotes(annote, prefix) {
|
|
95
|
-
const notes = [...notesInOrder(annote)];
|
|
87
|
+
const notes = [...(0, annotation_utils_1.notesInOrder)(annote)];
|
|
96
88
|
return prefix ? notes.filter(note => note.text.match(prefix)) : notes;
|
|
97
89
|
}
|
|
98
90
|
/**
|
|
@@ -12,9 +12,19 @@ const sql_block_1 = require("../../model/sql_block");
|
|
|
12
12
|
const version_1 = require("../../version");
|
|
13
13
|
const readers_1 = require("./readers");
|
|
14
14
|
const document_1 = require("./document");
|
|
15
|
+
const uuid_1 = require("uuid");
|
|
15
16
|
const core_1 = require("./core");
|
|
16
17
|
const result_1 = require("./result");
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Mint the synthetic URL for an inline (URL-less) compile. Each call is
|
|
20
|
+
* unique, so two inline models — or an inline base and its inline extension —
|
|
21
|
+
* never collide on identity. Stays under the `internal://` scheme so it
|
|
22
|
+
* remains uncacheable (see `isInternalURL`). The `method` segment is a
|
|
23
|
+
* diagnostic label only.
|
|
24
|
+
*/
|
|
25
|
+
function mkInternalURL(method = 'loadModel') {
|
|
26
|
+
return `internal://${method}/${(0, uuid_1.v4)()}`;
|
|
27
|
+
}
|
|
18
28
|
// =============================================================================
|
|
19
29
|
// Helper Functions
|
|
20
30
|
// =============================================================================
|
|
@@ -69,7 +79,7 @@ class Malloy {
|
|
|
69
79
|
static _parse(source, url, eventStream, options, invalidationKey) {
|
|
70
80
|
var _a;
|
|
71
81
|
if (url === undefined) {
|
|
72
|
-
url = new URL(
|
|
82
|
+
url = new URL(mkInternalURL(options === null || options === void 0 ? void 0 : options.method));
|
|
73
83
|
}
|
|
74
84
|
let importBaseURL = url;
|
|
75
85
|
if (options === null || options === void 0 ? void 0 : options.importBaseURL) {
|
|
@@ -111,7 +121,7 @@ class Malloy {
|
|
|
111
121
|
static async compile(req) {
|
|
112
122
|
var _a, _b, _c, _d, _e;
|
|
113
123
|
let { url, source, importBaseURL, cacheManager } = req;
|
|
114
|
-
const { parse, urlReader, connections, model, refreshSchemaCache, noThrowOnError, eventStream, restrictedMode, } = req;
|
|
124
|
+
const { parse, urlReader, connections, model, refreshSchemaCache, noThrowOnError, eventStream, restrictedMode, method, } = req;
|
|
115
125
|
if (restrictedMode) {
|
|
116
126
|
// Restricted-mode compiles do not participate in the model-def
|
|
117
127
|
// cache. The cache key is the URL, but restricted vs. unrestricted
|
|
@@ -136,7 +146,7 @@ class Malloy {
|
|
|
136
146
|
url = new URL(parse._translator.sourceURL);
|
|
137
147
|
}
|
|
138
148
|
else {
|
|
139
|
-
url = new URL(
|
|
149
|
+
url = new URL(mkInternalURL(method));
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
152
|
const invalidationKeys = {};
|
|
@@ -250,7 +260,6 @@ class Malloy {
|
|
|
250
260
|
}
|
|
251
261
|
}
|
|
252
262
|
}
|
|
253
|
-
const { modelAnnotations } = translator.modelAnnotation(model === null || model === void 0 ? void 0 : model._modelDef);
|
|
254
263
|
if (result.tables) {
|
|
255
264
|
// collect tables by connection name since there may be multiple connections
|
|
256
265
|
const tablesByConnection = new Map();
|
|
@@ -273,7 +282,6 @@ class Malloy {
|
|
|
273
282
|
// the translator runs into an infinite loop fetching tables.
|
|
274
283
|
const { schemas: tables, errors } = await Malloy.safelyFetchTableSchema(connection, tablePathByKey, {
|
|
275
284
|
refreshTimestamp,
|
|
276
|
-
modelAnnotations,
|
|
277
285
|
});
|
|
278
286
|
translator.update({ tables, errors: { tables: errors } });
|
|
279
287
|
}
|
|
@@ -318,7 +326,6 @@ class Malloy {
|
|
|
318
326
|
const conn = await connections.lookupConnection(connectionName);
|
|
319
327
|
const resolved = await conn.fetchSchemaForSQLStruct(toCompile, {
|
|
320
328
|
refreshTimestamp,
|
|
321
|
-
modelAnnotations,
|
|
322
329
|
});
|
|
323
330
|
if (resolved.error) {
|
|
324
331
|
translator.update({
|
|
@@ -416,7 +423,7 @@ class Malloy {
|
|
|
416
423
|
let sql;
|
|
417
424
|
let resultExplore;
|
|
418
425
|
if (sqlStruct) {
|
|
419
|
-
resultExplore = new core_1.Explore(sqlStruct);
|
|
426
|
+
resultExplore = new core_1.Explore((0, core_1.pseudoModelFor)(sqlStruct), sqlStruct);
|
|
420
427
|
sql = sqlStruct.selectStr;
|
|
421
428
|
}
|
|
422
429
|
else if (preparedResult !== undefined) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LogMessage } from '../../lang';
|
|
2
|
-
import type { BuildID, CompiledQuery, ConstantExpr, DocumentLocation, BooleanFieldDef, JSONFieldDef, NumberFieldDef, StringFieldDef, FilterCondition, Given as InternalGiven, GivenID, GivenTypeDef, Query as InternalQuery, Pipeline, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQueryDef, StructDef, TurtleDef, NativeUnsupportedFieldDef, ImportLocation, AnnotationsDef, NamedModelObject, AtomicFieldDef, DateFieldDef, ATimestampFieldDef, SourceDef, Argument, SourceComponentInfo, DocumentReference, PersistableSourceDef } from '../../model';
|
|
2
|
+
import type { BuildID, CompiledQuery, ConstantExpr, DocumentLocation, BooleanFieldDef, JSONFieldDef, NumberFieldDef, StringFieldDef, FilterCondition, Given as InternalGiven, GivenID, GivenTypeDef, Query as InternalQuery, Pipeline, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQueryDef, StructDef, TurtleDef, NativeUnsupportedFieldDef, ImportLocation, AnnotationsDef, ModelAnnotationEntry, ModelID, NamedModelObject, AtomicFieldDef, DateFieldDef, ATimestampFieldDef, SourceDef, Argument, SourceComponentInfo, DocumentReference, PersistableSourceDef } from '../../model';
|
|
3
3
|
import { QueryModel } from '../../model';
|
|
4
4
|
import type { Dialect } from '../../dialect';
|
|
5
5
|
import type { BuildGraph, CompileQueryOptions } from './types';
|
|
@@ -8,6 +8,7 @@ import type { MalloyTagParse, TagParseSpec } from './annotation';
|
|
|
8
8
|
import { Annotations } from './annotation';
|
|
9
9
|
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
10
10
|
import type { Taggable } from './taggable';
|
|
11
|
+
export declare function pseudoModelFor(structDef: StructDef, modelID?: ModelID, modelAnnotations?: Record<ModelID, ModelAnnotationEntry>): ModelDef;
|
|
11
12
|
declare abstract class Entity {
|
|
12
13
|
private readonly _name;
|
|
13
14
|
protected readonly _parent?: Explore;
|
|
@@ -79,6 +80,10 @@ export declare enum JoinRelationship {
|
|
|
79
80
|
export type Field = AtomicField | QueryField | ExploreField;
|
|
80
81
|
export type SerializedExplore = {
|
|
81
82
|
_structDef: StructDef;
|
|
83
|
+
/** Owner model id + annotation closure, so a deserialized Explore folds
|
|
84
|
+
* model annotations as the live one did. */
|
|
85
|
+
modelID: ModelID;
|
|
86
|
+
modelAnnotations: Record<ModelID, ModelAnnotationEntry>;
|
|
82
87
|
sourceExplore?: SerializedExplore;
|
|
83
88
|
_parentExplore?: SerializedExplore;
|
|
84
89
|
};
|
|
@@ -103,10 +108,16 @@ interface ModelQueries {
|
|
|
103
108
|
export declare class Explore extends Entity implements Taggable {
|
|
104
109
|
protected readonly _structDef: StructDef;
|
|
105
110
|
protected readonly _parentExplore?: Explore;
|
|
111
|
+
private readonly _ownerModelDef;
|
|
106
112
|
private _fieldMap;
|
|
107
113
|
private sourceExplore;
|
|
108
114
|
private _allFieldsWithOrder;
|
|
109
|
-
constructor(structDef: StructDef, parentExplore?: Explore, source?: Explore);
|
|
115
|
+
constructor(modelDef: ModelDef, structDef: StructDef, parentExplore?: Explore, source?: Explore);
|
|
116
|
+
/** The model this Explore was resolved in. For detached Explores
|
|
117
|
+
* (`fromJSON`, raw SQL block) this is a synthetic single-source model
|
|
118
|
+
* with no model annotations. Read by child fields to resolve their own
|
|
119
|
+
* model annotations. */
|
|
120
|
+
get _modelDef(): ModelDef;
|
|
110
121
|
get source(): Explore | undefined;
|
|
111
122
|
isIntrinsic(): boolean;
|
|
112
123
|
isExploreField(): this is ExploreField;
|
|
@@ -115,14 +126,18 @@ export declare class Explore extends Entity implements Taggable {
|
|
|
115
126
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
116
127
|
getTaglines(prefix?: RegExp): string[];
|
|
117
128
|
get annotations(): Annotations;
|
|
129
|
+
/** The model annotations resolved for this object. */
|
|
130
|
+
get modelAnnotations(): Annotations;
|
|
118
131
|
private parsedModelTag?;
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated Use `.modelAnnotations.parseAsTag(route)`.
|
|
134
|
+
*/
|
|
119
135
|
get modelTag(): Tag;
|
|
120
136
|
/**
|
|
121
137
|
* @return The name of the entity.
|
|
122
138
|
*/
|
|
123
139
|
get name(): string;
|
|
124
140
|
getQueryByName(name: string): PreparedQuery;
|
|
125
|
-
private get modelDef();
|
|
126
141
|
getSingleExploreModel(): Model;
|
|
127
142
|
private get fieldMap();
|
|
128
143
|
get allFields(): Field[];
|
|
@@ -158,6 +173,8 @@ export declare class AtomicField extends Entity implements Taggable {
|
|
|
158
173
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
159
174
|
getTaglines(prefix?: RegExp): string[];
|
|
160
175
|
get annotations(): Annotations;
|
|
176
|
+
/** The model annotations resolved for this field, via its parent. */
|
|
177
|
+
get modelAnnotations(): Annotations;
|
|
161
178
|
isIntrinsic(): boolean;
|
|
162
179
|
isQueryField(): this is QueryField;
|
|
163
180
|
isExploreField(): this is ExploreField;
|
|
@@ -224,6 +241,9 @@ export declare class Query extends Entity implements Taggable {
|
|
|
224
241
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
225
242
|
getTaglines(prefix?: RegExp): string[];
|
|
226
243
|
get annotations(): Annotations;
|
|
244
|
+
/** The model annotations resolved for this view, via its parent
|
|
245
|
+
* explore. A bare `Query` with no parent has none. */
|
|
246
|
+
get modelAnnotations(): Annotations;
|
|
227
247
|
}
|
|
228
248
|
export declare class QueryField extends Query {
|
|
229
249
|
protected parent: Explore;
|
|
@@ -335,11 +355,15 @@ export declare class Model implements Taggable {
|
|
|
335
355
|
* every given the model can accept.
|
|
336
356
|
*/
|
|
337
357
|
get givens(): ReadonlyMap<string, Given>;
|
|
358
|
+
/** This model's own `##` bundle (its self-entry's `ownNotes`). */
|
|
359
|
+
private get _ownModelAnnotations();
|
|
338
360
|
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
339
361
|
tagParse(spec?: TagParseSpec): MalloyTagParse;
|
|
340
362
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
341
363
|
getTaglines(prefix?: RegExp): string[];
|
|
342
364
|
get annotations(): Annotations;
|
|
365
|
+
/** The model annotations resolved across this model's import/extend lineage. */
|
|
366
|
+
get modelAnnotations(): Annotations;
|
|
343
367
|
/**
|
|
344
368
|
* Retrieve a reference for the token at the given position within the
|
|
345
369
|
* document that produced this model.
|
|
@@ -491,6 +515,8 @@ export declare class PersistSource implements Taggable {
|
|
|
491
515
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
492
516
|
getTaglines(prefix?: RegExp): string[];
|
|
493
517
|
get annotations(): Annotations;
|
|
518
|
+
/** The model annotations resolved for this source. */
|
|
519
|
+
get modelAnnotations(): Annotations;
|
|
494
520
|
/**
|
|
495
521
|
* The connection name for this source.
|
|
496
522
|
*/
|
|
@@ -542,14 +568,17 @@ export declare class Given implements Taggable {
|
|
|
542
568
|
readonly name: string;
|
|
543
569
|
readonly id: GivenID;
|
|
544
570
|
private readonly _internal;
|
|
571
|
+
private readonly _modelDef;
|
|
545
572
|
/**
|
|
546
573
|
* @param name Caller-facing surface name in the model (post-rename
|
|
547
574
|
* on import). The key by which the caller passes a
|
|
548
575
|
* value to `.run({givens: {[name]: ...}})`.
|
|
549
576
|
* @param id Global GivenID. Stable across imports and renames.
|
|
550
577
|
* @param _internal The internal Given declaration record.
|
|
578
|
+
* @param _modelDef The model this given is declared in, for resolving
|
|
579
|
+
* its model annotations.
|
|
551
580
|
*/
|
|
552
|
-
constructor(name: string, id: GivenID, _internal: InternalGiven);
|
|
581
|
+
constructor(name: string, id: GivenID, _internal: InternalGiven, _modelDef: ModelDef);
|
|
553
582
|
get type(): GivenTypeDef;
|
|
554
583
|
/** `undefined` when no default — the caller must supply at run time. */
|
|
555
584
|
get default(): ConstantExpr | undefined;
|
|
@@ -559,6 +588,8 @@ export declare class Given implements Taggable {
|
|
|
559
588
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
560
589
|
getTaglines(prefix?: RegExp): string[];
|
|
561
590
|
get annotations(): Annotations;
|
|
591
|
+
/** The model annotations resolved for this given. */
|
|
592
|
+
get modelAnnotations(): Annotations;
|
|
562
593
|
}
|
|
563
594
|
/**
|
|
564
595
|
* Internal abstract base for Foundation wrappers around an IR `Pipeline`
|
|
@@ -570,6 +601,9 @@ declare abstract class PipelineBase implements Taggable {
|
|
|
570
601
|
protected pipelineDef: Pipeline;
|
|
571
602
|
constructor(pipelineDef: Pipeline);
|
|
572
603
|
get annotations(): Annotations;
|
|
604
|
+
/** Resolved model annotations. Abstract because the base has no
|
|
605
|
+
* model in hand — subclasses that carry one supply the resolution. */
|
|
606
|
+
abstract get modelAnnotations(): Annotations;
|
|
573
607
|
get location(): DocumentLocation | undefined;
|
|
574
608
|
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
575
609
|
tagParse(spec?: TagParseSpec): MalloyTagParse;
|
|
@@ -583,6 +617,8 @@ export declare class PreparedQuery extends PipelineBase {
|
|
|
583
617
|
constructor(query: InternalQuery, _model: Model, problems: LogMessage[], name?: string | undefined);
|
|
584
618
|
get _query(): InternalQuery | NamedQueryDef;
|
|
585
619
|
get _modelDef(): ModelDef;
|
|
620
|
+
/** The model annotations resolved for this query's head. */
|
|
621
|
+
get modelAnnotations(): Annotations;
|
|
586
622
|
/**
|
|
587
623
|
* Generate the SQL for this query.
|
|
588
624
|
*
|
|
@@ -629,6 +665,8 @@ export declare class PreparedResult implements Taggable {
|
|
|
629
665
|
/** @deprecated Use `.annotations.texts(route)`. */
|
|
630
666
|
getTaglines(prefix?: RegExp): string[];
|
|
631
667
|
get annotations(): Annotations;
|
|
668
|
+
/** The model annotations resolved for this query's run-head. */
|
|
669
|
+
get modelAnnotations(): Annotations;
|
|
632
670
|
/**
|
|
633
671
|
* @deprecated Hands out raw IR (`AnnotationsDef`). Use `.annotations`
|
|
634
672
|
* (returns the {@link Annotations} view) for read access. Internal
|
|
@@ -637,8 +675,8 @@ export declare class PreparedResult implements Taggable {
|
|
|
637
675
|
*/
|
|
638
676
|
get annotation(): AnnotationsDef | undefined;
|
|
639
677
|
/**
|
|
640
|
-
* @deprecated Hands out raw IR (`AnnotationsDef`). Internal code that
|
|
641
|
-
*
|
|
678
|
+
* @deprecated Hands out raw IR (`AnnotationsDef`). Internal code that needs
|
|
679
|
+
* the model-level IR shape should call `getModelAnnotations(this.modelDef)`
|
|
642
680
|
* directly. Slated for removal once external consumers migrate.
|
|
643
681
|
*/
|
|
644
682
|
get modelAnnotation(): AnnotationsDef | undefined;
|