@malloydata/malloy 0.0.123-dev240207164302 → 0.0.123-dev240207191052

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.
@@ -62,6 +62,7 @@ const function_map_1 = require("./function_map");
62
62
  const coalesce_1 = require("./coalesce");
63
63
  const string_agg_1 = require("./string_agg");
64
64
  const sql_1 = require("./sql");
65
+ const sum_moving_1 = require("./sum_moving");
65
66
  /**
66
67
  * This is a function map containing default implementations of all Malloy
67
68
  * built-in functions. These don't work in all dialects, but are a good starting
@@ -135,6 +136,7 @@ exports.FUNCTIONS.add('min_window', sum_min_max_window_1.fnMinWindow);
135
136
  exports.FUNCTIONS.add('max_window', sum_min_max_window_1.fnMaxWindow);
136
137
  exports.FUNCTIONS.add('sum_window', sum_min_max_window_1.fnSumWindow);
137
138
  exports.FUNCTIONS.add('avg_moving', avg_moving_1.fnAvgRolling);
139
+ exports.FUNCTIONS.add('sum_moving', sum_moving_1.fnSumMoving);
138
140
  exports.FUNCTIONS.add('sql_number', sql_1.fnSqlNumber);
139
141
  exports.FUNCTIONS.add('sql_string', sql_1.fnSqlString);
140
142
  exports.FUNCTIONS.add('sql_date', sql_1.fnSqlDate);
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from './util';
2
+ export declare function fnSumMoving(): DialectFunctionOverloadDef[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.fnSumMoving = void 0;
26
+ const util_1 = require("./util");
27
+ function fnSumMoving() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.output)((0, util_1.maxAggregate)('number')));
29
+ const preceding = (0, util_1.makeParam)('preceding', (0, util_1.literal)((0, util_1.maxScalar)('number')));
30
+ const following = (0, util_1.makeParam)('following', (0, util_1.literal)((0, util_1.maxScalar)('number')));
31
+ return [
32
+ (0, util_1.overload)((0, util_1.minAnalytic)('number'), [value.param, preceding.param], (0, util_1.sql) `SUM(${value.arg})`, {
33
+ needsWindowOrderBy: true,
34
+ between: { preceding: 'preceding', following: 0 },
35
+ }),
36
+ (0, util_1.overload)((0, util_1.minAnalytic)('number'), [value.param, preceding.param, following.param], (0, util_1.sql) `SUM(${value.arg})`, {
37
+ needsWindowOrderBy: true,
38
+ between: { preceding: 'preceding', following: 'following' },
39
+ }),
40
+ ];
41
+ }
42
+ exports.fnSumMoving = fnSumMoving;
43
+ //# sourceMappingURL=sum_moving.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.123-dev240207164302",
3
+ "version": "0.0.123-dev240207191052",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",