@autobe/agent 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.mjs +83 -74
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +47 -40
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +47 -40
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +12 -20
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/package.json +6 -6
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +1 -1
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +12 -20
package/lib/index.mjs
CHANGED
|
@@ -4538,20 +4538,8 @@ const claude$6 = {
|
|
|
4538
4538
|
type: "string"
|
|
4539
4539
|
},
|
|
4540
4540
|
relation: {
|
|
4541
|
-
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.",
|
|
4542
|
-
|
|
4543
|
-
properties: {
|
|
4544
|
-
name: {
|
|
4545
|
-
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"',
|
|
4546
|
-
type: "string",
|
|
4547
|
-
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
4548
|
-
},
|
|
4549
|
-
targetModel: {
|
|
4550
|
-
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"',
|
|
4551
|
-
type: "string"
|
|
4552
|
-
}
|
|
4553
|
-
},
|
|
4554
|
-
required: [ "name", "targetModel" ]
|
|
4541
|
+
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. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
|
|
4542
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
4555
4543
|
},
|
|
4556
4544
|
unique: {
|
|
4557
4545
|
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.",
|
|
@@ -4564,6 +4552,22 @@ const claude$6 = {
|
|
|
4564
4552
|
},
|
|
4565
4553
|
required: [ "name", "type", "description", "relation", "unique", "nullable" ]
|
|
4566
4554
|
},
|
|
4555
|
+
"AutoBePrisma.IRelation": {
|
|
4556
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
4557
|
+
type: "object",
|
|
4558
|
+
properties: {
|
|
4559
|
+
name: {
|
|
4560
|
+
description: 'Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- "customer" for shopping_customer_id field\n- "channel" for shopping_channel_id field\n- "parent" for parent_id field in hierarchical structures\n- "snapshot" for versioning relationships\n- "article" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship\'s business\nmeaning',
|
|
4561
|
+
type: "string",
|
|
4562
|
+
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
4563
|
+
},
|
|
4564
|
+
targetModel: {
|
|
4565
|
+
description: 'Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- "shopping_customers" for customer relationships\n- "shopping_channels" for channel relationships\n- "bbs_articles" for article relationships\n- "attachment_files" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.',
|
|
4566
|
+
type: "string"
|
|
4567
|
+
}
|
|
4568
|
+
},
|
|
4569
|
+
required: [ "name", "targetModel" ]
|
|
4570
|
+
},
|
|
4567
4571
|
"AutoBePrisma.IPlainField": {
|
|
4568
4572
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
4569
4573
|
type: "object",
|
|
@@ -4574,7 +4578,7 @@ const claude$6 = {
|
|
|
4574
4578
|
pattern: "^[a-z][a-z0-9_]*$"
|
|
4575
4579
|
},
|
|
4576
4580
|
type: {
|
|
4577
|
-
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-
|
|
4581
|
+
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- Datetime: Timestamp fields with date and time",
|
|
4578
4582
|
oneOf: [ {
|
|
4579
4583
|
const: "string"
|
|
4580
4584
|
}, {
|
|
@@ -4823,11 +4827,11 @@ const claude$6 = {
|
|
|
4823
4827
|
value: input.description
|
|
4824
4828
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
4825
4829
|
path: _path + ".relation",
|
|
4826
|
-
expected: "
|
|
4830
|
+
expected: "AutoBePrisma.IRelation",
|
|
4827
4831
|
value: input.relation
|
|
4828
4832
|
})) && _vo4(input.relation, _path + ".relation", _exceptionable) || _report(_exceptionable, {
|
|
4829
4833
|
path: _path + ".relation",
|
|
4830
|
-
expected: "
|
|
4834
|
+
expected: "AutoBePrisma.IRelation",
|
|
4831
4835
|
value: input.relation
|
|
4832
4836
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
4833
4837
|
path: _path + ".unique",
|
|
@@ -5065,7 +5069,7 @@ const collection$6 = {
|
|
|
5065
5069
|
required: [ "name", "type", "description" ]
|
|
5066
5070
|
},
|
|
5067
5071
|
"AutoBePrisma.IForeignField": {
|
|
5068
|
-
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
|
|
5072
|
+
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.\n\n### Description of {@link relation} property:\n\n> Prisma relation configuration defining the association details.\n> \n> Specifies how this foreign key connects to the target model, including\n> relation name, target model, and target field. This configuration is used\n> to generate the appropriate Prisma relation directive in the schema.",
|
|
5069
5073
|
type: "object",
|
|
5070
5074
|
properties: {
|
|
5071
5075
|
name: {
|
|
@@ -5082,19 +5086,7 @@ const collection$6 = {
|
|
|
5082
5086
|
type: "string"
|
|
5083
5087
|
},
|
|
5084
5088
|
relation: {
|
|
5085
|
-
|
|
5086
|
-
type: "object",
|
|
5087
|
-
properties: {
|
|
5088
|
-
name: {
|
|
5089
|
-
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"\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$',
|
|
5090
|
-
type: "string"
|
|
5091
|
-
},
|
|
5092
|
-
targetModel: {
|
|
5093
|
-
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"',
|
|
5094
|
-
type: "string"
|
|
5095
|
-
}
|
|
5096
|
-
},
|
|
5097
|
-
required: [ "name", "targetModel" ]
|
|
5089
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
5098
5090
|
},
|
|
5099
5091
|
unique: {
|
|
5100
5092
|
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.",
|
|
@@ -5107,6 +5099,21 @@ const collection$6 = {
|
|
|
5107
5099
|
},
|
|
5108
5100
|
required: [ "name", "type", "description", "relation", "unique", "nullable" ]
|
|
5109
5101
|
},
|
|
5102
|
+
"AutoBePrisma.IRelation": {
|
|
5103
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
5104
|
+
type: "object",
|
|
5105
|
+
properties: {
|
|
5106
|
+
name: {
|
|
5107
|
+
description: 'Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- "customer" for shopping_customer_id field\n- "channel" for shopping_channel_id field\n- "parent" for parent_id field in hierarchical structures\n- "snapshot" for versioning relationships\n- "article" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship\'s business\nmeaning\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$',
|
|
5108
|
+
type: "string"
|
|
5109
|
+
},
|
|
5110
|
+
targetModel: {
|
|
5111
|
+
description: 'Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- "shopping_customers" for customer relationships\n- "shopping_channels" for channel relationships\n- "bbs_articles" for article relationships\n- "attachment_files" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.',
|
|
5112
|
+
type: "string"
|
|
5113
|
+
}
|
|
5114
|
+
},
|
|
5115
|
+
required: [ "name", "targetModel" ]
|
|
5116
|
+
},
|
|
5110
5117
|
"AutoBePrisma.IPlainField": {
|
|
5111
5118
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
5112
5119
|
type: "object",
|
|
@@ -5116,7 +5123,7 @@ const collection$6 = {
|
|
|
5116
5123
|
type: "string"
|
|
5117
5124
|
},
|
|
5118
5125
|
type: {
|
|
5119
|
-
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-
|
|
5126
|
+
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- Datetime: Timestamp fields with date and time",
|
|
5120
5127
|
type: "string",
|
|
5121
5128
|
enum: [ "string", "boolean", "uuid", "uri", "int", "double", "datetime" ]
|
|
5122
5129
|
},
|
|
@@ -5349,11 +5356,11 @@ const collection$6 = {
|
|
|
5349
5356
|
value: input.description
|
|
5350
5357
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
5351
5358
|
path: _path + ".relation",
|
|
5352
|
-
expected: "
|
|
5359
|
+
expected: "AutoBePrisma.IRelation",
|
|
5353
5360
|
value: input.relation
|
|
5354
5361
|
})) && _vo4(input.relation, _path + ".relation", _exceptionable) || _report(_exceptionable, {
|
|
5355
5362
|
path: _path + ".relation",
|
|
5356
|
-
expected: "
|
|
5363
|
+
expected: "AutoBePrisma.IRelation",
|
|
5357
5364
|
value: input.relation
|
|
5358
5365
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
5359
5366
|
path: _path + ".unique",
|
|
@@ -5508,12 +5515,7 @@ const transformPrismaSchemaHistories = (analyze, component) => [ {
|
|
|
5508
5515
|
id: v4(),
|
|
5509
5516
|
created_at: (new Date).toISOString(),
|
|
5510
5517
|
type: "systemMessage",
|
|
5511
|
-
text: [ "Before making prisma schema files,", "learn about the prisma schema language", "from the best practices and examples", "", 'Study the following comprehensive BBS (bullet-in board system) project schema as a reference for implementing all the patterns and best practices outlined above. \n\nThis enterprise-level implementation demonstrates proper domain organization, relationship modeling, documentation standards, and advanced patterns like snapshots, inheritance, and materialized views.\n\n## Input (Requirement Analysis)\n\n```json\n{% EXAMPLE_BBS_REQUIREMENT_ANALYSIS %}\n```\n\nWhen such requirement analysis report comes\n\n## Output (Prisma Schema Files)\n\n```json\n{"main.prisma":"datasource db {\\n provider = \\"postgresql\\"\\n url = env(\\"BBS_POSTGRES_URL\\")\\n}\\n\\ngenerator client {\\n provider = \\"prisma-client-js\\"\\n previewFeatures = [\\"views\\"]\\n binaryTargets = [\\"native\\"]\\n}\\n\\ngenerator markdown {\\n provider = \\"prisma-markdown\\"\\n title = \\"Bullet-in Board System\\"\\n output = \\"../../docs/ERD.md\\"\\n}\\n\\n//-----------------------------------------------------------\\n// ARTICLES\\n//-----------------------------------------------------------\\n/// Attachment File.\\n///\\n/// Every attachment files that are managed in current system.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel attachment_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// File name, except extension.\\n name String @db.VarChar\\n\\n /// Extension.\\n ///\\n /// Possible to omit like `README` case.\\n extension String? @db.VarChar\\n\\n /// URL path of the real file.\\n url String @db.VarChar\\n\\n /// Creation time of file.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n bbs_article_snapshot_files bbs_article_snapshot_files[]\\n bbs_article_comment_snapshots_files bbs_article_comment_snapshot_files[]\\n}\\n\\n/// Article entity.\\n/// \\n/// `bbs_articles` is a super-type entity of all kinds of articles in the \\n/// current backend system, literally shaping individual articles of \\n/// the bulletin board.\\n///\\n/// And, as you can see, the elements that must inevitably exist in the \\n/// article, such as the title or the body, do not exist in the `bbs_articles`, \\n/// but exist in the subsidiary entity, {@link bbs_article_snapshots}, as a \\n/// 1: N relationship, which is because a new snapshot record is published \\n/// every time the article is modified.\\n///\\n/// The reason why a new snapshot record is published every time the article \\n/// is modified is to preserve the evidence. Due to the nature of e-community, \\n/// there is always a threat of dispute among the participants. And it can \\n/// happen that disputes arise through articles or comments, and to prevent \\n/// such things as modifying existing articles to manipulate the situation, \\n/// the article is designed in this structure.\\n///\\n/// In other words, to keep evidence, and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_articles {\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Writer\'s name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of article.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of article.\\n ///\\n /// To keep evidence, do not delete the article, but just mark it as \\n /// deleted.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when an article is created, and is\\n /// accumulated every time the article is modified.\\n snapshots bbs_article_snapshots[]\\n\\n /// List of comments.\\n comments bbs_article_comments[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([created_at])\\n}\\n\\n/// Snapshot of article.\\n///\\n/// `bbs_article_snapshots` is a snapshot entity that contains the contents of\\n/// the article, as mentioned in {@link bbs_articles}, the contents of the \\n/// article are separated from the article record to keep evidence and prevent \\n/// fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belong article\'s {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Format of body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Title of article.\\n title String @db.VarChar\\n\\n /// Content body of article.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or article.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong article info.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_snapshot_files[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([bbs_article_id, created_at])\\n}\\n\\n/// Attachment file of article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is an entity that shapes the attached files of\\n/// the article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is a typical pair relationship table to \\n/// resolve the M: N relationship between {@link bbs_article_snapshots} and\\n/// {@link attachment_files} tables. Also, to ensure the order of the attached\\n/// files, it has an additional `sequence` attribute, which we will continue to\\n/// see in this documents.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot\'s {@link bbs_article_snapshots.id}\\n bbs_article_snapshot_id String @db.Uuid\\n\\n /// Belonged file\'s {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence of attachment file in the snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// Comment written on an article.\\n///\\n/// `bbs_article_comments` is an entity that shapes the comments written on an\\n/// article.\\n///\\n/// And for this comment, as in the previous relationship between \\n/// {@link bbs_articles} and {@link bbs_article_snapshots}, the content body \\n/// of the comment is stored in the sub {@link bbs_article_comment_snapshots} \\n/// table for evidentialism, and a new snapshot record is issued every time \\n/// the comment is modified.\\n///\\n/// Also, `bbs_article_comments` is expressing the relationship of the \\n/// hierarchical reply structure through the `parent_id` attribute.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comments {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article\'s {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Parent comment\'s {@link bbs_article_comments.id}\\n ///\\n /// Used to express the hierarchical reply structure.\\n parent_id String? @db.Uuid\\n\\n /// Writer\'s name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of comment.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of comment.\\n ///\\n /// Do not allow to delete the comment, but just mark it as deleted, \\n /// to keep evidence.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// Parent comment.\\n ///\\n /// Only when reply case.\\n parent bbs_article_comments? @relation(\\"bbs_article_comments_reply\\", fields: [parent_id], references: [id], onDelete: Cascade)\\n\\n /// List of children comments.\\n ///\\n /// Reply comments of current.\\n children bbs_article_comments[] @relation(\\"bbs_article_comments_reply\\")\\n\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when a comment is created, and is\\n /// accumulated every time the comment is modified.\\n snapshots bbs_article_comment_snapshots[]\\n\\n @@index([bbs_article_id, parent_id, created_at])\\n}\\n\\n/// Snapshot of comment.\\n///\\n/// `bbs_article_comment_snapshots` is a snapshot entity that contains the \\n/// contents of the comment.\\n///\\n/// As mentioned in {@link bbs_article_comments}, designed to keep evidence \\n/// and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article\'s {@link bbs_article_comments.id}\\n bbs_article_comment_id String @db.Uuid\\n\\n /// Format of content body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Content body of comment.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or comment.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong comment info.\\n comment bbs_article_comments @relation(fields: [bbs_article_comment_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_comment_snapshot_files[]\\n\\n @@index([bbs_article_comment_id, created_at])\\n}\\n\\n/// Attachment file of comment snapshot.\\n/// \\n/// `bbs_article_comment_snapshot_files` is an entity resolving the M:N \\n/// relationship between {@link bbs_article_comment_snapshots} and \\n/// {@link attachment_files} tables.\\n/// \\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot\'s {@link bbs_article_comment_snapshots.id}\\n bbs_article_comment_snapshot_id String @db.Uuid\\n\\n /// Belonged file\'s {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence order.\\n ///\\n /// Sequence order of the attached file in the belonged snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_comment_snapshots @relation(fields: [bbs_article_comment_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_comment_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// @hidden\\n/// @author Samchon\\nmodel mv_bbs_article_last_snapshots {\\n bbs_article_id String @id @db.Uuid\\n bbs_article_snapshot_id String @db.Uuid\\n\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n @@unique([bbs_article_snapshot_id])\\n}\\n"}\n```\n\nYou have to make above like prisma schema files.\n\nStudy the above schema files, and follow its coding style.' ].join("\n")
|
|
5512
|
-
}, {
|
|
5513
|
-
id: v4(),
|
|
5514
|
-
created_at: (new Date).toISOString(),
|
|
5515
|
-
type: "assistantMessage",
|
|
5516
|
-
text: [ "Here is the requirement analysis report.", "", "Call the provided tool function to generate Prisma DB schema", "referencing below requirement analysis report.", "", "## User Request", analyze.reason, "", `## Requirement Analysis Report`, "", "```json", JSON.stringify(analyze.files), "```", "", "## Context", "", ` - Target filename: ${component.filename}`, ` - Tables what you have to make:`, ...component.tables.map((table => ` - ${table}`)), ` - Entire tables you can reference:`, ...component.entireTables.map((table => ` - ${table}`)), "", "## User Role Rules", "", "**CRITICAL**: For User Role tables (User, Admin, Moderator, etc.):", "1. **Separate tables** - Each role = independent table (User, Admin, Moderator tables)", "2. **No `role` field** - Never include role enum fields in any table", "", "You can use TPT (Table Per Type) pattern with FK relationships if needed, or completely separate tables." ].join("\n")
|
|
5518
|
+
text: [ "Here is the requirement analysis report.", "", "Call the provided tool function to generate Prisma DB schema", "referencing below requirement analysis report.", "", "## User Request", analyze.reason, "", `## Requirement Analysis Report`, "", "```json", JSON.stringify(analyze.files), "```", "", "## Context", "", ` - Target filename: ${component.filename}`, ` - Tables what you have to make:`, ...component.tables.map((table => ` - ${table}`)), ` - Entire tables you can reference:`, ...component.entireTables.map((table => ` - ${table}`)) ].join("\n")
|
|
5517
5519
|
} ];
|
|
5518
5520
|
|
|
5519
5521
|
async function orchestratePrismaSchemas(ctx, components) {
|
|
@@ -5732,20 +5734,8 @@ const claude$5 = {
|
|
|
5732
5734
|
type: "string"
|
|
5733
5735
|
},
|
|
5734
5736
|
relation: {
|
|
5735
|
-
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.",
|
|
5736
|
-
|
|
5737
|
-
properties: {
|
|
5738
|
-
name: {
|
|
5739
|
-
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"',
|
|
5740
|
-
type: "string",
|
|
5741
|
-
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
5742
|
-
},
|
|
5743
|
-
targetModel: {
|
|
5744
|
-
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"',
|
|
5745
|
-
type: "string"
|
|
5746
|
-
}
|
|
5747
|
-
},
|
|
5748
|
-
required: [ "name", "targetModel" ]
|
|
5737
|
+
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. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
|
|
5738
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
5749
5739
|
},
|
|
5750
5740
|
unique: {
|
|
5751
5741
|
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.",
|
|
@@ -5758,6 +5748,22 @@ const claude$5 = {
|
|
|
5758
5748
|
},
|
|
5759
5749
|
required: [ "name", "type", "description", "relation", "unique", "nullable" ]
|
|
5760
5750
|
},
|
|
5751
|
+
"AutoBePrisma.IRelation": {
|
|
5752
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
5753
|
+
type: "object",
|
|
5754
|
+
properties: {
|
|
5755
|
+
name: {
|
|
5756
|
+
description: 'Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- "customer" for shopping_customer_id field\n- "channel" for shopping_channel_id field\n- "parent" for parent_id field in hierarchical structures\n- "snapshot" for versioning relationships\n- "article" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship\'s business\nmeaning',
|
|
5757
|
+
type: "string",
|
|
5758
|
+
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
5759
|
+
},
|
|
5760
|
+
targetModel: {
|
|
5761
|
+
description: 'Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- "shopping_customers" for customer relationships\n- "shopping_channels" for channel relationships\n- "bbs_articles" for article relationships\n- "attachment_files" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.',
|
|
5762
|
+
type: "string"
|
|
5763
|
+
}
|
|
5764
|
+
},
|
|
5765
|
+
required: [ "name", "targetModel" ]
|
|
5766
|
+
},
|
|
5761
5767
|
"AutoBePrisma.IPlainField": {
|
|
5762
5768
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
5763
5769
|
type: "object",
|
|
@@ -5768,7 +5774,7 @@ const claude$5 = {
|
|
|
5768
5774
|
pattern: "^[a-z][a-z0-9_]*$"
|
|
5769
5775
|
},
|
|
5770
5776
|
type: {
|
|
5771
|
-
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-
|
|
5777
|
+
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- Datetime: Timestamp fields with date and time",
|
|
5772
5778
|
oneOf: [ {
|
|
5773
5779
|
const: "string"
|
|
5774
5780
|
}, {
|
|
@@ -6035,11 +6041,11 @@ const claude$5 = {
|
|
|
6035
6041
|
value: input.description
|
|
6036
6042
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
6037
6043
|
path: _path + ".relation",
|
|
6038
|
-
expected: "
|
|
6044
|
+
expected: "AutoBePrisma.IRelation",
|
|
6039
6045
|
value: input.relation
|
|
6040
6046
|
})) && _vo5(input.relation, _path + ".relation", _exceptionable) || _report(_exceptionable, {
|
|
6041
6047
|
path: _path + ".relation",
|
|
6042
|
-
expected: "
|
|
6048
|
+
expected: "AutoBePrisma.IRelation",
|
|
6043
6049
|
value: input.relation
|
|
6044
6050
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
6045
6051
|
path: _path + ".unique",
|
|
@@ -6291,7 +6297,7 @@ const collection$5 = {
|
|
|
6291
6297
|
required: [ "name", "type", "description" ]
|
|
6292
6298
|
},
|
|
6293
6299
|
"AutoBePrisma.IForeignField": {
|
|
6294
|
-
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
|
|
6300
|
+
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.\n\n### Description of {@link relation} property:\n\n> Prisma relation configuration defining the association details.\n> \n> Specifies how this foreign key connects to the target model, including\n> relation name, target model, and target field. This configuration is used\n> to generate the appropriate Prisma relation directive in the schema.",
|
|
6295
6301
|
type: "object",
|
|
6296
6302
|
properties: {
|
|
6297
6303
|
name: {
|
|
@@ -6308,19 +6314,7 @@ const collection$5 = {
|
|
|
6308
6314
|
type: "string"
|
|
6309
6315
|
},
|
|
6310
6316
|
relation: {
|
|
6311
|
-
|
|
6312
|
-
type: "object",
|
|
6313
|
-
properties: {
|
|
6314
|
-
name: {
|
|
6315
|
-
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"\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$',
|
|
6316
|
-
type: "string"
|
|
6317
|
-
},
|
|
6318
|
-
targetModel: {
|
|
6319
|
-
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"',
|
|
6320
|
-
type: "string"
|
|
6321
|
-
}
|
|
6322
|
-
},
|
|
6323
|
-
required: [ "name", "targetModel" ]
|
|
6317
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
6324
6318
|
},
|
|
6325
6319
|
unique: {
|
|
6326
6320
|
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.",
|
|
@@ -6333,6 +6327,21 @@ const collection$5 = {
|
|
|
6333
6327
|
},
|
|
6334
6328
|
required: [ "name", "type", "description", "relation", "unique", "nullable" ]
|
|
6335
6329
|
},
|
|
6330
|
+
"AutoBePrisma.IRelation": {
|
|
6331
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
6332
|
+
type: "object",
|
|
6333
|
+
properties: {
|
|
6334
|
+
name: {
|
|
6335
|
+
description: 'Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- "customer" for shopping_customer_id field\n- "channel" for shopping_channel_id field\n- "parent" for parent_id field in hierarchical structures\n- "snapshot" for versioning relationships\n- "article" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship\'s business\nmeaning\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$',
|
|
6336
|
+
type: "string"
|
|
6337
|
+
},
|
|
6338
|
+
targetModel: {
|
|
6339
|
+
description: 'Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- "shopping_customers" for customer relationships\n- "shopping_channels" for channel relationships\n- "bbs_articles" for article relationships\n- "attachment_files" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.',
|
|
6340
|
+
type: "string"
|
|
6341
|
+
}
|
|
6342
|
+
},
|
|
6343
|
+
required: [ "name", "targetModel" ]
|
|
6344
|
+
},
|
|
6336
6345
|
"AutoBePrisma.IPlainField": {
|
|
6337
6346
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
6338
6347
|
type: "object",
|
|
@@ -6342,7 +6351,7 @@ const collection$5 = {
|
|
|
6342
6351
|
type: "string"
|
|
6343
6352
|
},
|
|
6344
6353
|
type: {
|
|
6345
|
-
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-
|
|
6354
|
+
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- Datetime: Timestamp fields with date and time",
|
|
6346
6355
|
type: "string",
|
|
6347
6356
|
enum: [ "string", "boolean", "uuid", "uri", "int", "double", "datetime" ]
|
|
6348
6357
|
},
|
|
@@ -6593,11 +6602,11 @@ const collection$5 = {
|
|
|
6593
6602
|
value: input.description
|
|
6594
6603
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
6595
6604
|
path: _path + ".relation",
|
|
6596
|
-
expected: "
|
|
6605
|
+
expected: "AutoBePrisma.IRelation",
|
|
6597
6606
|
value: input.relation
|
|
6598
6607
|
})) && _vo5(input.relation, _path + ".relation", _exceptionable) || _report(_exceptionable, {
|
|
6599
6608
|
path: _path + ".relation",
|
|
6600
|
-
expected: "
|
|
6609
|
+
expected: "AutoBePrisma.IRelation",
|
|
6601
6610
|
value: input.relation
|
|
6602
6611
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
6603
6612
|
path: _path + ".unique",
|