-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.ts
More file actions
119 lines (109 loc) · 4.17 KB
/
Copy pathindex.ts
File metadata and controls
119 lines (109 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* @objectstack/spec
*
* ObjectStack Protocol & Specification
*
* This package does NOT export types at the root level to prevent naming conflicts.
* Please use namespaced imports or subpath imports.
*
* ## Import Styles
*
* ### Style 1: Namespace Imports from Root
* ```typescript
* import { Data, UI, System, Auth, AI, API } from '@objectstack/spec';
*
* const field: Data.Field = { name: 'task_name', type: 'text' };
* const user: Auth.User = { id: 'u1', email: 'user@example.com' };
* ```
*
* ### Style 2: Namespace Imports via Subpath
* ```typescript
* import * as Data from '@objectstack/spec/data';
* import * as UI from '@objectstack/spec/ui';
* import * as System from '@objectstack/spec/system';
* import * as Auth from '@objectstack/spec/auth';
*
* const field: Data.Field = { name: 'task_name', type: 'text' };
* const user: Auth.User = { id: 'u1', email: 'user@example.com' };
* ```
*
* ### Style 3: Direct Subpath Imports
* ```typescript
* import { Field, FieldType } from '@objectstack/spec/data';
* import { User, Session } from '@objectstack/spec/auth';
*
* const field: Field = { name: 'task_name', type: 'text' };
* const user: User = { id: 'u1', email: 'user@example.com' };
* ```
*/
// ============================================================================
// NAMESPACE EXPORTS — REMOVED
// ============================================================================
// `export * as Namespace from './sub'` is NOT tree-shakeable in Node ESM —
// every subdomain (16 of them, ~400 Zod schema closures) is force-evaluated
// on the first `import` of `@objectstack/spec`, even when consumers only
// touch one namespace. This caused ~1.2GB RSS bloat in `@objectstack/objectos`.
//
// Use subpath imports instead:
// import * as Data from '@objectstack/spec/data';
// import { Field } from '@objectstack/spec/data';
//
// Enforced by the `no-restricted-imports` ESLint rule.
export {
defineStack,
composeStacks,
ComposeStacksOptionsSchema,
ConflictStrategySchema,
ObjectStackDefinitionSchema,
ObjectStackSchema,
ObjectStackCapabilitiesSchema,
ObjectQLCapabilitiesSchema,
ObjectUICapabilitiesSchema,
ObjectOSCapabilitiesSchema
} from './stack.zod';
export type { DefineStackOptions, ComposeStacksOptions, ConflictStrategy, ObjectStackDefinitionInput } from './stack.zod';
export * from './stack.zod';
// DX Helper Functions (re-exported for convenience)
export { defineView, defineForm, defineViewItem, isAggregatedViewContainer, expandViewContainer } from './ui/view.zod';
export type { ExpandedViewItem } from './ui/view.zod';
export { defineApp } from './ui/app.zod';
export { defineFlow } from './automation/flow.zod';
export { defineJob } from './system/job.zod';
export { defineBook } from './system/book.zod';
export { defineAgent } from './ai/agent.zod';
export { defineTool } from './ai/tool.zod';
export { defineSkill } from './ai/skill.zod';
export type { Agent } from './ai/agent.zod';
export type { Tool } from './ai/tool.zod';
export type { Skill } from './ai/skill.zod';
// DX Validation Utilities (re-exported for convenience)
export { objectStackErrorMap, formatZodError, formatZodIssue, safeParsePretty } from './shared/error-map.zod';
export { suggestFieldType, findClosestMatches, formatSuggestion } from './shared/suggestions.zod';
export { normalizeMetadataCollection, normalizeStackInput, normalizePluginMetadata, MAP_SUPPORTED_FIELDS, METADATA_ALIASES } from './shared/metadata-collection.zod';
export type { MetadataCollectionInput, MapSupportedField } from './shared/metadata-collection.zod';
export { type PluginContext } from './kernel/plugin.zod';
// Expression Protocol (M9 — canonical wire format for formulas / predicates / conditions)
export {
ExpressionDialect,
ExpressionMetaSchema,
ExpressionSchema,
ExpressionInputSchema,
CronExpressionInputSchema,
TemplateExpressionInputSchema,
PredicateSchema,
PredicateInputSchema,
expression,
cel,
cron,
tmpl,
F,
P,
} from './shared/expression.zod';
export type {
Expression,
ExpressionMeta,
ExpressionInput,
Predicate,
PredicateInput,
} from './shared/expression.zod';