@objectstack/spec 0.8.1 → 0.9.0

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 (197) hide show
  1. package/dist/ai/devops-agent.zod.d.ts +1 -1
  2. package/dist/ai/feedback-loop.zod.d.ts +4293 -0
  3. package/dist/ai/feedback-loop.zod.d.ts.map +1 -0
  4. package/dist/ai/feedback-loop.zod.js +53 -0
  5. package/dist/ai/index.d.ts +1 -0
  6. package/dist/ai/index.d.ts.map +1 -1
  7. package/dist/ai/index.js +1 -0
  8. package/dist/api/documentation.zod.d.ts +1073 -0
  9. package/dist/api/documentation.zod.d.ts.map +1 -0
  10. package/dist/api/documentation.zod.js +487 -0
  11. package/dist/api/errors.zod.d.ts +6 -6
  12. package/dist/api/graphql.zod.d.ts +3 -3
  13. package/dist/api/hub.zod.d.ts +5239 -0
  14. package/dist/api/hub.zod.d.ts.map +1 -0
  15. package/dist/api/hub.zod.js +784 -0
  16. package/dist/api/index.d.ts +4 -2
  17. package/dist/api/index.d.ts.map +1 -1
  18. package/dist/api/index.js +4 -2
  19. package/dist/api/odata.zod.d.ts +1 -1
  20. package/dist/api/protocol.zod.d.ts +2 -1143
  21. package/dist/api/protocol.zod.d.ts.map +1 -1
  22. package/dist/api/protocol.zod.js +2 -49
  23. package/dist/api/registry.example.d.ts +411 -0
  24. package/dist/api/registry.example.d.ts.map +1 -0
  25. package/dist/api/registry.example.js +470 -0
  26. package/dist/api/registry.zod.d.ts +2095 -0
  27. package/dist/api/registry.zod.d.ts.map +1 -0
  28. package/dist/api/registry.zod.js +755 -0
  29. package/dist/api/websocket.zod.d.ts +8 -8
  30. package/dist/auth/scim.zod.d.ts +3 -3
  31. package/dist/automation/flow.zod.d.ts +3 -3
  32. package/dist/contracts/index.d.ts +1 -0
  33. package/dist/contracts/index.d.ts.map +1 -1
  34. package/dist/contracts/index.js +1 -0
  35. package/dist/contracts/schema-driver.d.ts +21 -0
  36. package/dist/contracts/schema-driver.d.ts.map +1 -0
  37. package/dist/contracts/schema-driver.js +2 -0
  38. package/dist/hub/composer.zod.d.ts +226 -0
  39. package/dist/hub/composer.zod.d.ts.map +1 -1
  40. package/dist/hub/hub-federation.zod.d.ts +764 -0
  41. package/dist/hub/hub-federation.zod.d.ts.map +1 -0
  42. package/dist/hub/hub-federation.zod.js +441 -0
  43. package/dist/hub/index.d.ts +2 -0
  44. package/dist/hub/index.d.ts.map +1 -1
  45. package/dist/hub/index.js +3 -0
  46. package/dist/hub/plugin-security.zod.d.ts +1029 -0
  47. package/dist/hub/plugin-security.zod.d.ts.map +1 -0
  48. package/dist/hub/plugin-security.zod.js +637 -0
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +2 -1
  52. package/dist/integration/connector/vercel.zod.d.ts +2 -2
  53. package/dist/qa/index.d.ts +11 -0
  54. package/dist/qa/index.d.ts.map +1 -0
  55. package/dist/qa/index.js +26 -0
  56. package/dist/qa/testing.zod.d.ts +345 -0
  57. package/dist/qa/testing.zod.d.ts.map +1 -0
  58. package/dist/qa/testing.zod.js +69 -0
  59. package/dist/stack.zod.d.ts +576 -3
  60. package/dist/stack.zod.d.ts.map +1 -1
  61. package/dist/system/index.d.ts +2 -0
  62. package/dist/system/index.d.ts.map +1 -1
  63. package/dist/system/index.js +2 -0
  64. package/dist/system/manifest.zod.d.ts +226 -0
  65. package/dist/system/manifest.zod.d.ts.map +1 -1
  66. package/dist/system/manifest.zod.js +8 -0
  67. package/dist/system/message-queue.zod.d.ts +2 -2
  68. package/dist/system/metadata-loader.zod.d.ts +1 -1
  69. package/dist/system/migration.zod.d.ts +4205 -0
  70. package/dist/system/migration.zod.d.ts.map +1 -0
  71. package/dist/system/migration.zod.js +70 -0
  72. package/dist/system/plugin-loading.zod.d.ts +575 -0
  73. package/dist/system/plugin-loading.zod.d.ts.map +1 -0
  74. package/dist/system/plugin-loading.zod.js +612 -0
  75. package/json-schema/{api/ViewResponse.json → ai/FeedbackLoop.json} +2 -2
  76. package/json-schema/{api/ViewType.json → ai/Issue.json} +2 -2
  77. package/json-schema/{api/GetViewRequest.json → ai/MetadataSource.json} +2 -2
  78. package/json-schema/{api/ViewColumn.json → ai/Resolution.json} +2 -2
  79. package/json-schema/api/{DeleteViewRequest.json → ApiChangelogEntry.json} +2 -2
  80. package/json-schema/api/{CreateViewRequest.json → ApiDiscoveryQuery.json} +2 -2
  81. package/json-schema/api/ApiDiscoveryResponse.json +7 -0
  82. package/json-schema/api/ApiDocumentationConfig.json +7 -0
  83. package/json-schema/api/ApiEndpointRegistration.json +7 -0
  84. package/json-schema/api/ApiMetadata.json +7 -0
  85. package/json-schema/api/ApiParameter.json +7 -0
  86. package/json-schema/api/{GetViewResponse.json → ApiProtocolType.json} +2 -2
  87. package/json-schema/api/ApiRegistry.json +7 -0
  88. package/json-schema/api/{ListViewsRequest.json → ApiRegistryEntry.json} +2 -2
  89. package/json-schema/api/ApiResponse.json +7 -0
  90. package/json-schema/api/ApiTestCollection.json +7 -0
  91. package/json-schema/api/ApiTestRequest.json +7 -0
  92. package/json-schema/api/{DeleteViewResponse.json → ApiTestingUiConfig.json} +2 -2
  93. package/json-schema/api/ApiTestingUiType.json +7 -0
  94. package/json-schema/api/BuildStatusResponse.json +7 -0
  95. package/json-schema/api/CodeGenerationTemplate.json +7 -0
  96. package/json-schema/api/CompileManifestRequest.json +7 -0
  97. package/json-schema/api/CompileManifestResponse.json +7 -0
  98. package/json-schema/api/ConflictResolutionStrategy.json +7 -0
  99. package/json-schema/api/CreateSpaceRequest.json +7 -0
  100. package/json-schema/api/CreateTenantRequest.json +7 -0
  101. package/json-schema/api/GeneratedApiDocumentation.json +7 -0
  102. package/json-schema/api/GetBuildStatusRequest.json +7 -0
  103. package/json-schema/api/GetMarketplacePluginRequest.json +7 -0
  104. package/json-schema/api/GetPluginVersionsRequest.json +7 -0
  105. package/json-schema/api/GetPluginVersionsResponse.json +7 -0
  106. package/json-schema/api/HttpStatusCode.json +7 -0
  107. package/json-schema/api/HubHealthResponse.json +7 -0
  108. package/json-schema/api/HubMetricsResponse.json +7 -0
  109. package/json-schema/api/IssueLicenseRequest.json +7 -0
  110. package/json-schema/api/LicenseResponse.json +7 -0
  111. package/json-schema/api/ListLicensesRequest.json +7 -0
  112. package/json-schema/api/ListLicensesResponse.json +7 -0
  113. package/json-schema/api/ListMarketplaceRequest.json +7 -0
  114. package/json-schema/api/ListMarketplaceResponse.json +7 -0
  115. package/json-schema/api/ListSpacesRequest.json +7 -0
  116. package/json-schema/api/ListSpacesResponse.json +7 -0
  117. package/json-schema/api/ListTenantsRequest.json +7 -0
  118. package/json-schema/api/ListTenantsResponse.json +7 -0
  119. package/json-schema/api/MarketplacePluginResponse.json +7 -0
  120. package/json-schema/api/ObjectQLReference.json +7 -0
  121. package/json-schema/api/OpenApiSecurityScheme.json +7 -0
  122. package/json-schema/api/OpenApiServer.json +7 -0
  123. package/json-schema/api/OpenApiSpec.json +7 -0
  124. package/json-schema/api/PaginationRequest.json +7 -0
  125. package/json-schema/api/PaginationResponse.json +7 -0
  126. package/json-schema/api/PluginResponse.json +7 -0
  127. package/json-schema/api/PluginVersionInfo.json +7 -0
  128. package/json-schema/api/PublishPluginRequest.json +7 -0
  129. package/json-schema/api/RevokeLicenseRequest.json +7 -0
  130. package/json-schema/api/SchemaDefinition.json +7 -0
  131. package/json-schema/api/SearchPluginsRequest.json +7 -0
  132. package/json-schema/api/SearchPluginsResponse.json +7 -0
  133. package/json-schema/api/SpaceResponse.json +7 -0
  134. package/json-schema/api/TenantResponse.json +7 -0
  135. package/json-schema/api/UpdatePluginRequest.json +7 -0
  136. package/json-schema/api/UpdateSpaceRequest.json +7 -0
  137. package/json-schema/api/UpdateTenantRequest.json +7 -0
  138. package/json-schema/api/ValidateLicenseRequest.json +7 -0
  139. package/json-schema/api/ValidateLicenseResponse.json +7 -0
  140. package/json-schema/hub/DependencyConflict.json +7 -0
  141. package/json-schema/hub/DependencyGraph.json +7 -0
  142. package/json-schema/hub/DependencyGraphNode.json +7 -0
  143. package/json-schema/hub/DependencyResolutionResult.json +7 -0
  144. package/json-schema/hub/EdgeLocation.json +7 -0
  145. package/json-schema/hub/FederationTopology.json +7 -0
  146. package/json-schema/hub/GlobalRegistryEntry.json +7 -0
  147. package/json-schema/hub/HubInstance.json +7 -0
  148. package/json-schema/hub/PackageDependency.json +7 -0
  149. package/json-schema/hub/PluginProvenance.json +7 -0
  150. package/json-schema/hub/PluginTrustScore.json +7 -0
  151. package/json-schema/{api/SavedView.json → hub/Region.json} +2 -2
  152. package/json-schema/hub/ReplicationJob.json +7 -0
  153. package/json-schema/{api/ViewLayout.json → hub/SBOM.json} +2 -2
  154. package/json-schema/hub/SBOMEntry.json +7 -0
  155. package/json-schema/hub/SecurityPolicy.json +7 -0
  156. package/json-schema/hub/SecurityScanResult.json +7 -0
  157. package/json-schema/hub/SecurityVulnerability.json +7 -0
  158. package/json-schema/hub/TenantPlacementPolicy.json +7 -0
  159. package/json-schema/hub/VulnerabilitySeverity.json +7 -0
  160. package/json-schema/qa/TestAction.json +7 -0
  161. package/json-schema/qa/TestActionType.json +7 -0
  162. package/json-schema/qa/TestAssertion.json +7 -0
  163. package/json-schema/qa/TestAssertionType.json +7 -0
  164. package/json-schema/qa/TestContext.json +7 -0
  165. package/json-schema/qa/TestScenario.json +7 -0
  166. package/json-schema/qa/TestStep.json +7 -0
  167. package/json-schema/qa/TestSuite.json +7 -0
  168. package/json-schema/system/AddFieldOperation.json +7 -0
  169. package/json-schema/system/ChangeSet.json +7 -0
  170. package/json-schema/system/CreateObjectOperation.json +7 -0
  171. package/json-schema/system/DeleteObjectOperation.json +7 -0
  172. package/json-schema/system/ExecuteSqlOperation.json +7 -0
  173. package/json-schema/system/MigrationDependency.json +7 -0
  174. package/json-schema/system/MigrationOperation.json +7 -0
  175. package/json-schema/system/ModifyFieldOperation.json +7 -0
  176. package/json-schema/system/PluginCaching.json +7 -0
  177. package/json-schema/system/PluginCodeSplitting.json +7 -0
  178. package/json-schema/system/PluginDependencyResolution.json +7 -0
  179. package/json-schema/system/PluginDynamicImport.json +7 -0
  180. package/json-schema/system/PluginHotReload.json +7 -0
  181. package/json-schema/system/PluginInitialization.json +7 -0
  182. package/json-schema/system/PluginLoadingConfig.json +7 -0
  183. package/json-schema/system/PluginLoadingEvent.json +7 -0
  184. package/json-schema/system/PluginLoadingState.json +7 -0
  185. package/json-schema/system/PluginLoadingStrategy.json +7 -0
  186. package/json-schema/system/PluginPerformanceMonitoring.json +7 -0
  187. package/json-schema/system/PluginPreloadConfig.json +7 -0
  188. package/json-schema/system/PluginSandboxing.json +7 -0
  189. package/json-schema/system/RemoveFieldOperation.json +7 -0
  190. package/json-schema/system/RenameObjectOperation.json +7 -0
  191. package/package.json +1 -1
  192. package/dist/api/view-storage.zod.d.ts +0 -2054
  193. package/dist/api/view-storage.zod.d.ts.map +0 -1
  194. package/dist/api/view-storage.zod.js +0 -243
  195. package/json-schema/api/ListViewsResponse.json +0 -7
  196. package/json-schema/api/UpdateViewRequest.json +0 -7
  197. package/json-schema/api/ViewVisibility.json +0 -7
@@ -0,0 +1,470 @@
1
+ "use strict";
2
+ /**
3
+ * API Registry Enhancement Examples
4
+ *
5
+ * This file demonstrates all the enhancements made to the Unified API Registry:
6
+ * 1. RBAC Integration
7
+ * 2. Dynamic Schema Linking (ObjectQL References)
8
+ * 3. Protocol Extensibility
9
+ * 4. Route Conflict Detection
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.productionEndpoint = exports.completeRegistry = exports.fallbackEndpoint = exports.pluginEndpoint = exports.coreEndpoint = exports.websocketEndpoint = exports.trpcEndpoint = exports.grpcEndpoint = exports.orderWithRelations = exports.createEndpointWithDynamicSchema = exports.endpointWithDynamicSchema = exports.adminEndpoint = exports.endpointWithRBAC = void 0;
13
+ const registry_zod_1 = require("./registry.zod");
14
+ // ==========================================
15
+ // Example 1: RBAC Integration
16
+ // ==========================================
17
+ /**
18
+ * Example: Endpoint with RBAC Permission Requirements
19
+ *
20
+ * The gateway automatically validates these permissions before
21
+ * allowing the request to proceed.
22
+ */
23
+ const endpointWithRBAC = registry_zod_1.ApiEndpointRegistration.create({
24
+ id: 'get_customer_by_id',
25
+ method: 'GET',
26
+ path: '/api/v1/customers/:id',
27
+ summary: 'Get customer by ID',
28
+ description: 'Retrieves a customer record with RBAC protection',
29
+ // RBAC Integration: Permissions checked at gateway level
30
+ requiredPermissions: ['customer.read'],
31
+ parameters: [
32
+ {
33
+ name: 'id',
34
+ in: 'path',
35
+ required: true,
36
+ schema: {
37
+ type: 'string',
38
+ format: 'uuid',
39
+ },
40
+ },
41
+ ],
42
+ responses: [
43
+ {
44
+ statusCode: 200,
45
+ description: 'Customer found',
46
+ },
47
+ {
48
+ statusCode: 403,
49
+ description: 'Permission denied - customer.read required',
50
+ },
51
+ ],
52
+ });
53
+ exports.endpointWithRBAC = endpointWithRBAC;
54
+ /**
55
+ * Example: Admin Endpoint with Multiple Permissions
56
+ *
57
+ * All listed permissions must be satisfied (AND logic).
58
+ */
59
+ const adminEndpoint = registry_zod_1.ApiEndpointRegistration.create({
60
+ id: 'bulk_update_customers',
61
+ method: 'POST',
62
+ path: '/api/v1/admin/customers/bulk-update',
63
+ summary: 'Bulk update customers',
64
+ // Multiple permissions required
65
+ requiredPermissions: [
66
+ 'customer.modifyAll', // Can modify all customer records
67
+ 'api_enabled', // API access enabled
68
+ ],
69
+ responses: [],
70
+ });
71
+ exports.adminEndpoint = adminEndpoint;
72
+ // ==========================================
73
+ // Example 2: Dynamic Schema Linking
74
+ // ==========================================
75
+ /**
76
+ * Example: Response with ObjectQL Reference
77
+ *
78
+ * Instead of duplicating the customer schema, we reference
79
+ * the ObjectQL object definition. When the object schema changes,
80
+ * the API documentation automatically updates.
81
+ */
82
+ const endpointWithDynamicSchema = registry_zod_1.ApiEndpointRegistration.create({
83
+ id: 'get_customer_dynamic',
84
+ method: 'GET',
85
+ path: '/api/v1/customers/:id',
86
+ summary: 'Get customer (with dynamic schema)',
87
+ parameters: [
88
+ {
89
+ name: 'id',
90
+ in: 'path',
91
+ required: true,
92
+ schema: {
93
+ type: 'string',
94
+ },
95
+ },
96
+ ],
97
+ responses: [
98
+ {
99
+ statusCode: 200,
100
+ description: 'Customer retrieved successfully',
101
+ // Dynamic schema reference - auto-updates when object changes
102
+ schema: {
103
+ $ref: {
104
+ objectId: 'customer',
105
+ // Exclude sensitive fields from API response
106
+ excludeFields: ['password_hash', 'internal_notes'],
107
+ },
108
+ },
109
+ },
110
+ ],
111
+ });
112
+ exports.endpointWithDynamicSchema = endpointWithDynamicSchema;
113
+ /**
114
+ * Example: Request Body with ObjectQL Reference
115
+ *
116
+ * The request body schema references the customer object,
117
+ * but only includes specific fields allowed for creation.
118
+ */
119
+ const createEndpointWithDynamicSchema = registry_zod_1.ApiEndpointRegistration.create({
120
+ id: 'create_customer_dynamic',
121
+ method: 'POST',
122
+ path: '/api/v1/customers',
123
+ summary: 'Create customer (with dynamic schema)',
124
+ requestBody: {
125
+ description: 'Customer data',
126
+ required: true,
127
+ schema: {
128
+ $ref: {
129
+ objectId: 'customer',
130
+ // Only allow these fields in creation
131
+ includeFields: ['name', 'email', 'phone', 'company'],
132
+ },
133
+ },
134
+ },
135
+ responses: [
136
+ {
137
+ statusCode: 201,
138
+ description: 'Customer created',
139
+ schema: {
140
+ $ref: {
141
+ objectId: 'customer',
142
+ excludeFields: ['password_hash'],
143
+ },
144
+ },
145
+ },
146
+ ],
147
+ });
148
+ exports.createEndpointWithDynamicSchema = createEndpointWithDynamicSchema;
149
+ /**
150
+ * Example: Complex Schema with Related Objects
151
+ *
152
+ * Include related objects via lookup fields for a complete response.
153
+ */
154
+ const orderWithRelations = registry_zod_1.ApiEndpointRegistration.create({
155
+ id: 'get_order_with_relations',
156
+ method: 'GET',
157
+ path: '/api/v1/orders/:id',
158
+ summary: 'Get order with customer and items',
159
+ parameters: [
160
+ {
161
+ name: 'id',
162
+ in: 'path',
163
+ required: true,
164
+ schema: { type: 'string' },
165
+ },
166
+ ],
167
+ responses: [
168
+ {
169
+ statusCode: 200,
170
+ description: 'Order with related objects',
171
+ schema: {
172
+ $ref: {
173
+ objectId: 'order',
174
+ // Include related customer and order items
175
+ includeRelated: ['customer', 'items'],
176
+ },
177
+ },
178
+ },
179
+ ],
180
+ });
181
+ exports.orderWithRelations = orderWithRelations;
182
+ // ==========================================
183
+ // Example 3: Protocol Extensibility
184
+ // ==========================================
185
+ /**
186
+ * Example: gRPC Service Endpoint
187
+ *
188
+ * Plugin-registered gRPC service with protocol-specific configuration.
189
+ */
190
+ const grpcEndpoint = registry_zod_1.ApiEndpointRegistration.create({
191
+ id: 'grpc_get_customer',
192
+ path: '/grpc/CustomerService/GetCustomer',
193
+ summary: 'gRPC: Get Customer',
194
+ // Protocol-specific configuration for gRPC
195
+ protocolConfig: {
196
+ subProtocol: 'grpc',
197
+ serviceName: 'CustomerService',
198
+ methodName: 'GetCustomer',
199
+ streaming: false,
200
+ packageName: 'objectstack.customer.v1',
201
+ },
202
+ responses: [],
203
+ });
204
+ exports.grpcEndpoint = grpcEndpoint;
205
+ /**
206
+ * Example: tRPC Procedure
207
+ *
208
+ * tRPC query with procedure-specific metadata.
209
+ */
210
+ const trpcEndpoint = registry_zod_1.ApiEndpointRegistration.create({
211
+ id: 'trpc_customer_get_by_id',
212
+ path: '/trpc/customer.getById',
213
+ summary: 'tRPC: Get Customer by ID',
214
+ // tRPC-specific configuration
215
+ protocolConfig: {
216
+ subProtocol: 'trpc',
217
+ procedureType: 'query',
218
+ router: 'customer',
219
+ procedureName: 'getById',
220
+ },
221
+ responses: [],
222
+ });
223
+ exports.trpcEndpoint = trpcEndpoint;
224
+ /**
225
+ * Example: WebSocket Event
226
+ *
227
+ * Real-time event with WebSocket-specific metadata.
228
+ */
229
+ const websocketEndpoint = registry_zod_1.ApiEndpointRegistration.create({
230
+ id: 'ws_customer_updated',
231
+ path: '/ws/events/customer.updated',
232
+ summary: 'WebSocket: Customer Updated Event',
233
+ // WebSocket-specific configuration
234
+ protocolConfig: {
235
+ subProtocol: 'websocket',
236
+ eventName: 'customer.updated',
237
+ direction: 'server-to-client',
238
+ requiresAuth: true,
239
+ room: 'customer_updates',
240
+ },
241
+ responses: [],
242
+ });
243
+ exports.websocketEndpoint = websocketEndpoint;
244
+ // ==========================================
245
+ // Example 4: Route Priority & Conflict Resolution
246
+ // ==========================================
247
+ /**
248
+ * Example: High Priority Core Endpoint
249
+ *
250
+ * Core system endpoints should have high priority (900-1000)
251
+ * to ensure they're registered before plugin endpoints.
252
+ */
253
+ const coreEndpoint = registry_zod_1.ApiEndpointRegistration.create({
254
+ id: 'core_data_operation',
255
+ method: 'GET',
256
+ path: '/api/v1/data/:object/:id',
257
+ summary: 'Core data operation',
258
+ // High priority for core system endpoint
259
+ priority: 950,
260
+ responses: [],
261
+ });
262
+ exports.coreEndpoint = coreEndpoint;
263
+ /**
264
+ * Example: Medium Priority Plugin Endpoint
265
+ *
266
+ * Plugin endpoints should have medium priority (100-500).
267
+ */
268
+ const pluginEndpoint = registry_zod_1.ApiEndpointRegistration.create({
269
+ id: 'plugin_custom_action',
270
+ method: 'POST',
271
+ path: '/api/v1/custom/action',
272
+ summary: 'Plugin custom action',
273
+ // Medium priority for plugin endpoint
274
+ priority: 300,
275
+ protocolConfig: {
276
+ pluginId: 'custom_actions_plugin',
277
+ },
278
+ responses: [],
279
+ });
280
+ exports.pluginEndpoint = pluginEndpoint;
281
+ /**
282
+ * Example: Low Priority Fallback Endpoint
283
+ *
284
+ * Fallback or catch-all endpoints should have low priority (0-100).
285
+ */
286
+ const fallbackEndpoint = registry_zod_1.ApiEndpointRegistration.create({
287
+ id: 'fallback_handler',
288
+ method: 'GET',
289
+ path: '/api/*',
290
+ summary: 'Fallback handler',
291
+ // Low priority for fallback endpoint
292
+ priority: 50,
293
+ responses: [
294
+ {
295
+ statusCode: 404,
296
+ description: 'Not found',
297
+ },
298
+ ],
299
+ });
300
+ exports.fallbackEndpoint = fallbackEndpoint;
301
+ // ==========================================
302
+ // Example 5: Complete Registry with Conflict Resolution
303
+ // ==========================================
304
+ /**
305
+ * Example: Complete Registry with Priority-based Conflict Resolution
306
+ *
307
+ * When multiple endpoints have overlapping routes, the priority field
308
+ * determines which endpoint wins.
309
+ */
310
+ const completeRegistry = registry_zod_1.ApiRegistry.create({
311
+ version: '1.0.0',
312
+ // Use priority-based conflict resolution
313
+ conflictResolution: 'priority',
314
+ apis: [
315
+ // Core REST API (high priority endpoints)
316
+ registry_zod_1.ApiRegistryEntry.create({
317
+ id: 'core_rest_api',
318
+ name: 'Core REST API',
319
+ type: 'rest',
320
+ version: 'v1',
321
+ basePath: '/api/v1',
322
+ description: 'Core system REST API',
323
+ endpoints: [
324
+ coreEndpoint,
325
+ ],
326
+ metadata: {
327
+ owner: 'platform_team',
328
+ status: 'active',
329
+ },
330
+ }),
331
+ // Plugin API (medium priority endpoints)
332
+ registry_zod_1.ApiRegistryEntry.create({
333
+ id: 'plugin_api',
334
+ name: 'Custom Actions Plugin API',
335
+ type: 'plugin',
336
+ version: '1.0.0',
337
+ basePath: '/api/v1/custom',
338
+ description: 'Custom actions provided by plugin',
339
+ endpoints: [
340
+ pluginEndpoint,
341
+ ],
342
+ metadata: {
343
+ owner: 'plugin_team',
344
+ status: 'active',
345
+ pluginSource: 'custom_actions_plugin',
346
+ },
347
+ }),
348
+ // gRPC API
349
+ registry_zod_1.ApiRegistryEntry.create({
350
+ id: 'grpc_api',
351
+ name: 'gRPC API',
352
+ type: 'plugin',
353
+ version: '1.0.0',
354
+ basePath: '/grpc',
355
+ description: 'gRPC services',
356
+ endpoints: [
357
+ grpcEndpoint,
358
+ ],
359
+ config: {
360
+ grpcVersion: '1.0.0',
361
+ reflection: true,
362
+ },
363
+ metadata: {
364
+ status: 'beta',
365
+ },
366
+ }),
367
+ ],
368
+ totalApis: 3,
369
+ totalEndpoints: 3,
370
+ });
371
+ exports.completeRegistry = completeRegistry;
372
+ // ==========================================
373
+ // Example 6: Complete Endpoint with All Features
374
+ // ==========================================
375
+ /**
376
+ * Example: Production-ready Endpoint with All Enhancements
377
+ *
378
+ * This example combines all four enhancements:
379
+ * - RBAC permissions
380
+ * - Dynamic schema linking
381
+ * - Protocol configuration
382
+ * - Route priority
383
+ */
384
+ const productionEndpoint = registry_zod_1.ApiEndpointRegistration.create({
385
+ id: 'get_customer_full_featured',
386
+ method: 'GET',
387
+ path: '/api/v1/customers/:id',
388
+ summary: 'Get customer by ID (full-featured)',
389
+ description: 'Production-ready endpoint with all enhancements',
390
+ operationId: 'getCustomerById',
391
+ tags: ['customer', 'crm', 'public'],
392
+ // 1. RBAC Integration
393
+ requiredPermissions: ['customer.read'],
394
+ // 2. Route Priority
395
+ priority: 500,
396
+ // 3. Protocol Configuration
397
+ protocolConfig: {
398
+ cacheEnabled: true,
399
+ cacheTtl: 300, // 5 minutes
400
+ rateLimitPerMinute: 100,
401
+ },
402
+ // Standard OpenAPI security (in addition to RBAC)
403
+ security: [
404
+ {
405
+ type: 'http',
406
+ scheme: 'bearer',
407
+ },
408
+ ],
409
+ parameters: [
410
+ {
411
+ name: 'id',
412
+ in: 'path',
413
+ description: 'Customer ID',
414
+ required: true,
415
+ schema: {
416
+ type: 'string',
417
+ format: 'uuid',
418
+ },
419
+ example: '123e4567-e89b-12d3-a456-426614174000',
420
+ },
421
+ {
422
+ name: 'include',
423
+ in: 'query',
424
+ description: 'Related objects to include',
425
+ required: false,
426
+ schema: {
427
+ type: 'array',
428
+ items: { type: 'string' },
429
+ enum: ['orders', 'contacts', 'activities'],
430
+ },
431
+ },
432
+ ],
433
+ // 4. Dynamic Schema Linking
434
+ responses: [
435
+ {
436
+ statusCode: 200,
437
+ description: 'Customer found',
438
+ schema: {
439
+ $ref: {
440
+ objectId: 'customer',
441
+ excludeFields: ['password_hash', 'internal_notes'],
442
+ includeRelated: ['account'],
443
+ },
444
+ },
445
+ example: {
446
+ id: '123e4567-e89b-12d3-a456-426614174000',
447
+ name: 'Acme Corporation',
448
+ email: 'contact@acme.com',
449
+ phone: '+1-555-0100',
450
+ account: {
451
+ id: 'acc-001',
452
+ name: 'Acme Account',
453
+ },
454
+ },
455
+ },
456
+ {
457
+ statusCode: 404,
458
+ description: 'Customer not found',
459
+ },
460
+ {
461
+ statusCode: 403,
462
+ description: 'Permission denied',
463
+ },
464
+ ],
465
+ externalDocs: {
466
+ description: 'Customer API Documentation',
467
+ url: 'https://docs.objectstack.ai/api/customers',
468
+ },
469
+ });
470
+ exports.productionEndpoint = productionEndpoint;