-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.ts
More file actions
174 lines (159 loc) · 6.69 KB
/
Copy pathindex.ts
File metadata and controls
174 lines (159 loc) · 6.69 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// 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
} 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, expandViewContainerWithDiagnostics } from './ui/view.zod';
export type { ExpandedViewItem, ViewKeyCollision, ExpandViewResult } 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';
// DX factories for the remaining authoring domains (issue #2035) — one type-safe
// entry per writable domain, mirroring the 19 factories above. `defineX` is a
// *value* import: a broken import hard-errors instead of silently degrading to
// `any` (the #2023 failure mode). Input-shape config + runtime `.parse()`.
export { defineDatasource } from './data/datasource.zod';
export { defineConnector } from './integration/connector.zod';
export { defineSharingRule } from './security/sharing.zod';
export { definePosition, EVERYONE_POSITION, GUEST_POSITION, AUDIENCE_ANCHOR_POSITIONS } from './identity/position.zod';
export { definePermissionSet } from './security/permission.zod';
export { defineCapability } from './security/capabilities';
export { defineEmailTemplateDefinition } from './system/email-template.zod';
export { defineReport } from './ui/report.zod';
export { defineWebhook } from './automation/webhook.zod';
export { defineObjectExtension } from './data/object.zod';
export { defineCube } from './data/analytics.zod';
export { defineMapping } from './data/mapping.zod';
export { defineTheme } from './ui/theme.zod';
export { defineTranslationBundle } from './system/translation.zod';
export { definePage } from './ui/page.zod';
export { defineAction } from './ui/action.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, NormalizeStackInputOptions } from './shared/metadata-collection.zod';
// Metadata conversion layer (ADR-0087 D2) — old-shape → canonical-shape transforms applied at load.
export * from './conversions/index.js';
// Metadata migration chain + change manifest (ADR-0087 D3/D4).
export * from './migrations/index.js';
export { type PluginContext } from './kernel/plugin.zod';
// Platform SERVICE capability vocabulary for `requires: [...]` (framework#3265),
// plus the provider/edition registry + classifier behind the installable-provider
// preflight (framework#3366).
export {
PLATFORM_CAPABILITY_TOKENS,
isKnownPlatformCapability,
PLATFORM_CAPABILITY_PROVIDERS,
classifyRequiredCapability,
type CapabilityEdition,
type PlatformCapabilityProvider,
type CapabilityProviderStatus,
type CapabilityClassification,
} from './kernel/platform-capabilities';
// 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';
// ADR-0068: unified user-context contract (EvalUser) + built-in identity roles.
export {
createEvalUser,
mapMembershipRole,
EvalUserSchema,
BUILTIN_IDENTITY_NAMES,
BUILTIN_IDENTITY_METADATA,
BUILTIN_IDENTITY_PLATFORM_ADMIN,
BUILTIN_IDENTITY_ORG_OWNER,
BUILTIN_IDENTITY_ORG_ADMIN,
BUILTIN_IDENTITY_ORG_MEMBER,
ADMIN_FULL_ACCESS,
ORGANIZATION_ADMIN,
ORGANIZATION_ADMIN_NO_BYPASS,
ORGANIZATION_ADMIN_GRANTS,
} from './identity/eval-user.zod';
export type { EvalUser, EvalUserInput, BuiltinIdentityName } from './identity/eval-user.zod';