@api-client/core 0.18.20 → 0.18.21
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/build/src/modeling/templates/index.d.ts +20 -0
- package/build/src/modeling/templates/index.d.ts.map +1 -0
- package/build/src/modeling/templates/index.js +174 -0
- package/build/src/modeling/templates/index.js.map +1 -0
- package/build/src/modeling/templates/meta/blog-publishing-platform.json +1 -0
- package/build/src/modeling/templates/meta/ecommerce-platform.json +1 -0
- package/build/src/modeling/templates/meta/index.d.ts +56 -0
- package/build/src/modeling/templates/meta/index.d.ts.map +1 -0
- package/build/src/modeling/templates/meta/index.js +90 -0
- package/build/src/modeling/templates/meta/index.js.map +1 -0
- package/build/src/modeling/templates/template-registry.d.ts +41 -0
- package/build/src/modeling/templates/template-registry.d.ts.map +1 -0
- package/build/src/modeling/templates/template-registry.js +48 -0
- package/build/src/modeling/templates/template-registry.js.map +1 -0
- package/build/src/modeling/templates/types.d.ts +158 -0
- package/build/src/modeling/templates/types.d.ts.map +1 -1
- package/build/src/modeling/templates/types.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/package.json +1 -1
- package/src/modeling/templates/meta/blog-publishing-platform.json +1 -0
- package/src/modeling/templates/meta/ecommerce-platform.json +1 -0
- package/src/modeling/templates/readme.md +246 -0
- package/src/modeling/templates/template-registry.ts +67 -0
- package/src/modeling/templates/types.ts +166 -0
|
@@ -42074,10 +42074,10 @@
|
|
|
42074
42074
|
"@id": "#200"
|
|
42075
42075
|
},
|
|
42076
42076
|
{
|
|
42077
|
-
"@id": "#
|
|
42077
|
+
"@id": "#203"
|
|
42078
42078
|
},
|
|
42079
42079
|
{
|
|
42080
|
-
"@id": "#
|
|
42080
|
+
"@id": "#206"
|
|
42081
42081
|
},
|
|
42082
42082
|
{
|
|
42083
42083
|
"@id": "#209"
|
|
@@ -43520,7 +43520,7 @@
|
|
|
43520
43520
|
"doc:ExternalDomainElement",
|
|
43521
43521
|
"doc:DomainElement"
|
|
43522
43522
|
],
|
|
43523
|
-
"doc:raw": "code: '
|
|
43523
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43524
43524
|
"core:mediaType": "application/yaml",
|
|
43525
43525
|
"sourcemaps:sources": [
|
|
43526
43526
|
{
|
|
@@ -43541,7 +43541,7 @@
|
|
|
43541
43541
|
"doc:ExternalDomainElement",
|
|
43542
43542
|
"doc:DomainElement"
|
|
43543
43543
|
],
|
|
43544
|
-
"doc:raw": "code: '
|
|
43544
|
+
"doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
|
|
43545
43545
|
"core:mediaType": "application/yaml",
|
|
43546
43546
|
"sourcemaps:sources": [
|
|
43547
43547
|
{
|
|
@@ -44776,12 +44776,12 @@
|
|
|
44776
44776
|
{
|
|
44777
44777
|
"@id": "#205/source-map/lexical/element_0",
|
|
44778
44778
|
"sourcemaps:element": "amf://id#205",
|
|
44779
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44779
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44780
44780
|
},
|
|
44781
44781
|
{
|
|
44782
44782
|
"@id": "#208/source-map/lexical/element_0",
|
|
44783
44783
|
"sourcemaps:element": "amf://id#208",
|
|
44784
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44784
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
44785
44785
|
},
|
|
44786
44786
|
{
|
|
44787
44787
|
"@id": "#223/source-map/lexical/element_0",
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"blog-publishing-platform","name":"Blog Publishing Platform","description":"A comprehensive content management and publishing platform for blogs, magazines, and digital publications. Includes content management, user roles, publishing workflow, and social features.","createdAt":"2025-07-27T21:14:57.328Z","updatedAt":"2025-07-27T21:14:57.328Z","version":"1.0.0","author":"API Now! Core Team","tags":["blog","cms","publishing","content","media","editorial"],"structure":{"domain":{"name":"Blog Publishing Platform","description":"A comprehensive content management and publishing platform for blogs, magazines, and digital publications","totalEntities":8,"totalProperties":68,"totalAssociations":14},"namespaces":[{"name":"ContentManagement","displayName":"Content Management","description":"Core content creation, editing, and organization features","modelCount":2,"entityCount":4,"models":[{"name":"Publications","displayName":"Publications Management","description":"Individual blogs, magazines, or publications within the platform","entityCount":1,"entities":[{"name":"publication","displayName":"Publication","description":"Individual blog or publication site","propertyCount":8,"associationCount":0,"properties":[{"name":"id","displayName":"Publication ID","description":"Unique identifier for the publication","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"name","displayName":"Publication Name","description":"Display name of the publication","type":"string","semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the publication","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"description","displayName":"Description","description":"Publication description and tagline","type":"string","semantics":["Semantic#Description"]},{"name":"domain","displayName":"Custom Domain","description":"Custom domain name for the publication","type":"string","semantics":[]},{"name":"logo_url","displayName":"Logo URL","description":"URL to publication logo image","type":"string","semantics":["Semantic#ImageURL"]},{"name":"status","displayName":"Publication Status","description":"Current status of the publication","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["active","suspended","archived"],"defaultValue":"active"},{"name":"created_at","displayName":"Created At","description":"When the publication was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[],"semantics":[]}]},{"name":"Content","displayName":"Content Management","description":"Posts, pages, and other content types","entityCount":3,"entities":[{"name":"category","displayName":"Content Category","description":"Content categorization for organization and navigation","propertyCount":5,"associationCount":2,"properties":[{"name":"id","displayName":"Category ID","description":"Unique identifier for the category","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"name","displayName":"Category Name","description":"Display name of the category","type":"string","semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the category","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"description","displayName":"Description","description":"Category description","type":"string","semantics":["Semantic#Description"]},{"name":"color","displayName":"Color","description":"Theme color for the category","type":"string","semantics":[]}],"associations":[{"name":"publication","displayName":"Publication","description":"Publication this category belongs to","required":true,"multiple":false,"targetEntities":["publication"],"semantics":[],"cardinality":"One-to-One"},{"name":"parentCategory","displayName":"Parent Category","description":"Parent category for hierarchical organization","required":false,"multiple":false,"targetEntities":["category"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]},{"name":"Tag","displayName":"Content Tag","description":"Tags for flexible content labeling and discovery","propertyCount":3,"associationCount":1,"properties":[{"name":"id","displayName":"Tag ID","description":"Unique identifier for the tag","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"name","displayName":"Tag Name","description":"Display name of the tag","type":"string","semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the tag","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]}],"associations":[{"name":"publication","displayName":"Publication","description":"Publication this tag belongs to","required":true,"multiple":false,"targetEntities":["publication"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]},{"name":"Post","displayName":"Blog Post","description":"Individual blog posts and articles","propertyCount":16,"associationCount":4,"properties":[{"name":"id","displayName":"Post ID","description":"Unique identifier for the post","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"title","displayName":"Post Title","description":"Title of the blog post","type":"string","required":true,"semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the post","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"excerpt","displayName":"Excerpt","description":"Brief summary or excerpt of the post","type":"string","semantics":["Semantic#Summary"]},{"name":"content","displayName":"Content","description":"Full content of the post in HTML or Markdown","type":"string","required":true,"semantics":["Semantic#HTML"]},{"name":"content_format","displayName":"Content Format","description":"Format of the content (HTML, Markdown, etc.)","type":"string","required":true,"semantics":[],"enumValues":["html","markdown","richtext"],"defaultValue":"markdown"},{"name":"featured_image_url","displayName":"Featured Image URL","description":"URL to featured image","type":"string","semantics":["Semantic#ImageURL"]},{"name":"status","displayName":"Post Status","description":"Current publishing status of the post","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["draft","pending_review","scheduled","published","archived"],"defaultValue":"draft"},{"name":"published_at","displayName":"Published At","description":"When the post was published","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]},{"name":"scheduled_at","displayName":"Scheduled At","description":"When the post is scheduled to be published","type":"datetime","semantics":[]},{"name":"view_count","displayName":"View Count","description":"Number of times the post has been viewed","type":"number","required":true,"semantics":[]},{"name":"reading_time","displayName":"Reading Time","description":"Estimated reading time in minutes","type":"number","readOnly":true,"semantics":["Semantic#Calculated"]},{"name":"word_count","displayName":"Word Count","description":"Number of words in the post content","type":"number","readOnly":true,"semantics":["Semantic#Calculated"]},{"name":"meta_title","displayName":"Meta Title","description":"SEO meta title","type":"string","semantics":[]},{"name":"meta_description","displayName":"Meta Description","description":"SEO meta description","type":"string","semantics":[]},{"name":"updated_at","displayName":"Updated At","description":"When the post was last updated","type":"datetime","readOnly":true,"semantics":["Semantic#UpdatedTimestamp"]}],"associations":[{"name":"publication","displayName":"Publication","description":"Publication this post belongs to","required":true,"multiple":false,"targetEntities":["publication"],"semantics":[],"cardinality":"One-to-One"},{"name":"categories","displayName":"Post Categories","description":"Categories this post belongs to","required":false,"multiple":true,"targetEntities":["category"],"semantics":["Semantic#Categories"],"cardinality":"One-to-Many"},{"name":"tags","displayName":"Post Tags","description":"Tags associated with this post","required":false,"multiple":true,"targetEntities":["Tag"],"semantics":["Semantic#Tags"],"cardinality":"One-to-Many"},{"name":"author","displayName":"Post Author","description":"Author who wrote this post","required":true,"multiple":false,"targetEntities":["user"],"semantics":["Semantic#ResourceOwnerIdentifier"],"cardinality":"One-to-One"}],"semantics":[]}]}]},{"name":"UserManagement","displayName":"User Management","description":"Authors, editors, subscribers, and user roles management","modelCount":1,"entityCount":1,"models":[{"name":"Users","displayName":"User Management","description":"User accounts and authentication","entityCount":1,"entities":[{"name":"user","displayName":"User Account","description":"User account for authors, editors, and subscribers","propertyCount":13,"associationCount":0,"properties":[{"name":"id","displayName":"User ID","description":"Unique identifier for the user","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"email","displayName":"Email Address","description":"User email address for login and communication","type":"string","required":true,"semantics":["Semantic#Email"]},{"name":"password","displayName":"Password","description":"Encrypted password for authentication","type":"string","required":true,"semantics":["Semantic#Password"]},{"name":"username","displayName":"Username","description":"Unique username for the user","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"display_name","displayName":"Display Name","description":"Public display name for the user","type":"string","required":true,"semantics":[]},{"name":"first_name","displayName":"First Name","description":"User first name","type":"string","semantics":[]},{"name":"last_name","displayName":"Last Name","description":"User last name","type":"string","semantics":[]},{"name":"bio","displayName":"Biography","description":"User biography and description","type":"string","semantics":["Semantic#Description"]},{"name":"avatar_url","displayName":"Avatar URL","description":"URL to user profile picture","type":"string","semantics":["Semantic#ImageURL"]},{"name":"website","displayName":"Website","description":"User personal website URL","type":"string","semantics":["Semantic#URL"]},{"name":"role","displayName":"User Role","description":"User role for permission management","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["subscriber","author","editor","admin","super_admin"],"defaultValue":"subscriber"},{"name":"emailVerified","displayName":"Email Verified","description":"Whether the user has verified their email","type":"boolean","required":true,"semantics":[],"defaultValue":"false"},{"name":"created_at","displayName":"Created At","description":"When the user account was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[],"semantics":["Semantic#User"]}]}]},{"name":"SocialFeatures","displayName":"Social Features","description":"Comments, likes, shares, and social interactions","modelCount":1,"entityCount":1,"models":[{"name":"Comments","displayName":"Comment System","description":"Post comments and replies","entityCount":1,"entities":[{"name":"comment","displayName":"Comment","description":"User comments on posts","propertyCount":7,"associationCount":3,"properties":[{"name":"id","displayName":"Comment ID","description":"Unique identifier for the comment","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"content","displayName":"Comment Content","description":"Content of the comment","type":"string","required":true,"semantics":[]},{"name":"author_name","displayName":"Author Name","description":"Name of the comment author (for guest comments)","type":"string","semantics":[]},{"name":"author_email","displayName":"Author Email","description":"Email of the comment author (for guest comments)","type":"string","required":true,"semantics":["Semantic#Email"]},{"name":"status","displayName":"Comment Status","description":"Moderation status of the comment","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["pending","approved","rejected","spam"],"defaultValue":"pending"},{"name":"user_agent","displayName":"User Agent","description":"Browser user agent string","type":"string","semantics":[]},{"name":"created_at","displayName":"Created At","description":"When the comment was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[{"name":"post","displayName":"Post","description":"Post this comment belongs to","required":true,"multiple":false,"targetEntities":["Post"],"semantics":[],"cardinality":"One-to-One"},{"name":"author","displayName":"Comment Author","description":"Registered user who wrote this comment","required":false,"multiple":false,"targetEntities":["user"],"semantics":["Semantic#ResourceOwnerIdentifier"],"cardinality":"One-to-One"},{"name":"parent_comment","displayName":"Parent Comment","description":"Parent comment for replies","required":false,"multiple":false,"targetEntities":["comment"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]}]},{"name":"Analytics","displayName":"Analytics & Tracking","description":"Analytics, metrics, and performance tracking","modelCount":1,"entityCount":1,"models":[{"name":"Analytics","displayName":"Content Analytics","description":"Content performance and user engagement metrics","entityCount":1,"entities":[{"name":"page_view","displayName":"Page View","description":"Individual page view tracking record","propertyCount":6,"associationCount":2,"properties":[{"name":"id","displayName":"Page View ID","description":"Unique identifier for the page view","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"path","displayName":"Page Path","description":"URL path of the viewed page","type":"string","required":true,"semantics":[]},{"name":"referrer","displayName":"Referrer","description":"Referring URL","type":"string","semantics":["Semantic#URL"]},{"name":"user_agent","displayName":"User Agent","description":"Browser user agent string","type":"string","semantics":[]},{"name":"session_id","displayName":"Session ID","description":"Visitor session identifier","type":"string","semantics":[]},{"name":"viewed_at","displayName":"Viewed At","description":"When the page was viewed","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[{"name":"post","displayName":"Viewed Post","description":"Post that was viewed (if applicable)","required":false,"multiple":false,"targetEntities":["Post"],"semantics":[],"cardinality":"One-to-One"},{"name":"publication","displayName":"Publication","description":"Publication this page view belongs to","required":true,"multiple":false,"targetEntities":["publication"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]}]},{"name":"MediaManagement","displayName":"Media Management","description":"Image, video, and file upload management","modelCount":1,"entityCount":1,"models":[{"name":"Media","displayName":"Media Library","description":"Uploaded files, images, and media assets","entityCount":1,"entities":[{"name":"media_file","displayName":"Media File","description":"Uploaded media files (images, videos, documents)","propertyCount":10,"associationCount":2,"properties":[{"name":"id","displayName":"Media File ID","description":"Unique identifier for the media file","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"filename","displayName":"File Name","description":"Original filename of the uploaded file","type":"string","required":true,"semantics":[]},{"name":"storage_key","displayName":"Storage Key","description":"Unique storage key for the file","type":"string","required":true,"unique":true,"semantics":[]},{"name":"url","displayName":"File URL","description":"Public URL to access the file","type":"string","required":true,"semantics":["Semantic#URL"]},{"name":"mime_type","displayName":"MIME Type","description":"MIME type of the file","type":"string","required":true,"semantics":[]},{"name":"file_size","displayName":"File Size","description":"File size in bytes","type":"number","required":true,"semantics":[]},{"name":"width","displayName":"Image Width","description":"Width in pixels (for images)","type":"number","required":true,"semantics":[]},{"name":"height","displayName":"Image Height","description":"Height in pixels (for images)","type":"number","required":true,"semantics":[]},{"name":"alt_text","displayName":"Alt Text","description":"Alternative text for accessibility","type":"string","semantics":[]},{"name":"uploaded_at","displayName":"Uploaded At","description":"When the file was uploaded","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[{"name":"uploader","displayName":"File Uploader","description":"User who uploaded this file","required":true,"multiple":false,"targetEntities":["user"],"semantics":["Semantic#ResourceOwnerIdentifier"],"cardinality":"One-to-One"},{"name":"publication","displayName":"Publication","description":"Publication this media file belongs to","required":true,"multiple":false,"targetEntities":["publication"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]}]}]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"ecommerce-platform","name":"E-Commerce Platform","description":"A comprehensive e-commerce platform with user management, product catalog, inventory, and order processing capabilities. Perfect for online stores, marketplaces, and retail businesses.","createdAt":"2025-07-27T21:14:57.328Z","updatedAt":"2025-07-27T21:14:57.328Z","version":"1.0.0","author":"API Now! Core Team","tags":["e-commerce","retail","shopping","business","inventory","orders"],"structure":{"domain":{"name":"E-Commerce Platform","description":"A comprehensive e-commerce platform with user management, product catalog, and order processing capabilities","totalEntities":11,"totalProperties":73,"totalAssociations":14},"namespaces":[{"name":"UserManagement","displayName":"User Management","description":"Handles user authentication, authorization, and profile management","modelCount":2,"entityCount":3,"models":[{"name":"Authentication","displayName":"User Authentication","description":"User accounts and authentication data","entityCount":1,"entities":[{"name":"User","displayName":"User Account","description":"Represents a user account in the system","propertyCount":9,"associationCount":2,"properties":[{"name":"id","displayName":"User ID","description":"Unique identifier for the user","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"email","displayName":"Email Address","description":"User email address for login and communication","type":"string","required":true,"semantics":["Semantic#Email"]},{"name":"password","displayName":"Password","description":"User password for authentication","type":"string","required":true,"semantics":["Semantic#Password"]},{"name":"first_name","displayName":"First Name","description":"User first name","type":"string","required":true,"semantics":[]},{"name":"last_name","displayName":"Last Name","description":"User last name","type":"string","required":true,"semantics":[]},{"name":"role","displayName":"User Role","description":"User role for permission management","type":"string","required":true,"semantics":["Semantic#UserRole"],"enumValues":["customer","admin","moderator"],"defaultValue":"customer"},{"name":"email_verified","displayName":"Email Verified","description":"Whether the user has verified their email address","type":"boolean","required":true,"semantics":[],"defaultValue":"false"},{"name":"created_at","displayName":"Created At","description":"When the user account was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]},{"name":"updated_at","displayName":"Updated At","description":"When the user account was last updated","type":"datetime","readOnly":true,"semantics":["Semantic#UpdatedTimestamp"]}],"associations":[{"name":"profile","displayName":"User Profile","description":"Link to extended profile information","required":false,"multiple":false,"targetEntities":["user_profile"],"semantics":[],"cardinality":"One-to-One"},{"name":"addresses","displayName":"User Addresses","description":"User shipping and billing addresses","required":false,"multiple":true,"targetEntities":["address"],"semantics":[],"cardinality":"One-to-Many"}],"semantics":["Semantic#User"]}]},{"name":"UserProfile","displayName":"User Profile","description":"Extended user profile information","entityCount":2,"entities":[{"name":"user_profile","displayName":"User Profile","description":"Extended profile information for users","propertyCount":4,"associationCount":0,"properties":[{"name":"id","displayName":"Profile ID","description":"Unique identifier for the profile","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"birthdate","displayName":"Date of Birth","description":"User date of birth","type":"date","semantics":[]},{"name":"phone","displayName":"Phone Number","description":"User phone number","type":"string","semantics":["Semantic#Phone"]},{"name":"avatar_url","displayName":"Avatar URL","description":"URL to user profile picture","type":"string","semantics":["Semantic#ImageURL"]}],"associations":[],"semantics":[]},{"name":"address","displayName":"Address","description":"Physical address information","propertyCount":9,"associationCount":0,"properties":[{"name":"id","displayName":"Address ID","description":"Unique identifier for the address","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"type","displayName":"Address Type","description":"Type of address (shipping, billing, etc.)","type":"string","required":true,"semantics":[],"enumValues":["shipping","billing","both"]},{"name":"line1","displayName":"Address Line 1","description":"Primary street address, including house number and street name","type":"string","required":true,"semantics":[]},{"name":"line2","displayName":"Address Line 2","description":"Optional field for additional street-level information like apartment numbers or building names.","type":"string","required":false,"semantics":[]},{"name":"line3","displayName":"Address Line 3","description":"Optional field for additional street-level information like apartment numbers or building names.","type":"string","required":false,"semantics":[]},{"name":"city","displayName":"City","description":"City name","type":"string","required":true,"semantics":[]},{"name":"state","displayName":"State/Province","description":"State or province","type":"string","required":true,"semantics":[]},{"name":"postal_code","displayName":"ZIP/Postal Code","description":"ZIP or postal code","type":"string","required":true,"semantics":[]},{"name":"country","displayName":"Country","description":"Country name","type":"string","required":true,"semantics":[]}],"associations":[],"semantics":[]}]}]},{"name":"ProductCatalog","displayName":"Product Catalog","description":"Product information, categories, and inventory management","modelCount":2,"entityCount":3,"models":[{"name":"Products","displayName":"Product Management","description":"Core product entities and relationships","entityCount":2,"entities":[{"name":"category","displayName":"Product Category","description":"Product categorization for organization and navigation","propertyCount":4,"associationCount":1,"properties":[{"name":"id","displayName":"Category ID","description":"Unique identifier for the category","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"name","displayName":"Category Name","description":"Display name of the category","type":"string","semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the category","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"description","displayName":"Description","description":"Category description","type":"string","semantics":["Semantic#Description"]}],"associations":[{"name":"parent_category","displayName":"Parent Category","description":"Parent category for hierarchical organization","required":false,"multiple":false,"targetEntities":["category"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]},{"name":"product","displayName":"Product","description":"Core product information and specifications","propertyCount":13,"associationCount":2,"properties":[{"name":"id","displayName":"Product ID","description":"Unique identifier for the product","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"name","displayName":"Product Name","description":"Display name of the product","type":"string","semantics":["Semantic#Title"]},{"name":"slug","displayName":"URL Slug","description":"URL-friendly identifier for the product","type":"string","required":true,"unique":true,"semantics":["Semantic#PublicUniqueName"]},{"name":"description","displayName":"Description","description":"Detailed product description","type":"string","semantics":["Semantic#Description"]},{"name":"short_description","displayName":"Short Description","description":"Brief product summary","type":"string","semantics":["Semantic#Summary"]},{"name":"sku","displayName":"SKU","description":"Stock Keeping Unit - unique product identifier","type":"string","required":true,"unique":true,"semantics":["Semantic#SKU"]},{"name":"price","displayName":"Price","description":"Product price in cents (USD)","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"compare_at_price","displayName":"Compare at Price","description":"Original price for discount display","type":"number","semantics":["Semantic#Currency"]},{"name":"status","displayName":"Status","description":"Current status of the product","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["inactive","active","pending","archived"],"defaultValue":"inactive"},{"name":"weight","displayName":"Weight","description":"Product weight in grams","type":"number","semantics":[]},{"name":"images","displayName":"Images","description":"Array of product image URLs","type":"string","multiple":true,"semantics":["Semantic#ImageURL"]},{"name":"created_at","displayName":"Created At","description":"When the product was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]},{"name":"updated_at","displayName":"Updated At","description":"When the product was last updated","type":"datetime","readOnly":true,"semantics":["Semantic#UpdatedTimestamp"]}],"associations":[{"name":"categories","displayName":"Product Categories","description":"Categories this product belongs to","required":true,"multiple":true,"targetEntities":["category"],"semantics":["Semantic#Categories"],"cardinality":"One-to-Many"},{"name":"inventory","displayName":"Product Inventory","description":"Inventory information for this product","required":true,"multiple":false,"targetEntities":["inventory"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]},{"name":"Inventory","displayName":"Inventory Management","description":"Stock levels and inventory tracking","entityCount":1,"entities":[{"name":"inventory","displayName":"Inventory","description":"Stock levels and inventory information for products","propertyCount":4,"associationCount":0,"properties":[{"name":"id","displayName":"Inventory ID","description":"Unique identifier for the inventory record","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"quantity","displayName":"Stock Quantity","description":"Available stock quantity","type":"number","required":true,"semantics":[],"defaultValue":"0"},{"name":"trackQuantity","displayName":"Track Quantity","description":"Whether to track inventory for this product","type":"boolean","required":true,"semantics":[],"defaultValue":"true"},{"name":"allowBackorder","displayName":"Allow Backorder","description":"Whether to allow ordering when out of stock","type":"boolean","required":true,"semantics":[],"defaultValue":"false"}],"associations":[],"semantics":[]}]}]},{"name":"OrderManagement","displayName":"Order Management","description":"Shopping cart, orders, and payment processing","modelCount":3,"entityCount":5,"models":[{"name":"ShoppingCart","displayName":"Shopping Cart","description":"Shopping cart and cart items","entityCount":2,"entities":[{"name":"cart","displayName":"Shopping Cart","description":"User shopping cart","propertyCount":5,"associationCount":2,"properties":[{"name":"id","displayName":"Cart ID","description":"Unique identifier for the cart","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"sessionId","displayName":"Session ID","description":"Session identifier for guest carts","type":"string","semantics":[]},{"name":"expiresAt","displayName":"Expires At","description":"When the cart expires for cleanup","type":"datetime","semantics":[]},{"name":"created_at","displayName":"Created At","description":"When the cart was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]},{"name":"updated_at","displayName":"Updated At","description":"When the cart was last updated","type":"datetime","readOnly":true,"semantics":["Semantic#UpdatedTimestamp"]}],"associations":[{"name":"user","displayName":"Cart Owner","description":"User who owns this cart","required":false,"multiple":false,"targetEntities":["User"],"semantics":["Semantic#ResourceOwnerIdentifier"],"cardinality":"One-to-One"},{"name":"items","displayName":"Cart Items","description":"Items in this cart","required":false,"multiple":true,"targetEntities":["cart_item"],"semantics":[],"cardinality":"One-to-Many"}],"semantics":[]},{"name":"cart_item","displayName":"Cart Item","description":"Individual items in a shopping cart","propertyCount":4,"associationCount":1,"properties":[{"name":"id","displayName":"Cart Item ID","description":"Unique identifier for the cart item","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"quantity","displayName":"Quantity","description":"Number of items","type":"number","required":true,"semantics":[]},{"name":"unitPrice","displayName":"Unit Price","description":"Price per unit at time of adding to cart","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"total_price","displayName":"Total Price","description":"Total price for this line item","type":"number","required":true,"readOnly":true,"semantics":["Semantic#Currency","Semantic#Calculated"]}],"associations":[{"name":"product","displayName":"Product","description":"Product for this cart item","required":true,"multiple":false,"targetEntities":["product"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]},{"name":"Orders","displayName":"Order Processing","description":"Orders and order fulfillment","entityCount":2,"entities":[{"name":"order","displayName":"Order","description":"Customer order","propertyCount":10,"associationCount":5,"properties":[{"name":"id","displayName":"Order ID","description":"Unique identifier for the order","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"order_number","displayName":"Order Number","description":"Human-readable order number","type":"string","required":true,"unique":true,"semantics":[]},{"name":"status","displayName":"Order Status","description":"Current status of the order","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["pending","confirmed","processing","shipped","delivered","cancelled","refunded"],"defaultValue":"pending"},{"name":"subtotal","displayName":"Subtotal","description":"Order subtotal before taxes and shipping","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"taxAmount","displayName":"Tax Amount","description":"Total tax amount","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"shippingAmount","displayName":"Shipping Amount","description":"Shipping cost","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"total_amount","displayName":"Total Amount","description":"Final order total","type":"number","required":true,"semantics":["Semantic#Currency","Semantic#Calculated"]},{"name":"notes","displayName":"Order Notes","description":"Customer notes or special instructions","type":"string","semantics":[]},{"name":"created_at","displayName":"Created At","description":"When the order was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]},{"name":"updated_at","displayName":"Updated At","description":"When the order was last updated","type":"datetime","readOnly":true,"semantics":["Semantic#UpdatedTimestamp"]}],"associations":[{"name":"customer","displayName":"Customer","description":"Customer who placed this order","required":true,"multiple":false,"targetEntities":["User"],"semantics":["Semantic#ResourceOwnerIdentifier"],"cardinality":"One-to-One"},{"name":"shipping_address","displayName":"Shipping Address","description":"Address for order delivery","required":true,"multiple":false,"targetEntities":["address"],"semantics":[],"cardinality":"One-to-One"},{"name":"billing_address","displayName":"Billing Address","description":"Address for billing purposes","required":true,"multiple":false,"targetEntities":["address"],"semantics":[],"cardinality":"One-to-One"},{"name":"items","displayName":"Order Items","description":"Items in this order","required":true,"multiple":true,"targetEntities":["order_item"],"semantics":[],"cardinality":"One-to-Many"},{"name":"payments","displayName":"Order Payments","description":"Payment transactions for this order","required":false,"multiple":true,"targetEntities":["payment"],"semantics":[],"cardinality":"One-to-Many"}],"semantics":[]},{"name":"order_item","displayName":"Order Line Item","description":"Individual line items in an order","propertyCount":4,"associationCount":1,"properties":[{"name":"id","displayName":"Order Item ID","description":"Unique identifier for the order item","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"quantity","displayName":"Quantity","description":"Number of items ordered","type":"number","required":true,"semantics":[]},{"name":"unitPrice","displayName":"Unit Price","description":"Price per unit at time of order","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"total_price","displayName":"Total Price","description":"Total price for this line item","type":"number","required":true,"readOnly":true,"semantics":["Semantic#Currency","Semantic#Calculated"]}],"associations":[{"name":"product","displayName":"Product","description":"Product for this order item","required":true,"multiple":false,"targetEntities":["product"],"semantics":[],"cardinality":"One-to-One"}],"semantics":[]}]},{"name":"Payments","displayName":"Payment Processing","description":"Payment methods and transactions","entityCount":1,"entities":[{"name":"payment","displayName":"Payment","description":"Payment transaction record","propertyCount":7,"associationCount":0,"properties":[{"name":"id","displayName":"Payment ID","description":"Unique identifier for the payment","type":"string","primary":true,"readOnly":true,"semantics":[]},{"name":"method","displayName":"Payment Method","description":"Method used for payment","type":"string","required":true,"semantics":[],"enumValues":["credit_card","debit_card","paypal","bank_transfer","apple_pay","google_pay"]},{"name":"status","displayName":"Payment Status","description":"Current status of the payment","type":"string","required":true,"semantics":["Semantic#Status"],"enumValues":["pending","authorized","captured","failed","cancelled","refunded"],"defaultValue":"pending"},{"name":"amount","displayName":"Payment Amount","description":"Amount charged","type":"number","required":true,"semantics":["Semantic#Currency"]},{"name":"currency","displayName":"Currency","description":"Currency code for the payment","type":"string","required":true,"semantics":[],"defaultValue":"USD"},{"name":"transaction_id","displayName":"Transaction ID","description":"External payment processor transaction ID","type":"string","semantics":[]},{"name":"created_at","displayName":"Created At","description":"When the payment was created","type":"datetime","readOnly":true,"semantics":["Semantic#CreatedTimestamp"]}],"associations":[],"semantics":[]}]}]}]}}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Domain Templates
|
|
2
|
+
|
|
3
|
+
The domain templates allow creating or updating existing data domains from a template. Templates follow the Domain-Driven Design (DDD) principles and provide pre-built business domain structures that users can instantiate or extend.
|
|
4
|
+
|
|
5
|
+
## Template Structure
|
|
6
|
+
|
|
7
|
+
Each template is a TypeScript file that exports a default function conforming to the template signature. Templates create comprehensive data domains with proper namespace organization, entity relationships, and semantic annotations.
|
|
8
|
+
|
|
9
|
+
### Required Function Signature
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import type { CreateTemplateOptions } from './types.js'
|
|
13
|
+
import { DataDomain } from '../DataDomain.js'
|
|
14
|
+
|
|
15
|
+
export default function createMyDomain(options: CreateTemplateOptions = {}): DataDomain {
|
|
16
|
+
// Template implementation
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Template Implementation Pattern
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
/**
|
|
24
|
+
* Template Documentation Header
|
|
25
|
+
*
|
|
26
|
+
* Provide comprehensive documentation explaining:
|
|
27
|
+
* - What business domain this template models
|
|
28
|
+
* - Key entities and relationships included
|
|
29
|
+
* - Semantic annotations and business rules applied
|
|
30
|
+
* - Example usage scenarios
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { DataDomain } from '../DataDomain.js'
|
|
34
|
+
import { SemanticType } from '../Semantics.js'
|
|
35
|
+
import {
|
|
36
|
+
addIdField,
|
|
37
|
+
addNameField,
|
|
38
|
+
addEmailField,
|
|
39
|
+
// Import other helper functions as needed
|
|
40
|
+
} from '../helpers/Intelisense.js'
|
|
41
|
+
import type { CreateTemplateOptions } from './types.js'
|
|
42
|
+
|
|
43
|
+
function createDomain(): DataDomain {
|
|
44
|
+
return new DataDomain({
|
|
45
|
+
info: {
|
|
46
|
+
name: 'My Business Domain',
|
|
47
|
+
displayName: 'My Business Domain',
|
|
48
|
+
description: 'Clear description of what this domain models',
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default function createMyDomain(options: CreateTemplateOptions = {}): DataDomain {
|
|
54
|
+
// Use existing domain if provided, otherwise create new one
|
|
55
|
+
const domain = options.domain ?? createDomain()
|
|
56
|
+
|
|
57
|
+
// Create namespaces following business capabilities
|
|
58
|
+
const coreNamespace = domain.addNamespace({
|
|
59
|
+
info: { name: 'CoreManagement' }
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// Add models to organize related entities
|
|
63
|
+
const entityModel = coreNamespace.addModel({
|
|
64
|
+
info: { name: 'CoreEntities' }
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Create entities with proper semantic annotations
|
|
68
|
+
const mainEntity = entityModel.addEntity({
|
|
69
|
+
info: { name: 'MainEntity' },
|
|
70
|
+
semantics: [{ type: SemanticType.User }] // If applicable
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// Add properties using helper functions for consistency
|
|
74
|
+
addIdField(mainEntity)
|
|
75
|
+
addNameField(mainEntity)
|
|
76
|
+
addEmailField(mainEntity)
|
|
77
|
+
|
|
78
|
+
// Add custom properties with proper semantics
|
|
79
|
+
mainEntity.addProperty({
|
|
80
|
+
info: { name: 'customField' },
|
|
81
|
+
type: 'string',
|
|
82
|
+
required: false,
|
|
83
|
+
semantics: [/* appropriate semantics */]
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// Create associations between entities
|
|
87
|
+
// (Add more entities and relationships as needed)
|
|
88
|
+
|
|
89
|
+
return domain
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Adding a Template
|
|
94
|
+
|
|
95
|
+
### 1. Create the Template File
|
|
96
|
+
|
|
97
|
+
Create a new file `[domain-name]-domain.ts` in `src/modeling/templates/` following the naming convention:
|
|
98
|
+
|
|
99
|
+
- Use kebab-case for file names
|
|
100
|
+
- End with `-domain.ts`
|
|
101
|
+
- Examples: `healthcare-domain.ts`, `financial-services-domain.ts`
|
|
102
|
+
|
|
103
|
+
### 2. Follow Modeling Guidelines
|
|
104
|
+
|
|
105
|
+
Templates must adhere to the modeling instructions in `.github/instructions/modeling.instructions.md`:
|
|
106
|
+
|
|
107
|
+
- **Business-First Approach**: Model business concepts, not technical concerns
|
|
108
|
+
- **Proper Hierarchy**: DataDomain → DomainNamespace → DomainModel → DomainEntity → DomainProperty
|
|
109
|
+
- **Semantic Annotations**: Use `SemanticType` for passwords, emails, timestamps, etc.
|
|
110
|
+
- **Security**: Mark sensitive properties as `writeOnly`, validate all inputs
|
|
111
|
+
- **Database Compliance**: Follow PostgreSQL naming conventions (snake_case conversion)
|
|
112
|
+
|
|
113
|
+
### 3. Required Imports
|
|
114
|
+
|
|
115
|
+
Include these essential imports:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { DataDomain } from '../DataDomain.js'
|
|
119
|
+
import { SemanticType } from '../Semantics.js'
|
|
120
|
+
import type { CreateTemplateOptions } from './types.js'
|
|
121
|
+
|
|
122
|
+
// Import semantic definition helpers as needed
|
|
123
|
+
import { createCalculatedSemantic } from '../definitions/Calculated.js'
|
|
124
|
+
import { createCurrencySemantic } from '../definitions/Currency.js'
|
|
125
|
+
|
|
126
|
+
// Import property helper functions for consistency
|
|
127
|
+
import {
|
|
128
|
+
addIdField,
|
|
129
|
+
addNameField,
|
|
130
|
+
addEmailField,
|
|
131
|
+
addPasswordField,
|
|
132
|
+
addCreatedAtField,
|
|
133
|
+
addUpdatedAtField,
|
|
134
|
+
// ... other helpers as needed
|
|
135
|
+
} from '../helpers/Intelisense.js'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 4. Handle Template Options
|
|
139
|
+
|
|
140
|
+
Always support the `CreateTemplateOptions` interface:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
export default function createMyDomain(options: CreateTemplateOptions = {}): DataDomain {
|
|
144
|
+
// Use provided domain or create new one
|
|
145
|
+
const domain = options.domain ?? createDomain()
|
|
146
|
+
|
|
147
|
+
// If domain is provided, you're extending an existing domain
|
|
148
|
+
// If not provided, you're creating a new domain
|
|
149
|
+
|
|
150
|
+
return domain
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Registering Templates
|
|
155
|
+
|
|
156
|
+
### 1. Add to Generation Script
|
|
157
|
+
|
|
158
|
+
Edit `scripts/generate-template-metadata.js` and add your template to the registry:
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
// Import your template function
|
|
162
|
+
import createMyDomain from '../build/src/modeling/templates/my-domain.js'
|
|
163
|
+
|
|
164
|
+
// Add to templates array
|
|
165
|
+
const TEMPLATE_CONFIGS = [
|
|
166
|
+
{
|
|
167
|
+
id: 'my-business-domain',
|
|
168
|
+
name: 'My Business Domain',
|
|
169
|
+
description: 'Brief description for UI display',
|
|
170
|
+
version: '1.0.0',
|
|
171
|
+
author: 'API Now! Core Team',
|
|
172
|
+
tags: ['business', 'industry-specific'], // For categorization
|
|
173
|
+
createdAt: '2025-01-01T00:00:00.000Z',
|
|
174
|
+
updatedAt: '2025-01-01T00:00:00.000Z',
|
|
175
|
+
createDomainFn: createMyDomain,
|
|
176
|
+
},
|
|
177
|
+
// ... other templates
|
|
178
|
+
]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 2. Template Metadata
|
|
182
|
+
|
|
183
|
+
The generation script will create metadata including:
|
|
184
|
+
|
|
185
|
+
- Template structure analysis (namespaces, models, entities)
|
|
186
|
+
- Property counts and types
|
|
187
|
+
- Association mappings
|
|
188
|
+
- Semantic annotation usage
|
|
189
|
+
- UI presentation information
|
|
190
|
+
|
|
191
|
+
## Generating Metadata
|
|
192
|
+
|
|
193
|
+
Each template needs to be processed to generate metadata files. These metadata are used to generate the templates view in the UI.
|
|
194
|
+
|
|
195
|
+
**If you won't generate metadata, the template won't get registered by the UI.**
|
|
196
|
+
|
|
197
|
+
### 1. Build the Project First
|
|
198
|
+
|
|
199
|
+
```sh
|
|
200
|
+
npm run build
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 2. Run the Metadata Generation Script
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
node scripts/generate-template-metadata.js
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 3. Rebuild to Include New Metadata
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npm run build
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
All metadata are generated under `src/modeling/templates/meta` directory as JSON files.
|
|
216
|
+
|
|
217
|
+
## Best Practices
|
|
218
|
+
|
|
219
|
+
### Domain Design
|
|
220
|
+
|
|
221
|
+
1. **Business Alignment**: Model actual business processes and entities
|
|
222
|
+
2. **Clear Naming**: Use business-meaningful names, not technical jargon
|
|
223
|
+
3. **Proper Grouping**: Organize entities into logical namespaces and models
|
|
224
|
+
4. **Semantic Richness**: Apply appropriate semantic annotations for security and behavior
|
|
225
|
+
|
|
226
|
+
### Code Quality
|
|
227
|
+
|
|
228
|
+
1. **Documentation**: Include comprehensive JSDoc comments explaining the business purpose
|
|
229
|
+
2. **Type Safety**: Use TypeScript interfaces and proper type annotations
|
|
230
|
+
3. **Error Handling**: Validate inputs and provide clear error messages
|
|
231
|
+
4. **Consistency**: Use helper functions from `helpers/Intelisense.js` for common patterns
|
|
232
|
+
|
|
233
|
+
### Security
|
|
234
|
+
|
|
235
|
+
1. **Sensitive Data**: Mark passwords and sensitive fields as `writeOnly`
|
|
236
|
+
2. **Validation**: Validate all user inputs and model structures
|
|
237
|
+
3. **Access Control**: Consider data access patterns in your domain design
|
|
238
|
+
|
|
239
|
+
## Example Templates
|
|
240
|
+
|
|
241
|
+
Refer to existing templates for comprehensive examples:
|
|
242
|
+
|
|
243
|
+
- `ecommerce-domain.ts` - E-commerce platform with users, products, orders
|
|
244
|
+
- `blog-domain.ts` - Content management with publishing workflow
|
|
245
|
+
|
|
246
|
+
These demonstrate proper structure, semantic usage, and business modeling patterns.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DomainTemplate } from './types.js'
|
|
2
|
+
import {
|
|
3
|
+
getAllTemplates,
|
|
4
|
+
getTemplate,
|
|
5
|
+
getTemplatesByTag,
|
|
6
|
+
getTemplatesByCategory,
|
|
7
|
+
searchTemplates,
|
|
8
|
+
getTemplateStats,
|
|
9
|
+
} from './meta/index.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Registry of all available domain templates with their metadata.
|
|
13
|
+
* This provides a central location for UI components to discover and present templates.
|
|
14
|
+
*
|
|
15
|
+
* The templates are pre-processed at build time using the generate-template-metadata.js script
|
|
16
|
+
* to avoid loading and processing all templates on the client side.
|
|
17
|
+
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
19
|
+
export class TemplateRegistry {
|
|
20
|
+
/**
|
|
21
|
+
* Gets all available templates
|
|
22
|
+
*/
|
|
23
|
+
static getAllTemplates(): DomainTemplate[] {
|
|
24
|
+
return getAllTemplates()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Gets a template by its ID
|
|
29
|
+
*/
|
|
30
|
+
static getTemplate(id: string): DomainTemplate | undefined {
|
|
31
|
+
return getTemplate(id)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets templates filtered by tags
|
|
36
|
+
*/
|
|
37
|
+
static getTemplatesByTag(tag: string): DomainTemplate[] {
|
|
38
|
+
return getTemplatesByTag(tag)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets templates filtered by category (based on tags)
|
|
43
|
+
*/
|
|
44
|
+
static getTemplatesByCategory(category: 'business' | 'content' | 'social' | 'technical'): DomainTemplate[] {
|
|
45
|
+
return getTemplatesByCategory(category)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Searches templates by name or description
|
|
50
|
+
*/
|
|
51
|
+
static searchTemplates(query: string): DomainTemplate[] {
|
|
52
|
+
return searchTemplates(query)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Gets template statistics for analytics
|
|
57
|
+
*/
|
|
58
|
+
static getTemplateStats(): {
|
|
59
|
+
totalTemplates: number
|
|
60
|
+
totalEntities: number
|
|
61
|
+
totalProperties: number
|
|
62
|
+
totalAssociations: number
|
|
63
|
+
categoryCounts: Record<string, number>
|
|
64
|
+
} {
|
|
65
|
+
return getTemplateStats()
|
|
66
|
+
}
|
|
67
|
+
}
|