@spl2dql/core 0.1.0 → 0.1.1

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/index.d.ts CHANGED
@@ -19,4 +19,5 @@ export { collectMappingNeeds, type MappingNeeds } from './needs.ts';
19
19
  export { highlightSpl, type SplToken, type SplTokenType } from './spl/highlight.ts';
20
20
  export { expandedLength, translate, translateCondition } from './translate.ts';
21
21
  export type { Confidence, DashboardToken, DatamodelMapping, Diagnostic, FieldType, MappingConfig, MappingIssue, Result, ResultShape, Severity, Span, StageResult, StageStatus, TimeRange, TranslateOptions, TranslateResult, } from './types.ts';
22
- export declare const VERSION = "0.1.0";
22
+ /** The release version. A test keeps it equal to the version in package.json. */
23
+ export declare const VERSION = "0.1.1";
package/dist/index.js CHANGED
@@ -18,5 +18,6 @@ export { emptyMapping, parseMappingConfig } from './mapping/config.js';
18
18
  export { collectMappingNeeds } from './needs.js';
19
19
  export { highlightSpl } from './spl/highlight.js';
20
20
  export { expandedLength, translate, translateCondition } from './translate.js';
21
- export const VERSION = '0.1.0';
21
+ /** The release version. A test keeps it equal to the version in package.json. */
22
+ export const VERSION = '0.1.1';
22
23
  //# sourceMappingURL=index.js.map
@@ -3,7 +3,7 @@ import { parseSearch } from '../spl/search.js';
3
3
  import { dqlUnit } from '../spl/time.js';
4
4
  import { dict } from '../util/dict.js';
5
5
  import { Untranslatable } from './context.js';
6
- import { regexLiteral, regexToDpl } from './regex.js';
6
+ import { dplLiteral, regexLiteral, regexToDpl } from './regex.js';
7
7
  import { lowerSearchExpr } from './search.js';
8
8
  import { strftimeToDql } from './strftime.js';
9
9
  const DATE_FIELDS = dict({
@@ -429,7 +429,7 @@ const FUNCTIONS = dict({
429
429
  if (!conv.ok)
430
430
  throw new Untranslatable('SPL2004', args[1].span, `The format directive ${conv.directive} has no DQL equivalent.`);
431
431
  st.report('SPL3010', node.span);
432
- return { e: call('parse', s, dpl(`TIMESTAMP('${conv.format.replace(/'/g, "\\'")}'):t`)), type: 'time' };
432
+ return { e: call('parse', s, dpl(`TIMESTAMP(${dplLiteral(conv.format)}):t`)), type: 'time' };
433
433
  },
434
434
  });
435
435
  function typeTest(build) {
@@ -30,3 +30,5 @@ export declare const MAX_PATTERN_ITEMS = 2000;
30
30
  export declare function regexToDpl(re: string, options?: DplOptions): DplConversion;
31
31
  /** True when the regex has no metacharacters, so it can be used as a literal string. */
32
32
  export declare function regexLiteral(re: string): string | undefined;
33
+ /** A DPL literal: quoted, with a backslash before every backslash and quote. */
34
+ export declare function dplLiteral(text: string): string;
@@ -485,7 +485,8 @@ function isFixed(item) {
485
485
  function exportName(name) {
486
486
  return /^[A-Za-z][A-Za-z0-9]*$/.test(name) ? name : `'${name}'`;
487
487
  }
488
- function dplLiteral(text) {
488
+ /** A DPL literal: quoted, with a backslash before every backslash and quote. */
489
+ export function dplLiteral(text) {
489
490
  return `'${text.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
490
491
  }
491
492
  function classEscape(c) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spl2dql/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Translate Splunk SPL searches to Dynatrace DQL queries and convert Splunk dashboards, offline: a deterministic library with no dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {