@kizenapps/packager 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/lib/minify.ts","../src/lib/apiNames.ts","../src/lib/image.ts","../src/lib/structure.ts","../src/lib/package.ts","../src/lib/transform.ts"],"sourcesContent":["export { minifyFiles } from \"./lib/minify.js\";\nexport { packagePlugin, parseManifestFromFiles } from \"./lib/package.js\";\nexport { transformDeployablePlugin } from \"./lib/transform.js\";\nexport { sanitizeToAPIName, scriptRuntimeToApiName } from \"./lib/apiNames.js\";\nexport { imagetoUint8Array, zipToUint8Array } from \"./lib/image.js\";\nexport {\n thumbnailImageExtensions,\n triggerImageExtensions,\n EVENT_SCRIPTS_DIRECTORY_NAME,\n FLOATING_FRAMES_DIRECTORY_NAME,\n DATA_ADORNMENTS_DIRECTORY_NAME,\n TOOLBAR_ITEMS_DIRECTORY_NAME,\n ROUTABLE_PAGES_DIRECTORY_NAME,\n BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME,\n JS_ACTIONS_DIRECTORY_NAME,\n OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME,\n AUTOMATION_STEPS_DIRECTORY_NAME,\n SETUP_ASSISTANT_DIRECTORY_NAME,\n USER_SETUP_ASSISTANT_DIRECTORY_NAME,\n CALENDAR_SOURCES_DIRECTORY_NAME,\n THUMBNAIL_FILE_NAMES,\n RELEASE_NOTES_EXTENSION,\n SCRIPT_EXTENSION,\n MAIN_SCRIPT_FILE,\n MESSAGE_SCRIPT_FILE,\n CALLBACK_SCRIPT_FILE,\n AUTOMATION_SCRIPT_FILE,\n CONFIG_FILE_NAME,\n STYLES_FILE_NAME,\n MANIFEST_FILE_NAME,\n KZN_FILE_NAME,\n maybeParseConfig,\n getMinimizedConfig,\n getAdornmentIcon,\n} from \"./lib/structure.js\";\n\nexport type { FileContent, MinifiedFileContent } from \"./types/files.js\";\nexport type {\n ManifestFile,\n ManifestFileContent,\n SetupAssistantConfig,\n SetupAssistantField,\n Environment,\n PublishableEnvironments,\n EnvironmentAliases,\n} from \"./types/manifest.js\";\nexport type {\n PackagedPlugin,\n ProcessedPluginPackage,\n DeployablePlugin,\n FloatingFrame,\n FloatingFramesMap,\n DataAdornment,\n DataAdornmentConfig,\n DataAdornmentsMap,\n RoutablePage,\n RoutablePagesMap,\n ToolbarItem,\n ToolbarItemsMap,\n JSAction,\n JSActionsMap,\n RouteScript,\n RouteScriptsMap,\n ObjectSettingsItem,\n ObjectSettingsItemsMap,\n AutomationStep,\n AutomationStepsMap,\n AutomationScriptRuntimeInput,\n AutomationScriptRuntimeOutput,\n CalendarSource,\n CalendarSourcesMap,\n EventScripts,\n} from \"./types/package.js\";\n","import type { FileContent, MinifiedFileContent } from \"../types/files.js\";\n\nconst minifyFile = async (file: FileContent): Promise<string> => {\n if (file.path.endsWith(\".js\")) {\n if (!file.content) {\n return \"\";\n }\n\n const { minify } = await import(\"@node-minify/core\");\n const { uglifyJs } = await import(\"@node-minify/uglify-js\");\n\n // The @node-minify generic Compressor type causes variance issues in strict TS.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: string = await (minify as (opts: any) => Promise<string>)({\n compressor: uglifyJs,\n content: file.content,\n options: {\n mangle: true,\n parse: {\n bare_returns: true,\n },\n },\n });\n\n return result;\n }\n\n return file.content;\n};\n\nexport const minifyFiles = async (\n files: FileContent[],\n): Promise<MinifiedFileContent[]> => {\n return Promise.all(\n files.map(async (file) => {\n const minified = await minifyFile(file);\n return { ...file, minified };\n }),\n );\n};\n","import type { AutomationScriptRuntimeInput, AutomationScriptRuntimeOutput } from \"../types/package.js\";\n\nexport const sanitizeToAPIName = (name: string): string => {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9\\-\\s]/g, \"\")\n .replace(/\\s+/g, \"_\");\n};\n\nexport const scriptRuntimeToApiName = (\n runtime: AutomationScriptRuntimeInput,\n): AutomationScriptRuntimeOutput => {\n const result = runtime\n .replace(/\\s+/g, \"-\")\n .replace(/\\./g, \"-\") as AutomationScriptRuntimeOutput;\n\n return result;\n};\n","export const imagetoUint8Array = (base64Image: string): Uint8Array => {\n const byteCharacters = atob(base64Image);\n const byteNumbers = new Array(byteCharacters.length);\n\n for (let i = 0; i < byteCharacters.length; i++) {\n byteNumbers[i] = byteCharacters.charCodeAt(i);\n }\n\n return new Uint8Array(byteNumbers);\n};\n\nexport const zipToUint8Array = (zip: Buffer): Uint8Array => {\n return Uint8Array.from(zip);\n};\n","import type { MinifiedFileContent } from \"../types/files.js\";\n\nexport const thumbnailImageExtensions = [\"png\"];\nexport const triggerImageExtensions = [...thumbnailImageExtensions, \"svg\"];\n\nexport const EVENT_SCRIPTS_DIRECTORY_NAME = \"eventScripts\";\nexport const FLOATING_FRAMES_DIRECTORY_NAME = \"floatingFrames\";\nexport const DATA_ADORNMENTS_DIRECTORY_NAME = \"dataAdornments\";\nexport const TOOLBAR_ITEMS_DIRECTORY_NAME = \"toolbarItems\";\nexport const ROUTABLE_PAGES_DIRECTORY_NAME = \"pages\";\nexport const BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME = \"routeScripts\";\nexport const JS_ACTIONS_DIRECTORY_NAME = \"actions\";\nexport const OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME = \"objectSettingsItems\";\nexport const AUTOMATION_STEPS_DIRECTORY_NAME = \"automationSteps\";\nexport const SETUP_ASSISTANT_DIRECTORY_NAME = \"setupAssistant\";\nexport const USER_SETUP_ASSISTANT_DIRECTORY_NAME = \"userSetupAssistant\";\nexport const CALENDAR_SOURCES_DIRECTORY_NAME = \"calendarSources\";\n\nexport const THUMBNAIL_FILE_NAMES = thumbnailImageExtensions.map(\n (ext) => `thumbnail.${ext}`,\n);\n\nexport const RELEASE_NOTES_EXTENSION = \"md\";\nexport const SCRIPT_EXTENSION = \"js\";\n\nexport const MAIN_SCRIPT_FILE = `script.${SCRIPT_EXTENSION}`;\nexport const MESSAGE_SCRIPT_FILE = `message.${SCRIPT_EXTENSION}`;\nexport const CALLBACK_SCRIPT_FILE = `callback.${SCRIPT_EXTENSION}`;\nexport const AUTOMATION_SCRIPT_FILE = `script.py`;\n\nexport const CONFIG_FILE_NAME = \"config.json\";\nexport const STYLES_FILE_NAME = \"styles.css\";\nexport const MANIFEST_FILE_NAME = \"kizen.json\";\nexport const KZN_FILE_NAME = \"import.kzn\";\n\nexport const maybeParseConfig = (\n content: string | undefined,\n path: string,\n): Record<string, unknown> => {\n if (!content) {\n throw new Error(`No content provided for config file: ${path}`);\n }\n\n try {\n return JSON.parse(content) as Record<string, unknown>;\n } catch {\n throw new Error(`Failed to parse config content: ${path}`);\n }\n};\n\nexport const getMinimizedConfig = (\n config: Record<string, unknown>,\n entry: string,\n splitPath: string[],\n consideredFiles: MinifiedFileContent[],\n): Record<string, unknown> => {\n const result: Record<string, unknown> =\n (config[\"minimized_config\"] as Record<string, unknown>) ?? {};\n\n if (result[\"customIconFile\"]) {\n let basePath = splitPath.slice(0, -1).join(\"/\");\n\n if (entry.endsWith(\"/\")) {\n basePath = `${entry}${basePath}`;\n } else {\n basePath = `${entry}/${basePath}`;\n }\n\n const filePath = `${basePath}/${result[\"customIconFile\"]}`;\n const file = consideredFiles.find((f) => f.path === filePath);\n\n if (file?.base64Image) {\n let extension = filePath.split(\".\").pop()?.toLowerCase();\n\n if (extension === \"svg\") {\n extension = \"svg+xml\";\n }\n\n result[\"customIcon\"] = `data:image/${extension};base64,${file.base64Image}`;\n }\n }\n\n return result;\n};\n\nexport const getAdornmentIcon = (\n config: Record<string, unknown>,\n entry: string,\n splitPath: string[],\n consideredFiles: MinifiedFileContent[],\n): string => {\n if (config[\"customIconFile\"]) {\n let basePath = splitPath.slice(0, -1).join(\"/\");\n\n if (entry.endsWith(\"/\")) {\n basePath = `${entry}${basePath}`;\n } else {\n basePath = `${entry}/${basePath}`;\n }\n\n const filePath = `${basePath}/${config[\"customIconFile\"]}`;\n const file = consideredFiles.find((f) => f.path === filePath);\n\n if (file?.base64Image) {\n let extension = filePath.split(\".\").pop()?.toLowerCase();\n\n if (extension === \"svg\") {\n extension = \"svg+xml\";\n }\n\n return `data:image/${extension};base64,${file.base64Image}`;\n }\n }\n\n return \"\";\n};\n","import type { ManifestFileContent } from \"../types/manifest.js\";\nimport type { MinifiedFileContent } from \"../types/files.js\";\nimport type {\n AutomationStepsMap,\n CalendarSourcesMap,\n DataAdornmentsMap,\n FloatingFramesMap,\n JSActionsMap,\n ObjectSettingsItemsMap,\n ProcessedPluginPackage,\n RoutablePagesMap,\n RouteScriptsMap,\n ToolbarItemsMap,\n} from \"../types/package.js\";\nimport { sanitizeToAPIName, scriptRuntimeToApiName } from \"./apiNames.js\";\nimport { imagetoUint8Array, zipToUint8Array } from \"./image.js\";\nimport {\n AUTOMATION_SCRIPT_FILE,\n AUTOMATION_STEPS_DIRECTORY_NAME,\n BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME,\n CALLBACK_SCRIPT_FILE,\n CALENDAR_SOURCES_DIRECTORY_NAME,\n CONFIG_FILE_NAME,\n DATA_ADORNMENTS_DIRECTORY_NAME,\n EVENT_SCRIPTS_DIRECTORY_NAME,\n FLOATING_FRAMES_DIRECTORY_NAME,\n getAdornmentIcon,\n getMinimizedConfig,\n JS_ACTIONS_DIRECTORY_NAME,\n KZN_FILE_NAME,\n MAIN_SCRIPT_FILE,\n MANIFEST_FILE_NAME,\n maybeParseConfig,\n MESSAGE_SCRIPT_FILE,\n OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME,\n RELEASE_NOTES_EXTENSION,\n ROUTABLE_PAGES_DIRECTORY_NAME,\n SCRIPT_EXTENSION,\n SETUP_ASSISTANT_DIRECTORY_NAME,\n STYLES_FILE_NAME,\n THUMBNAIL_FILE_NAMES,\n TOOLBAR_ITEMS_DIRECTORY_NAME,\n USER_SETUP_ASSISTANT_DIRECTORY_NAME,\n} from \"./structure.js\";\n\nconst replacementVar = \"__kizen_state\";\nconst prepend = \"const __kizen_utils = {};\\n\";\n\nconst convertToSelfInvokingFunction = (\n fn: string,\n variable: string,\n args: Record<string, unknown> = {},\n prependCode = \"\",\n): string => {\n const functionString = fn.replace(/\\n$/, \"\").replace(/;$/, \"\");\n const inner = `(${functionString})({ state: {{${variable}}}, args: ${JSON.stringify(args)}, utils: __kizen_utils })`;\n const full = `(function() { ${prependCode}\\nreturn ${inner}; })()`;\n return full;\n};\n\nconst mapFields = (\n fields: Array<Record<string, unknown>>,\n scriptsByKey: Record<string, Record<string, string>>,\n): Array<Record<string, unknown>> => {\n return fields.map((field) => {\n if (\n field[\"type\"] === \"container\" &&\n field[\"fields\"] &&\n Array.isArray(field[\"fields\"])\n ) {\n return {\n ...field,\n fields: mapFields(\n field[\"fields\"] as Array<Record<string, unknown>>,\n scriptsByKey,\n ),\n };\n }\n\n const fieldKey = field[\"key\"] as string;\n const scripts = scriptsByKey[fieldKey];\n\n if (scripts) {\n const result = { ...field };\n\n for (const fnName of [\n \"getFetchUrl\",\n \"optionMapper\",\n \"getHeaders\",\n \"getBody\",\n \"getContextUrl\",\n ] as const) {\n const fn = scripts[fnName];\n if (fn) {\n result[fnName] = convertToSelfInvokingFunction(\n fn,\n replacementVar,\n {},\n prepend,\n );\n }\n }\n\n return result;\n }\n\n return field;\n });\n};\n\nconst processSetupAssistantFromFiles = (\n assistantConfig: Record<string, unknown> | null,\n scripts: Array<{ key: string; type: string; content: string }>,\n): Record<string, unknown> | undefined => {\n if (!assistantConfig) {\n return undefined;\n }\n\n const scriptsByKey: Record<string, Record<string, string>> = scripts.reduce(\n (acc, script) => {\n if (!acc[script.key]) {\n acc[script.key] = {};\n }\n acc[script.key]![script.type] = script.content;\n return acc;\n },\n {} as Record<string, Record<string, string>>,\n );\n\n const newConfig = { ...assistantConfig };\n\n if (newConfig[\"fields\"] && Array.isArray(newConfig[\"fields\"])) {\n newConfig[\"fields\"] = mapFields(\n newConfig[\"fields\"] as Array<Record<string, unknown>>,\n scriptsByKey,\n );\n }\n\n return newConfig;\n};\n\nconst processOnePluginFromManifest = (\n manifest: ManifestFileContent,\n files: MinifiedFileContent[],\n): ProcessedPluginPackage => {\n const entry = manifest.entry;\n const releaseNotesDirectory = manifest.release_notes_directory;\n const apiName = manifest.api_name;\n\n const consideredFiles = files.filter(\n (f) => f.path !== MANIFEST_FILE_NAME && f.path.startsWith(entry),\n );\n\n const releaseNotesFiles = releaseNotesDirectory\n ? files.filter((f) => f.path.startsWith(releaseNotesDirectory))\n : [];\n\n const { version } = manifest;\n\n const releaseNotes = releaseNotesFiles.find((file) =>\n file.path.endsWith(`${version}.${RELEASE_NOTES_EXTENSION}`),\n );\n\n const floatingFrames: FloatingFramesMap = {};\n const dataAdornments: DataAdornmentsMap = {};\n const toolbarItems: ToolbarItemsMap = {};\n const routablePages: RoutablePagesMap = {};\n const routeScripts: RouteScriptsMap = {};\n const jsActions: JSActionsMap = {};\n const objectSettingsItems: ObjectSettingsItemsMap = {};\n const automationSteps: AutomationStepsMap = {};\n const calendarSources: CalendarSourcesMap = {};\n\n let thumbnail: Uint8Array | null = null;\n let kznFile: Uint8Array | null = null;\n let hasBlockingCondition = false;\n\n const requiredConfigFiles: Record<string, boolean> = {};\n\n let setupAssistantJSON: Record<string, unknown> | null = null;\n const setupAssistantFunctions: Array<{\n key: string;\n type: string;\n content: string;\n }> = [];\n\n let userSetupAssistantJSON: Record<string, unknown> | null = null;\n const userSetupAssistantFunctions: Array<{\n key: string;\n type: string;\n content: string;\n }> = [];\n\n for (const file of consideredFiles) {\n let strippedPath = file.path.replace(entry, \"\");\n strippedPath = strippedPath.startsWith(\"/\")\n ? strippedPath.substring(1)\n : strippedPath;\n\n const splitPath = strippedPath.split(\"/\");\n\n if (splitPath[0] === SETUP_ASSISTANT_DIRECTORY_NAME) {\n if (splitPath[1] === \"assistant.json\") {\n setupAssistantJSON = maybeParseConfig(file.content, file.path);\n } else {\n const assistantKey = splitPath[1];\n if (assistantKey && splitPath[2]?.endsWith(`.${SCRIPT_EXTENSION}`)) {\n setupAssistantFunctions.push({\n key: assistantKey,\n type: splitPath[2].replace(`.${SCRIPT_EXTENSION}`, \"\"),\n content: file.content,\n });\n }\n }\n } else if (splitPath[0] === USER_SETUP_ASSISTANT_DIRECTORY_NAME) {\n if (splitPath[1] === \"assistant.json\") {\n userSetupAssistantJSON = maybeParseConfig(file.content, file.path);\n } else {\n const assistantKey = splitPath[1];\n if (assistantKey && splitPath[2]?.endsWith(`.${SCRIPT_EXTENSION}`)) {\n userSetupAssistantFunctions.push({\n key: assistantKey,\n type: splitPath[2].replace(`.${SCRIPT_EXTENSION}`, \"\"),\n content: file.content,\n });\n }\n }\n } else if (splitPath[0] === FLOATING_FRAMES_DIRECTORY_NAME) {\n const floatingFrameName = splitPath[1];\n if (!floatingFrameName) continue;\n\n if (!floatingFrames[floatingFrameName]) {\n requiredConfigFiles[`frame:${floatingFrameName}`] = true;\n floatingFrames[floatingFrameName] = {\n name: \"\",\n api_name: \"\",\n title: \"\",\n type: \"script\",\n css: \"\",\n event_scripts: {},\n default_position: \"bottom-right\",\n header_color: \"\",\n header_text_color: \"\",\n height: 0,\n width: 0,\n ignore: [],\n match: [],\n message_handler: \"\",\n minimized_style: \"circle\",\n minimized_config: {},\n script: \"\",\n html: \"\",\n when: \"\",\n };\n }\n\n const frame = floatingFrames[floatingFrameName]!;\n\n if (splitPath[2] === EVENT_SCRIPTS_DIRECTORY_NAME) {\n if (splitPath[3]?.endsWith(`.${SCRIPT_EXTENSION}`)) {\n const functionName = splitPath[3].replace(`.${SCRIPT_EXTENSION}`, \"\");\n frame.event_scripts[functionName] = file.minified;\n }\n } else if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`frame:${floatingFrameName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n frame.name = (config[\"name\"] as string) || \"\";\n frame.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(floatingFrameName);\n frame.title = (config[\"title\"] as string) || \"\";\n frame.default_position =\n (config[\"default_position\"] as string) || \"bottom-right\";\n frame.header_color = (config[\"header_color\"] as string) || \"\";\n frame.header_text_color = (config[\"header_text_color\"] as string) || \"\";\n frame.height = (config[\"height\"] as number) || 0;\n frame.width = (config[\"width\"] as number) || 0;\n frame.ignore = (config[\"ignore\"] as string[]) || [];\n frame.match = (config[\"match\"] as string[]) || [];\n frame.html = (config[\"html\"] as string) || \"\";\n frame.minimized_style =\n (config[\"minimized_style\"] as \"bar\" | \"circle\" | \"none\") || \"circle\";\n frame.minimized_config = getMinimizedConfig(\n config,\n entry,\n splitPath,\n consideredFiles,\n );\n frame.when = (config[\"when\"] as string) || \"\";\n } else if (splitPath[2] === MESSAGE_SCRIPT_FILE) {\n frame.message_handler = file.minified;\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n frame.script = file.minified;\n } else if (splitPath[2] === STYLES_FILE_NAME) {\n frame.css = file.minified;\n }\n } else if (splitPath[0] === DATA_ADORNMENTS_DIRECTORY_NAME) {\n const dataAdornmentName = splitPath[1];\n if (!dataAdornmentName) continue;\n\n if (!dataAdornments[dataAdornmentName]) {\n requiredConfigFiles[`dataAdornment:${dataAdornmentName}`] = true;\n dataAdornments[dataAdornmentName] = {\n config: { icon: \"\", color: \"\", tooltip: \"\" },\n field_type: \"phonenumber\",\n script: \"\",\n when: \"\",\n };\n }\n\n const adornment = dataAdornments[dataAdornmentName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`dataAdornment:${dataAdornmentName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n adornment.config.icon = (config[\"icon\"] as string) || \"\";\n adornment.config.color = (config[\"color\"] as string) || \"\";\n adornment.config.tooltip = (config[\"tooltip\"] as string) || \"\";\n adornment.config.customIcon = getAdornmentIcon(\n config,\n entry,\n splitPath,\n consideredFiles,\n );\n adornment.field_type =\n (config[\"field_type\"] as \"phonenumber\" | \"date\" | \"datetime\") ||\n \"phonenumber\";\n adornment.when = (config[\"when\"] as string) || \"\";\n if (config[\"when\"]) hasBlockingCondition = true;\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n adornment.script = file.minified;\n }\n } else if (splitPath[0] === TOOLBAR_ITEMS_DIRECTORY_NAME) {\n const toolbarItemName = splitPath[1];\n if (!toolbarItemName) continue;\n\n if (!toolbarItems[toolbarItemName]) {\n requiredConfigFiles[`toolbarItem:${toolbarItemName}`] = true;\n toolbarItems[toolbarItemName] = {\n api_name: \"\",\n label: \"\",\n icon: \"\",\n color: \"\",\n script: \"\",\n when: \"\",\n };\n }\n\n const item = toolbarItems[toolbarItemName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`toolbarItem:${toolbarItemName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n item.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(toolbarItemName);\n item.label = (config[\"label\"] as string) || \"\";\n item.icon = (config[\"icon\"] as string) || \"\";\n item.color = (config[\"color\"] as string) || \"\";\n item.when = (config[\"when\"] as string) || \"\";\n if (config[\"when\"]) hasBlockingCondition = true;\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n item.script = file.minified;\n }\n } else if (splitPath[0] === ROUTABLE_PAGES_DIRECTORY_NAME) {\n const pageName = splitPath[1];\n if (!pageName) continue;\n\n if (!routablePages[pageName]) {\n requiredConfigFiles[`page:${pageName}`] = true;\n routablePages[pageName] = {\n name: pageName,\n api_name: \"\",\n event_scripts: {},\n script: \"\",\n callback: \"\",\n css: \"\",\n is_toolbar_item: false,\n toolbar_color: \"\",\n toolbar_icon: \"\",\n type: \"script\",\n html: \"\",\n iframe_url: \"\",\n };\n }\n\n const page = routablePages[pageName]!;\n\n if (splitPath[2] === EVENT_SCRIPTS_DIRECTORY_NAME) {\n if (splitPath[3]?.endsWith(SCRIPT_EXTENSION)) {\n const functionName = splitPath[3].replace(`.${SCRIPT_EXTENSION}`, \"\");\n page.event_scripts[functionName] = file.minified;\n }\n } else if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`page:${pageName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n page.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(pageName);\n page.name = (config[\"name\"] as string) || pageName;\n page.is_toolbar_item = (config[\"is_toolbar_item\"] as boolean) || false;\n page.toolbar_color = (config[\"toolbar_color\"] as string) || \"\";\n page.toolbar_icon = (config[\"toolbar_icon\"] as string) || \"\";\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n page.script = file.minified;\n } else if (splitPath[2] === CALLBACK_SCRIPT_FILE) {\n page.callback = file.minified;\n } else if (splitPath[2] === STYLES_FILE_NAME) {\n page.css = file.minified;\n }\n } else if (splitPath[0] === AUTOMATION_STEPS_DIRECTORY_NAME) {\n const stepName = splitPath[1];\n if (!stepName) continue;\n\n if (!automationSteps[stepName]) {\n requiredConfigFiles[`automationStep:${stepName}`] = true;\n automationSteps[stepName] = {\n name: \"\",\n action_step_api_name: \"\",\n overall_description: \"\",\n action_description: \"\",\n action_type: \"\",\n script_runtime: scriptRuntimeToApiName(\"python 3.12\"),\n secrets: [],\n inputs: [],\n outputs: [],\n script: \"\",\n when: \"\",\n };\n }\n\n const step = automationSteps[stepName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`automationStep:${stepName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n step.name = (config[\"name\"] as string) || stepName;\n step.action_step_api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(stepName);\n step.overall_description =\n (config[\"plugin_description\"] as string) || \"\";\n step.action_description =\n (config[\"action_description\"] as string) || \"\";\n step.action_type = (config[\"action_type\"] as string) || \"\";\n step.secrets = (config[\"secrets\"] as string[]) || [];\n step.inputs = (config[\"inputs\"] as typeof step.inputs) || [];\n step.outputs = (config[\"outputs\"] as typeof step.outputs) || [];\n step.script_runtime = scriptRuntimeToApiName(\n ((config[\"runtime\"] as string) || \"python 3.12\") as `${string} ${number}.${number}`,\n );\n step.when = (config[\"when\"] as string) || \"\";\n if (config[\"when\"]) hasBlockingCondition = true;\n } else if (splitPath[2] === AUTOMATION_SCRIPT_FILE) {\n step.script = file.content;\n }\n } else if (splitPath[0] === BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME) {\n const routeName = splitPath[1];\n if (!routeName) continue;\n\n if (!routeScripts[routeName]) {\n requiredConfigFiles[`route:${routeName}`] = true;\n routeScripts[routeName] = {\n script: \"\",\n api_name: \"\",\n hint_object_name: \"\",\n routes: [],\n name: routeName,\n };\n }\n\n const route = routeScripts[routeName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`route:${routeName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n route.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(routeName);\n route.hint_object_name =\n (config[\"hint_object_name\"] as string) || \"\";\n route.routes = (config[\"routes\"] as string[]) || [];\n route.name = (config[\"name\"] as string) || routeName;\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n route.script = file.minified;\n }\n } else if (splitPath[0] === JS_ACTIONS_DIRECTORY_NAME) {\n const actionName = splitPath[1];\n if (!actionName) continue;\n\n if (!jsActions[actionName]) {\n requiredConfigFiles[`action:${actionName}`] = true;\n jsActions[actionName] = {\n script: \"\",\n name: \"\",\n hint_object_name: \"\",\n api_name: \"\",\n };\n }\n\n const action = jsActions[actionName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`action:${actionName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n action.name = (config[\"name\"] as string) || actionName;\n action.hint_object_name =\n (config[\"hint_object_name\"] as string) || \"\";\n action.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(actionName);\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n action.script = file.minified;\n }\n } else if (splitPath[0] === OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME) {\n const itemName = splitPath[1];\n if (!itemName) continue;\n\n if (!objectSettingsItems[itemName]) {\n requiredConfigFiles[`objectSettingsItem:${itemName}`] = true;\n objectSettingsItems[itemName] = {\n api_name: \"\",\n label: \"\",\n script: \"\",\n when: \"\",\n };\n }\n\n const settingsItem = objectSettingsItems[itemName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`objectSettingsItem:${itemName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n settingsItem.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(itemName);\n settingsItem.label = (config[\"label\"] as string) || \"\";\n settingsItem.when = (config[\"when\"] as string) || \"\";\n } else if (splitPath[2] === MAIN_SCRIPT_FILE) {\n settingsItem.script = file.minified;\n }\n } else if (splitPath[0] === CALENDAR_SOURCES_DIRECTORY_NAME) {\n const itemName = splitPath[1];\n if (!itemName) continue;\n\n if (!calendarSources[itemName]) {\n requiredConfigFiles[`calendarSource:${itemName}`] = true;\n calendarSources[itemName] = {\n api_name: \"\",\n name: \"\",\n calendars_script: \"\",\n events_script: \"\",\n when: \"\",\n };\n }\n\n const cal = calendarSources[itemName]!;\n\n if (splitPath[2] === CONFIG_FILE_NAME) {\n requiredConfigFiles[`calendarSource:${itemName}`] = false;\n const config = maybeParseConfig(file.content, file.path);\n cal.api_name =\n (config[\"api_name\"] as string) || sanitizeToAPIName(itemName);\n cal.name = (config[\"name\"] as string) || \"\";\n cal.when = (config[\"when\"] as string) || \"\";\n if (config[\"when\"]) hasBlockingCondition = true;\n } else if (splitPath[2] === \"calendars.js\") {\n cal.calendars_script = file.minified;\n } else if (splitPath[2] === \"events.js\") {\n cal.events_script = file.minified;\n }\n } else if (splitPath[0] === KZN_FILE_NAME) {\n if (!file.binaryData) {\n throw new Error(\n `KZN file ${file.path} does not contain binary data. Cannot proceed.`,\n );\n }\n\n if (kznFile) {\n throw new Error(\n `Multiple KZN files found for plugin ${apiName}. Only one is allowed.`,\n );\n }\n\n kznFile = zipToUint8Array(file.binaryData);\n } else if (THUMBNAIL_FILE_NAMES.includes(splitPath[0] ?? \"\")) {\n if (file.base64Image) {\n if (thumbnail) {\n throw new Error(\n `Multiple thumbnail files found for plugin ${apiName}. Only one is allowed.`,\n );\n }\n thumbnail = imagetoUint8Array(file.base64Image);\n }\n }\n }\n\n const requiredFileKeys = Object.keys(requiredConfigFiles).filter(\n (key) => requiredConfigFiles[key] === true,\n );\n\n if (requiredFileKeys.length > 0) {\n throw new Error(\n `The following required files are missing for plugin ${apiName}: ${requiredFileKeys.join(\" config.json, \")} config.json. Please ensure these files are present in the repository.`,\n );\n }\n\n const setupAssistantContent = processSetupAssistantFromFiles(\n setupAssistantJSON,\n setupAssistantFunctions,\n );\n\n const userSetupAssistantContent = processSetupAssistantFromFiles(\n userSetupAssistantJSON,\n userSetupAssistantFunctions,\n );\n\n // Build the updated manifest carefully to satisfy exactOptionalPropertyTypes:\n // only set optional fields when they have a value.\n const updatedManifest: ManifestFileContent = {\n ...manifest,\n block_loading_for_setup: hasBlockingCondition,\n };\n\n const resolvedSetupAssistant =\n manifest.setup_assistant ??\n (setupAssistantContent as ManifestFileContent[\"setup_assistant\"]);\n if (resolvedSetupAssistant !== undefined) {\n updatedManifest.setup_assistant = resolvedSetupAssistant;\n }\n\n const resolvedUserSetupAssistant =\n manifest.user_setup_assistant ??\n (userSetupAssistantContent as ManifestFileContent[\"user_setup_assistant\"]);\n if (resolvedUserSetupAssistant !== undefined) {\n updatedManifest.user_setup_assistant = resolvedUserSetupAssistant;\n }\n\n return {\n [apiName]: {\n manifest: updatedManifest,\n thumbnail,\n floatingFrames,\n dataAdornments,\n toolbarItems,\n routablePages,\n actions: jsActions,\n routeScripts,\n releaseNotes: releaseNotes?.content,\n objectSettingsMenuItems: objectSettingsItems,\n calendarSources,\n automationSteps,\n kznFile,\n },\n };\n};\n\n/**\n * Packages one or more plugins from the given set of minified files.\n * The caller is responsible for any branch-based filtering of manifests before calling.\n */\nexport const packagePlugin = (\n files: MinifiedFileContent[],\n manifests: ManifestFileContent | ManifestFileContent[],\n): ProcessedPluginPackage => {\n const manifestArray = Array.isArray(manifests) ? manifests : [manifests];\n\n return manifestArray.reduce<ProcessedPluginPackage>((acc, manifest) => {\n return { ...acc, ...processOnePluginFromManifest(manifest, files) };\n }, {});\n};\n\n/**\n * Reads and parses kizen.json from a set of files.\n * Returns the manifest content (single or array) without any branch defaulting.\n */\nexport const parseManifestFromFiles = (\n files: MinifiedFileContent[],\n): ManifestFileContent | ManifestFileContent[] => {\n const manifestFile = files.find((f) => f.path === MANIFEST_FILE_NAME);\n\n if (!manifestFile) {\n throw new Error(\"Missing kizen.json at the root of the plugin directory.\");\n }\n\n try {\n return JSON.parse(manifestFile.content) as\n | ManifestFileContent\n | ManifestFileContent[];\n } catch {\n throw new Error(\"kizen.json could not be parsed.\");\n }\n};\n","import type { SetupAssistantConfig } from \"../types/manifest.js\";\nimport type { DeployablePlugin, PackagedPlugin } from \"../types/package.js\";\n\nconst formatBaseConfig = (packagedPlugin: PackagedPlugin): Record<string, unknown> => {\n const assistantConfig: SetupAssistantConfig | undefined =\n packagedPlugin.manifest.setup_assistant;\n\n const actionsByApiName = Object.values(packagedPlugin.actions).reduce(\n (acc, action) => {\n acc[action.api_name] = action;\n return acc;\n },\n {} as Record<string, unknown>,\n );\n\n const userAssistantConfig: SetupAssistantConfig | undefined =\n packagedPlugin.manifest.user_setup_assistant;\n\n return {\n ...packagedPlugin.manifest.base_config,\n setup_assistant: assistantConfig\n ? {\n ...assistantConfig,\n actions: (assistantConfig.actions ?? []).map((apiName) => {\n const action = actionsByApiName[apiName];\n\n if (!action) {\n throw new Error(\n `Action with API name ${apiName} not found in packaged plugin for setup assistant. Allowed actions: ${Object.keys(actionsByApiName).join(\", \")}`,\n );\n }\n\n return action;\n }),\n }\n : undefined,\n user_setup_assistant: userAssistantConfig,\n block_loading_for_setup: packagedPlugin.manifest.block_loading_for_setup,\n };\n};\n\nexport const transformDeployablePlugin = (\n packagedPlugin: PackagedPlugin,\n): DeployablePlugin => {\n const {\n manifest,\n floatingFrames,\n dataAdornments,\n routablePages,\n toolbarItems,\n actions,\n routeScripts,\n thumbnail,\n releaseNotes,\n objectSettingsMenuItems,\n automationSteps,\n calendarSources,\n kznFile,\n } = packagedPlugin;\n\n return {\n ...manifest,\n api_name: manifest.api_name,\n artifacts: {\n data_adornments: Object.values(dataAdornments),\n floating_frames: Object.values(floatingFrames),\n routable_pages: Object.values(routablePages),\n toolbar_items: Object.values(toolbarItems),\n js_action_templates: Object.values(actions),\n route_scripts: Object.values(routeScripts),\n object_settings_menu_items: Object.values(objectSettingsMenuItems),\n automation_action_configs: Object.values(automationSteps),\n calendar_sources: Object.values(calendarSources),\n },\n thumbnail,\n kznFile,\n releaseNotes,\n base_config: formatBaseConfig(packagedPlugin),\n setup_assistant: undefined,\n services: manifest.services ?? [],\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,aAAa,OAAO,SAAuC;AAC/D,MAAI,KAAK,KAAK,SAAS,KAAK,GAAG;AAC7B,QAAI,CAAC,KAAK,SAAS;AACjB,aAAO;AAAA,IACT;AAEA,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,mBAAmB;AACnD,UAAM,EAAE,SAAS,IAAI,MAAM,OAAO,wBAAwB;AAI1D,UAAM,SAAiB,MAAO,OAA0C;AAAA,MACtE,YAAY;AAAA,MACZ,SAAS,KAAK;AAAA,MACd,SAAS;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,UACL,cAAc;AAAA,QAChB;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO,KAAK;AACd;A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AAO,YAAY;AAAA,MACzC,4BAA4B,OAAO,OAAO,uBAAuB;AAAA,MACjE,2BAA2B,OAAO,OAAO,eAAe;AAAA,MACxD,kBAAkB,OAAO,OAAO,eAAe;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,iBAAiB,cAAc;AAAA,IAC5C,iBAAiB;AAAA,IACjB,UAAU,SAAS,YAAY,CAAC;AAAA,EAClC;AACF;","names":[]}
@@ -0,0 +1,266 @@
1
+ type FileContent = {
2
+ path: string;
3
+ content: string;
4
+ base64Image?: string;
5
+ binaryData?: Buffer;
6
+ };
7
+ type MinifiedFileContent = FileContent & {
8
+ minified: string;
9
+ };
10
+
11
+ declare const minifyFiles: (files: FileContent[]) => Promise<MinifiedFileContent[]>;
12
+
13
+ type PublishableEnvironments = "go" | "fmo" | "staging" | "integration" | "e2e-integration" | "e2e-staging" | "test1";
14
+ type EnvironmentAliases = "prod" | "dev" | "testing";
15
+ type Environment = PublishableEnvironments | EnvironmentAliases;
16
+ type ManifestFileContent = {
17
+ version: string;
18
+ api_name: string;
19
+ name: string;
20
+ engine: string;
21
+ description: string;
22
+ release_branches: string[];
23
+ release_environments: Array<Environment>;
24
+ entry: string;
25
+ release_notes_directory?: string;
26
+ config_template?: Record<string, unknown>;
27
+ base_config?: Record<string, unknown>;
28
+ setup_assistant?: SetupAssistantConfig;
29
+ user_setup_assistant?: SetupAssistantConfig;
30
+ services?: Array<Record<string, unknown>>;
31
+ published: boolean;
32
+ developer_business_id?: string | Record<PublishableEnvironments, string>;
33
+ block_loading_for_setup?: boolean;
34
+ };
35
+ type SetupAssistantField = {
36
+ key: string;
37
+ type: "custom_object" | "description" | "container" | "field" | "text" | "number" | "select" | "boolean";
38
+ columns?: number;
39
+ fields?: Array<SetupAssistantField>;
40
+ content?: string;
41
+ label?: string;
42
+ object_id?: string;
43
+ default?: string;
44
+ options?: Array<{
45
+ label: string;
46
+ value: string;
47
+ }>;
48
+ allow_multiple?: boolean;
49
+ placeholder?: string;
50
+ when?: string;
51
+ };
52
+ type SetupAssistantConfig = {
53
+ fields?: Array<SetupAssistantField>;
54
+ actions?: Array<string>;
55
+ };
56
+ type ManifestFile = ManifestFileContent | Array<ManifestFileContent>;
57
+
58
+ type CalendarSource = {
59
+ api_name: string;
60
+ name: string;
61
+ calendars_script: string;
62
+ events_script: string;
63
+ when: string;
64
+ };
65
+ type CalendarSourcesMap = Record<string, CalendarSource>;
66
+ type ObjectSettingsItem = {
67
+ api_name: string;
68
+ label: string;
69
+ script: string;
70
+ when: string;
71
+ };
72
+ type ObjectSettingsItemsMap = Record<string, ObjectSettingsItem>;
73
+ type EventScripts = Record<string, string>;
74
+ type JSAction = {
75
+ name: string;
76
+ hint_object_name: string;
77
+ api_name: string;
78
+ script: string;
79
+ };
80
+ type JSActionsMap = Record<string, JSAction>;
81
+ type RouteScript = {
82
+ script: string;
83
+ api_name: string;
84
+ hint_object_name: string;
85
+ routes: Array<string>;
86
+ name: string;
87
+ };
88
+ type RouteScriptsMap = Record<string, RouteScript>;
89
+ type RoutablePage = {
90
+ name: string;
91
+ api_name: string;
92
+ type: "script";
93
+ css: string;
94
+ event_scripts: EventScripts;
95
+ callback: string;
96
+ is_toolbar_item: boolean;
97
+ toolbar_color: string;
98
+ toolbar_icon: string;
99
+ script: string;
100
+ html: string;
101
+ iframe_url: string;
102
+ };
103
+ type RoutablePagesMap = Record<string, RoutablePage>;
104
+ type ToolbarItem = {
105
+ api_name: string;
106
+ label: string;
107
+ icon: string;
108
+ color: string;
109
+ script: string;
110
+ when: string;
111
+ };
112
+ type ToolbarItemsMap = Record<string, ToolbarItem>;
113
+ type DataAdornmentConfig = {
114
+ icon: string;
115
+ color: string;
116
+ tooltip: string;
117
+ customIcon?: string;
118
+ };
119
+ type DataAdornment = {
120
+ config: DataAdornmentConfig;
121
+ field_type: "phonenumber" | "date" | "datetime";
122
+ script: string;
123
+ when: string;
124
+ };
125
+ type DataAdornmentsMap = Record<string, DataAdornment>;
126
+ type FloatingFrame = {
127
+ name: string;
128
+ api_name: string;
129
+ title: string;
130
+ type: "script";
131
+ css: string;
132
+ event_scripts: EventScripts;
133
+ default_position: string;
134
+ header_color: string;
135
+ header_text_color: string;
136
+ height: number;
137
+ width: number;
138
+ ignore: Array<string>;
139
+ match: Array<string>;
140
+ message_handler: string;
141
+ minimized_style: "bar" | "circle" | "none";
142
+ minimized_config: Record<string, unknown>;
143
+ script: string;
144
+ html: string;
145
+ when: string;
146
+ };
147
+ type FloatingFramesMap = Record<string, FloatingFrame>;
148
+ type AutomationScriptRuntimeInput = `${string} ${number}.${number}`;
149
+ type AutomationScriptRuntimeOutput = `${string}-${number}-${number}`;
150
+ type AutomationStep = {
151
+ name: string;
152
+ action_step_api_name: string;
153
+ overall_description: string;
154
+ action_description: string;
155
+ action_type: string;
156
+ script_runtime: AutomationScriptRuntimeOutput;
157
+ secrets: Array<string>;
158
+ inputs: Array<{
159
+ name: string;
160
+ label: string;
161
+ data_type: string;
162
+ required: boolean;
163
+ input_source: string;
164
+ hint_field_name: string;
165
+ hint_related_object_field_name: string;
166
+ script_alias: string;
167
+ }>;
168
+ outputs: Array<{
169
+ name: string;
170
+ label: string;
171
+ data_type: string;
172
+ required: boolean;
173
+ input_source: string;
174
+ hint_field_name: string;
175
+ hint_related_object_field_name: string;
176
+ script_alias: string;
177
+ conflict_resolution: "overwrite" | "skip" | "append";
178
+ create_field_options: boolean;
179
+ }>;
180
+ script: string;
181
+ when: string;
182
+ };
183
+ type AutomationStepsMap = Record<string, AutomationStep>;
184
+ type PackagedPlugin = {
185
+ manifest: ManifestFileContent;
186
+ floatingFrames: FloatingFramesMap;
187
+ dataAdornments: DataAdornmentsMap;
188
+ routablePages: RoutablePagesMap;
189
+ toolbarItems: ToolbarItemsMap;
190
+ objectSettingsMenuItems: ObjectSettingsItemsMap;
191
+ automationSteps: AutomationStepsMap;
192
+ actions: JSActionsMap;
193
+ routeScripts: RouteScriptsMap;
194
+ thumbnail: Uint8Array | null;
195
+ releaseNotes?: string;
196
+ kznFile: Uint8Array | null;
197
+ calendarSources: CalendarSourcesMap;
198
+ };
199
+ type ProcessedPluginPackage = Record<string, PackagedPlugin>;
200
+ type DeployablePlugin = ManifestFileContent & {
201
+ api_name: string;
202
+ artifacts: {
203
+ data_adornments: Array<DataAdornment>;
204
+ floating_frames: Array<FloatingFrame>;
205
+ routable_pages: Array<RoutablePage>;
206
+ toolbar_items: Array<ToolbarItem>;
207
+ js_action_templates: Array<JSAction>;
208
+ route_scripts: Array<RouteScript>;
209
+ object_settings_menu_items: Array<ObjectSettingsItem>;
210
+ automation_action_configs: Array<AutomationStep>;
211
+ calendar_sources: Array<CalendarSource>;
212
+ };
213
+ thumbnail: Uint8Array | null;
214
+ kznFile: Uint8Array | null;
215
+ releaseNotes?: string;
216
+ };
217
+
218
+ /**
219
+ * Packages one or more plugins from the given set of minified files.
220
+ * The caller is responsible for any branch-based filtering of manifests before calling.
221
+ */
222
+ declare const packagePlugin: (files: MinifiedFileContent[], manifests: ManifestFileContent | ManifestFileContent[]) => ProcessedPluginPackage;
223
+ /**
224
+ * Reads and parses kizen.json from a set of files.
225
+ * Returns the manifest content (single or array) without any branch defaulting.
226
+ */
227
+ declare const parseManifestFromFiles: (files: MinifiedFileContent[]) => ManifestFileContent | ManifestFileContent[];
228
+
229
+ declare const transformDeployablePlugin: (packagedPlugin: PackagedPlugin) => DeployablePlugin;
230
+
231
+ declare const sanitizeToAPIName: (name: string) => string;
232
+ declare const scriptRuntimeToApiName: (runtime: AutomationScriptRuntimeInput) => AutomationScriptRuntimeOutput;
233
+
234
+ declare const imagetoUint8Array: (base64Image: string) => Uint8Array;
235
+ declare const zipToUint8Array: (zip: Buffer) => Uint8Array;
236
+
237
+ declare const thumbnailImageExtensions: string[];
238
+ declare const triggerImageExtensions: string[];
239
+ declare const EVENT_SCRIPTS_DIRECTORY_NAME = "eventScripts";
240
+ declare const FLOATING_FRAMES_DIRECTORY_NAME = "floatingFrames";
241
+ declare const DATA_ADORNMENTS_DIRECTORY_NAME = "dataAdornments";
242
+ declare const TOOLBAR_ITEMS_DIRECTORY_NAME = "toolbarItems";
243
+ declare const ROUTABLE_PAGES_DIRECTORY_NAME = "pages";
244
+ declare const BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME = "routeScripts";
245
+ declare const JS_ACTIONS_DIRECTORY_NAME = "actions";
246
+ declare const OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME = "objectSettingsItems";
247
+ declare const AUTOMATION_STEPS_DIRECTORY_NAME = "automationSteps";
248
+ declare const SETUP_ASSISTANT_DIRECTORY_NAME = "setupAssistant";
249
+ declare const USER_SETUP_ASSISTANT_DIRECTORY_NAME = "userSetupAssistant";
250
+ declare const CALENDAR_SOURCES_DIRECTORY_NAME = "calendarSources";
251
+ declare const THUMBNAIL_FILE_NAMES: string[];
252
+ declare const RELEASE_NOTES_EXTENSION = "md";
253
+ declare const SCRIPT_EXTENSION = "js";
254
+ declare const MAIN_SCRIPT_FILE = "script.js";
255
+ declare const MESSAGE_SCRIPT_FILE = "message.js";
256
+ declare const CALLBACK_SCRIPT_FILE = "callback.js";
257
+ declare const AUTOMATION_SCRIPT_FILE = "script.py";
258
+ declare const CONFIG_FILE_NAME = "config.json";
259
+ declare const STYLES_FILE_NAME = "styles.css";
260
+ declare const MANIFEST_FILE_NAME = "kizen.json";
261
+ declare const KZN_FILE_NAME = "import.kzn";
262
+ declare const maybeParseConfig: (content: string | undefined, path: string) => Record<string, unknown>;
263
+ declare const getMinimizedConfig: (config: Record<string, unknown>, entry: string, splitPath: string[], consideredFiles: MinifiedFileContent[]) => Record<string, unknown>;
264
+ declare const getAdornmentIcon: (config: Record<string, unknown>, entry: string, splitPath: string[], consideredFiles: MinifiedFileContent[]) => string;
265
+
266
+ export { AUTOMATION_SCRIPT_FILE, AUTOMATION_STEPS_DIRECTORY_NAME, type AutomationScriptRuntimeInput, type AutomationScriptRuntimeOutput, type AutomationStep, type AutomationStepsMap, BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME, CALENDAR_SOURCES_DIRECTORY_NAME, CALLBACK_SCRIPT_FILE, CONFIG_FILE_NAME, type CalendarSource, type CalendarSourcesMap, DATA_ADORNMENTS_DIRECTORY_NAME, type DataAdornment, type DataAdornmentConfig, type DataAdornmentsMap, type DeployablePlugin, EVENT_SCRIPTS_DIRECTORY_NAME, type Environment, type EnvironmentAliases, type EventScripts, FLOATING_FRAMES_DIRECTORY_NAME, type FileContent, type FloatingFrame, type FloatingFramesMap, type JSAction, type JSActionsMap, JS_ACTIONS_DIRECTORY_NAME, KZN_FILE_NAME, MAIN_SCRIPT_FILE, MANIFEST_FILE_NAME, MESSAGE_SCRIPT_FILE, type ManifestFile, type ManifestFileContent, type MinifiedFileContent, OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME, type ObjectSettingsItem, type ObjectSettingsItemsMap, type PackagedPlugin, type ProcessedPluginPackage, type PublishableEnvironments, RELEASE_NOTES_EXTENSION, ROUTABLE_PAGES_DIRECTORY_NAME, type RoutablePage, type RoutablePagesMap, type RouteScript, type RouteScriptsMap, SCRIPT_EXTENSION, SETUP_ASSISTANT_DIRECTORY_NAME, STYLES_FILE_NAME, type SetupAssistantConfig, type SetupAssistantField, THUMBNAIL_FILE_NAMES, TOOLBAR_ITEMS_DIRECTORY_NAME, type ToolbarItem, type ToolbarItemsMap, USER_SETUP_ASSISTANT_DIRECTORY_NAME, getAdornmentIcon, getMinimizedConfig, imagetoUint8Array, maybeParseConfig, minifyFiles, packagePlugin, parseManifestFromFiles, sanitizeToAPIName, scriptRuntimeToApiName, thumbnailImageExtensions, transformDeployablePlugin, triggerImageExtensions, zipToUint8Array };
@@ -0,0 +1,266 @@
1
+ type FileContent = {
2
+ path: string;
3
+ content: string;
4
+ base64Image?: string;
5
+ binaryData?: Buffer;
6
+ };
7
+ type MinifiedFileContent = FileContent & {
8
+ minified: string;
9
+ };
10
+
11
+ declare const minifyFiles: (files: FileContent[]) => Promise<MinifiedFileContent[]>;
12
+
13
+ type PublishableEnvironments = "go" | "fmo" | "staging" | "integration" | "e2e-integration" | "e2e-staging" | "test1";
14
+ type EnvironmentAliases = "prod" | "dev" | "testing";
15
+ type Environment = PublishableEnvironments | EnvironmentAliases;
16
+ type ManifestFileContent = {
17
+ version: string;
18
+ api_name: string;
19
+ name: string;
20
+ engine: string;
21
+ description: string;
22
+ release_branches: string[];
23
+ release_environments: Array<Environment>;
24
+ entry: string;
25
+ release_notes_directory?: string;
26
+ config_template?: Record<string, unknown>;
27
+ base_config?: Record<string, unknown>;
28
+ setup_assistant?: SetupAssistantConfig;
29
+ user_setup_assistant?: SetupAssistantConfig;
30
+ services?: Array<Record<string, unknown>>;
31
+ published: boolean;
32
+ developer_business_id?: string | Record<PublishableEnvironments, string>;
33
+ block_loading_for_setup?: boolean;
34
+ };
35
+ type SetupAssistantField = {
36
+ key: string;
37
+ type: "custom_object" | "description" | "container" | "field" | "text" | "number" | "select" | "boolean";
38
+ columns?: number;
39
+ fields?: Array<SetupAssistantField>;
40
+ content?: string;
41
+ label?: string;
42
+ object_id?: string;
43
+ default?: string;
44
+ options?: Array<{
45
+ label: string;
46
+ value: string;
47
+ }>;
48
+ allow_multiple?: boolean;
49
+ placeholder?: string;
50
+ when?: string;
51
+ };
52
+ type SetupAssistantConfig = {
53
+ fields?: Array<SetupAssistantField>;
54
+ actions?: Array<string>;
55
+ };
56
+ type ManifestFile = ManifestFileContent | Array<ManifestFileContent>;
57
+
58
+ type CalendarSource = {
59
+ api_name: string;
60
+ name: string;
61
+ calendars_script: string;
62
+ events_script: string;
63
+ when: string;
64
+ };
65
+ type CalendarSourcesMap = Record<string, CalendarSource>;
66
+ type ObjectSettingsItem = {
67
+ api_name: string;
68
+ label: string;
69
+ script: string;
70
+ when: string;
71
+ };
72
+ type ObjectSettingsItemsMap = Record<string, ObjectSettingsItem>;
73
+ type EventScripts = Record<string, string>;
74
+ type JSAction = {
75
+ name: string;
76
+ hint_object_name: string;
77
+ api_name: string;
78
+ script: string;
79
+ };
80
+ type JSActionsMap = Record<string, JSAction>;
81
+ type RouteScript = {
82
+ script: string;
83
+ api_name: string;
84
+ hint_object_name: string;
85
+ routes: Array<string>;
86
+ name: string;
87
+ };
88
+ type RouteScriptsMap = Record<string, RouteScript>;
89
+ type RoutablePage = {
90
+ name: string;
91
+ api_name: string;
92
+ type: "script";
93
+ css: string;
94
+ event_scripts: EventScripts;
95
+ callback: string;
96
+ is_toolbar_item: boolean;
97
+ toolbar_color: string;
98
+ toolbar_icon: string;
99
+ script: string;
100
+ html: string;
101
+ iframe_url: string;
102
+ };
103
+ type RoutablePagesMap = Record<string, RoutablePage>;
104
+ type ToolbarItem = {
105
+ api_name: string;
106
+ label: string;
107
+ icon: string;
108
+ color: string;
109
+ script: string;
110
+ when: string;
111
+ };
112
+ type ToolbarItemsMap = Record<string, ToolbarItem>;
113
+ type DataAdornmentConfig = {
114
+ icon: string;
115
+ color: string;
116
+ tooltip: string;
117
+ customIcon?: string;
118
+ };
119
+ type DataAdornment = {
120
+ config: DataAdornmentConfig;
121
+ field_type: "phonenumber" | "date" | "datetime";
122
+ script: string;
123
+ when: string;
124
+ };
125
+ type DataAdornmentsMap = Record<string, DataAdornment>;
126
+ type FloatingFrame = {
127
+ name: string;
128
+ api_name: string;
129
+ title: string;
130
+ type: "script";
131
+ css: string;
132
+ event_scripts: EventScripts;
133
+ default_position: string;
134
+ header_color: string;
135
+ header_text_color: string;
136
+ height: number;
137
+ width: number;
138
+ ignore: Array<string>;
139
+ match: Array<string>;
140
+ message_handler: string;
141
+ minimized_style: "bar" | "circle" | "none";
142
+ minimized_config: Record<string, unknown>;
143
+ script: string;
144
+ html: string;
145
+ when: string;
146
+ };
147
+ type FloatingFramesMap = Record<string, FloatingFrame>;
148
+ type AutomationScriptRuntimeInput = `${string} ${number}.${number}`;
149
+ type AutomationScriptRuntimeOutput = `${string}-${number}-${number}`;
150
+ type AutomationStep = {
151
+ name: string;
152
+ action_step_api_name: string;
153
+ overall_description: string;
154
+ action_description: string;
155
+ action_type: string;
156
+ script_runtime: AutomationScriptRuntimeOutput;
157
+ secrets: Array<string>;
158
+ inputs: Array<{
159
+ name: string;
160
+ label: string;
161
+ data_type: string;
162
+ required: boolean;
163
+ input_source: string;
164
+ hint_field_name: string;
165
+ hint_related_object_field_name: string;
166
+ script_alias: string;
167
+ }>;
168
+ outputs: Array<{
169
+ name: string;
170
+ label: string;
171
+ data_type: string;
172
+ required: boolean;
173
+ input_source: string;
174
+ hint_field_name: string;
175
+ hint_related_object_field_name: string;
176
+ script_alias: string;
177
+ conflict_resolution: "overwrite" | "skip" | "append";
178
+ create_field_options: boolean;
179
+ }>;
180
+ script: string;
181
+ when: string;
182
+ };
183
+ type AutomationStepsMap = Record<string, AutomationStep>;
184
+ type PackagedPlugin = {
185
+ manifest: ManifestFileContent;
186
+ floatingFrames: FloatingFramesMap;
187
+ dataAdornments: DataAdornmentsMap;
188
+ routablePages: RoutablePagesMap;
189
+ toolbarItems: ToolbarItemsMap;
190
+ objectSettingsMenuItems: ObjectSettingsItemsMap;
191
+ automationSteps: AutomationStepsMap;
192
+ actions: JSActionsMap;
193
+ routeScripts: RouteScriptsMap;
194
+ thumbnail: Uint8Array | null;
195
+ releaseNotes?: string;
196
+ kznFile: Uint8Array | null;
197
+ calendarSources: CalendarSourcesMap;
198
+ };
199
+ type ProcessedPluginPackage = Record<string, PackagedPlugin>;
200
+ type DeployablePlugin = ManifestFileContent & {
201
+ api_name: string;
202
+ artifacts: {
203
+ data_adornments: Array<DataAdornment>;
204
+ floating_frames: Array<FloatingFrame>;
205
+ routable_pages: Array<RoutablePage>;
206
+ toolbar_items: Array<ToolbarItem>;
207
+ js_action_templates: Array<JSAction>;
208
+ route_scripts: Array<RouteScript>;
209
+ object_settings_menu_items: Array<ObjectSettingsItem>;
210
+ automation_action_configs: Array<AutomationStep>;
211
+ calendar_sources: Array<CalendarSource>;
212
+ };
213
+ thumbnail: Uint8Array | null;
214
+ kznFile: Uint8Array | null;
215
+ releaseNotes?: string;
216
+ };
217
+
218
+ /**
219
+ * Packages one or more plugins from the given set of minified files.
220
+ * The caller is responsible for any branch-based filtering of manifests before calling.
221
+ */
222
+ declare const packagePlugin: (files: MinifiedFileContent[], manifests: ManifestFileContent | ManifestFileContent[]) => ProcessedPluginPackage;
223
+ /**
224
+ * Reads and parses kizen.json from a set of files.
225
+ * Returns the manifest content (single or array) without any branch defaulting.
226
+ */
227
+ declare const parseManifestFromFiles: (files: MinifiedFileContent[]) => ManifestFileContent | ManifestFileContent[];
228
+
229
+ declare const transformDeployablePlugin: (packagedPlugin: PackagedPlugin) => DeployablePlugin;
230
+
231
+ declare const sanitizeToAPIName: (name: string) => string;
232
+ declare const scriptRuntimeToApiName: (runtime: AutomationScriptRuntimeInput) => AutomationScriptRuntimeOutput;
233
+
234
+ declare const imagetoUint8Array: (base64Image: string) => Uint8Array;
235
+ declare const zipToUint8Array: (zip: Buffer) => Uint8Array;
236
+
237
+ declare const thumbnailImageExtensions: string[];
238
+ declare const triggerImageExtensions: string[];
239
+ declare const EVENT_SCRIPTS_DIRECTORY_NAME = "eventScripts";
240
+ declare const FLOATING_FRAMES_DIRECTORY_NAME = "floatingFrames";
241
+ declare const DATA_ADORNMENTS_DIRECTORY_NAME = "dataAdornments";
242
+ declare const TOOLBAR_ITEMS_DIRECTORY_NAME = "toolbarItems";
243
+ declare const ROUTABLE_PAGES_DIRECTORY_NAME = "pages";
244
+ declare const BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME = "routeScripts";
245
+ declare const JS_ACTIONS_DIRECTORY_NAME = "actions";
246
+ declare const OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME = "objectSettingsItems";
247
+ declare const AUTOMATION_STEPS_DIRECTORY_NAME = "automationSteps";
248
+ declare const SETUP_ASSISTANT_DIRECTORY_NAME = "setupAssistant";
249
+ declare const USER_SETUP_ASSISTANT_DIRECTORY_NAME = "userSetupAssistant";
250
+ declare const CALENDAR_SOURCES_DIRECTORY_NAME = "calendarSources";
251
+ declare const THUMBNAIL_FILE_NAMES: string[];
252
+ declare const RELEASE_NOTES_EXTENSION = "md";
253
+ declare const SCRIPT_EXTENSION = "js";
254
+ declare const MAIN_SCRIPT_FILE = "script.js";
255
+ declare const MESSAGE_SCRIPT_FILE = "message.js";
256
+ declare const CALLBACK_SCRIPT_FILE = "callback.js";
257
+ declare const AUTOMATION_SCRIPT_FILE = "script.py";
258
+ declare const CONFIG_FILE_NAME = "config.json";
259
+ declare const STYLES_FILE_NAME = "styles.css";
260
+ declare const MANIFEST_FILE_NAME = "kizen.json";
261
+ declare const KZN_FILE_NAME = "import.kzn";
262
+ declare const maybeParseConfig: (content: string | undefined, path: string) => Record<string, unknown>;
263
+ declare const getMinimizedConfig: (config: Record<string, unknown>, entry: string, splitPath: string[], consideredFiles: MinifiedFileContent[]) => Record<string, unknown>;
264
+ declare const getAdornmentIcon: (config: Record<string, unknown>, entry: string, splitPath: string[], consideredFiles: MinifiedFileContent[]) => string;
265
+
266
+ export { AUTOMATION_SCRIPT_FILE, AUTOMATION_STEPS_DIRECTORY_NAME, type AutomationScriptRuntimeInput, type AutomationScriptRuntimeOutput, type AutomationStep, type AutomationStepsMap, BROWSER_ROUTE_SCRIPTS_DIRECTORY_NAME, CALENDAR_SOURCES_DIRECTORY_NAME, CALLBACK_SCRIPT_FILE, CONFIG_FILE_NAME, type CalendarSource, type CalendarSourcesMap, DATA_ADORNMENTS_DIRECTORY_NAME, type DataAdornment, type DataAdornmentConfig, type DataAdornmentsMap, type DeployablePlugin, EVENT_SCRIPTS_DIRECTORY_NAME, type Environment, type EnvironmentAliases, type EventScripts, FLOATING_FRAMES_DIRECTORY_NAME, type FileContent, type FloatingFrame, type FloatingFramesMap, type JSAction, type JSActionsMap, JS_ACTIONS_DIRECTORY_NAME, KZN_FILE_NAME, MAIN_SCRIPT_FILE, MANIFEST_FILE_NAME, MESSAGE_SCRIPT_FILE, type ManifestFile, type ManifestFileContent, type MinifiedFileContent, OBJECT_SETTINGS_ITEMS_DIRECTORY_NAME, type ObjectSettingsItem, type ObjectSettingsItemsMap, type PackagedPlugin, type ProcessedPluginPackage, type PublishableEnvironments, RELEASE_NOTES_EXTENSION, ROUTABLE_PAGES_DIRECTORY_NAME, type RoutablePage, type RoutablePagesMap, type RouteScript, type RouteScriptsMap, SCRIPT_EXTENSION, SETUP_ASSISTANT_DIRECTORY_NAME, STYLES_FILE_NAME, type SetupAssistantConfig, type SetupAssistantField, THUMBNAIL_FILE_NAMES, TOOLBAR_ITEMS_DIRECTORY_NAME, type ToolbarItem, type ToolbarItemsMap, USER_SETUP_ASSISTANT_DIRECTORY_NAME, getAdornmentIcon, getMinimizedConfig, imagetoUint8Array, maybeParseConfig, minifyFiles, packagePlugin, parseManifestFromFiles, sanitizeToAPIName, scriptRuntimeToApiName, thumbnailImageExtensions, transformDeployablePlugin, triggerImageExtensions, zipToUint8Array };