@malloydata/malloy 0.0.197-dev241009193540 → 0.0.197-dev241010003320

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.
@@ -50,6 +50,9 @@ class ExprCast extends expression_def_1.ExpressionDef {
50
50
  else {
51
51
  this.logError('invalid-sql-native-type', `Cast type \`${this.castType.raw}\` is invalid for ${dialect.name} dialect`);
52
52
  }
53
+ if (this.safe && !dialect.supportsSafeCast) {
54
+ this.logError('dialect-cast-unsafe-only', `The SQL dialect '${fs.dialectName()}' does not supply a safe cast operator`);
55
+ }
53
56
  }
54
57
  }
55
58
  return {
@@ -315,6 +315,7 @@ type MessageParameterTypes = {
315
315
  'sql-is-not-null': string;
316
316
  'sql-is-null': string;
317
317
  'illegal-record-property-type': string;
318
+ 'dialect-cast-unsafe-only': string;
318
319
  };
319
320
  export declare const MESSAGE_FORMATTERS: PartialErrorCodeMessageMap;
320
321
  export type MessageCode = keyof MessageParameterTypes;
@@ -308,5 +308,13 @@ describe('source:', () => {
308
308
  `).toTranslate();
309
309
  });
310
310
  });
311
+ test('dates do not become timestamps', () => {
312
+ const dateThing = (0, test_translator_1.model) `source: hasDate is a -> { select: ad }`;
313
+ expect(dateThing).toTranslate();
314
+ const hasDate = dateThing.translator.getSourceDef('hasDate');
315
+ expect(hasDate).toBeDefined();
316
+ const ad = (0, test_translator_1.getFieldDef)(hasDate, 'ad');
317
+ expect(ad).toMatchObject({ name: 'ad', type: 'date' });
318
+ });
311
319
  });
312
320
  //# sourceMappingURL=source.spec.js.map
@@ -1925,25 +1925,17 @@ class QueryQuery extends QueryField {
1925
1925
  case 'date':
1926
1926
  case 'timestamp': {
1927
1927
  const timeframe = fi.f.fieldDef.timeframe;
1928
+ const fd = { type: fi.f.fieldDef.type };
1928
1929
  if (timeframe) {
1929
- fields.push({
1930
- name,
1931
- type: 'timestamp',
1932
- timeframe,
1933
- resultMetadata,
1934
- location,
1935
- annotation,
1936
- });
1937
- }
1938
- else {
1939
- fields.push({
1940
- name,
1941
- type: 'timestamp',
1942
- resultMetadata,
1943
- location,
1944
- annotation,
1945
- });
1930
+ fd.timeframe = timeframe;
1946
1931
  }
1932
+ fields.push({
1933
+ name,
1934
+ ...fd,
1935
+ resultMetadata,
1936
+ location,
1937
+ annotation,
1938
+ });
1947
1939
  break;
1948
1940
  }
1949
1941
  case 'number':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.197-dev241009193540",
3
+ "version": "0.0.197-dev241010003320",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",