@budibase/string-templates 3.2.47 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ export declare function isTest(): boolean;
2
+ export declare const isJSAllowed: () => boolean;
3
+ export declare const isTestingBackendJS: () => string | undefined;
4
+ export declare const setTestingBackendJS: () => void;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { ProcessOptions } from "./types";
1
+ import { Log, ProcessOptions } from "./types";
2
+ export type { Log, LogType } from "./types";
3
+ export { setTestingBackendJS } from "./environment";
2
4
  export { helpersToRemoveForJs, getJsHelperList } from "./helpers/list";
3
5
  export { FIND_ANY_HBS_REGEX } from "./utilities";
4
6
  export { setJSRunner, setOnErrorLog } from "./helpers/javascript";
@@ -42,6 +44,13 @@ export declare function processObjectSync(object: {
42
44
  * @returns {string} The enriched string, all templates should have been replaced if they can be.
43
45
  */
44
46
  export declare function processStringSync(string: string, context?: object, opts?: ProcessOptions): string;
47
+ /**
48
+ * Same as function above, but allows logging to be returned - this is only for JS bindings.
49
+ */
50
+ export declare function processStringWithLogsSync(string: string, context?: object, opts?: ProcessOptions): {
51
+ result: string;
52
+ logs: Log[];
53
+ };
45
54
  /**
46
55
  * By default with expressions like {{ name }} handlebars will escape various
47
56
  * characters, which can be problematic. To fix this we use the syntax {{{ name }}},
@@ -1,3 +1,7 @@
1
- import { ProcessOptions } from "../types";
1
+ import { Log, ProcessOptions } from "../types";
2
2
  export declare function preprocess(string: string, opts: ProcessOptions): string;
3
3
  export declare function postprocess(string: string): string;
4
+ export declare function postprocessWithLogs(string: string): {
5
+ result: string;
6
+ logs: Log[];
7
+ };
@@ -1,12 +1,18 @@
1
+ import { Log } from "../types";
1
2
  export declare enum PostProcessorNames {
2
3
  CONVERT_LITERALS = "convert-literals"
3
4
  }
4
- type PostprocessorFn = (statement: string) => string;
5
- declare class Postprocessor {
5
+ export type PostprocessorFn = (statement: string) => {
6
+ result: any;
7
+ logs?: Log[];
8
+ };
9
+ export declare class Postprocessor {
6
10
  name: PostProcessorNames;
7
11
  private readonly fn;
8
12
  constructor(name: PostProcessorNames, fn: PostprocessorFn);
9
- process(statement: string): string;
13
+ process(statement: string): {
14
+ result: any;
15
+ logs?: Log[];
16
+ };
10
17
  }
11
18
  export declare const processors: Postprocessor[];
12
- export {};
@@ -5,12 +5,11 @@ export declare enum PreprocessorNames {
5
5
  FINALISE = "finalise",
6
6
  NORMALIZE_SPACES = "normalize-spaces"
7
7
  }
8
- type PreprocessorFn = (statement: string, opts?: ProcessOptions) => string;
9
- declare class Preprocessor {
8
+ export type PreprocessorFn = (statement: string, opts?: ProcessOptions) => string;
9
+ export declare class Preprocessor {
10
10
  name: string;
11
11
  private readonly fn;
12
12
  constructor(name: PreprocessorNames, fn: PreprocessorFn);
13
13
  process(fullString: string, statement: string, opts: ProcessOptions): string;
14
14
  }
15
15
  export declare const processors: Preprocessor[];
16
- export {};
package/dist/types.d.ts CHANGED
@@ -8,3 +8,9 @@ export interface ProcessOptions {
8
8
  onlyFound?: boolean;
9
9
  disabledHelpers?: string[];
10
10
  }
11
+ export type LogType = "log" | "info" | "debug" | "warn" | "error" | "table";
12
+ export interface Log {
13
+ log: any[];
14
+ line?: number;
15
+ type?: LogType;
16
+ }
@@ -10,3 +10,4 @@ export declare const removeHandlebarsStatements: (string: string, replacement?:
10
10
  export declare const btoa: (plainText: string) => string;
11
11
  export declare const atob: (base64: string) => string;
12
12
  export declare const prefixStrings: (baseString: string, strings: string[], prefix: string) => string;
13
+ export declare function frontendWrapJS(js: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/string-templates",
3
- "version": "3.2.47",
3
+ "version": "3.3.0",
4
4
  "description": "Handlebars wrapper for Budibase templating.",
5
5
  "main": "dist/bundle.cjs",
6
6
  "module": "dist/bundle.mjs",
@@ -42,5 +42,5 @@
42
42
  "ts-jest": "29.1.1",
43
43
  "typescript": "5.7.2"
44
44
  },
45
- "gitHead": "b05548bb07650275f45856cff116a59b5e78f5d3"
45
+ "gitHead": "0bf13accc06044438d403b43ffa9eb696ecabe78"
46
46
  }