@objectstack/spec 0.2.0 → 0.3.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 (103) hide show
  1. package/README.md +127 -5
  2. package/dist/ai/index.d.ts +14 -0
  3. package/dist/ai/index.d.ts.map +1 -0
  4. package/dist/ai/index.js +29 -0
  5. package/dist/ai/model-registry.zod.d.ts +1389 -0
  6. package/dist/ai/model-registry.zod.d.ts.map +1 -0
  7. package/dist/ai/model-registry.zod.js +164 -0
  8. package/dist/ai/nlq.zod.d.ts +1126 -0
  9. package/dist/ai/nlq.zod.d.ts.map +1 -0
  10. package/dist/ai/nlq.zod.js +246 -0
  11. package/dist/ai/rag-pipeline.zod.d.ts +1034 -0
  12. package/dist/ai/rag-pipeline.zod.d.ts.map +1 -0
  13. package/dist/ai/rag-pipeline.zod.js +244 -0
  14. package/dist/api/index.d.ts +9 -0
  15. package/dist/api/index.d.ts.map +1 -0
  16. package/dist/api/index.js +24 -0
  17. package/dist/data/index.d.ts +21 -0
  18. package/dist/data/index.d.ts.map +1 -0
  19. package/dist/data/index.js +36 -0
  20. package/dist/data/query.zod.d.ts +386 -3
  21. package/dist/data/query.zod.d.ts.map +1 -1
  22. package/dist/data/query.zod.js +386 -3
  23. package/dist/data/validation.zod.d.ts +349 -0
  24. package/dist/data/validation.zod.d.ts.map +1 -1
  25. package/dist/data/validation.zod.js +395 -0
  26. package/dist/index.d.ts +36 -41
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +64 -49
  29. package/dist/system/auth-protocol.d.ts +175 -0
  30. package/dist/system/auth-protocol.d.ts.map +1 -0
  31. package/dist/system/auth-protocol.js +60 -0
  32. package/dist/system/auth.zod.d.ts +1097 -65
  33. package/dist/system/auth.zod.d.ts.map +1 -1
  34. package/dist/system/auth.zod.js +135 -1
  35. package/dist/system/identity.zod.d.ts +234 -180
  36. package/dist/system/identity.zod.d.ts.map +1 -1
  37. package/dist/system/identity.zod.js +168 -51
  38. package/dist/system/index.d.ts +28 -0
  39. package/dist/system/index.d.ts.map +1 -0
  40. package/dist/system/index.js +43 -0
  41. package/dist/system/manifest.zod.d.ts +10 -10
  42. package/dist/system/organization.zod.d.ts +179 -0
  43. package/dist/system/organization.zod.d.ts.map +1 -0
  44. package/dist/system/organization.zod.js +129 -0
  45. package/dist/ui/action.zod.d.ts +2 -2
  46. package/dist/ui/index.d.ts +17 -0
  47. package/dist/ui/index.d.ts.map +1 -0
  48. package/dist/ui/index.js +32 -0
  49. package/dist/ui/theme.zod.d.ts +6 -6
  50. package/json-schema/Account.json +87 -0
  51. package/json-schema/AuthConfig.json +235 -0
  52. package/json-schema/ChunkingStrategy.json +133 -0
  53. package/json-schema/DatabaseMapping.json +48 -0
  54. package/json-schema/DocumentChunk.json +97 -0
  55. package/json-schema/DocumentLoaderConfig.json +69 -0
  56. package/json-schema/DocumentMetadata.json +61 -0
  57. package/json-schema/EmbeddingModel.json +57 -0
  58. package/json-schema/EnterpriseAuthConfig.json +172 -0
  59. package/json-schema/Entity.json +55 -0
  60. package/json-schema/FieldSynonymConfig.json +39 -0
  61. package/json-schema/Invitation.json +69 -0
  62. package/json-schema/InvitationStatus.json +15 -0
  63. package/json-schema/LDAPConfig.json +22 -5
  64. package/json-schema/Member.json +46 -0
  65. package/json-schema/ModelCapability.json +47 -0
  66. package/json-schema/ModelConfig.json +181 -0
  67. package/json-schema/ModelLimits.json +45 -0
  68. package/json-schema/ModelPricing.json +28 -0
  69. package/json-schema/ModelProvider.json +19 -0
  70. package/json-schema/ModelRegistry.json +427 -0
  71. package/json-schema/ModelRegistryEntry.json +239 -0
  72. package/json-schema/ModelSelectionCriteria.json +50 -0
  73. package/json-schema/NLQAnalytics.json +106 -0
  74. package/json-schema/NLQFieldMapping.json +40 -0
  75. package/json-schema/NLQModelConfig.json +78 -0
  76. package/json-schema/NLQParseResult.json +252 -0
  77. package/json-schema/NLQRequest.json +110 -0
  78. package/json-schema/NLQResponse.json +288 -0
  79. package/json-schema/NLQTrainingExample.json +120 -0
  80. package/json-schema/OIDCConfig.json +18 -3
  81. package/json-schema/Organization.json +52 -0
  82. package/json-schema/PromptTemplate.json +163 -0
  83. package/json-schema/PromptVariable.json +56 -0
  84. package/json-schema/QueryContext.json +72 -0
  85. package/json-schema/QueryIntent.json +21 -0
  86. package/json-schema/QueryTemplate.json +81 -0
  87. package/json-schema/RAGPipelineConfig.json +552 -0
  88. package/json-schema/RAGPipelineStatus.json +66 -0
  89. package/json-schema/RAGQueryRequest.json +64 -0
  90. package/json-schema/RAGQueryResponse.json +108 -0
  91. package/json-schema/RerankingConfig.json +34 -0
  92. package/json-schema/RetrievalStrategy.json +121 -0
  93. package/json-schema/SAMLConfig.json +17 -3
  94. package/json-schema/Session.json +63 -0
  95. package/json-schema/StandardAuthProvider.json +235 -0
  96. package/json-schema/Timeframe.json +68 -0
  97. package/json-schema/User.json +51 -0
  98. package/json-schema/VectorStoreConfig.json +82 -0
  99. package/json-schema/VectorStoreProvider.json +21 -0
  100. package/json-schema/VerificationToken.json +36 -0
  101. package/package.json +27 -1
  102. package/json-schema/AuthProtocol.json +0 -17
  103. package/json-schema/AuthProvider.json +0 -171
@@ -2,8 +2,54 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConditionalValidationSchema = exports.ValidationRuleSchema = exports.CustomValidatorSchema = exports.AsyncValidationSchema = exports.CrossFieldValidationSchema = exports.FormatValidationSchema = exports.StateMachineValidationSchema = exports.UniquenessValidationSchema = exports.ScriptValidationSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ /**
6
+ * # ObjectStack Validation Protocol
7
+ *
8
+ * This module defines the validation schema protocol for ObjectStack, providing a comprehensive
9
+ * type-safe validation system similar to Salesforce's validation rules but with enhanced capabilities.
10
+ *
11
+ * ## Overview
12
+ *
13
+ * Validation rules are applied at the data layer to ensure data integrity and enforce business logic.
14
+ * The system supports multiple validation types:
15
+ *
16
+ * 1. **Script Validation**: Formula-based validation using expressions
17
+ * 2. **Uniqueness Validation**: Enforce unique constraints across fields
18
+ * 3. **State Machine Validation**: Control allowed state transitions
19
+ * 4. **Format Validation**: Validate field formats (email, URL, regex, etc.)
20
+ * 5. **Cross-Field Validation**: Validate relationships between multiple fields
21
+ * 6. **Async Validation**: Remote validation via API calls
22
+ * 7. **Custom Validation**: User-defined validation functions
23
+ * 8. **Conditional Validation**: Apply validations based on conditions
24
+ *
25
+ * ## Salesforce Comparison
26
+ *
27
+ * ObjectStack validation rules are inspired by Salesforce validation rules but enhanced:
28
+ * - Salesforce: Formula-based validation with `Error Condition Formula`
29
+ * - ObjectStack: Multiple validation types with composable rules
30
+ *
31
+ * Example Salesforce validation rule:
32
+ * ```
33
+ * Rule Name: Discount_Cannot_Exceed_40_Percent
34
+ * Error Condition Formula: Discount_Percent__c > 0.40
35
+ * Error Message: Discount cannot exceed 40%.
36
+ * ```
37
+ *
38
+ * Equivalent ObjectStack rule:
39
+ * ```typescript
40
+ * {
41
+ * type: 'script',
42
+ * name: 'discount_cannot_exceed_40_percent',
43
+ * condition: 'discount_percent > 0.40',
44
+ * message: 'Discount cannot exceed 40%',
45
+ * severity: 'error'
46
+ * }
47
+ * ```
48
+ */
5
49
  /**
6
50
  * Base Validation Rule
51
+ *
52
+ * All validation rules extend from this base schema with common properties.
7
53
  */
8
54
  const BaseValidationSchema = zod_1.z.object({
9
55
  name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique rule name'),
@@ -51,6 +97,65 @@ exports.FormatValidationSchema = BaseValidationSchema.extend({
51
97
  /**
52
98
  * 5. Cross-Field Validation
53
99
  * Validates relationships between multiple fields.
100
+ *
101
+ * ## Use Cases
102
+ * - Date range validations (end_date > start_date)
103
+ * - Amount comparisons (discount < total)
104
+ * - Complex business rules involving multiple fields
105
+ *
106
+ * ## Salesforce Examples
107
+ *
108
+ * ### Example 1: Close Date Must Be In Current or Future Month
109
+ * **Salesforce Formula:**
110
+ * ```
111
+ * MONTH(CloseDate) < MONTH(TODAY()) ||
112
+ * YEAR(CloseDate) < YEAR(TODAY())
113
+ * ```
114
+ *
115
+ * **ObjectStack Equivalent:**
116
+ * ```typescript
117
+ * {
118
+ * type: 'cross_field',
119
+ * name: 'close_date_future',
120
+ * condition: 'MONTH(close_date) >= MONTH(TODAY()) AND YEAR(close_date) >= YEAR(TODAY())',
121
+ * fields: ['close_date'],
122
+ * message: 'Close Date must be in the current or a future month'
123
+ * }
124
+ * ```
125
+ *
126
+ * ### Example 2: Discount Validation
127
+ * **Salesforce Formula:**
128
+ * ```
129
+ * Discount__c > (Amount__c * 0.40)
130
+ * ```
131
+ *
132
+ * **ObjectStack Equivalent:**
133
+ * ```typescript
134
+ * {
135
+ * type: 'cross_field',
136
+ * name: 'discount_limit',
137
+ * condition: 'discount > (amount * 0.40)',
138
+ * fields: ['discount', 'amount'],
139
+ * message: 'Discount cannot exceed 40% of the amount'
140
+ * }
141
+ * ```
142
+ *
143
+ * ### Example 3: Opportunity Must Have Products
144
+ * **Salesforce Formula:**
145
+ * ```
146
+ * ISBLANK(Products__c) && ISPICKVAL(StageName, "Closed Won")
147
+ * ```
148
+ *
149
+ * **ObjectStack Equivalent:**
150
+ * ```typescript
151
+ * {
152
+ * type: 'cross_field',
153
+ * name: 'products_required_for_won',
154
+ * condition: 'products = null AND stage = "closed_won"',
155
+ * fields: ['products', 'stage'],
156
+ * message: 'Opportunity must have products to be marked as Closed Won'
157
+ * }
158
+ * ```
54
159
  */
55
160
  exports.CrossFieldValidationSchema = BaseValidationSchema.extend({
56
161
  type: zod_1.z.literal('cross_field'),
@@ -60,6 +165,124 @@ exports.CrossFieldValidationSchema = BaseValidationSchema.extend({
60
165
  /**
61
166
  * 6. Async Validation
62
167
  * Remote validation via API call or database query.
168
+ *
169
+ * ## Use Cases
170
+ *
171
+ * ### 1. Email Uniqueness Check
172
+ * Check if an email address is already registered in the system.
173
+ * ```typescript
174
+ * {
175
+ * type: 'async',
176
+ * name: 'unique_email',
177
+ * field: 'email',
178
+ * validatorUrl: '/api/users/check-email',
179
+ * message: 'This email address is already registered',
180
+ * debounce: 500, // Wait 500ms after user stops typing
181
+ * timeout: 3000
182
+ * }
183
+ * ```
184
+ *
185
+ * ### 2. Username Availability
186
+ * Verify username is available before form submission.
187
+ * ```typescript
188
+ * {
189
+ * type: 'async',
190
+ * name: 'username_available',
191
+ * field: 'username',
192
+ * validatorUrl: '/api/users/check-username',
193
+ * message: 'This username is already taken',
194
+ * debounce: 300,
195
+ * timeout: 2000
196
+ * }
197
+ * ```
198
+ *
199
+ * ### 3. Tax ID Validation
200
+ * Validate tax ID with government API (e.g., IRS, HMRC).
201
+ * ```typescript
202
+ * {
203
+ * type: 'async',
204
+ * name: 'validate_tax_id',
205
+ * field: 'tax_id',
206
+ * validatorFunction: 'validateTaxIdWithIRS',
207
+ * message: 'Invalid Tax ID number',
208
+ * timeout: 10000, // Government APIs may be slow
209
+ * params: { country: 'US', format: 'EIN' }
210
+ * }
211
+ * ```
212
+ *
213
+ * ### 4. Credit Card Validation
214
+ * Verify credit card with payment gateway without charging.
215
+ * ```typescript
216
+ * {
217
+ * type: 'async',
218
+ * name: 'validate_card',
219
+ * field: 'card_number',
220
+ * validatorUrl: 'https://api.stripe.com/v1/tokens/validate',
221
+ * message: 'Invalid credit card number',
222
+ * timeout: 5000,
223
+ * params: {
224
+ * mode: 'validate_only',
225
+ * checkFunds: false
226
+ * }
227
+ * }
228
+ * ```
229
+ *
230
+ * ### 5. Address Validation
231
+ * Validate and standardize addresses using geocoding services.
232
+ * ```typescript
233
+ * {
234
+ * type: 'async',
235
+ * name: 'validate_address',
236
+ * field: 'street_address',
237
+ * validatorFunction: 'validateAddressWithGoogleMaps',
238
+ * message: 'Unable to verify address',
239
+ * timeout: 4000,
240
+ * params: {
241
+ * includeFields: ['city', 'state', 'zip'],
242
+ * strictMode: true,
243
+ * country: 'US'
244
+ * }
245
+ * }
246
+ * ```
247
+ *
248
+ * ### 6. Domain Name Availability
249
+ * Check if domain name is available for registration.
250
+ * ```typescript
251
+ * {
252
+ * type: 'async',
253
+ * name: 'domain_available',
254
+ * field: 'domain_name',
255
+ * validatorUrl: '/api/domains/check-availability',
256
+ * message: 'This domain is already taken or reserved',
257
+ * debounce: 500,
258
+ * timeout: 2000
259
+ * }
260
+ * ```
261
+ *
262
+ * ### 7. Coupon Code Validation
263
+ * Verify coupon code is valid and not expired.
264
+ * ```typescript
265
+ * {
266
+ * type: 'async',
267
+ * name: 'validate_coupon',
268
+ * field: 'coupon_code',
269
+ * validatorUrl: '/api/coupons/validate',
270
+ * message: 'Invalid or expired coupon code',
271
+ * timeout: 2000,
272
+ * params: {
273
+ * checkExpiration: true,
274
+ * checkUsageLimit: true,
275
+ * userId: '{{current_user_id}}'
276
+ * }
277
+ * }
278
+ * ```
279
+ *
280
+ * ## Best Practices
281
+ * - Always set a reasonable `timeout` (default is 5000ms)
282
+ * - Use `debounce` for fields that are typed (300-500ms recommended)
283
+ * - Implement proper error handling on the server side
284
+ * - Cache validation results when appropriate
285
+ * - Consider rate limiting for external API calls
63
286
  */
64
287
  exports.AsyncValidationSchema = BaseValidationSchema.extend({
65
288
  type: zod_1.z.literal('async'),
@@ -96,6 +319,178 @@ exports.ValidationRuleSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('ty
96
319
  /**
97
320
  * 8. Conditional Validation
98
321
  * Validation that only applies when a condition is met.
322
+ *
323
+ * ## Overview
324
+ * Conditional validations follow the pattern: "Validate X only if Y is true"
325
+ * This allows for context-aware validation rules that adapt to different scenarios.
326
+ *
327
+ * ## Use Cases
328
+ *
329
+ * ### 1. Validate Based on Record Type
330
+ * Apply different validation rules based on the type of record.
331
+ * ```typescript
332
+ * {
333
+ * type: 'conditional',
334
+ * name: 'enterprise_approval_required',
335
+ * when: 'account_type = "enterprise"',
336
+ * message: 'Enterprise validation',
337
+ * then: {
338
+ * type: 'script',
339
+ * name: 'require_approval',
340
+ * message: 'Enterprise accounts require manager approval',
341
+ * condition: 'approval_status = null'
342
+ * }
343
+ * }
344
+ * ```
345
+ *
346
+ * ### 2. Conditional Field Requirements
347
+ * Require certain fields only when specific conditions are met.
348
+ * ```typescript
349
+ * {
350
+ * type: 'conditional',
351
+ * name: 'shipping_address_when_required',
352
+ * when: 'requires_shipping = true',
353
+ * message: 'Shipping validation',
354
+ * then: {
355
+ * type: 'script',
356
+ * name: 'shipping_address_required',
357
+ * message: 'Shipping address is required for physical products',
358
+ * condition: 'shipping_address = null OR shipping_address = ""'
359
+ * }
360
+ * }
361
+ * ```
362
+ *
363
+ * ### 3. Amount-Based Validation
364
+ * Apply different rules based on transaction amount.
365
+ * ```typescript
366
+ * {
367
+ * type: 'conditional',
368
+ * name: 'high_value_approval',
369
+ * when: 'order_total > 10000',
370
+ * message: 'High value order validation',
371
+ * then: {
372
+ * type: 'script',
373
+ * name: 'manager_approval_required',
374
+ * message: 'Orders over $10,000 require manager approval',
375
+ * condition: 'manager_approval_id = null'
376
+ * },
377
+ * otherwise: {
378
+ * type: 'script',
379
+ * name: 'standard_validation',
380
+ * message: 'Payment method is required',
381
+ * condition: 'payment_method = null'
382
+ * }
383
+ * }
384
+ * ```
385
+ *
386
+ * ### 4. Regional Compliance
387
+ * Apply region-specific validation rules.
388
+ * ```typescript
389
+ * {
390
+ * type: 'conditional',
391
+ * name: 'regional_compliance',
392
+ * when: 'region = "EU"',
393
+ * message: 'EU compliance validation',
394
+ * then: {
395
+ * type: 'script',
396
+ * name: 'gdpr_consent',
397
+ * message: 'GDPR consent is required for EU customers',
398
+ * condition: 'gdpr_consent_given = false'
399
+ * },
400
+ * otherwise: {
401
+ * type: 'script',
402
+ * name: 'tos_acceptance',
403
+ * message: 'Terms of Service acceptance required',
404
+ * condition: 'tos_accepted = false'
405
+ * }
406
+ * }
407
+ * ```
408
+ *
409
+ * ### 5. Nested Conditional Validation
410
+ * Create complex validation logic with nested conditions.
411
+ * ```typescript
412
+ * {
413
+ * type: 'conditional',
414
+ * name: 'country_state_validation',
415
+ * when: 'country = "US"',
416
+ * message: 'US-specific validation',
417
+ * then: {
418
+ * type: 'conditional',
419
+ * name: 'california_validation',
420
+ * when: 'state = "CA"',
421
+ * message: 'California-specific validation',
422
+ * then: {
423
+ * type: 'script',
424
+ * name: 'ca_tax_id_required',
425
+ * message: 'California requires a valid tax ID',
426
+ * condition: 'tax_id = null OR NOT(REGEX(tax_id, "^\\d{2}-\\d{7}$"))'
427
+ * }
428
+ * }
429
+ * }
430
+ * ```
431
+ *
432
+ * ### 6. Tax Validation for Taxable Items
433
+ * Only validate tax fields when the item is taxable.
434
+ * ```typescript
435
+ * {
436
+ * type: 'conditional',
437
+ * name: 'tax_field_validation',
438
+ * when: 'is_taxable = true',
439
+ * message: 'Tax validation',
440
+ * then: {
441
+ * type: 'script',
442
+ * name: 'tax_code_required',
443
+ * message: 'Tax code is required for taxable items',
444
+ * condition: 'tax_code = null OR tax_code = ""'
445
+ * }
446
+ * }
447
+ * ```
448
+ *
449
+ * ### 7. Role-Based Validation
450
+ * Apply validation based on user role.
451
+ * ```typescript
452
+ * {
453
+ * type: 'conditional',
454
+ * name: 'role_based_approval_limit',
455
+ * when: 'user_role = "manager"',
456
+ * message: 'Manager approval limits',
457
+ * then: {
458
+ * type: 'script',
459
+ * name: 'manager_limit',
460
+ * message: 'Managers can approve up to $50,000',
461
+ * condition: 'approval_amount > 50000'
462
+ * }
463
+ * }
464
+ * ```
465
+ *
466
+ * ## Salesforce Pattern Comparison
467
+ *
468
+ * Salesforce doesn't have explicit "conditional validation" rules but achieves similar
469
+ * behavior using formula logic. ObjectStack makes this pattern explicit and composable.
470
+ *
471
+ * **Salesforce Approach:**
472
+ * ```
473
+ * IF(
474
+ * ISPICKVAL(Type, "Enterprise"),
475
+ * AND(Amount > 100000, ISBLANK(Approval__c)),
476
+ * FALSE
477
+ * )
478
+ * ```
479
+ *
480
+ * **ObjectStack Approach:**
481
+ * ```typescript
482
+ * {
483
+ * type: 'conditional',
484
+ * name: 'enterprise_high_value',
485
+ * when: 'type = "enterprise"',
486
+ * then: {
487
+ * type: 'cross_field',
488
+ * name: 'amount_approval',
489
+ * condition: 'amount > 100000 AND approval = null',
490
+ * fields: ['amount', 'approval']
491
+ * }
492
+ * }
493
+ * ```
99
494
  */
100
495
  exports.ConditionalValidationSchema = BaseValidationSchema.extend({
101
496
  type: zod_1.z.literal('conditional'),
package/dist/index.d.ts CHANGED
@@ -3,46 +3,41 @@
3
3
  *
4
4
  * ObjectStack Protocol & Specification
5
5
  *
6
- * This package contains the core interfaces, schemas, and conventions for the ObjectStack ecosystem.
7
- * All types and schemas are centralized here.
6
+ * This package does NOT export types at the root level to prevent naming conflicts.
7
+ * Please use namespaced imports or subpath imports.
8
+ *
9
+ * ## Import Styles
10
+ *
11
+ * ### Style 1: Namespace Imports from Root
12
+ * ```typescript
13
+ * import { Data, UI, System, AI, API } from '@objectstack/spec';
14
+ *
15
+ * const field: Data.Field = { name: 'task_name', type: 'text' };
16
+ * const user: System.User = { id: 'u1', email: 'user@example.com' };
17
+ * ```
18
+ *
19
+ * ### Style 2: Namespace Imports via Subpath
20
+ * ```typescript
21
+ * import * as Data from '@objectstack/spec/data';
22
+ * import * as UI from '@objectstack/spec/ui';
23
+ * import * as System from '@objectstack/spec/system';
24
+ *
25
+ * const field: Data.Field = { name: 'task_name', type: 'text' };
26
+ * const user: System.User = { id: 'u1', email: 'user@example.com' };
27
+ * ```
28
+ *
29
+ * ### Style 3: Direct Subpath Imports
30
+ * ```typescript
31
+ * import { Field, FieldType } from '@objectstack/spec/data';
32
+ * import { User, Session } from '@objectstack/spec/system';
33
+ *
34
+ * const field: Field = { name: 'task_name', type: 'text' };
35
+ * const user: User = { id: 'u1', email: 'user@example.com' };
36
+ * ```
8
37
  */
9
- export * from './data/field.zod';
10
- export * from './data/object.zod';
11
- export * from './data/validation.zod';
12
- export * from './data/permission.zod';
13
- export * from './data/sharing.zod';
14
- export * from './data/workflow.zod';
15
- export * from './data/flow.zod';
16
- export * from './data/dataset.zod';
17
- export * from './data/query.zod';
18
- export * from './data/filter.zod';
19
- export * from './data/mapping.zod';
20
- export * from './data/trigger.zod';
21
- export * from './api/contract.zod';
22
- export * from './ai/agent.zod';
23
- export * from './ui/app.zod';
24
- export * from './ui/view.zod';
25
- export * from './ui/dashboard.zod';
26
- export * from './ui/report.zod';
27
- export * from './ui/action.zod';
28
- export * from './ui/page.zod';
29
- export * from './ui/widget.zod';
30
- export * from './ui/theme.zod';
31
- export * from './system/manifest.zod';
32
- export * from './system/datasource.zod';
33
- export * from './system/api.zod';
34
- export * from './system/identity.zod';
35
- export * from './system/auth.zod';
36
- export * from './system/policy.zod';
37
- export * from './system/role.zod';
38
- export * from './system/territory.zod';
39
- export * from './system/license.zod';
40
- export * from './system/webhook.zod';
41
- export * from './system/translation.zod';
42
- export * from './system/driver.zod';
43
- export * from './system/constants';
44
- export * from './system/types';
45
- export * from './system/discovery.zod';
46
- export * from './system/plugin.zod';
47
- export * from './system/driver.zod';
38
+ export * as Data from './data';
39
+ export * as UI from './ui';
40
+ export * as System from './system';
41
+ export * as AI from './ai';
42
+ export * as API from './api';
48
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAQH,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -4,8 +4,37 @@
4
4
  *
5
5
  * ObjectStack Protocol & Specification
6
6
  *
7
- * This package contains the core interfaces, schemas, and conventions for the ObjectStack ecosystem.
8
- * All types and schemas are centralized here.
7
+ * This package does NOT export types at the root level to prevent naming conflicts.
8
+ * Please use namespaced imports or subpath imports.
9
+ *
10
+ * ## Import Styles
11
+ *
12
+ * ### Style 1: Namespace Imports from Root
13
+ * ```typescript
14
+ * import { Data, UI, System, AI, API } from '@objectstack/spec';
15
+ *
16
+ * const field: Data.Field = { name: 'task_name', type: 'text' };
17
+ * const user: System.User = { id: 'u1', email: 'user@example.com' };
18
+ * ```
19
+ *
20
+ * ### Style 2: Namespace Imports via Subpath
21
+ * ```typescript
22
+ * import * as Data from '@objectstack/spec/data';
23
+ * import * as UI from '@objectstack/spec/ui';
24
+ * import * as System from '@objectstack/spec/system';
25
+ *
26
+ * const field: Data.Field = { name: 'task_name', type: 'text' };
27
+ * const user: System.User = { id: 'u1', email: 'user@example.com' };
28
+ * ```
29
+ *
30
+ * ### Style 3: Direct Subpath Imports
31
+ * ```typescript
32
+ * import { Field, FieldType } from '@objectstack/spec/data';
33
+ * import { User, Session } from '@objectstack/spec/system';
34
+ *
35
+ * const field: Field = { name: 'task_name', type: 'text' };
36
+ * const user: User = { id: 'u1', email: 'user@example.com' };
37
+ * ```
9
38
  */
10
39
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
40
  if (k2 === undefined) k2 = k;
@@ -18,51 +47,37 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
18
47
  if (k2 === undefined) k2 = k;
19
48
  o[k2] = m[k];
20
49
  }));
21
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
- };
50
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
51
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
52
+ }) : function(o, v) {
53
+ o["default"] = v;
54
+ });
55
+ var __importStar = (this && this.__importStar) || (function () {
56
+ var ownKeys = function(o) {
57
+ ownKeys = Object.getOwnPropertyNames || function (o) {
58
+ var ar = [];
59
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
60
+ return ar;
61
+ };
62
+ return ownKeys(o);
63
+ };
64
+ return function (mod) {
65
+ if (mod && mod.__esModule) return mod;
66
+ var result = {};
67
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
68
+ __setModuleDefault(result, mod);
69
+ return result;
70
+ };
71
+ })();
24
72
  Object.defineProperty(exports, "__esModule", { value: true });
25
- // Data Protocol (Schema, Validation, Logic)
26
- __exportStar(require("./data/field.zod"), exports);
27
- __exportStar(require("./data/object.zod"), exports);
28
- __exportStar(require("./data/validation.zod"), exports);
29
- __exportStar(require("./data/permission.zod"), exports);
30
- __exportStar(require("./data/sharing.zod"), exports);
31
- __exportStar(require("./data/workflow.zod"), exports);
32
- __exportStar(require("./data/flow.zod"), exports);
33
- __exportStar(require("./data/dataset.zod"), exports);
34
- __exportStar(require("./data/query.zod"), exports);
35
- __exportStar(require("./data/filter.zod"), exports); // Unified Query DSL
36
- __exportStar(require("./data/mapping.zod"), exports);
37
- __exportStar(require("./data/trigger.zod"), exports);
38
- // API Protocol (Envelopes, Contracts)
39
- __exportStar(require("./api/contract.zod"), exports);
40
- // AI Protocol (Agent, RAG)
41
- __exportStar(require("./ai/agent.zod"), exports);
42
- // UI Protocol (Layout, Navigation, Interaction)
43
- __exportStar(require("./ui/app.zod"), exports);
44
- __exportStar(require("./ui/view.zod"), exports);
45
- __exportStar(require("./ui/dashboard.zod"), exports);
46
- __exportStar(require("./ui/report.zod"), exports);
47
- __exportStar(require("./ui/action.zod"), exports);
48
- __exportStar(require("./ui/page.zod"), exports);
49
- __exportStar(require("./ui/widget.zod"), exports);
50
- __exportStar(require("./ui/theme.zod"), exports);
51
- // System Protocol (Manifest, Runtime, Constants)
52
- __exportStar(require("./system/manifest.zod"), exports);
53
- __exportStar(require("./system/datasource.zod"), exports);
54
- __exportStar(require("./system/api.zod"), exports);
55
- __exportStar(require("./system/identity.zod"), exports);
56
- __exportStar(require("./system/auth.zod"), exports);
57
- __exportStar(require("./system/policy.zod"), exports);
58
- __exportStar(require("./system/role.zod"), exports);
59
- __exportStar(require("./system/territory.zod"), exports);
60
- __exportStar(require("./system/license.zod"), exports);
61
- __exportStar(require("./system/webhook.zod"), exports);
62
- __exportStar(require("./system/translation.zod"), exports);
63
- __exportStar(require("./system/driver.zod"), exports); // Export Driver Protocol
64
- __exportStar(require("./system/constants"), exports);
65
- __exportStar(require("./system/types"), exports);
66
- __exportStar(require("./system/discovery.zod"), exports);
67
- __exportStar(require("./system/plugin.zod"), exports);
68
- __exportStar(require("./system/driver.zod"), exports);
73
+ exports.API = exports.AI = exports.System = exports.UI = exports.Data = void 0;
74
+ // ============================================================================
75
+ // NAMESPACE EXPORTS
76
+ // ============================================================================
77
+ // Export protocol domains as namespaces to prevent naming conflicts
78
+ // and establish clear boundaries between different protocol layers.
79
+ exports.Data = __importStar(require("./data"));
80
+ exports.UI = __importStar(require("./ui"));
81
+ exports.System = __importStar(require("./system"));
82
+ exports.AI = __importStar(require("./ai"));
83
+ exports.API = __importStar(require("./api"));