@malloydata/malloy 0.0.254 → 0.0.255-dev250401191142

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/to_stable.js CHANGED
@@ -20,12 +20,20 @@ function modelDefToModelInfo(modelDef) {
20
20
  if (!modelDef.exports.includes(name))
21
21
  continue;
22
22
  if ((0, model_1.isSourceDef)(entry)) {
23
+ const parameters = entry.parameters && Object.entries(entry.parameters).length > 0
24
+ ? Object.entries(entry.parameters).map(([name, parameter]) => ({
25
+ name,
26
+ type: typeDefToType(parameter),
27
+ default_value: convertParameterDefaultValue(parameter.value),
28
+ }))
29
+ : undefined;
23
30
  const sourceInfo = {
24
31
  kind: 'source',
25
32
  name,
26
33
  schema: {
27
34
  fields: convertFieldInfos(entry, entry.fields),
28
35
  },
36
+ parameters,
29
37
  };
30
38
  modelInfo.entries.push(sourceInfo);
31
39
  }
@@ -71,6 +79,30 @@ function modelDefToModelInfo(modelDef) {
71
79
  return modelInfo;
72
80
  }
73
81
  exports.modelDefToModelInfo = modelDefToModelInfo;
82
+ function convertParameterDefaultValue(value) {
83
+ if (value === null)
84
+ return undefined;
85
+ switch (value.node) {
86
+ case 'numberLiteral':
87
+ // TODO handle all kinds of number literals?
88
+ return { kind: 'number_literal', number_value: parseFloat(value.literal) };
89
+ case 'stringLiteral':
90
+ return { kind: 'string_literal', string_value: value.literal };
91
+ case 'timeLiteral':
92
+ return {
93
+ kind: 'timestamp_literal',
94
+ timestamp_value: value.literal,
95
+ };
96
+ case 'true':
97
+ return { kind: 'boolean_literal', boolean_value: true };
98
+ case 'false':
99
+ return { kind: 'boolean_literal', boolean_value: false };
100
+ case 'null':
101
+ return { kind: 'null_literal' };
102
+ default:
103
+ throw new Error('Invalid parameter default value');
104
+ }
105
+ }
74
106
  function getAnnotationsFromField(field) {
75
107
  const taglines = (0, annotation_1.annotationToTaglines)(field.annotation);
76
108
  return taglines.map(tagline => ({
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.254";
1
+ export declare const MALLOY_VERSION = "0.0.255";
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.254';
5
+ exports.MALLOY_VERSION = '0.0.255';
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.254",
3
+ "version": "0.0.255-dev250401191142",
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.254",
45
- "@malloydata/malloy-interfaces": "^0.0.254",
46
- "@malloydata/malloy-tag": "^0.0.254",
44
+ "@malloydata/malloy-filter": "^0.0.255-dev250401191142",
45
+ "@malloydata/malloy-interfaces": "^0.0.255-dev250401191142",
46
+ "@malloydata/malloy-tag": "^0.0.255-dev250401191142",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
49
  "jest-diff": "^29.6.2",