UNPKG

@autobe/agent

Version:

AI backend server code generator

584 lines 166 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.orchestratePrismaCorrect = orchestratePrismaCorrect; const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js")); const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js")); const core_1 = require("@agentica/core"); const typia_1 = __importDefault(require("typia")); const assertSchemaModel_1 = require("../../context/assertSchemaModel"); const enforceToolCall_1 = require("../../utils/enforceToolCall"); const transformPrismaCorrectHistories_1 = require("./transformPrismaCorrectHistories"); function orchestratePrismaCorrect(ctx, application, life = 4) { const unique = new Set(); for (const file of application.files) file.models = file.models.filter((model) => { if (unique.has(model.name)) return false; unique.add(model.name); return true; }); application.files = application.files.filter((f) => f.models.length !== 0); return step(ctx, application, life); } function step(ctx, application, life) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e; const result = yield ctx.compiler.prisma.validate(application); if (result.success) return result; // SUCCESS else if (life <= 0) return result; // FAILURE // VALIDATION FAILED const schemas = yield ctx.compiler.prisma.write(application); ctx.dispatch({ type: "prismaValidate", result, schemas, compiled: yield ctx.compiler.prisma.compile({ files: schemas, }), step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0, created_at: new Date().toISOString(), }); const pointer = { value: null, }; const agentica = new core_1.MicroAgentica({ model: ctx.model, vendor: ctx.vendor, config: Object.assign({}, ((_c = ctx.config) !== null && _c !== void 0 ? _c : {})), histories: (0, transformPrismaCorrectHistories_1.transformPrismaCorrectHistories)(result), tokenUsage: ctx.usage(), controllers: [ createApplication({ model: ctx.model, build: (next) => { pointer.value = next; }, }), ], }); (0, enforceToolCall_1.enforceToolCall)(agentica); // REQUEST CORRECTION yield agentica.conversate("Resolve the compilation errors in the provided Prisma schema files."); if (pointer.value === null) { console.error("Unreachable error: PrismaCompilerAgent.pointer.value is null"); return result; // unreachable } const correction = { files: application.files.map((file) => ({ filename: file.filename, namespace: file.namespace, models: file.models.map((model) => { const newbie = pointer.value.models.find((m) => m.name === model.name); return newbie !== null && newbie !== void 0 ? newbie : model; }), })), }; ctx.dispatch({ type: "prismaCorrect", failure: result, correction, planning: pointer.value.planning, step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0, created_at: new Date().toISOString(), }); return step(ctx, { files: correction.files, }, life - 1); }); } function createApplication(props) { (0, assertSchemaModel_1.assertSchemaModel)(props.model); const application = collection[props.model]; return { protocol: "class", name: "Prisma Compiler", application, execute: { correctPrismaSchemaFiles: (next) => { props.build(next); }, }, }; } const claude = { model: "claude", options: { reference: true, separate: null }, functions: [ { name: "correctPrismaSchemaFiles", parameters: { description: "Current Type: {@link IModifyPrismaSchemaFilesProps}", type: "object", properties: { planning: { description: "Detailed execution plan for fixing `AutoBePrisma` validation errors in\nspecific models.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for targeted model validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Scope Analysis**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Extract unique table names from errors to identify affected models\n - Categorize errors by type (field duplications, references, types, indexes)\n - Identify which models need correction vs. which remain unchanged\n2. **Targeted Fix Strategy**\n\n - Focus ONLY on models mentioned in validation errors\n - Outline minimal changes needed for each affected model\n - Plan cross-model reference updates (if any) without modifying non-error\n models\n - Ensure unchanged models maintain valid references to corrected models\n3. **Model-Specific Fix Plan**\n\n - Model-by-model modification plan for ONLY affected models\n - Exact field additions, renames, or type corrections required\n - Reference updates within corrected models only\n - Index corrections limited to affected models\n4. **Minimal Scope Validation**\n\n - Confirm which models will be included in output (error models only)\n - List models that will remain unchanged in original schema\n - Identify cross-model dependencies without including unchanged models\n - Preserve all business logic within corrected models\n5. **Targeted Impact Assessment**\n\n - Potential effects of fixes on unchanged models (reference validation)\n - Verification points for corrected models only\n - Ensure no new validation errors in targeted models\n - Confirm minimal output scope compliance\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Scope\n - Target Models: shopping_customers, shopping_orders (2 models only)\n - Unchanged Models: All others remain in original schema\n\n ## Targeted Fixes\n - shopping_customers: Remove duplicate 'email' field\n - shopping_orders: Update targetModel reference to 'shopping_customers'\n\n ## Output Scope\n - Return: Only shopping_customers and shopping_orders models\n - Preserve: All other models unchanged in original schema\n\n ## Cross-Model Impact\n - Verify: shopping_orders still references shopping_customers correctly\n - No changes needed in other models referencing these", type: "string" }, models: { description: "ONLY the specific models that contain validation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array\n- Each model has specific validation errors that need targeted correction\n- Models not mentioned in errors are excluded from this input\n- Represents minimal scope for error correction\n\n\uD83D\uDD0D Expected Validation Issues (Model-Specific):\n\n- Duplicate field/relation names within these specific models\n- Invalid foreign key references from these models to other models\n- Single foreign key fields in index arrays within these models\n- Invalid naming conventions within these specific models\n- Type validation errors in fields of these models\n\n\uD83D\uDCDD Model Content Analysis (Targeted Scope):\n\n- Complete field definitions for each error model only\n- Relationships from these models (may reference unchanged models)\n- Indexes within these models that need correction\n- Business descriptions specific to these models\n- Cross-model references that need validation (read-only for targets)\n\n\u26A0\uFE0F Processing Notes (Focused Approach):\n\n- Input contains ONLY models with validation errors\n- May reference other models not included in this input\n- Cross-model references must be validated but target models won't be\n modified\n- Output should return corrected versions of ONLY these input models\n- All business logic and descriptions within these models must be preserved\n- Corrections must not break references from unchanged models\n\n\uD83C\uDFAF Correction Scope:\n\n- Fix validation errors within these specific models\n- Update internal model structure (fields, relations, indexes)\n- Correct references to external models (without modifying targets)\n- Maintain compatibility with unchanged models in the full schema\n- Return corrected versions of ONLY these models", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IModel} type:\n\n> Interface representing a single Prisma model (database table).\n> \n> Based on the uploaded schemas, models follow specific patterns:\n> \n> - Main business entities (e.g., shopping_sales, shopping_customers)\n> - Snapshot/versioning entities for audit trails (e.g.,\n> shopping_sale_snapshots)\n> - Junction tables for M:N relationships (e.g.,\n> shopping_cart_commodity_stocks)\n> - Materialized views for performance (prefixed with mv_)", type: "object", properties: { name: { title: "Name of the Prisma model (database table name)", description: "Name of the Prisma model (database table name).\n\nShould follow snake_case convention with domain prefix. Examples:\n\"shopping_customers\", \"shopping_sale_snapshots\", \"bbs_articles\"\nMaterialized views use \"mv_\" prefix: \"mv_shopping_sale_last_snapshots\"", type: "string", pattern: "^[a-z][a-z0-9_]*$" }, description: { description: "Detailed description explaining the business purpose and usage of the\nmodel.\n\nShould include:\n\n- Business context and purpose\n- Key relationships with other models\n- Important behavioral notes or constraints\n- References to related entities using \"{@\\link ModelName}\" syntax Example:\n \"Customer information, but not a person but a **connection** basis...\"", type: "string" }, material: { description: "Indicates whether this model represents a materialized view for\nperformance optimization.\n\nMaterialized views are read-only computed tables that cache complex query\nresults. They're marked as \"@\\hidden\" in documentation and prefixed with\n\"mv_\" in naming. Examples: mv_shopping_sale_last_snapshots,\nmv_shopping_cart_commodity_prices", type: "boolean" }, primaryField: { description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.\n\n------------------------------\n\nDescription of the current {@link AutoBePrisma.IPrimaryField} type:\n\n> Interface representing the primary key field of a Prisma model.\n> \n> All models in the uploaded schemas use UUID as primary key for better\n> distributed system compatibility and security (no sequential ID exposure).", type: "object", properties: { name: { title: "Name of the primary key field", description: "Name of the primary key field.\n\nConsistently named \"id\" across all models in the uploaded schemas.\nRepresents the unique identifier for each record in the table.", type: "string", pattern: "^[a-z][a-z0-9_]*$" }, type: { title: "Data type of the primary key field", description: "Data type of the primary key field.\n\nAlways \"uuid\" in the uploaded schemas for better distributed system\nsupport and to avoid exposing sequential IDs that could reveal business\ninformation.", "const": "uuid" }, description: { title: "Description of the primary key field's purpose", description: "Description of the primary key field's purpose.\n\nStandard description is \"Primary Key.\" across all models. Serves as the\nunique identifier for the model instance.", type: "string" } }, required: [ "name", "type", "description" ] }, foreignFields: { title: "Array of foreign key fields that reference other models", description: "Array of foreign key fields that reference other models.\n\nThese establish relationships between models and include Prisma relation\ndirectives. Can be nullable (optional relationships) or required\n(mandatory relationships). May have unique constraints for 1:1\nrelationships.", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IForeignField} type:\n\n> Interface representing a foreign key field that establishes relationships\n> between models.\n> \n> Foreign keys create associations between models, enabling relational data\n> modeling. They can represent 1:1, 1:N, or participate in M:N relationships\n> through junction tables.", type: "object", properties: { name: { title: "Name of the foreign key field", description: "Name of the foreign key field.\n\nFollows convention: \"{target_model_name_without_prefix}_id\" Examples:\n\"shopping_customer_id\", \"bbs_article_id\", \"attachment_file_id\" For\nself-references: \"parent_id\" (e.g., in hierarchical structures)", type: "string", pattern: "^[a-z][a-z0-9_]*$" }, type: { title: "Data type of the foreign key field", description: "Data type of the foreign key field.\n\nAlways \"uuid\" to match the primary key type of referenced models. Ensures\nreferential integrity and consistency across the schema.", "const": "uuid" }, description: { description: "Description explaining the purpose and target of this foreign key\nrelationship.\n\nShould reference the target model using format: \"Target model's {@\\link\nModelName.id}\" Examples: \"Belonged customer's {@\\link\nshopping_customers.id}\" May include additional context about the\nrelationship's business meaning.", type: "string" }, relation: { title: "Prisma relation configuration defining the association details", description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field.", type: "object", properties: { name: { title: "Name of the relation property in the Prisma model", description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\"", type: "string", pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$" }, targetModel: { title: "Name of the target model being referenced", description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\"", type: "string" } }, required: [ "name", "targetModel" ] }, unique: { title: "Whether this foreign key has a unique constraint", description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.", type: "boolean" }, nullable: { title: "Whether this foreign key can be null (optional relationship)", description: "Whether this foreign key can be null (optional relationship).\n\nTrue: Relationship is optional, foreign key can be null false:\nRelationship is required, foreign key cannot be null Reflects business\nrules about mandatory vs optional associations.", type: "boolean" } }, required: [ "name", "type", "description", "relation", "unique", "nullable" ] } }, plainFields: { title: "Array of regular data fields that don't reference other models", description: "Array of regular data fields that don't reference other models.\n\nInclude business data like names, descriptions, timestamps, flags,\namounts, etc. Common patterns: created_at, updated_at, deleted_at for\nsoft deletion and auditing.", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IPlainField} type:\n\n> Interface representing a regular data field that stores business\n> information.\n> \n> These fields contain the actual business data like names, amounts,\n> timestamps, flags, descriptions, and other domain-specific information.", type: "object", properties: { name: { title: "Name of the field in the database table", description: "Name of the field in the database table.\n\nShould use snake_case convention. Common patterns from uploaded schemas:\n\n- Timestamps: created_at, updated_at, deleted_at, opened_at, closed_at\n- Identifiers: code, name, nickname, title\n- Business data: value, quantity, price, volume, balance\n- Flags: primary, required, exclusive, secret, multiplicative", type: "string", pattern: "^[a-z][a-z0-9_]*$" }, type: { title: "Data type of the field for Prisma schema generation", description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Date: Date-only values (rare, mostly for business dates)\n- Datetime: Timestamp fields with date and time", oneOf: [ { "const": "string" }, { "const": "boolean" }, { "const": "uuid" }, { "const": "uri" }, { "const": "int" }, { "const": "double" }, { "const": "datetime" } ] }, description: { title: "Description explaining the business purpose and usage of this field", description: "Description explaining the business purpose and usage of this field.\n\nShould clearly explain:\n\n- What business concept this field represents\n- Valid values or constraints if applicable\n- How it relates to business processes\n- Any special behavioral notes Example: \"Amount of cash payment.\" or\n \"Whether the unit is required or not.\"", type: "string" }, nullable: { title: "Whether this field can contain null values", description: "Whether this field can contain null values.\n\nTrue: Field is optional and can be null (e.g., middle name, description)\nfalse: Field is required and cannot be null (e.g., creation timestamp,\nname) Reflects business rules about mandatory vs optional data.", type: "boolean" } }, required: [ "name", "type", "description", "nullable" ] } }, uniqueIndexes: { title: "Array of unique indexes for enforcing data integrity constraints", description: "Array of unique indexes for enforcing data integrity constraints.\n\nEnsure uniqueness across single or multiple columns. Examples: unique\nemail addresses, unique codes within a channel, unique combinations like\n(channel_id, nickname).", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IUniqueIndex} type:\n\n> Interface representing a unique index constraint on one or more fields.\n> \n> Unique indexes enforce data integrity by ensuring no duplicate values exist\n> for the specified field combination. Essential for business rules that\n> require uniqueness like email addresses, codes, or composite keys.", type: "object", properties: { fieldNames: { title: "Array of field names that together form the unique constraint", description: "Array of field names that together form the unique constraint.\n\nCan be single field (e.g., [\"email\"]) or composite (e.g., [\"channel_id\",\n\"code\"]). All field names must exist in the model. Order matters for\ncomposite indexes. Examples: [\"code\"], [\"shopping_channel_id\",\n\"nickname\"], [\"email\"]", type: "array", items: { type: "string" }, minItems: 1, uniqueItems: true }, unique: { title: "Explicit marker indicating this is a unique index", description: "Explicit marker indicating this is a unique index.\n\nAlways true to distinguish from regular indexes. Used by code generator\nto emit \"@@unique\" directive in Prisma schema instead of \"@@index\".", "const": true } }, required: [ "fieldNames", "unique" ] } }, plainIndexes: { title: "Array of regular indexes for query performance optimization", description: "Array of regular indexes for query performance optimization.\n\nSpeed up common query patterns like filtering by foreign keys, date\nranges, or frequently searched fields. Examples: indexes on created_at,\nforeign key fields, search fields.", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IPlainIndex} type:\n\n> Interface representing a regular (non-unique) index for query performance.\n> \n> Regular indexes speed up database queries by creating optimized data\n> structures for common search patterns. Essential for foreign keys, date\n> ranges, and frequently filtered fields.", type: "object", properties: { fieldNames: { title: "Array of field names to include in the performance index", description: "Array of field names to include in the performance index.\n\nCan be single field (e.g., [\"created_at\"]) or composite (e.g.,\n[\"customer_id\", \"created_at\"]). All field names must exist in the model.\nOrder matters for composite indexes and should match common query\npatterns. Examples: [\"created_at\"], [\"shopping_customer_id\",\n\"created_at\"], [\"ip\"]", type: "array", items: { type: "string" }, minItems: 1, uniqueItems: true } }, required: [ "fieldNames" ] } }, ginIndexes: { title: "Array of GIN (Generalized Inverted Index) indexes for full-text search", description: "Array of GIN (Generalized Inverted Index) indexes for full-text search.\n\nUsed specifically for PostgreSQL text search capabilities using trigram\noperations. Applied to text fields that need fuzzy matching or partial\ntext search. Examples: searching names, nicknames, titles, content\nbodies.", type: "array", items: { description: "Description of the current {@link AutoBePrisma.IGinIndex} type:\n\n> Interface representing a GIN (Generalized Inverted Index) for full-text\n> search.\n> \n> GIN indexes enable advanced PostgreSQL text search capabilities including\n> fuzzy matching and partial text search using trigram operations. Essential\n> for user-facing search features on text content.", type: "object", properties: { fieldName: { title: "Name of the text field to index for full-text search capabilities", description: "Name of the text field to index for full-text search capabilities.\n\nMust be a string field in the model that contains searchable text.\nExamples from uploaded schemas: \"nickname\", \"title\", \"body\", \"name\" Used\nwith PostgreSQL gin_trgm_ops for trigram-based fuzzy text search.", type: "string" } }, required: [ "fieldName" ] } } }, required: [ "name", "description", "material", "primaryField", "foreignFields", "plainFields", "uniqueIndexes", "plainIndexes", "ginIndexes" ] } } }, required: [ "planning", "models" ], additionalProperties: false, $defs: {} }, description: "Fixes validation errors in specific AutoBePrisma models while preserving\nALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors in provided models - never remove business\n descriptions\n2. Apply minimal changes to error models only - preserve original design\n intent\n3. Return ONLY corrected models - unchanged models remain in original schema\n4. Maintain referential integrity with unchanged models\n\n## Targeted Scope\n\n- Process ONLY models with validation errors from IError[] array\n- Exclude models without errors from processing and output\n- Minimize context usage by returning corrected models only\n- Preserve unchanged models in their original state\n\n## Fix Strategy\n\n- Resolve validation errors within specific models only\n- Fix field duplications, invalid references, and type mismatches\n- Update cross-model references without modifying target models\n- Ensure naming conventions and index rules compliance in corrected models", validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, { path: _path + ".planning", expected: "string", value: input.planning }), (Array.isArray(input.models) || _report(_exceptionable, { path: _path + ".models", expected: "Array<AutoBePrisma.IModel>", value: input.models })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".models[" + _index9 + "]", expected: "AutoBePrisma.IModel", value: elem })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".models[" + _index9 + "]", expected: "AutoBePrisma.IModel", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".models", expected: "Array<AutoBePrisma.IModel>", value: input.models })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, { path: _path + ".name", expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">", value: input.name })) || _report(_exceptionable, { path: _path + ".name", expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)", value: input.name }), "string" === typeof input.description || _report(_exceptionable, { path: _path + ".description", expected: "string", value: input.description }), "boolean" === typeof input.material || _report(_exceptionable, { path: _path + ".material", expected: "boolean", value: input.material }), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, { path: _path + ".primaryField", expected: "AutoBePrisma.IPrimaryField", value: input.primaryField })) && _vo2(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, { path: _path + ".primaryField", expected: "AutoBePrisma.IPrimaryField", value: input.primaryField }), (Array.isArray(input.foreignFields) || _report(_exceptionable, { path: _path + ".foreignFields", expected: "Array<AutoBePrisma.IForeignField>", value: input.foreignFields })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".foreignFields[" + _index10 + "]", expected: "AutoBePrisma.IForeignField", value: elem })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".foreignFields[" + _index10 + "]", expected: "AutoBePrisma.IForeignField", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".foreignFields", expected: "Array<AutoBePrisma.IForeignField>", value: input.foreignFields }), (Array.isArray(input.plainFields) || _report(_exceptionable, { path: _path + ".plainFields", expected: "Array<AutoBePrisma.IPlainField>", value: input.plainFields })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".plainFields[" + _index11 + "]", expected: "AutoBePrisma.IPlainField", value: elem })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".plainFields[" + _index11 + "]", expected: "AutoBePrisma.IPlainField", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".plainFields", expected: "Array<AutoBePrisma.IPlainField>", value: input.plainFields }), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, { path: _path + ".uniqueIndexes", expected: "Array<AutoBePrisma.IUniqueIndex>", value: input.uniqueIndexes })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".uniqueIndexes[" + _index12 + "]", expected: "AutoBePrisma.IUniqueIndex", value: elem })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".uniqueIndexes[" + _index12 + "]", expected: "AutoBePrisma.IUniqueIndex", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".uniqueIndexes", expected: "Array<AutoBePrisma.IUniqueIndex>", value: input.uniqueIndexes }), (Array.isArray(input.plainIndexes) || _report(_exceptionable, { path: _path + ".plainIndexes", expected: "Array<AutoBePrisma.IPlainIndex>", value: input.plainIndexes })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".plainIndexes[" + _index13 + "]", expected: "AutoBePrisma.IPlainIndex", value: elem })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".plainIndexes[" + _index13 + "]", expected: "AutoBePrisma.IPlainIndex", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".plainIndexes", expected: "Array<AutoBePrisma.IPlainIndex>", value: input.plainIndexes }), (Array.isArray(input.ginIndexes) || _report(_exceptionable, { path: _path + ".ginIndexes", expected: "Array<AutoBePrisma.IGinIndex>", value: input.ginIndexes })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".ginIndexes[" + _index14 + "]", expected: "AutoBePrisma.IGinIndex", value: elem })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".ginIndexes[" + _index14 + "]", expected: "AutoBePrisma.IGinIndex", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".ginIndexes", expected: "Array<AutoBePrisma.IGinIndex>", value: input.ginIndexes })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, { path: _path + ".name", expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">", value: input.name })) || _report(_exceptionable, { path: _path + ".name", expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)", value: input.name }), "uuid" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"uuid\"", value: input.type }), "string" === typeof input.description || _report(_exceptionable, { path: _path + ".description", expected: "string", value: input.description })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, { path: _path + ".name", expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">", value: input.name })) || _report(_exceptionable, { path: _path + ".name", expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)", val