@meshery/schemas 0.8.106 → 0.8.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +294 -23
  2. package/dist/Core-Wy_3jcVT.d.mts +736 -0
  3. package/dist/Core-Wy_3jcVT.d.ts +736 -0
  4. package/dist/cloudApi.d.mts +6882 -3601
  5. package/dist/cloudApi.d.ts +6882 -3601
  6. package/dist/cloudApi.js +1 -1
  7. package/dist/cloudApi.mjs +1 -1
  8. package/dist/constructs/v1alpha1/capability/Capability.d.mts +115 -0
  9. package/dist/constructs/v1alpha1/capability/Capability.d.ts +115 -0
  10. package/dist/constructs/v1alpha1/capability/Capability.js +1 -0
  11. package/dist/constructs/v1alpha1/capability/Capability.mjs +0 -0
  12. package/dist/constructs/v1alpha1/capability/CapabilitySchema.d.mts +155 -0
  13. package/dist/constructs/v1alpha1/capability/CapabilitySchema.d.ts +155 -0
  14. package/dist/constructs/v1alpha1/capability/CapabilitySchema.js +2 -0
  15. package/dist/constructs/v1alpha1/capability/CapabilitySchema.mjs +2 -0
  16. package/dist/constructs/v1alpha1/core/Core.d.mts +1 -0
  17. package/dist/constructs/v1alpha1/core/Core.d.ts +1 -0
  18. package/dist/constructs/v1alpha1/core/Core.js +1 -0
  19. package/dist/constructs/v1alpha1/core/Core.mjs +0 -0
  20. package/dist/constructs/v1alpha1/core/CoreSchema.d.mts +1649 -0
  21. package/dist/constructs/v1alpha1/core/CoreSchema.d.ts +1649 -0
  22. package/dist/constructs/v1alpha1/core/CoreSchema.js +2 -0
  23. package/dist/constructs/v1alpha1/core/CoreSchema.mjs +2 -0
  24. package/dist/constructs/v1alpha2/catalog/Catalog.d.mts +46 -0
  25. package/dist/constructs/v1alpha2/catalog/Catalog.d.ts +46 -0
  26. package/dist/constructs/v1alpha2/catalog/Catalog.js +1 -0
  27. package/dist/constructs/v1alpha2/catalog/Catalog.mjs +0 -0
  28. package/dist/constructs/v1alpha2/catalog/CatalogSchema.d.mts +80 -0
  29. package/dist/constructs/v1alpha2/catalog/CatalogSchema.d.ts +80 -0
  30. package/dist/constructs/v1alpha2/catalog/CatalogSchema.js +2 -0
  31. package/dist/constructs/v1alpha2/catalog/CatalogSchema.mjs +2 -0
  32. package/dist/constructs/v1beta1/academy/Academy.d.mts +5762 -0
  33. package/dist/constructs/v1beta1/academy/Academy.d.ts +5762 -0
  34. package/dist/constructs/v1beta1/academy/Academy.js +1 -0
  35. package/dist/constructs/v1beta1/academy/Academy.mjs +0 -0
  36. package/dist/constructs/v1beta1/academy/AcademySchema.d.mts +11838 -0
  37. package/dist/constructs/v1beta1/academy/AcademySchema.d.ts +11838 -0
  38. package/dist/constructs/v1beta1/academy/AcademySchema.js +2 -0
  39. package/dist/constructs/v1beta1/academy/AcademySchema.mjs +2 -0
  40. package/dist/constructs/v1beta1/badge/Badge.d.mts +253 -0
  41. package/dist/constructs/v1beta1/badge/Badge.d.ts +253 -0
  42. package/dist/constructs/v1beta1/badge/Badge.js +1 -0
  43. package/dist/constructs/v1beta1/badge/Badge.mjs +0 -0
  44. package/dist/constructs/v1beta1/badge/BadgeSchema.d.mts +519 -0
  45. package/dist/constructs/v1beta1/badge/BadgeSchema.d.ts +519 -0
  46. package/dist/constructs/v1beta1/badge/BadgeSchema.js +2 -0
  47. package/dist/constructs/v1beta1/badge/BadgeSchema.mjs +2 -0
  48. package/dist/constructs/v1beta1/category/Category.d.mts +33 -0
  49. package/dist/constructs/v1beta1/category/Category.d.ts +33 -0
  50. package/dist/constructs/v1beta1/category/Category.js +1 -0
  51. package/dist/constructs/v1beta1/category/Category.mjs +0 -0
  52. package/dist/constructs/v1beta1/category/CategorySchema.d.mts +60 -0
  53. package/dist/constructs/v1beta1/category/CategorySchema.d.ts +60 -0
  54. package/dist/constructs/v1beta1/category/CategorySchema.js +2 -0
  55. package/dist/constructs/v1beta1/category/CategorySchema.mjs +2 -0
  56. package/dist/constructs/v1beta1/component/Component.d.mts +737 -0
  57. package/dist/constructs/v1beta1/component/Component.d.ts +737 -0
  58. package/dist/constructs/v1beta1/component/Component.js +1 -0
  59. package/dist/constructs/v1beta1/component/Component.mjs +0 -0
  60. package/dist/constructs/v1beta1/component/ComponentSchema.d.mts +1751 -0
  61. package/dist/constructs/v1beta1/component/ComponentSchema.d.ts +1751 -0
  62. package/dist/constructs/v1beta1/component/ComponentSchema.js +10 -0
  63. package/dist/constructs/v1beta1/component/ComponentSchema.mjs +10 -0
  64. package/dist/constructs/v1beta1/connection/Connection.d.mts +186 -0
  65. package/dist/constructs/v1beta1/connection/Connection.d.ts +186 -0
  66. package/dist/constructs/v1beta1/connection/Connection.js +1 -0
  67. package/dist/constructs/v1beta1/connection/Connection.mjs +0 -0
  68. package/dist/constructs/v1beta1/connection/ConnectionSchema.d.mts +612 -0
  69. package/dist/constructs/v1beta1/connection/ConnectionSchema.d.ts +612 -0
  70. package/dist/constructs/v1beta1/connection/ConnectionSchema.js +2 -0
  71. package/dist/constructs/v1beta1/connection/ConnectionSchema.mjs +2 -0
  72. package/dist/constructs/v1beta1/environment/Environment.d.mts +307 -0
  73. package/dist/constructs/v1beta1/environment/Environment.d.ts +307 -0
  74. package/dist/constructs/v1beta1/environment/Environment.js +1 -0
  75. package/dist/constructs/v1beta1/environment/Environment.mjs +0 -0
  76. package/dist/constructs/v1beta1/environment/EnvironmentSchema.d.mts +904 -0
  77. package/dist/constructs/v1beta1/environment/EnvironmentSchema.d.ts +904 -0
  78. package/dist/constructs/v1beta1/environment/EnvironmentSchema.js +2 -0
  79. package/dist/constructs/v1beta1/environment/EnvironmentSchema.mjs +2 -0
  80. package/dist/constructs/v1beta1/evaluation/Evaluation.d.mts +5729 -0
  81. package/dist/constructs/v1beta1/evaluation/Evaluation.d.ts +5729 -0
  82. package/dist/constructs/v1beta1/evaluation/Evaluation.js +1 -0
  83. package/dist/constructs/v1beta1/evaluation/Evaluation.mjs +0 -0
  84. package/dist/constructs/v1beta1/evaluation/EvaluationSchema.d.mts +15473 -0
  85. package/dist/constructs/v1beta1/evaluation/EvaluationSchema.d.ts +15473 -0
  86. package/dist/constructs/v1beta1/evaluation/EvaluationSchema.js +210 -0
  87. package/dist/constructs/v1beta1/evaluation/EvaluationSchema.mjs +210 -0
  88. package/dist/constructs/v1beta1/event/Event.d.mts +177 -0
  89. package/dist/constructs/v1beta1/event/Event.d.ts +177 -0
  90. package/dist/constructs/v1beta1/event/Event.js +1 -0
  91. package/dist/constructs/v1beta1/event/Event.mjs +0 -0
  92. package/dist/constructs/v1beta1/event/EventSchema.d.mts +360 -0
  93. package/dist/constructs/v1beta1/event/EventSchema.d.ts +360 -0
  94. package/dist/constructs/v1beta1/event/EventSchema.js +1 -0
  95. package/dist/constructs/v1beta1/event/EventSchema.mjs +1 -0
  96. package/dist/constructs/v1beta1/feature/Feature.d.mts +287 -0
  97. package/dist/constructs/v1beta1/feature/Feature.d.ts +287 -0
  98. package/dist/constructs/v1beta1/feature/Feature.js +1 -0
  99. package/dist/constructs/v1beta1/feature/Feature.mjs +0 -0
  100. package/dist/constructs/v1beta1/feature/FeatureSchema.d.mts +773 -0
  101. package/dist/constructs/v1beta1/feature/FeatureSchema.d.ts +773 -0
  102. package/dist/constructs/v1beta1/feature/FeatureSchema.js +1 -0
  103. package/dist/constructs/v1beta1/feature/FeatureSchema.mjs +1 -0
  104. package/dist/constructs/v1beta1/invitation/Invitation.d.mts +644 -0
  105. package/dist/constructs/v1beta1/invitation/Invitation.d.ts +644 -0
  106. package/dist/constructs/v1beta1/invitation/Invitation.js +1 -0
  107. package/dist/constructs/v1beta1/invitation/Invitation.mjs +0 -0
  108. package/dist/constructs/v1beta1/invitation/InvitationSchema.d.mts +1652 -0
  109. package/dist/constructs/v1beta1/invitation/InvitationSchema.d.ts +1652 -0
  110. package/dist/constructs/v1beta1/invitation/InvitationSchema.js +1 -0
  111. package/dist/constructs/v1beta1/invitation/InvitationSchema.mjs +1 -0
  112. package/dist/constructs/v1beta1/key/Key.d.mts +409 -0
  113. package/dist/constructs/v1beta1/key/Key.d.ts +409 -0
  114. package/dist/constructs/v1beta1/key/Key.js +1 -0
  115. package/dist/constructs/v1beta1/key/Key.mjs +0 -0
  116. package/dist/constructs/v1beta1/key/KeySchema.d.mts +1029 -0
  117. package/dist/constructs/v1beta1/key/KeySchema.d.ts +1029 -0
  118. package/dist/constructs/v1beta1/key/KeySchema.js +1 -0
  119. package/dist/constructs/v1beta1/key/KeySchema.mjs +1 -0
  120. package/dist/constructs/v1beta1/keychain/Keychain.d.mts +641 -0
  121. package/dist/constructs/v1beta1/keychain/Keychain.d.ts +641 -0
  122. package/dist/constructs/v1beta1/keychain/Keychain.js +1 -0
  123. package/dist/constructs/v1beta1/keychain/Keychain.mjs +0 -0
  124. package/dist/constructs/v1beta1/keychain/KeychainSchema.d.mts +1541 -0
  125. package/dist/constructs/v1beta1/keychain/KeychainSchema.d.ts +1541 -0
  126. package/dist/constructs/v1beta1/keychain/KeychainSchema.js +1 -0
  127. package/dist/constructs/v1beta1/keychain/KeychainSchema.mjs +1 -0
  128. package/dist/constructs/v1beta1/model/Model.d.mts +474 -0
  129. package/dist/constructs/v1beta1/model/Model.d.ts +474 -0
  130. package/dist/constructs/v1beta1/model/Model.js +1 -0
  131. package/dist/constructs/v1beta1/model/Model.mjs +0 -0
  132. package/dist/constructs/v1beta1/model/ModelSchema.d.mts +1281 -0
  133. package/dist/constructs/v1beta1/model/ModelSchema.d.ts +1281 -0
  134. package/dist/constructs/v1beta1/model/ModelSchema.js +6 -0
  135. package/dist/constructs/v1beta1/model/ModelSchema.mjs +6 -0
  136. package/dist/constructs/v1beta1/organization/Organization.d.mts +268 -0
  137. package/dist/constructs/v1beta1/organization/Organization.d.ts +268 -0
  138. package/dist/constructs/v1beta1/organization/Organization.js +1 -0
  139. package/dist/constructs/v1beta1/organization/Organization.mjs +0 -0
  140. package/dist/constructs/v1beta1/organization/OrganizationSchema.d.mts +765 -0
  141. package/dist/constructs/v1beta1/organization/OrganizationSchema.d.ts +765 -0
  142. package/dist/constructs/v1beta1/organization/OrganizationSchema.js +1 -0
  143. package/dist/constructs/v1beta1/organization/OrganizationSchema.mjs +1 -0
  144. package/dist/constructs/v1beta1/pattern/Pattern.d.mts +5776 -0
  145. package/dist/constructs/v1beta1/pattern/Pattern.d.ts +5776 -0
  146. package/dist/constructs/v1beta1/pattern/Pattern.js +1 -0
  147. package/dist/constructs/v1beta1/pattern/Pattern.mjs +0 -0
  148. package/dist/constructs/v1beta1/pattern/PatternSchema.d.mts +15669 -0
  149. package/dist/constructs/v1beta1/pattern/PatternSchema.d.ts +15669 -0
  150. package/dist/constructs/v1beta1/pattern/PatternSchema.js +210 -0
  151. package/dist/constructs/v1beta1/pattern/PatternSchema.mjs +210 -0
  152. package/dist/constructs/v1beta1/plan/Plan.d.mts +120 -0
  153. package/dist/constructs/v1beta1/plan/Plan.d.ts +120 -0
  154. package/dist/constructs/v1beta1/plan/Plan.js +1 -0
  155. package/dist/constructs/v1beta1/plan/Plan.mjs +0 -0
  156. package/dist/constructs/v1beta1/plan/PlanSchema.d.mts +322 -0
  157. package/dist/constructs/v1beta1/plan/PlanSchema.d.ts +322 -0
  158. package/dist/constructs/v1beta1/plan/PlanSchema.js +1 -0
  159. package/dist/constructs/v1beta1/plan/PlanSchema.mjs +1 -0
  160. package/dist/constructs/v1beta1/subcategory/Subcategory.d.mts +23 -0
  161. package/dist/constructs/v1beta1/subcategory/Subcategory.d.ts +23 -0
  162. package/dist/constructs/v1beta1/subcategory/Subcategory.js +1 -0
  163. package/dist/constructs/v1beta1/subcategory/Subcategory.mjs +0 -0
  164. package/dist/constructs/v1beta1/subcategory/SubcategorySchema.d.mts +33 -0
  165. package/dist/constructs/v1beta1/subcategory/SubcategorySchema.d.ts +33 -0
  166. package/dist/constructs/v1beta1/subcategory/SubcategorySchema.js +2 -0
  167. package/dist/constructs/v1beta1/subcategory/SubcategorySchema.mjs +2 -0
  168. package/dist/constructs/v1beta1/subscription/Subscription.d.mts +624 -0
  169. package/dist/constructs/v1beta1/subscription/Subscription.d.ts +624 -0
  170. package/dist/constructs/v1beta1/subscription/Subscription.js +1 -0
  171. package/dist/constructs/v1beta1/subscription/Subscription.mjs +0 -0
  172. package/dist/constructs/v1beta1/subscription/SubscriptionSchema.d.mts +1642 -0
  173. package/dist/constructs/v1beta1/subscription/SubscriptionSchema.d.ts +1642 -0
  174. package/dist/constructs/v1beta1/subscription/SubscriptionSchema.js +2 -0
  175. package/dist/constructs/v1beta1/subscription/SubscriptionSchema.mjs +2 -0
  176. package/dist/constructs/v1beta1/user/User.d.mts +473 -0
  177. package/dist/constructs/v1beta1/user/User.d.ts +473 -0
  178. package/dist/constructs/v1beta1/user/User.js +1 -0
  179. package/dist/constructs/v1beta1/user/User.mjs +0 -0
  180. package/dist/constructs/v1beta1/user/UserSchema.d.mts +1112 -0
  181. package/dist/constructs/v1beta1/user/UserSchema.d.ts +1112 -0
  182. package/dist/constructs/v1beta1/user/UserSchema.js +1 -0
  183. package/dist/constructs/v1beta1/user/UserSchema.mjs +1 -0
  184. package/dist/constructs/v1beta1/workspace/Workspace.d.mts +303 -0
  185. package/dist/constructs/v1beta1/workspace/Workspace.d.ts +303 -0
  186. package/dist/constructs/v1beta1/workspace/Workspace.js +1 -0
  187. package/dist/constructs/v1beta1/workspace/Workspace.mjs +0 -0
  188. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.d.mts +964 -0
  189. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.d.ts +964 -0
  190. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.js +2 -0
  191. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.mjs +2 -0
  192. package/dist/index.d.mts +40 -34677
  193. package/dist/index.d.ts +40 -34677
  194. package/dist/index.js +29 -93
  195. package/dist/index.mjs +29 -93
  196. package/dist/mesheryApi.d.mts +1825 -727
  197. package/dist/mesheryApi.d.ts +1825 -727
  198. package/dist/mesheryApi.js +1 -1
  199. package/dist/mesheryApi.mjs +1 -1
  200. package/dist/permissions.d.mts +422 -0
  201. package/dist/permissions.d.ts +422 -0
  202. package/dist/permissions.js +1 -0
  203. package/dist/permissions.mjs +1 -0
  204. package/package.json +52 -48
package/README.md CHANGED
@@ -124,10 +124,35 @@ schemas/
124
124
  constructs/
125
125
  <schema-version>/ # e.g., v1beta1
126
126
  <construct>/ # e.g., model, component
127
- <construct>.json # Schema definition for the construct (noun)
128
- openapi.yml # API operations (verbs: create, update, delete)
129
- <construct>_template.json # Generated JSON template from schema
130
- <construct>_template.yaml # Generated YAML template from schema
127
+ api.yml # Index file: references all subschemas + defines API endpoints
128
+ <construct>.yaml # Subschema: data model definition for the construct
129
+ <other_subschema>.yaml # Additional subschemas (optional)
130
+ templates/ # Manually defined templates directory
131
+ <construct>_template.json # JSON template from schema
132
+ <construct>_template.yaml # YAML template from schema
133
+ <variant>_template.json # Additional variant templates (optional)
134
+
135
+ typescript/ # TypeScript source and generated files
136
+ index.ts # Manually maintained - public API surface
137
+ generated/ # Auto-generated (do NOT commit)
138
+ <schema-version>/
139
+ <construct>/
140
+ <Construct>.d.ts # TypeScript type definitions
141
+ <Construct>Schema.ts # OpenAPI schema as JS object
142
+ rtk/ # RTK Query client configurations
143
+ cloud.ts
144
+ meshery.ts
145
+
146
+ dist/ # Built distribution (do NOT commit)
147
+ index.js, index.d.ts
148
+ cloudApi.js, mesheryApi.js
149
+ constructs/ # Built schema exports (renamed from 'generated')
150
+ <schema-version>/<construct>/<Construct>Schema.js
151
+
152
+ models/ # Auto-generated Go code (do NOT commit)
153
+ <schema-version>/
154
+ <construct>/
155
+ <construct>.go
131
156
  ```
132
157
 
133
158
  ### 🧠 Explanation
@@ -135,9 +160,203 @@ schemas/
135
160
  * **`constructs/`** – Holds schemas for various versions.
136
161
  * **`<schema-version>/`** – Represents a version (e.g., `v1alpha2`, `v1beta1`).
137
162
  * **`<construct>/`** – A directory to contain all files for any given construct like `pattern`, `component`, etc.
138
- * **`<construct>.json`** – Defines the **data model (noun)** for the construct.
139
- * **`openapi.yml`** Contains a package manifest of all schema files with respect to any given construct (used by openapi generator) AND defines **API operations** (verbs).
140
- * **Templates** `*_template.json` and `*_template.yaml` are auto-generated examples with resolved references and defaults.
163
+ * **`api.yml`** – The **index file** for the construct. This file:
164
+ 1. References all subschemas (via `$ref`) to bundle them together
165
+ 2. Defines all **API endpoints** (REST operations: GET, POST, PUT, DELETE) for the construct
166
+ 3. Serves as the entry point for code generation tools (oapi-codegen, openapi-typescript)
167
+ * **`<construct>.yaml`** – A **subschema** that defines the data model (noun) for the construct. Contains the schema properties, types, and validation rules.
168
+ * **Other `.yaml` files** – Additional subschemas can be defined in separate files (e.g., `model_core.yml`, `component_metadata.yml`) and referenced from `api.yml`.
169
+ * **`templates/`** – A subdirectory containing manually defined template files. You can add as many different templates here for different variants, use cases, or configurations. Templates are example instances of the schema with default or sample values.
170
+ * `<construct>_template.json` / `<construct>_template.yaml` – Default templates in JSON/YAML format.
171
+ * Additional variant templates can be added (e.g., `<construct>_minimal_template.json`, `<construct>_full_template.yaml`) for different use cases.
172
+
173
+ ---
174
+
175
+ ## Naming Conventions
176
+
177
+ - Property names
178
+ - Use camelCase for property fields (e.g., `schemaVersion`, `displayName`, `componentsCount`).
179
+ - Identifier fields use lowerCamelCase with "Id" suffix (e.g., `modelId`, `registrantId`, `categoryId`).
180
+ - Enums use lowercase words (e.g., `enabled`, `ignored`, `duplicate`).
181
+ - Use singular nouns for object names (e.g., `model`, `component`, `design`).
182
+
183
+ - OpenAPI schema names
184
+ - PascalCase nouns under `components/schemas` (e.g., `Model`, `Component`).
185
+ - Files/folders are lowercase: `api.yml` (index), `<construct>.yaml` (subschemas), `templates/<construct>_template.(json|yaml)`.
186
+
187
+ - Endpoints and operations
188
+ - Paths are under `/api` with kebab-case , plural nouns (e.g., `/api/workspaces`, `/api/environments`).
189
+ - Path params are camelCase (e.g., `{subscriptionId}`, `{connectionId}`).
190
+ - Non-CRUD actions append a verb segment (e.g., `.../register`, `.../export`, `.../cancel`); legacy lowerCamelCase may appear (e.g., `.../upgradePreview`).
191
+ - `operationId` is camelCase VerbNoun (e.g., `registerMeshmodels`).
192
+
193
+ - Versioning
194
+ - `schemaVersion` uses group/version (e.g., `models.meshery.io/v1beta1`, `components.meshery.io/v1beta1`).
195
+ - Version strings follow k8s-style (`v1`, `v1alpha1`, `v1beta1`); semver fields use standard SemVer.
196
+
197
+ ---
198
+
199
+ ## 🔧 Go Helper Files
200
+
201
+ While Go structs are auto-generated from schemas, you often need to add **custom methods** to make these structs compatible with databases, implement interfaces, or add utility functions. This is done through manually created **helper files**.
202
+
203
+ ### When to Create Helper Files
204
+
205
+ Create a helper file (`*_helper.go` or `helpers.go`) in the generated package when you need:
206
+
207
+ 1. **SQL Driver Compatibility** - Implement `database/sql/driver.Scanner` and `driver.Valuer` interfaces
208
+ 2. **Entity Interface Implementation** - Implement the `entity.Entity` interface for database operations
209
+ 3. **GORM Table Names** - Define custom table names via `TableName()` method
210
+ 4. **Utility Methods** - Add helper functions for serialization, validation, or business logic
211
+ 5. **Type Conversions** - Add methods to convert between related types
212
+
213
+ ### Helper File Location
214
+
215
+ ```
216
+ models/
217
+ ├── core/
218
+ │ ├── core.go # Auto-generated (do NOT edit)
219
+ │ ├── helpers.go # Manual: utility functions
220
+ │ ├── datatype_map.go # Manual: Map type with SQL driver methods
221
+ │ └── datatype_null_time.go # Manual: NullTime with SQL driver methods
222
+ ├── v1beta1/
223
+ │ ├── model/
224
+ │ │ ├── model.go # Auto-generated (do NOT edit)
225
+ │ │ └── model_helper.go # Manual: Entity interface, TableName, etc.
226
+ │ ├── component/
227
+ │ │ ├── component.go # Auto-generated (do NOT edit)
228
+ │ │ └── component_helper.go # Manual: Entity interface, TableName, etc.
229
+ │ └── category/
230
+ │ ├── category.go # Auto-generated (do NOT edit)
231
+ │ └── category_helper.go # Manual: Entity interface, TableName, etc.
232
+ ```
233
+
234
+ ### SQL Driver Interface Implementation
235
+
236
+ To store complex types in SQL databases, implement `Scan` and `Value` methods:
237
+
238
+ ```go
239
+ // helpers.go - This is NOT autogenerated
240
+ package mypackage
241
+
242
+ import (
243
+ "database/sql/driver"
244
+ "encoding/json"
245
+
246
+ "github.com/meshery/schemas/models/core"
247
+ )
248
+
249
+ // Scan implements sql.Scanner interface for reading from database
250
+ func (m *MyComplexType) Scan(value interface{}) error {
251
+ mapVal := core.Map{}
252
+ err := mapVal.Scan(value)
253
+ if err != nil {
254
+ return err
255
+ }
256
+ return core.MapToStruct(mapVal, m)
257
+ }
258
+
259
+ // Value implements driver.Valuer interface for writing to database
260
+ func (m MyComplexType) Value() (driver.Value, error) {
261
+ mapVal, err := core.StructToMap(m)
262
+ if err != nil {
263
+ return nil, err
264
+ }
265
+ return core.Map(mapVal).Value()
266
+ }
267
+ ```
268
+
269
+ ### Entity Interface Implementation
270
+
271
+ For structs that need database CRUD operations, implement the `entity.Entity` interface:
272
+
273
+ ```go
274
+ // component_helper.go - This is NOT autogenerated
275
+ package component
276
+
277
+ import (
278
+ "fmt"
279
+
280
+ "github.com/gofrs/uuid"
281
+ "github.com/meshery/meshkit/database"
282
+ "github.com/meshery/meshkit/models/meshmodel/entity"
283
+ "gorm.io/gorm/clause"
284
+ )
285
+
286
+ // TableName returns the database table name for GORM
287
+ func (c ComponentDefinition) TableName() string {
288
+ return "component_definition_dbs"
289
+ }
290
+
291
+ // Type returns the entity type identifier
292
+ func (c ComponentDefinition) Type() entity.EntityType {
293
+ return entity.ComponentDefinition
294
+ }
295
+
296
+ // GenerateID generates a new UUID for the entity
297
+ func (c *ComponentDefinition) GenerateID() (uuid.UUID, error) {
298
+ return uuid.NewV4()
299
+ }
300
+
301
+ // GetID returns the entity's ID
302
+ func (c ComponentDefinition) GetID() uuid.UUID {
303
+ return c.Id
304
+ }
305
+
306
+ // GetEntityDetail returns a human-readable description
307
+ func (c *ComponentDefinition) GetEntityDetail() string {
308
+ return fmt.Sprintf("type: %s, name: %s, model: %s",
309
+ c.Type(), c.DisplayName, c.Model.Name)
310
+ }
311
+
312
+ // Create inserts the entity into the database
313
+ func (c *ComponentDefinition) Create(db *database.Handler, hostID uuid.UUID) (uuid.UUID, error) {
314
+ c.Id, _ = c.GenerateID()
315
+ err := db.Omit(clause.Associations).Create(&c).Error
316
+ return c.Id, err
317
+ }
318
+
319
+ // UpdateStatus updates the entity's status in the database
320
+ func (c *ComponentDefinition) UpdateStatus(db *database.Handler, status entity.EntityStatus) error {
321
+ return nil
322
+ }
323
+ ```
324
+
325
+ ### Core Utility Types
326
+
327
+ The `models/core/` package provides reusable types with built-in SQL compatibility:
328
+
329
+ | Type | Purpose | Use Case |
330
+ |------|---------|----------|
331
+ | `core.Map` | `map[string]any` with SQL support | Storing JSON objects in database |
332
+ | `core.NullTime` | Nullable time with JSON/YAML support | Optional timestamp fields |
333
+ | `core.Time` | Time wrapper with custom formatting | Required timestamp fields |
334
+
335
+ ### Example: Using Core Types
336
+
337
+ ```go
338
+ // In your helper file
339
+ package mypackage
340
+
341
+ import "github.com/meshery/schemas/models/core"
342
+
343
+ // For nullable timestamps (e.g., deleted_at)
344
+ type MyStruct struct {
345
+ DeletedAt core.NullTime `json:"deleted_at" gorm:"column:deleted_at"`
346
+ }
347
+
348
+ // For JSON metadata stored as blob
349
+ type MyStruct struct {
350
+ Metadata core.Map `json:"metadata" gorm:"type:bytes;serializer:json"`
351
+ }
352
+ ```
353
+
354
+ ### Important Notes
355
+
356
+ 1. **File Header Comment**: Always add `// This is not autogenerated.` at the top of helper files
357
+ 2. **Same Package**: Helper files must be in the same package as the generated code
358
+ 3. **Do Commit Helper Files**: Unlike generated `.go` files, helper files ARE committed to the repository
359
+ 4. **Mutex for Creation**: Use sync.Mutex when implementing `Create()` to prevent race conditions
141
360
 
142
361
  ---
143
362
 
@@ -145,11 +364,41 @@ schemas/
145
364
 
146
365
  Meshery supports **automated code generation** from schemas for:
147
366
 
148
- * **Go**: Strongly-typed models for backend.
149
- * **TypeScript**: Interfaces and types for frontend use.
150
- * **RTK Query**: Clients generated from OpenAPI for use with Redux.
367
+ * **Go**: Strongly-typed models for backend → `models/<version>/<package>/`
368
+ * **TypeScript Types**: Interfaces and type definitions `typescript/generated/<version>/<package>/<Package>.d.ts`
369
+ * **TypeScript Schemas**: OpenAPI schemas as const JS objects `typescript/generated/<version>/<package>/<Package>Schema.ts`
370
+ * **RTK Query**: Clients generated from OpenAPI for use with Redux → `typescript/rtk/`
151
371
  * **JSON/YAML**: Templates with defaults and resolved references.
152
372
 
373
+ ### TypeScript Schema Exports
374
+
375
+ Each construct's OpenAPI schema is exported as a const JavaScript object for runtime use:
376
+
377
+ ```typescript
378
+ // Import from main index
379
+ import {
380
+ ModelDefinitionV1Beta1OpenApiSchema,
381
+ ComponentDefinitionV1Beta1OpenApiSchema,
382
+ DesignDefinitionV1Beta1OpenApiSchema,
383
+ } from "@meshery/schemas";
384
+
385
+ // Or import individual schemas directly
386
+ import ModelSchema from "@meshery/schemas/dist/constructs/v1beta1/model/ModelSchema";
387
+ import ComponentSchema from "@meshery/schemas/dist/constructs/v1beta1/component/ComponentSchema";
388
+ ```
389
+
390
+ ### TypeScript Type Namespaces
391
+
392
+ Types are organized by version in namespaces:
393
+
394
+ ```typescript
395
+ import { v1beta1, v1alpha1 } from "@meshery/schemas";
396
+
397
+ const component: v1beta1.Component = { /* ... */ };
398
+ const model: v1beta1.Model = { /* ... */ };
399
+ const design: v1beta1.Design = { /* ... */ };
400
+ ```
401
+
153
402
  ---
154
403
 
155
404
  ## 🚀 Unified Build: One Command for Everything
@@ -158,6 +407,7 @@ Use the following command to perform the **entire schema-driven generation workf
158
407
 
159
408
  ```bash
160
409
  make build
410
+ npm run build # Build TypeScript distribution with tsup
161
411
  ```
162
412
 
163
413
  ### 🔧 What `make build` does:
@@ -170,10 +420,16 @@ make build
170
420
 
171
421
  2. **Generates:**
172
422
 
173
- * Golang structs
174
- * TypeScript types
175
- * JSON & YAML templates
176
- * RTK Query clients
423
+ * Golang structs → `models/`
424
+ * TypeScript type definitions (`.d.ts`) → `typescript/generated/`
425
+ * TypeScript schema exports (`*Schema.ts`) → `typescript/generated/`
426
+ * RTK Query clients → `typescript/rtk/`
427
+
428
+ 3. **After `npm run build`:**
429
+
430
+ * Builds distribution files → `dist/`
431
+ * Creates CJS and ESM bundles
432
+ * Generates declaration files
177
433
 
178
434
  > ⚠️ This is the recommended way to stay in sync with schema changes.
179
435
 
@@ -233,7 +489,7 @@ generate_schema_models <construct> <schema-version> [<openapi-file>]
233
489
 
234
490
  generate_schema_models "capability" "v1alpha1"
235
491
  generate_schema_models "category" "v1beta1"
236
- generate_schema_models "pattern" "v1beta1" "schemas/constructs/v1beta1/design/openapi.yml"
492
+ generate_schema_models "pattern" "v1beta1" "schemas/constructs/v1beta1/design/api.yml"
237
493
  ```
238
494
 
239
495
  This maps to Go packages like:
@@ -255,7 +511,7 @@ npx @redocly/cli join schemas/base_cloud.yml \
255
511
  "${v1beta1}/component/${merged_construct}" \
256
512
  "${v1beta1}/model/${merged_construct}" \
257
513
  ... \
258
- -o schemas/merged_openapi.yml \
514
+ -o _openapi_build/merged_openapi.yml \
259
515
  --prefix-tags-with-info-prop title \
260
516
  --prefix-components-with-info-prop title
261
517
  ```
@@ -444,19 +700,34 @@ make build
444
700
  Or validate a single file:
445
701
 
446
702
  ```bash
447
- npx @redocly/cli lint schemas/constructs/v1beta1/pattern/openapi.yml
703
+ npx @redocly/cli lint schemas/constructs/v1beta1/pattern/api.yml
448
704
  ```
449
705
 
450
706
  ---
451
707
 
452
708
  ## ✅ Summary
453
709
 
454
- | Task | Command |
455
- | ----------------------- | ----------------------- |
456
- | Generate everything | `make build` |
457
- | Generate Go code only | `make golang-generate` |
458
- | Generate TS + templates | `make generate-types` |
459
- | Lint OpenAPI | `npx @redocly/cli lint` |
710
+ | Task | Command |
711
+ | ---------------------------- | ----------------------- |
712
+ | Generate everything | `make build` |
713
+ | Build TypeScript dist | `npm run build` |
714
+ | Generate Go code only | `make golang-generate` |
715
+ | Generate TS types + schemas | `make generate-ts` |
716
+ | Lint OpenAPI | `npx @redocly/cli lint` |
717
+
718
+ ### Importing Schemas
719
+
720
+ ```typescript
721
+ // Via namespaces (types)
722
+ import { v1beta1 } from "@meshery/schemas";
723
+ const model: v1beta1.Model = { /* ... */ };
724
+
725
+ // Via schema exports (runtime)
726
+ import { ModelDefinitionV1Beta1OpenApiSchema } from "@meshery/schemas";
727
+
728
+ // Direct schema import
729
+ import ModelSchema from "@meshery/schemas/dist/constructs/v1beta1/model/ModelSchema";
730
+ ```
460
731
 
461
732
  ---
462
733