@bubblelab/shared-schemas 0.1.26 → 0.1.27
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +237 -0
- package/dist/index.js.map +1 -1
- package/dist/parameter-formatter.d.ts +42 -0
- package/dist/parameter-formatter.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared parameter formatting utilities for both frontend and runtime.
|
|
3
|
+
* This module contains core formatting logic that can be used by:
|
|
4
|
+
* - bubble-runtime (for code injection/transformation)
|
|
5
|
+
* - bubble-studio (for visual editing)
|
|
6
|
+
*/
|
|
7
|
+
import type { BubbleParameter } from './bubble-definition-schema.js';
|
|
8
|
+
/**
|
|
9
|
+
* Check if a string contains function literal patterns.
|
|
10
|
+
* When function literals are present, the source code must be preserved as-is
|
|
11
|
+
* because functions cannot be safely serialized or condensed to single-line.
|
|
12
|
+
*/
|
|
13
|
+
export declare function containsFunctionLiteral(value: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Format a parameter value based on its type.
|
|
16
|
+
* Converts values to their TypeScript code representation.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatParameterValue(value: unknown, type: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Condense a parameters string to a single line.
|
|
21
|
+
* Used when parameters don't contain function literals.
|
|
22
|
+
*/
|
|
23
|
+
export declare function condenseToSingleLine(input: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Strip // line comments and /* block comments that are outside of string and template literals.
|
|
26
|
+
* This is used before we condense parameters into a single line so inline comments don't swallow code.
|
|
27
|
+
*/
|
|
28
|
+
export declare function stripCommentsOutsideStrings(input: string): string;
|
|
29
|
+
export interface BuildParameterObjectOptions {
|
|
30
|
+
/** Whether to preserve multi-line formatting (default: false, will condense to single line) */
|
|
31
|
+
preserveFormatting?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build just the parameters object literal (no runtime metadata like logger config).
|
|
35
|
+
* This is the core function used by both runtime and frontend for parameter serialization.
|
|
36
|
+
*
|
|
37
|
+
* @param parameters - Array of bubble parameters
|
|
38
|
+
* @param options - Optional settings for formatting
|
|
39
|
+
* @returns The parameters object as a TypeScript code string
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildParameterObjectLiteral(parameters: BubbleParameter[], options?: BuildParameterObjectOptions): string;
|
|
42
|
+
//# sourceMappingURL=parameter-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-formatter.d.ts","sourceRoot":"","sources":["../src/parameter-formatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAgBrE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAsDzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4GjE;AAED,MAAM,WAAW,2BAA2B;IAC1C,+FAA+F;IAC/F,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,CAAC,EAAE,2BAA2B,GACpC,MAAM,CA6FR"}
|