@xuda.io/xuda-studio-checker.min 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/index.mjs +1 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -47,4 +47,4 @@ var app_obj,progs_obj,_,progs_str,hide_not_in_use_check,is_server,deployments,Ug
47
47
  Example: xu-store="{'temp_var':'@calculated_value','status':'ready'}"
48
48
 
49
49
  - xu-viewport: Handles viewport-based logic during rendering
50
- Example: xu-viewport="@mobile_view"`);const UiElementSchema=z.lazy(()=>z.object({id:z.union([z.literal(`root`),UuidSchema,z.string().regex(/^node-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i),z.string().regex(/^ui-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)]).describe(`Element identifier: "root" for top-level, prefixed UUIDs like "ui-791ca98a-e284-4413-af0a-96e5527c338b"`),type:z.literal(`element`).describe(`Element type - only "element" allowed (no "comment" or "text" types)`),tagName:z.string().describe(`HTML tag name for the element (e.g., "div", "span", "input")`),attributes:UiAttributesSchema.optional().describe(`HTML attributes and Xuda directives (e.g., class, xu-bind, xu-on)`),content:z.string().optional().describe(`Text content for the element (replaces deprecated "text" type)`),text:z.string().optional().describe(`Alternative text property for element content`),children:z.array(UiElementSchema).optional().describe(`Array of child elements nested within this element`),workflow:z.array(WorkflowActionSchema).optional().describe(`Workflow actions associated with this UI element`),path:z.array(z.number()).optional().describe("Array representing the element`s position in the UI tree"),code:z.string().optional().describe(`Generated HTML code representation`),editCode:z.boolean().optional().describe(`Flag indicating if element is in code editing mode`),$folded:z.boolean().optional().describe(`UI editor state - whether element tree is collapsed`)}).describe(`UI element following Himalaya.js structure with Xuda extensions, 1. generate unique id using UUID for every item of the progUi (except the root node, leave the root node as is),2. never use "comment" or "text" type, 3. convert "text" type to "element" and add a text property instead next to the type property `));const DataSourceSchema=z.object({dataSourceType:z.union([z.literal(`table`).describe(`Connect to structured table from global Table Repository`),z.literal(`array`).describe(`Use static or dynamically populated array`),z.literal(`json`).describe(`Load structured data in JSON format`),z.literal(`csv`).describe(`Load data from CSV source`),z.literal(`none`).describe(`No data source attached - self-contained logic unit`),z.literal(``).describe(`Empty string indicating no datasource configured`)]).optional().describe(`Type of data source defining how data is retrieved and processed`),dataSourceFilterModelType:z.union([z.literal(`index`).describe(`Use predefined index with from/to values for fast range filtering`),z.literal(`query`).describe(`Use jQuery Mongo syntax for advanced conditional filters and logical rules`)]).optional().describe(`Filtering approach for table sources`),dataSourceSort:z.union([z.literal(`asc`),z.literal(`desc`)]).optional().describe(`Global sort direction for retrieved data`),dataSourceTableId:z.string().optional().describe(`Reference to table ID in Table Repository when dataSourceType is "table"`),dataSourceIndexId:z.string().optional().describe(`Default index ID used for efficient data lookup and filtering`),dataSourceIndexesObj:z.record(z.record(z.object({from:z.string().describe(`Starting value for index range (can be dynamic expression like @uid_in)`),locate_from:z.string().optional().describe(`Additional locate parameter for range start`),locate_to:z.string().optional().describe(`Additional locate parameter for range end`),to:z.string().describe(`Ending value for index range (can be dynamic expression)`),key:z.string().describe(`Field name being indexed and filtered`)}).describe(`Index field configuration with range values`))).optional().describe(`Index configurations mapped by index ID, defining field ranges and conditions for efficient filtering`),dataSourceReduce:z.boolean().optional().describe(`Whether to reduce results to single aggregated value (count, sum, avg) - requires DBS plugin`),filterModelMongo:z.object({}).optional().describe(`Static MongoDB-style filter query object built using jQuery QueryBuilder`),filterModelMongoFx:z.string().optional().describe(`Dynamic reference to input field containing filter query object (overrides filterModelMongo)`),sortModel:z.array(z.object({field_id:z.string().describe(`Field identifier to sort by`),sort_dir:z.union([z.literal(`asc`),z.literal(`desc`)]).describe(`Sort direction for this specific field`)})).optional().describe(`Array of field-level sorting rules for multi-column sorting`),dataSourceRealtime:z.boolean().optional().describe(`Enable real-time updates when source data changes (table sources only, requires @xuda.io/xuds-dbs-plugin-xuda)`),datafieldsOutputField:z.string().optional().describe(`Field name where raw query results will be stored within parent hierarchy`),dataSourceLimit:z.number().optional().describe(`Maximum number of rows or iterations to return for pagination`),dataSourceSkip:z.number().optional().describe(`Number of rows to skip before returning results, useful for pagination offset`),dataSourceUrl:z.string().optional().describe(`External URL endpoint for loading array/CSV/JSON data from REST APIs or static files`),dataSourceInputField:z.string().optional().describe(`Dynamic field reference in UI or app context for data source values (alternative to external URL)`)}).describe(`Comprehensive data source configuration defining how logic units retrieve, filter, and process data from tables, arrays, APIs, or external sources`);let properties_obj={menuType:z.literal(type).describe(`defines the object category`),menuName:z.string().describe(`Internal name displayed in the Studio interface`)};let properties=z.object(properties_obj).describe(`Core ${type} properties defining behavior, access, and UI framework settings`);const progFields=z.array(ProgFieldSchema).describe(`Defines the internal working fields of the ${type}. These include real and virtual fields used for data binding, user interaction, intermediate logic, and expression evaluation.`);const progEvents=z.array(ProgEventSchema).optional().describe(`Defines all functional logic associated with the ${type}. Events support lifecycle hooks (like on_load, screen_ready, client_interval), event-based workflow, custom utility functions, and conditional logic.`);const progUi=z.array(UiElementSchema).describe(`Describes the rendered interface in a structured JSON format, derived from Himalaya.js (HTML-to-JSON). Each node can be bound to logic via attributes such as xu-exp, bind, for, and trigger. This enables conditional rendering, looping constructs, inline script execution, and seamless integration with workflow.`);const progDataSource=DataSourceSchema.describe(`Defines where the ${type} pulls or binds its data from, such as a database table, external service, or static source.`);let main_obj={_id:z.string().regex(/^[a-zA-Z0-9_]+$/).describe(`Unique ${type} identifier with format constraints`),app_id:z.string().describe(`Reference to the parent application this ${type} belongs to`),stat:z.union([z.literal(1),z.literal(2),z.literal(3),z.literal(4)]).describe(`Document status: 1=draft, 2=review, 3=active, 4=archived`),docType:z.literal(`studio`).describe(`Always "studio" - indicates this is a Studio-authored ${type}`),docDate:TimestampSchema.describe(`Unix timestamp when the ${type} document was created`),ts:TimestampSchema.describe(`Unix timestamp of the most recent modification`),order_ts:TimestampSchema.describe(`Timestamp used for ordering components in the Studio interface`),description:z.string().optional().describe(`Describe in short the ${type}`),studio_meta:StudioMetaSchema};let XudaComponentSchema=z.object(main_obj);main_obj.properties=properties;switch(type){case`globals`:XudaComponentSchema.describe(`The globals object in the Xuda platform defines a universal logic layer shared across all programs, components, and workflows. It provides a centralized and consistent structure for declaring global fields, utility functions, and event-driven logic, ensuring logic reusability and reducing redundancy across the application.`);main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`table`:XudaComponentSchema.describe(`The Table Object represents a data entity and serves as the structural definition for interacting with external databases. It supports integration via pluggable connectors, allowing seamless connection to various database engines such as MySQL, CouchDB, and others (see available database plugins for the full list).`);properties_obj.databaseSocket=z.string().default("@xuda.io/xuda-dbs-plugin-xuda").describe("Database driver to use for the table");const XudaFieldType=z.enum(["string","number","boolean","array","object","date"]).describe("Data type for table fields");const IndexDataSchema=z.object({name:z.string().describe("Name of the index"),unique:z.boolean().describe("If true, ensures no duplicates for indexed fields"),keys:z.array(z.string()).describe("List of field names used in this index"),props:z.object({}).describe("")});const TableIndexSchema=z.object({id:z.string().uuid().describe("Unique uuid identifier for the index"),data:IndexDataSchema.describe("Contains keys, uniqueness setting, and index name")});const FieldPropsSchema=z.object({fieldType:XudaFieldType.describe('Data type: "string", "number", "boolean", "array", "object", or "date"'),label:z.string().describe("the name of the field")});const FieldDataSchema=z.object({field_id:z.string().describe("Field identifier used in logic or database operations")});const TableFieldSchema=z.object({id:z.string().uuid().describe("Unique uuid of the field object"),data:FieldDataSchema.describe("Contains the logical field ID"),props:FieldPropsSchema.describe("Properties of the field including data type")});main_obj.tableIndexes=z.array(TableIndexSchema).describe("Defines indexing rules for efficient lookups and uniqueness constraints");main_obj.tableFields=z.array(TableFieldSchema).describe("Defines each field used in the table and its data type");break;case`folder`:XudaComponentSchema.describe(`The Folder is a non-executable, project-level container represented as a structured JSON object. It is used to define a hierarchical structure for organizing application assets within the Xuda environment. Although it does not execute any logic at runtime, the folder object plays an essential role in shaping the overall architecture of a project by logically grouping related objects such as components, APIs, tables, datasets, and other program entities.`);break;case`component`:XudaComponentSchema.describe(`The component object in the Xuda platform defines a modular, self-contained program unit that encapsulates both front-end presentation and back-end logic. It serves as a reusable UI component that supports a full execution lifecycle, making it ideal for constructing low-code applications that are maintainable, scalable, and highly interactive. A component is engineered to allow seamless integration of logic, data, and rendering, enabling developers to build sophisticated interactive views without redundant code. Each component instance supports input/output parameters, can communicate with other components or programs, and can be dynamically rendered as a page, modal, or embedded panel.`);properties_obj.frameworkProperties=z.object({}).optional().describe(`Framework-specific rendering extensions and configuration`);properties_obj.renderType=z.string().describe(`Component layout type (e.g., "form", "grid", "list")`);properties_obj.rwMode=z.union([z.literal(`R`),z.literal(`W`),z.literal(`RW`)]).describe(`Access mode: R=read-only, W=write-only, RW=read-write`);properties_obj.uiFramework=z.string().describe(`Selected UI framework plugin (e.g., @xuda.io/xuda-framework-plugin-tailwind)`);properties_obj.menuTitle=z.string().optional().describe(`Display title for Studio UI or routing usage`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;main_obj.progUi=progUi;break;case`get_data`:XudaComponentSchema.describe(`The Get Data Object defines a lightweight, read-only program unit designed to retrieve data from a structured source such as a table, array, or remote dataset. It is used to extract specific values, perform indexed lookups, and support transformations through reduce or conditional logic. This object is typically used when a logic program requires only data retrieval without the need to iterate or mutate records. It supports output parameter mapping and can be embedded into workflows and alerts for dynamic value extraction.`);properties_obj.frameworkProperties=z.object({}).optional().describe(`Framework-specific rendering extensions and configuration`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`set_data`:XudaComponentSchema.describe(`The set_data object defines a program-level functional unit responsible for writing data to a specified table. It can be invoked from any program and is designed to handle create, update, and delete operations in a structured and reusable way. The object includes properties to determine the type of operation being performed and supports an optional flag to create a new record if one does not already exist. In addition to its core structure, the set_data object includes a parameter interface property that defines input and output parameters. This allows values to be passed into the function and returned to the calling context, enabling flexible, context-aware data handling.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);properties_obj.crudMode=z.enum(["C","U","D"]).describe("Operation mode: C = Create, U = Update, D = Delete");properties_obj.crudMode=z.boolean().describe("If true, allows record creation if not found");main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`batch`:XudaComponentSchema.describe(`The Batch Object defines a program-level execution unit tailored for iterative, record-by-record operations across datasets. It enables controlled loops over structured data sources or arrays, making it a foundational element for multi-record processing, automation flows, and background job orchestration. The batch object can be invoked from within any Xuda logic program and serves as a reusable execution block for bulk workflows, such as saving multiple records, transforming arrays, or triggering chained program logic. It accepts dynamic input and output parameters, which allow context-aware execution and return values that can be consumed downstream.The batch unit also includes lifecycle hooks and event workflow, enabling custom logic at specific points within the loop (e.g., before/after each record or on error conditions). This supports advanced control, transformation, and external interactions during iterative processing.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`api`:XudaComponentSchema.describe(`The API Program-Level Logic Unit is a program-level logic unit represented as a structured JSON object that exposes backend functionality through internal or external interfaces. It can be invoked internally via the call_project_api method or externally through the api/mcp endpoint, enabling controlled access to application-level logic and data services. Acting as an orchestration layer, the API unit enables coordination of multiple subordinate logic units such as get_data, set_data, and batch, allowing compound workflows, transactional operations, and conditional executions to be encapsulated within a single, callable endpoint. This design abstracts complexity and promotes composability of business logic across the application. The API unit includes an interface definition for parameter binding, specifying dynamic input and output mappings. This supports stateless, context-aware executions where external values can be passed into the API call, and structured results returned to the calling layer. Response format configuration is also supported, with output types including json, text, html, and others—allowing precise control over the serialization and consumption of API responses.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);const ApiOutputFormat=z.enum(["json","html","text","xml","csv","pdf"]).describe("Format of the API response: json, html, text, xml, csv, pdf, etc.");properties_obj.apiOutput=ApiOutputFormat.describe("Format of the API response: json, html, text, etc.");main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;main_obj.scriptData=z.object({value:z.string().describe("The return payload template as a stringified object. Placeholder bindings (e.g., @CS_Id) are replaced at runtime")});break;case`alert`:XudaComponentSchema.describe(`The Alert Object is a program-level UI unit in the Xuda platform used to deliver contextual messages and notifications to users or developers at runtime. These alerts can be triggered from within logic flows and offer various display formats (such as toast, modal, browser alert, or console message) based on the use case. The alert object is defined using a structured JSON format and can be embedded in broader program logic. It supports both static and dynamic content, and can optionally create log entries to support audit trails and debugging workflows.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.alertData=z.object({alertDisplay:AlertDisplay.describe('Mode of display: "toast", "modal", "browser", or "console"'),alertType:AlertType.describe('Type of message: "warning", "error", "info", or "success"'),alertTitle:z.string().describe("Main content of the alert shown to the user"),alertTitleFx:z.string().optional().describe("Optional dynamic override (e.g., @msg_v) for alert content"),createLog:z.boolean().describe("Whether to generate a system log entry associated with the alert")});break;case`javascript`:XudaComponentSchema.describe(`The javascript object is a functional unit designed to execute JavaScript code within the application context. It can be called from any program using methods such as call_native_javascript, call_evaluate_javascript, execute_native_javascript, or execute_evaluate_javascript. This object includes the following key property: Script – Contains the JavaScript code to be executed, along with any declared dependencies required for execution. The javascript object is ideal for performing advanced logic, custom client-side behavior, or dynamic scripting that extends the capabilities of low-code flows. Xuda also exposes a set of built-in API methods that can be easily called from JavaScript units. These include actions like reading from or writing to Drive, interacting with the Studio API, or performing database operations such as create, update, and delete. These ready-to-use APIs simplify common tasks and allow you to focus on building functionality instead of writing boilerplate code. By centralizing script execution in a modular and reusable way, the JavaScript unit enhances flexibility, promotes clean architecture, and empowers developers to go beyond standard configuration with native scripting power.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.scriptData=z.object({value:z.string().describe("JavaScript code to be executed"),dependencies:z.record(z.string()).optional().describe("Optional. Key-value map of external packages required")});break;default:break}return XudaComponentSchema};
50
+ Example: xu-viewport="@mobile_view"`);const UiElementSchema=z.lazy(()=>z.object({id:z.union([z.literal(`root`),UuidSchema,z.string().regex(/^node-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i),z.string().regex(/^ui-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)]).describe(`Element identifier: "root" for top-level, prefixed UUIDs like "ui-791ca98a-e284-4413-af0a-96e5527c338b"`),type:z.literal(`element`).describe(`Element type - only "element" allowed (no "comment" or "text" types)`),tagName:z.string().describe(`HTML tag name for the element (e.g., "div", "span", "input")`),attributes:UiAttributesSchema.optional().describe(`HTML attributes and Xuda directives (e.g., class, xu-bind, xu-on)`),content:z.string().optional().describe(`Text content for the element (replaces deprecated "text" type)`),text:z.string().optional().describe(`Alternative text property for element content`),children:z.array(UiElementSchema).optional().describe(`Array of child elements nested within this element`),workflow:z.array(WorkflowActionSchema).optional().describe(`Workflow actions associated with this UI element`),path:z.array(z.number()).optional().describe("Array representing the element`s position in the UI tree"),code:z.string().optional().describe(`Generated HTML code representation`),editCode:z.boolean().optional().describe(`Flag indicating if element is in code editing mode`),$folded:z.boolean().optional().describe(`UI editor state - whether element tree is collapsed`)}).describe(`UI element following Himalaya.js structure with Xuda extensions, 1. generate unique id using UUID for every item of the progUi (except the root node, leave the root node as is),2. never use "comment" or "text" type, 3. convert "text" type to "element" and add a text property instead next to the type property `));const DataSourceSchema=z.object({dataSourceType:z.union([z.literal(`table`).describe(`Connect to structured table from global Table Repository`),z.literal(`array`).describe(`Use static or dynamically populated array`),z.literal(`json`).describe(`Load structured data in JSON format`),z.literal(`csv`).describe(`Load data from CSV source`),z.literal(`none`).describe(`No data source attached - self-contained logic unit`),z.literal(``).describe(`Empty string indicating no datasource configured`)]).optional().describe(`Type of data source defining how data is retrieved and processed`),dataSourceFilterModelType:z.union([z.literal(`index`).describe(`Use predefined index with from/to values for fast range filtering`),z.literal(`query`).describe(`Use jQuery Mongo syntax for advanced conditional filters and logical rules`)]).optional().describe(`Filtering approach for table sources`),dataSourceSort:z.union([z.literal(`asc`),z.literal(`desc`)]).optional().describe(`Global sort direction for retrieved data`),dataSourceTableId:z.string().optional().describe(`Reference to table ID in Table Repository when dataSourceType is "table"`),dataSourceIndexId:z.string().optional().describe(`Default index ID used for efficient data lookup and filtering`),dataSourceIndexesObj:z.record(z.record(z.object({from:z.string().describe(`Starting value for index range (can be dynamic expression like @uid_in)`),locate_from:z.string().optional().describe(`Additional locate parameter for range start`),locate_to:z.string().optional().describe(`Additional locate parameter for range end`),to:z.string().describe(`Ending value for index range (can be dynamic expression)`),key:z.string().describe(`Field name being indexed and filtered`)}).describe(`Index field configuration with range values`))).optional().describe(`Index configurations mapped by index ID, defining field ranges and conditions for efficient filtering`),dataSourceReduce:z.boolean().optional().describe(`Whether to reduce results to single aggregated value (count, sum, avg) - requires DBS plugin`),filterModelMongo:z.object({}).optional().describe(`Static MongoDB-style filter query object built using jQuery QueryBuilder`),filterModelMongoFx:z.string().optional().describe(`Dynamic reference to input field containing filter query object (overrides filterModelMongo)`),sortModel:z.array(z.object({field_id:z.string().describe(`Field identifier to sort by`),sort_dir:z.union([z.literal(`asc`),z.literal(`desc`)]).describe(`Sort direction for this specific field`)})).optional().describe(`Array of field-level sorting rules for multi-column sorting`),dataSourceRealtime:z.boolean().optional().describe(`Enable real-time updates when source data changes (table sources only, requires @xuda.io/xuds-dbs-plugin-xuda)`),datafieldsOutputField:z.string().optional().describe(`Field name where raw query results will be stored within parent hierarchy`),dataSourceLimit:z.number().optional().describe(`Maximum number of rows or iterations to return for pagination`),dataSourceSkip:z.number().optional().describe(`Number of rows to skip before returning results, useful for pagination offset`),dataSourceUrl:z.string().optional().describe(`External URL endpoint for loading array/CSV/JSON data from REST APIs or static files`),dataSourceInputField:z.string().optional().describe(`Dynamic field reference in UI or app context for data source values (alternative to external URL)`)}).describe(`Comprehensive data source configuration defining how logic units retrieve, filter, and process data from tables, arrays, APIs, or external sources`);let properties_obj={menuType:z.literal(type).describe(`defines the object category`),menuName:z.string().describe(`Internal name displayed in the Studio interface`)};let properties=z.object(properties_obj).describe(`Core ${type} properties defining behavior, access, and UI framework settings`);const progFields=z.array(ProgFieldSchema).describe(`Defines the internal working fields of the ${type}. These include real and virtual fields used for data binding, user interaction, intermediate logic, and expression evaluation.`);const progEvents=z.array(ProgEventSchema).optional().describe(`Defines all functional logic associated with the ${type}. Events support lifecycle hooks (like on_load, screen_ready, client_interval), event-based workflow, custom utility functions, and conditional logic.`);const progUi=z.array(UiElementSchema).describe(`Describes the rendered interface in a structured JSON format, derived from Himalaya.js (HTML-to-JSON). Each node can be bound to logic via attributes such as xu-exp, bind, for, and trigger. This enables conditional rendering, looping constructs, inline script execution, and seamless integration with workflow.`);const progDataSource=DataSourceSchema.describe(`Defines where the ${type} pulls or binds its data from, such as a database table, external service, or static source.`);let main_obj={_id:z.string().regex(/^[a-zA-Z0-9_]+$/).describe(`Unique ${type} identifier with format constraints`),app_id:z.string().describe(`Reference to the parent application this ${type} belongs to`),stat:z.union([z.literal(1),z.literal(2),z.literal(3),z.literal(4)]).describe(`Document status: 1=draft, 2=review, 3=active, 4=archived`),docType:z.literal(`studio`).describe(`Always "studio" - indicates this is a Studio-authored ${type}`),docDate:TimestampSchema.describe(`Unix timestamp when the ${type} document was created`),ts:TimestampSchema.describe(`Unix timestamp of the most recent modification`),order_ts:TimestampSchema.describe(`Timestamp used for ordering components in the Studio interface`),description:z.string().optional().describe(`Describe in short the ${type}`),studio_meta:StudioMetaSchema};let XudaComponentSchema=z.object(main_obj);main_obj.properties=properties;switch(type){case`globals`:XudaComponentSchema.describe(`The globals object in the Xuda platform defines a universal logic layer shared across all programs, components, and workflows. It provides a centralized and consistent structure for declaring global fields, utility functions, and event-driven logic, ensuring logic reusability and reducing redundancy across the application.`);main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`table`:XudaComponentSchema.describe(`The Table Object represents a data entity and serves as the structural definition for interacting with external databases. It supports integration via pluggable connectors, allowing seamless connection to various database engines such as MySQL, CouchDB, and others (see available database plugins for the full list).`);properties_obj.databaseSocket=z.string().default("@xuda.io/xuda-dbs-plugin-xuda").describe("Database driver to use for the table");const XudaFieldType=z.enum(["string","number","boolean","array","object","date"]).describe("Data type for table fields");const IndexDataSchema=z.object({name:z.string().describe("Name of the index"),unique:z.boolean().describe("If true, ensures no duplicates for indexed fields"),keys:z.array(z.string()).describe("List of field names used in this index"),props:z.object({}).describe("")});const TableIndexSchema=z.object({id:z.string().uuid().describe("Unique uuid identifier for the index"),data:IndexDataSchema.describe("Contains keys, uniqueness setting, and index name")});const FieldPropsSchema=z.object({fieldType:XudaFieldType.describe('Data type: "string", "number", "boolean", "array", "object", or "date"'),label:z.string().describe("the name of the field")});const FieldDataSchema=z.object({field_id:z.string().describe("Field identifier used in logic or database operations")});const TableFieldSchema=z.object({id:z.string().uuid().describe("Unique uuid of the field object"),data:FieldDataSchema.describe("Contains the logical field ID"),props:FieldPropsSchema.describe("Properties of the field including data type")});main_obj.tableIndexes=z.array(TableIndexSchema).describe("Defines indexing rules for efficient lookups and uniqueness constraints");main_obj.tableFields=z.array(TableFieldSchema).describe("Defines each field used in the table and its data type");break;case`folder`:XudaComponentSchema.describe(`The Folder is a non-executable, project-level container represented as a structured JSON object. It is used to define a hierarchical structure for organizing application assets within the Xuda environment. Although it does not execute any logic at runtime, the folder object plays an essential role in shaping the overall architecture of a project by logically grouping related objects such as components, APIs, tables, datasets, and other program entities.`);break;case`component`:XudaComponentSchema.describe(`The component object in the Xuda platform defines a modular, self-contained program unit that encapsulates both front-end presentation and back-end logic. It serves as a reusable UI component that supports a full execution lifecycle, making it ideal for constructing low-code applications that are maintainable, scalable, and highly interactive. A component is engineered to allow seamless integration of logic, data, and rendering, enabling developers to build sophisticated interactive views without redundant code. Each component instance supports input/output parameters, can communicate with other components or programs, and can be dynamically rendered as a page, modal, or embedded panel.`);properties_obj.frameworkProperties=z.object({}).optional().describe(`Framework-specific rendering extensions and configuration`);properties_obj.renderType=z.string().describe(`Component layout type (e.g., "form", "grid", "list")`);properties_obj.rwMode=z.union([z.literal(`R`),z.literal(`W`),z.literal(`RW`)]).describe(`Access mode: R=read-only, W=write-only, RW=read-write`);properties_obj.uiFramework=z.string().describe(`Selected UI framework plugin (e.g., @xuda.io/xuda-framework-plugin-tailwind)`);properties_obj.menuTitle=z.string().optional().describe(`Display title for Studio UI or routing usage`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;main_obj.progUi=progUi;break;case`get_data`:XudaComponentSchema.describe(`The Get Data Object defines a lightweight, read-only program unit designed to retrieve data from a structured source such as a table, array, or remote dataset. It is used to extract specific values, perform indexed lookups, and support transformations through reduce or conditional logic. This object is typically used when a logic program requires only data retrieval without the need to iterate or mutate records. It supports output parameter mapping and can be embedded into workflows and alerts for dynamic value extraction.`);properties_obj.frameworkProperties=z.object({}).optional().describe(`Framework-specific rendering extensions and configuration`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`set_data`:XudaComponentSchema.describe(`The set_data object defines a program-level functional unit responsible for writing data to a specified table. It can be invoked from any program and is designed to handle create, update, and delete operations in a structured and reusable way. The object includes properties to determine the type of operation being performed and supports an optional flag to create a new record if one does not already exist. In addition to its core structure, the set_data object includes a parameter interface property that defines input and output parameters. This allows values to be passed into the function and returned to the calling context, enabling flexible, context-aware data handling.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);properties_obj.crudMode=z.enum(["C","U","D"]).describe("Operation mode: C = Create, U = Update, D = Delete");properties_obj.crudMode=z.boolean().describe("If true, allows record creation if not found");main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`batch`:XudaComponentSchema.describe(`The Batch Object defines a program-level execution unit tailored for iterative, record-by-record operations across datasets. It enables controlled loops over structured data sources or arrays, making it a foundational element for multi-record processing, automation flows, and background job orchestration. The batch object can be invoked from within any Xuda logic program and serves as a reusable execution block for bulk workflows, such as saving multiple records, transforming arrays, or triggering chained program logic. It accepts dynamic input and output parameters, which allow context-aware execution and return values that can be consumed downstream.The batch unit also includes lifecycle hooks and event workflow, enabling custom logic at specific points within the loop (e.g., before/after each record or on error conditions). This supports advanced control, transformation, and external interactions during iterative processing.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;break;case`api`:XudaComponentSchema.describe(`The API Program-Level Logic Unit is a program-level logic unit represented as a structured JSON object that exposes backend functionality through internal or external interfaces. It can be invoked internally via the call_project_api method or externally through the api/mcp endpoint, enabling controlled access to application-level logic and data services. Acting as an orchestration layer, the API unit enables coordination of multiple subordinate logic units such as get_data, set_data, and batch, allowing compound workflows, transactional operations, and conditional executions to be encapsulated within a single, callable endpoint. This design abstracts complexity and promotes composability of business logic across the application. The API unit includes an interface definition for parameter binding, specifying dynamic input and output mappings. This supports stateless, context-aware executions where external values can be passed into the API call, and structured results returned to the calling layer. Response format configuration is also supported, with output types including json, text, html, and others—allowing precise control over the serialization and consumption of API responses.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);const ApiOutputFormat=z.enum(["json","html","text","xml","csv","pdf"]).describe("Format of the API response: json, html, text, xml, csv, pdf, etc.");properties_obj.apiOutput=ApiOutputFormat.describe("Format of the API response: json, html, text, etc.");main_obj.progDataSource=progDataSource;main_obj.progFields=progFields;main_obj.progEvents=progEvents;main_obj.scriptData=z.object({value:z.string().describe("The return payload template as a stringified object. Placeholder bindings (e.g., @CS_Id) are replaced at runtime")});break;case`alert`:XudaComponentSchema.describe(`The Alert Object is a program-level UI unit in the Xuda platform used to deliver contextual messages and notifications to users or developers at runtime. These alerts can be triggered from within logic flows and offer various display formats (such as toast, modal, browser alert, or console message) based on the use case. The alert object is defined using a structured JSON format and can be embedded in broader program logic. It supports both static and dynamic content, and can optionally create log entries to support audit trails and debugging workflows.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.alertData=z.object({alertDisplay:AlertDisplay.describe('Mode of display: "toast", "modal", "browser", or "console"'),alertType:AlertType.describe('Type of message: "warning", "error", "info", or "success"'),alertTitle:z.string().describe("Main content of the alert shown to the user"),alertTitleFx:z.string().optional().describe("Optional dynamic override (e.g., @msg_v) for alert content"),createLog:z.boolean().describe("Whether to generate a system log entry associated with the alert")});break;case`javascript`:XudaComponentSchema.describe(`The javascript object is a functional unit designed to execute JavaScript code within the application context. It can be called from any program using methods such as call_native_javascript, call_evaluate_javascript, execute_native_javascript, or execute_evaluate_javascript. This object includes the following key property: Script – Contains the JavaScript code to be executed, along with any declared dependencies required for execution. The javascript object is ideal for performing advanced logic, custom client-side behavior, or dynamic scripting that extends the capabilities of low-code flows. Xuda also exposes a set of built-in API methods that can be easily called from JavaScript units. These include actions like reading from or writing to Drive, interacting with the Studio API, or performing database operations such as create, update, and delete. These ready-to-use APIs simplify common tasks and allow you to focus on building functionality instead of writing boilerplate code. By centralizing script execution in a modular and reusable way, the JavaScript unit enhances flexibility, promotes clean architecture, and empowers developers to go beyond standard configuration with native scripting power.`);properties_obj.progParams=z.array(ProgParamSchema).optional().describe(`Array of input/output parameter definitions for ${type} interface`);main_obj.scriptData=z.object({value:z.string().describe("JavaScript code to be executed"),dependencies:z.record(z.string()).optional().describe("Optional. Key-value map of external packages required")});break;default:break}return XudaComponentSchema};export const get_fields_z_schema=function(fields={},exclude_props=[]){let inputSchema={};const get_z_item=function(key,val){let prop={};if(val.type==="object"&&val.items){for(const[item_key,item_val]of Object.entries(val.items.properties)){prop[item_key]=get_z_item(item_key,item_val);if(!val?.items?.required?.includes(item_key)){prop[item_key]=prop[item_key].optional()}}}if(val.type==="array"){prop=get_z_item("",val.items)}let _z=z[val.type](prop);if(!val.mandatory){_z=_z.optional()}if(val.enum){_z=z.enum(val.enum)}let valid_values="";if(val.options){valid_values=val.options.join(", ")}if(val.description){const desc=val.name||key.replace(/_/g," ").replace(/\b(\w)/g,(_,char)=>char.toUpperCase());_z=_z.describe((desc?desc+" - ":"")+val.description+(valid_values?" Valid values: "+valid_values:""))}return _z};try{for(const[key,val]of Object.entries(fields)){if(exclude_props.includes(key))continue;inputSchema[key]=get_z_item(key,val)}}catch(error){debugger}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-studio-checker.min",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "main": "index.mjs",
5
5
  "type": "module",
6
6
  "description": "Auto-generated build for xuda-studio-checker.min.mjs",