This project reads a JSON input file containing string lists and generates TypeScript modules that expose functions for each string entry using the FlexID API.
yarn install-
src/generate.ts: Main generator script.
-
run.sh: Convenience script to run the generator.
-
output/: Folder where the generated .ts files are saved.
To generate TypeScript files, you’ll need to export the string lists from your Mosaic admin console:
- Go to the Admin Console of your Transmit Security environment.
- From the left-hand menu, select Journey Tools.
- Under Journey Tools, choose Import/Export.
- In the Export tab, click Add.
- Choose String List from the export types.
- Select Export all String Lists.
- Press Save and download the generated
.jsonfile.
Once downloaded, this JSON file becomes the input for the generator script.
The input JSON must contain an exports array, where each entry has:
-
an id (string list name)
-
a values array with key=value strings
{
"exports": [
{
"data": {
"id": "ui_strings",
"values": [
"session_expired=Session ended.",
"logout_not_found=Session to logout not found."
]
}
}
]
}./run.sh path/to/input.jsonThis will:
-
Parse the input file
-
Create a .ts file under output/ per string list
-
Add an exported function for each key and a generic lookup() function
export async function lookup(key: string): Promise<string> {
return await FlexID.authScript().customFunctions.typed_list_value("ui_strings", key);
}
export async function session_expired(): Promise<string> {
return await FlexID.authScript().customFunctions.typed_list_value("ui_strings", "session_expired");
}The generator uses FlexID.authScript().customFunctions.typed_list_value(...), but the FlexID library is not included in this project. The generated files are intended to be used in an environment where FlexID is available.
Typical ignores include:
node_modules/
dist/
output/
.vscode/See .gitignore for full list.
MIT
