@revealui/contracts 1.0.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.
- package/LICENSE +22 -0
- package/README.md +160 -0
- package/dist/a2a/index.d.ts +383 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +276 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/actions/action-validator.d.ts +48 -0
- package/dist/actions/action-validator.d.ts.map +1 -0
- package/dist/actions/action-validator.js +288 -0
- package/dist/actions/action-validator.js.map +1 -0
- package/dist/actions/index.d.ts +7 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +7 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/agents/index.d.ts +628 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +511 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/types.d.ts +22 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/api/auth.d.ts +60 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +84 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/chat.d.ts +45 -0
- package/dist/api/chat.d.ts.map +1 -0
- package/dist/api/chat.js +55 -0
- package/dist/api/chat.js.map +1 -0
- package/dist/api/gdpr.d.ts +39 -0
- package/dist/api/gdpr.d.ts.map +1 -0
- package/dist/api/gdpr.js +53 -0
- package/dist/api/gdpr.js.map +1 -0
- package/dist/cms/collection.d.ts +108 -0
- package/dist/cms/collection.d.ts.map +1 -0
- package/dist/cms/collection.js +144 -0
- package/dist/cms/collection.js.map +1 -0
- package/dist/cms/compat.d.ts +128 -0
- package/dist/cms/compat.d.ts.map +1 -0
- package/dist/cms/compat.js +141 -0
- package/dist/cms/compat.js.map +1 -0
- package/dist/cms/config-contract.d.ts +278 -0
- package/dist/cms/config-contract.d.ts.map +1 -0
- package/dist/cms/config-contract.js +220 -0
- package/dist/cms/config-contract.js.map +1 -0
- package/dist/cms/config.d.ts +351 -0
- package/dist/cms/config.d.ts.map +1 -0
- package/dist/cms/config.js +50 -0
- package/dist/cms/config.js.map +1 -0
- package/dist/cms/errors.d.ts +122 -0
- package/dist/cms/errors.d.ts.map +1 -0
- package/dist/cms/errors.js +163 -0
- package/dist/cms/errors.js.map +1 -0
- package/dist/cms/extensibility.d.ts +211 -0
- package/dist/cms/extensibility.d.ts.map +1 -0
- package/dist/cms/extensibility.js +313 -0
- package/dist/cms/extensibility.js.map +1 -0
- package/dist/cms/field.d.ts +69 -0
- package/dist/cms/field.d.ts.map +1 -0
- package/dist/cms/field.js +94 -0
- package/dist/cms/field.js.map +1 -0
- package/dist/cms/functions.d.ts +466 -0
- package/dist/cms/functions.d.ts.map +1 -0
- package/dist/cms/functions.js +19 -0
- package/dist/cms/functions.js.map +1 -0
- package/dist/cms/global.d.ts +45 -0
- package/dist/cms/global.d.ts.map +1 -0
- package/dist/cms/global.js +62 -0
- package/dist/cms/global.js.map +1 -0
- package/dist/cms/index.d.ts +23 -0
- package/dist/cms/index.d.ts.map +1 -0
- package/dist/cms/index.js +42 -0
- package/dist/cms/index.js.map +1 -0
- package/dist/cms/structure.d.ts +1601 -0
- package/dist/cms/structure.d.ts.map +1 -0
- package/dist/cms/structure.js +757 -0
- package/dist/cms/structure.js.map +1 -0
- package/dist/content/index.d.ts +1542 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +522 -0
- package/dist/content/index.js.map +1 -0
- package/dist/database/bridge.d.ts +177 -0
- package/dist/database/bridge.d.ts.map +1 -0
- package/dist/database/bridge.js +139 -0
- package/dist/database/bridge.js.map +1 -0
- package/dist/database/index.d.ts +8 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +9 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/type-bridge.d.ts +178 -0
- package/dist/database/type-bridge.d.ts.map +1 -0
- package/dist/database/type-bridge.js +154 -0
- package/dist/database/type-bridge.js.map +1 -0
- package/dist/entities/agent-context.d.ts +280 -0
- package/dist/entities/agent-context.d.ts.map +1 -0
- package/dist/entities/agent-context.js +390 -0
- package/dist/entities/agent-context.js.map +1 -0
- package/dist/entities/agent-memory.d.ts +661 -0
- package/dist/entities/agent-memory.d.ts.map +1 -0
- package/dist/entities/agent-memory.js +544 -0
- package/dist/entities/agent-memory.js.map +1 -0
- package/dist/entities/board.d.ts +95 -0
- package/dist/entities/board.d.ts.map +1 -0
- package/dist/entities/board.js +99 -0
- package/dist/entities/board.js.map +1 -0
- package/dist/entities/code-provenance.d.ts +270 -0
- package/dist/entities/code-provenance.d.ts.map +1 -0
- package/dist/entities/code-provenance.js +339 -0
- package/dist/entities/code-provenance.js.map +1 -0
- package/dist/entities/index.d.ts +22 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +22 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/media.d.ts +485 -0
- package/dist/entities/media.d.ts.map +1 -0
- package/dist/entities/media.js +606 -0
- package/dist/entities/media.js.map +1 -0
- package/dist/entities/page-revision.d.ts +390 -0
- package/dist/entities/page-revision.d.ts.map +1 -0
- package/dist/entities/page-revision.js +406 -0
- package/dist/entities/page-revision.js.map +1 -0
- package/dist/entities/page.d.ts +2349 -0
- package/dist/entities/page.d.ts.map +1 -0
- package/dist/entities/page.js +377 -0
- package/dist/entities/page.js.map +1 -0
- package/dist/entities/post.d.ts +619 -0
- package/dist/entities/post.d.ts.map +1 -0
- package/dist/entities/post.js +555 -0
- package/dist/entities/post.js.map +1 -0
- package/dist/entities/price.d.ts +772 -0
- package/dist/entities/price.d.ts.map +1 -0
- package/dist/entities/price.js +308 -0
- package/dist/entities/price.js.map +1 -0
- package/dist/entities/product.d.ts +753 -0
- package/dist/entities/product.d.ts.map +1 -0
- package/dist/entities/product.js +307 -0
- package/dist/entities/product.js.map +1 -0
- package/dist/entities/session.d.ts +222 -0
- package/dist/entities/session.d.ts.map +1 -0
- package/dist/entities/session.js +253 -0
- package/dist/entities/session.js.map +1 -0
- package/dist/entities/site.d.ts +387 -0
- package/dist/entities/site.d.ts.map +1 -0
- package/dist/entities/site.js +348 -0
- package/dist/entities/site.js.map +1 -0
- package/dist/entities/ticket-comment.d.ts +49 -0
- package/dist/entities/ticket-comment.d.ts.map +1 -0
- package/dist/entities/ticket-comment.js +58 -0
- package/dist/entities/ticket-comment.js.map +1 -0
- package/dist/entities/ticket-label.d.ts +64 -0
- package/dist/entities/ticket-label.d.ts.map +1 -0
- package/dist/entities/ticket-label.js +77 -0
- package/dist/entities/ticket-label.js.map +1 -0
- package/dist/entities/ticket.d.ts +204 -0
- package/dist/entities/ticket.d.ts.map +1 -0
- package/dist/entities/ticket.js +205 -0
- package/dist/entities/ticket.js.map +1 -0
- package/dist/entities/user.d.ts +336 -0
- package/dist/entities/user.d.ts.map +1 -0
- package/dist/entities/user.js +255 -0
- package/dist/entities/user.js.map +1 -0
- package/dist/foundation/contract.d.ts +221 -0
- package/dist/foundation/contract.d.ts.map +1 -0
- package/dist/foundation/contract.js +133 -0
- package/dist/foundation/contract.js.map +1 -0
- package/dist/foundation/index.d.ts +7 -0
- package/dist/foundation/index.d.ts.map +1 -0
- package/dist/foundation/index.js +7 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/generated/contracts.d.ts +1514 -0
- package/dist/generated/contracts.d.ts.map +1 -0
- package/dist/generated/contracts.js +959 -0
- package/dist/generated/contracts.js.map +1 -0
- package/dist/generated/database.d.ts +48 -0
- package/dist/generated/database.d.ts.map +1 -0
- package/dist/generated/database.js +17 -0
- package/dist/generated/database.js.map +1 -0
- package/dist/generated/zod-schemas.d.ts +14793 -0
- package/dist/generated/zod-schemas.d.ts.map +1 -0
- package/dist/generated/zod-schemas.js +547 -0
- package/dist/generated/zod-schemas.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/representation/index.d.ts +304 -0
- package/dist/representation/index.d.ts.map +1 -0
- package/dist/representation/index.js +280 -0
- package/dist/representation/index.js.map +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Entity Contract
|
|
3
|
+
*
|
|
4
|
+
* Manages authentication session lifecycle with security-critical validation.
|
|
5
|
+
* Sessions can be persistent (7 days) or regular (1 day) with automatic expiration.
|
|
6
|
+
*
|
|
7
|
+
* Business Rules:
|
|
8
|
+
* - Persistent sessions last 7 days
|
|
9
|
+
* - Regular sessions last 1 day
|
|
10
|
+
* - Sessions expire based on expiresAt timestamp
|
|
11
|
+
* - Last activity tracked on each request
|
|
12
|
+
* - Token hash stored (never plain token)
|
|
13
|
+
* - Cascading deletion when user is deleted
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod/v4';
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Constants
|
|
18
|
+
// =============================================================================
|
|
19
|
+
export const SESSION_SCHEMA_VERSION = 1;
|
|
20
|
+
// Session duration constants (in milliseconds)
|
|
21
|
+
export const SESSION_DURATION = {
|
|
22
|
+
REGULAR: 24 * 60 * 60 * 1000, // 1 day
|
|
23
|
+
PERSISTENT: 7 * 24 * 60 * 60 * 1000, // 7 days
|
|
24
|
+
};
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Base Session Schema
|
|
27
|
+
// =============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* Session object schema
|
|
30
|
+
*/
|
|
31
|
+
export const SessionObjectSchema = z.object({
|
|
32
|
+
id: z.string().uuid(),
|
|
33
|
+
schemaVersion: z.string().default(String(SESSION_SCHEMA_VERSION)),
|
|
34
|
+
userId: z.string().uuid(),
|
|
35
|
+
tokenHash: z.string().min(1, 'Token hash is required'),
|
|
36
|
+
expiresAt: z.date(),
|
|
37
|
+
userAgent: z.string().nullable().default(null),
|
|
38
|
+
ipAddress: z.string().nullable().default(null),
|
|
39
|
+
persistent: z.boolean().nullable().default(false),
|
|
40
|
+
lastActivityAt: z.date(),
|
|
41
|
+
createdAt: z.date(),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Session schema with validation rules
|
|
45
|
+
*/
|
|
46
|
+
export const SessionBaseSchema = SessionObjectSchema.refine((data) => {
|
|
47
|
+
// Validate expiration is in the future (for new sessions)
|
|
48
|
+
const now = new Date();
|
|
49
|
+
return data.expiresAt > now;
|
|
50
|
+
}, {
|
|
51
|
+
message: 'Session expiration must be in the future',
|
|
52
|
+
path: ['expiresAt'],
|
|
53
|
+
}).refine((data) => {
|
|
54
|
+
// Validate token hash format (should be a hash, not plain text)
|
|
55
|
+
const isValidHash = /^[a-f0-9]{64}$/i.test(data.tokenHash) || data.tokenHash.startsWith('$2');
|
|
56
|
+
return isValidHash;
|
|
57
|
+
}, {
|
|
58
|
+
message: 'Token hash must be a valid SHA-256 or bcrypt hash',
|
|
59
|
+
path: ['tokenHash'],
|
|
60
|
+
});
|
|
61
|
+
export const SessionSchema = SessionBaseSchema;
|
|
62
|
+
// =============================================================================
|
|
63
|
+
// Insert Schema
|
|
64
|
+
// =============================================================================
|
|
65
|
+
/**
|
|
66
|
+
* Schema for creating new sessions
|
|
67
|
+
*/
|
|
68
|
+
export const SessionInsertSchema = SessionObjectSchema.omit({
|
|
69
|
+
id: true,
|
|
70
|
+
createdAt: true,
|
|
71
|
+
lastActivityAt: true,
|
|
72
|
+
}).extend({
|
|
73
|
+
id: z.string().uuid().optional(),
|
|
74
|
+
createdAt: z.date().optional(),
|
|
75
|
+
lastActivityAt: z.date().optional(),
|
|
76
|
+
});
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// Computed Fields
|
|
79
|
+
// =============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Check if a session is expired
|
|
82
|
+
*/
|
|
83
|
+
export function isSessionExpired(session) {
|
|
84
|
+
return session.expiresAt <= new Date();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if a session is still valid (not expired)
|
|
88
|
+
*/
|
|
89
|
+
export function isSessionValid(session) {
|
|
90
|
+
return !isSessionExpired(session);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Calculate session duration based on persistent flag
|
|
94
|
+
*/
|
|
95
|
+
export function calculateSessionDuration(persistent) {
|
|
96
|
+
return persistent ? SESSION_DURATION.PERSISTENT : SESSION_DURATION.REGULAR;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Calculate expiration date for a new session
|
|
100
|
+
*/
|
|
101
|
+
export function calculateExpiresAt(persistent, from = new Date()) {
|
|
102
|
+
const duration = calculateSessionDuration(persistent);
|
|
103
|
+
return new Date(from.getTime() + duration);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if session needs activity update (last activity > 5 minutes ago)
|
|
107
|
+
*/
|
|
108
|
+
export function needsActivityUpdate(session, thresholdMinutes = 5) {
|
|
109
|
+
const threshold = thresholdMinutes * 60 * 1000;
|
|
110
|
+
const timeSinceLastActivity = Date.now() - session.lastActivityAt.getTime();
|
|
111
|
+
return timeSinceLastActivity > threshold;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get remaining session time in milliseconds
|
|
115
|
+
*/
|
|
116
|
+
export function getSessionTimeRemaining(session) {
|
|
117
|
+
const now = Date.now();
|
|
118
|
+
const expiresAt = session.expiresAt.getTime();
|
|
119
|
+
return Math.max(0, expiresAt - now);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get session age in milliseconds
|
|
123
|
+
*/
|
|
124
|
+
export function getSessionAge(session) {
|
|
125
|
+
const now = Date.now();
|
|
126
|
+
const createdAt = session.createdAt.getTime();
|
|
127
|
+
return now - createdAt;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if session is nearing expiration (< 1 hour remaining)
|
|
131
|
+
*/
|
|
132
|
+
export function isSessionNearExpiration(session, thresholdMinutes = 60) {
|
|
133
|
+
const threshold = thresholdMinutes * 60 * 1000;
|
|
134
|
+
const remaining = getSessionTimeRemaining(session);
|
|
135
|
+
return remaining > 0 && remaining < threshold;
|
|
136
|
+
}
|
|
137
|
+
// =============================================================================
|
|
138
|
+
// Validation Helpers
|
|
139
|
+
// =============================================================================
|
|
140
|
+
/**
|
|
141
|
+
* Validate session token hash format
|
|
142
|
+
*/
|
|
143
|
+
export function validateTokenHash(tokenHash) {
|
|
144
|
+
// SHA-256 hash (64 hex characters) or bcrypt hash (starts with $2)
|
|
145
|
+
return /^[a-f0-9]{64}$/i.test(tokenHash) || tokenHash.startsWith('$2');
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Validate IP address format (IPv4 or IPv6)
|
|
149
|
+
*/
|
|
150
|
+
export function validateIpAddress(ip) {
|
|
151
|
+
if (!ip)
|
|
152
|
+
return true; // Nullable field
|
|
153
|
+
// IPv4
|
|
154
|
+
const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
155
|
+
if (ipv4Regex.test(ip)) {
|
|
156
|
+
const parts = ip.split('.');
|
|
157
|
+
return parts.every((part) => Number.parseInt(part, 10) <= 255);
|
|
158
|
+
}
|
|
159
|
+
// IPv6
|
|
160
|
+
const ipv6Regex = /^([0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;
|
|
161
|
+
return ipv6Regex.test(ip);
|
|
162
|
+
}
|
|
163
|
+
// =============================================================================
|
|
164
|
+
// Session State Management
|
|
165
|
+
// =============================================================================
|
|
166
|
+
/**
|
|
167
|
+
* Create session insert data with computed fields
|
|
168
|
+
*/
|
|
169
|
+
export function createSessionInsert(userId, tokenHash, options) {
|
|
170
|
+
const now = new Date();
|
|
171
|
+
const persistent = options?.persistent ?? false;
|
|
172
|
+
return {
|
|
173
|
+
id: options?.id,
|
|
174
|
+
schemaVersion: String(SESSION_SCHEMA_VERSION),
|
|
175
|
+
userId,
|
|
176
|
+
tokenHash,
|
|
177
|
+
expiresAt: calculateExpiresAt(persistent, now),
|
|
178
|
+
userAgent: options?.userAgent ?? null,
|
|
179
|
+
ipAddress: options?.ipAddress ?? null,
|
|
180
|
+
persistent,
|
|
181
|
+
lastActivityAt: now,
|
|
182
|
+
createdAt: now,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Update session activity timestamp
|
|
187
|
+
*/
|
|
188
|
+
export function updateSessionActivity() {
|
|
189
|
+
return {
|
|
190
|
+
lastActivityAt: new Date(),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Convert session to format with computed fields
|
|
195
|
+
*/
|
|
196
|
+
export function sessionToHuman(session) {
|
|
197
|
+
return {
|
|
198
|
+
...session,
|
|
199
|
+
_computed: {
|
|
200
|
+
isExpired: isSessionExpired(session),
|
|
201
|
+
isValid: isSessionValid(session),
|
|
202
|
+
timeRemaining: getSessionTimeRemaining(session),
|
|
203
|
+
age: getSessionAge(session),
|
|
204
|
+
isNearExpiration: isSessionNearExpiration(session),
|
|
205
|
+
needsRefresh: isSessionNearExpiration(session, 120), // < 2 hours
|
|
206
|
+
durationMs: calculateSessionDuration(session.persistent ?? false),
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Convert session to agent-compatible format
|
|
212
|
+
*/
|
|
213
|
+
export function sessionToAgent(session) {
|
|
214
|
+
return {
|
|
215
|
+
...session,
|
|
216
|
+
metadata: {
|
|
217
|
+
expired: isSessionExpired(session),
|
|
218
|
+
valid: isSessionValid(session),
|
|
219
|
+
timeRemainingMs: getSessionTimeRemaining(session),
|
|
220
|
+
ageMs: getSessionAge(session),
|
|
221
|
+
nearExpiration: isSessionNearExpiration(session),
|
|
222
|
+
type: session.persistent ? 'persistent' : 'regular',
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Zod schema for session with computed fields
|
|
228
|
+
*/
|
|
229
|
+
export const SessionWithComputedSchema = SessionSchema.and(z.object({
|
|
230
|
+
_computed: z.object({
|
|
231
|
+
isExpired: z.boolean(),
|
|
232
|
+
isValid: z.boolean(),
|
|
233
|
+
timeRemaining: z.number(),
|
|
234
|
+
age: z.number(),
|
|
235
|
+
isNearExpiration: z.boolean(),
|
|
236
|
+
needsRefresh: z.boolean(),
|
|
237
|
+
durationMs: z.number(),
|
|
238
|
+
}),
|
|
239
|
+
}));
|
|
240
|
+
/**
|
|
241
|
+
* Zod schema for session with agent metadata
|
|
242
|
+
*/
|
|
243
|
+
export const SessionAgentSchema = SessionSchema.and(z.object({
|
|
244
|
+
metadata: z.object({
|
|
245
|
+
expired: z.boolean(),
|
|
246
|
+
valid: z.boolean(),
|
|
247
|
+
timeRemainingMs: z.number(),
|
|
248
|
+
ageMs: z.number(),
|
|
249
|
+
nearExpiration: z.boolean(),
|
|
250
|
+
type: z.enum(['persistent', 'regular']),
|
|
251
|
+
}),
|
|
252
|
+
}));
|
|
253
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/entities/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEvC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,QAAQ;IACtC,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,SAAS;CACtC,CAAA;AAEV,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;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a,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;QAC7B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;QACzB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;KACvB,CAAC;CACH,CAAC,CACH,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CACjD,CAAC,CAAC,MAAM,CAAC;IACP,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;QAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;KACxC,CAAC;CACH,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Site Schema
|
|
3
|
+
*
|
|
4
|
+
* A Site is a project container - it holds pages, assets, and configuration.
|
|
5
|
+
* Sites are the primary unit of ownership and collaboration.
|
|
6
|
+
*
|
|
7
|
+
* Sites support both human management (through UI) and agent management
|
|
8
|
+
* (through structured APIs), enabling true human-AI collaboration.
|
|
9
|
+
*
|
|
10
|
+
* This schema extends the auto-generated SitesSelectSchema from the database
|
|
11
|
+
* and adds:
|
|
12
|
+
* - Structured validation for JSONB fields (settings, theme)
|
|
13
|
+
* - Dual representation (human + agent views)
|
|
14
|
+
* - Business logic and computed fields
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod/v4';
|
|
17
|
+
export declare const SITE_SCHEMA_VERSION = 1;
|
|
18
|
+
export declare const SiteStatusSchema: z.ZodEnum<{
|
|
19
|
+
draft: "draft";
|
|
20
|
+
published: "published";
|
|
21
|
+
archived: "archived";
|
|
22
|
+
maintenance: "maintenance";
|
|
23
|
+
}>;
|
|
24
|
+
export type SiteStatus = z.infer<typeof SiteStatusSchema>;
|
|
25
|
+
export declare const SiteThemeSchema: z.ZodObject<{
|
|
26
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
27
|
+
secondaryColor: z.ZodOptional<z.ZodString>;
|
|
28
|
+
accentColor: z.ZodOptional<z.ZodString>;
|
|
29
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
30
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
31
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
32
|
+
headingFontFamily: z.ZodOptional<z.ZodString>;
|
|
33
|
+
borderRadius: z.ZodDefault<z.ZodEnum<{
|
|
34
|
+
sm: "sm";
|
|
35
|
+
md: "md";
|
|
36
|
+
lg: "lg";
|
|
37
|
+
none: "none";
|
|
38
|
+
full: "full";
|
|
39
|
+
}>>;
|
|
40
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
41
|
+
light: "light";
|
|
42
|
+
dark: "dark";
|
|
43
|
+
auto: "auto";
|
|
44
|
+
}>>;
|
|
45
|
+
customVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type SiteTheme = z.infer<typeof SiteThemeSchema>;
|
|
48
|
+
export declare const SiteSeoSchema: z.ZodObject<{
|
|
49
|
+
title: z.ZodOptional<z.ZodString>;
|
|
50
|
+
description: z.ZodOptional<z.ZodString>;
|
|
51
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
52
|
+
twitterHandle: z.ZodOptional<z.ZodString>;
|
|
53
|
+
facebookAppId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
googleSiteVerification: z.ZodOptional<z.ZodString>;
|
|
55
|
+
robots: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type SiteSeo = z.infer<typeof SiteSeoSchema>;
|
|
58
|
+
export declare const SiteSettingsSchema: z.ZodObject<{
|
|
59
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
60
|
+
subdomain: z.ZodOptional<z.ZodString>;
|
|
61
|
+
language: z.ZodDefault<z.ZodString>;
|
|
62
|
+
supportedLanguages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
64
|
+
seo: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
title: z.ZodOptional<z.ZodString>;
|
|
66
|
+
description: z.ZodOptional<z.ZodString>;
|
|
67
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
68
|
+
twitterHandle: z.ZodOptional<z.ZodString>;
|
|
69
|
+
facebookAppId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
googleSiteVerification: z.ZodOptional<z.ZodString>;
|
|
71
|
+
robots: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
analyticsId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
allowAgentEdits: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
agentRestrictions: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
canPublish: z.ZodDefault<z.ZodBoolean>;
|
|
77
|
+
canDeletePages: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
+
canModifySettings: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
+
protectedPages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
notFoundPageId: z.ZodOptional<z.ZodString>;
|
|
82
|
+
faviconUrl: z.ZodOptional<z.ZodURL>;
|
|
83
|
+
socialLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
platform: z.ZodString;
|
|
85
|
+
url: z.ZodURL;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type SiteSettings = z.infer<typeof SiteSettingsSchema>;
|
|
89
|
+
export declare const SiteCollaboratorSchema: z.ZodObject<{
|
|
90
|
+
userId: z.ZodString;
|
|
91
|
+
role: z.ZodEnum<{
|
|
92
|
+
admin: "admin";
|
|
93
|
+
editor: "editor";
|
|
94
|
+
viewer: "viewer";
|
|
95
|
+
}>;
|
|
96
|
+
addedAt: z.ZodString;
|
|
97
|
+
addedBy: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type SiteCollaborator = z.infer<typeof SiteCollaboratorSchema>;
|
|
100
|
+
export declare const SiteSchema: z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
human: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
label: z.ZodString;
|
|
105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
107
|
+
color: z.ZodOptional<z.ZodString>;
|
|
108
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
109
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
+
helpText: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
semanticType: z.ZodString;
|
|
114
|
+
embedding: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
model: z.ZodString;
|
|
116
|
+
vector: z.ZodArray<z.ZodNumber>;
|
|
117
|
+
dimension: z.ZodNumber;
|
|
118
|
+
generatedAt: z.ZodString;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
constraints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
+
type: z.ZodEnum<{
|
|
122
|
+
custom: "custom";
|
|
123
|
+
readonly: "readonly";
|
|
124
|
+
pattern: "pattern";
|
|
125
|
+
required: "required";
|
|
126
|
+
immutable: "immutable";
|
|
127
|
+
range: "range";
|
|
128
|
+
dependency: "dependency";
|
|
129
|
+
capability: "capability";
|
|
130
|
+
permission: "permission";
|
|
131
|
+
}>;
|
|
132
|
+
field: z.ZodOptional<z.ZodString>;
|
|
133
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
134
|
+
message: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>>;
|
|
136
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
137
|
+
name: z.ZodString;
|
|
138
|
+
description: z.ZodString;
|
|
139
|
+
params: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
140
|
+
type: z.ZodString;
|
|
141
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
description: z.ZodOptional<z.ZodString>;
|
|
143
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
144
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
returns: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
type: z.ZodString;
|
|
148
|
+
description: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
requiredCapabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
151
|
+
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
152
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
}, z.core.$strip>>>;
|
|
154
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
155
|
+
type: z.ZodEnum<{
|
|
156
|
+
dependency: "dependency";
|
|
157
|
+
parent: "parent";
|
|
158
|
+
child: "child";
|
|
159
|
+
sibling: "sibling";
|
|
160
|
+
reference: "reference";
|
|
161
|
+
related: "related";
|
|
162
|
+
}>;
|
|
163
|
+
targetId: z.ZodString;
|
|
164
|
+
targetType: z.ZodString;
|
|
165
|
+
weight: z.ZodDefault<z.ZodNumber>;
|
|
166
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
167
|
+
}, z.core.$strip>>>;
|
|
168
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
169
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
170
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
createdAt: z.ZodString;
|
|
173
|
+
updatedAt: z.ZodString;
|
|
174
|
+
schemaVersion: z.ZodDefault<z.ZodNumber>;
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
slug: z.ZodString;
|
|
177
|
+
description: z.ZodOptional<z.ZodString>;
|
|
178
|
+
ownerId: z.ZodString;
|
|
179
|
+
status: z.ZodEnum<{
|
|
180
|
+
draft: "draft";
|
|
181
|
+
published: "published";
|
|
182
|
+
archived: "archived";
|
|
183
|
+
maintenance: "maintenance";
|
|
184
|
+
}>;
|
|
185
|
+
settings: z.ZodObject<{
|
|
186
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
187
|
+
subdomain: z.ZodOptional<z.ZodString>;
|
|
188
|
+
language: z.ZodDefault<z.ZodString>;
|
|
189
|
+
supportedLanguages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
190
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
191
|
+
seo: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
title: z.ZodOptional<z.ZodString>;
|
|
193
|
+
description: z.ZodOptional<z.ZodString>;
|
|
194
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
195
|
+
twitterHandle: z.ZodOptional<z.ZodString>;
|
|
196
|
+
facebookAppId: z.ZodOptional<z.ZodString>;
|
|
197
|
+
googleSiteVerification: z.ZodOptional<z.ZodString>;
|
|
198
|
+
robots: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
analyticsId: z.ZodOptional<z.ZodString>;
|
|
201
|
+
allowAgentEdits: z.ZodDefault<z.ZodBoolean>;
|
|
202
|
+
agentRestrictions: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
canPublish: z.ZodDefault<z.ZodBoolean>;
|
|
204
|
+
canDeletePages: z.ZodDefault<z.ZodBoolean>;
|
|
205
|
+
canModifySettings: z.ZodDefault<z.ZodBoolean>;
|
|
206
|
+
protectedPages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
notFoundPageId: z.ZodOptional<z.ZodString>;
|
|
209
|
+
faviconUrl: z.ZodOptional<z.ZodURL>;
|
|
210
|
+
socialLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
platform: z.ZodString;
|
|
212
|
+
url: z.ZodURL;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
collaborators: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
216
|
+
userId: z.ZodString;
|
|
217
|
+
role: z.ZodEnum<{
|
|
218
|
+
admin: "admin";
|
|
219
|
+
editor: "editor";
|
|
220
|
+
viewer: "viewer";
|
|
221
|
+
}>;
|
|
222
|
+
addedAt: z.ZodString;
|
|
223
|
+
addedBy: z.ZodString;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
226
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
227
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
228
|
+
secondaryColor: z.ZodOptional<z.ZodString>;
|
|
229
|
+
accentColor: z.ZodOptional<z.ZodString>;
|
|
230
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
231
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
232
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
233
|
+
headingFontFamily: z.ZodOptional<z.ZodString>;
|
|
234
|
+
borderRadius: z.ZodDefault<z.ZodEnum<{
|
|
235
|
+
sm: "sm";
|
|
236
|
+
md: "md";
|
|
237
|
+
lg: "lg";
|
|
238
|
+
none: "none";
|
|
239
|
+
full: "full";
|
|
240
|
+
}>>;
|
|
241
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
242
|
+
light: "light";
|
|
243
|
+
dark: "dark";
|
|
244
|
+
auto: "auto";
|
|
245
|
+
}>>;
|
|
246
|
+
customVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
247
|
+
}, z.core.$strip>>;
|
|
248
|
+
pageCount: z.ZodDefault<z.ZodNumber>;
|
|
249
|
+
publishedAt: z.ZodOptional<z.ZodString>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
export type Site = z.infer<typeof SiteSchema>;
|
|
252
|
+
export declare const CreateSiteInputSchema: z.ZodObject<{
|
|
253
|
+
name: z.ZodString;
|
|
254
|
+
slug: z.ZodString;
|
|
255
|
+
description: z.ZodOptional<z.ZodString>;
|
|
256
|
+
ownerId: z.ZodString;
|
|
257
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
258
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
domain: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
260
|
+
subdomain: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
261
|
+
language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
262
|
+
supportedLanguages: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
263
|
+
timezone: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
264
|
+
seo: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
265
|
+
title: z.ZodOptional<z.ZodString>;
|
|
266
|
+
description: z.ZodOptional<z.ZodString>;
|
|
267
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
268
|
+
twitterHandle: z.ZodOptional<z.ZodString>;
|
|
269
|
+
facebookAppId: z.ZodOptional<z.ZodString>;
|
|
270
|
+
googleSiteVerification: z.ZodOptional<z.ZodString>;
|
|
271
|
+
robots: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strip>>>;
|
|
273
|
+
analyticsId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
274
|
+
allowAgentEdits: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
275
|
+
agentRestrictions: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
276
|
+
canPublish: z.ZodDefault<z.ZodBoolean>;
|
|
277
|
+
canDeletePages: z.ZodDefault<z.ZodBoolean>;
|
|
278
|
+
canModifySettings: z.ZodDefault<z.ZodBoolean>;
|
|
279
|
+
protectedPages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
280
|
+
}, z.core.$strip>>>;
|
|
281
|
+
notFoundPageId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
282
|
+
faviconUrl: z.ZodOptional<z.ZodOptional<z.ZodURL>>;
|
|
283
|
+
socialLinks: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
284
|
+
platform: z.ZodString;
|
|
285
|
+
url: z.ZodURL;
|
|
286
|
+
}, z.core.$strip>>>>;
|
|
287
|
+
}, z.core.$strip>>;
|
|
288
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
290
|
+
secondaryColor: z.ZodOptional<z.ZodString>;
|
|
291
|
+
accentColor: z.ZodOptional<z.ZodString>;
|
|
292
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
293
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
294
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
295
|
+
headingFontFamily: z.ZodOptional<z.ZodString>;
|
|
296
|
+
borderRadius: z.ZodDefault<z.ZodEnum<{
|
|
297
|
+
sm: "sm";
|
|
298
|
+
md: "md";
|
|
299
|
+
lg: "lg";
|
|
300
|
+
none: "none";
|
|
301
|
+
full: "full";
|
|
302
|
+
}>>;
|
|
303
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
304
|
+
light: "light";
|
|
305
|
+
dark: "dark";
|
|
306
|
+
auto: "auto";
|
|
307
|
+
}>>;
|
|
308
|
+
customVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
309
|
+
}, z.core.$strip>>;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
export type CreateSiteInput = z.infer<typeof CreateSiteInputSchema>;
|
|
312
|
+
/**
|
|
313
|
+
* Creates a new site with dual representation
|
|
314
|
+
*/
|
|
315
|
+
export declare function createSite(id: string, input: CreateSiteInput): Site;
|
|
316
|
+
export declare const UpdateSiteInputSchema: z.ZodObject<{
|
|
317
|
+
name: z.ZodOptional<z.ZodString>;
|
|
318
|
+
description: z.ZodOptional<z.ZodString>;
|
|
319
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
320
|
+
draft: "draft";
|
|
321
|
+
published: "published";
|
|
322
|
+
archived: "archived";
|
|
323
|
+
maintenance: "maintenance";
|
|
324
|
+
}>>;
|
|
325
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
326
|
+
domain: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
327
|
+
subdomain: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
328
|
+
language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
329
|
+
supportedLanguages: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
330
|
+
timezone: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
331
|
+
seo: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
332
|
+
title: z.ZodOptional<z.ZodString>;
|
|
333
|
+
description: z.ZodOptional<z.ZodString>;
|
|
334
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
335
|
+
twitterHandle: z.ZodOptional<z.ZodString>;
|
|
336
|
+
facebookAppId: z.ZodOptional<z.ZodString>;
|
|
337
|
+
googleSiteVerification: z.ZodOptional<z.ZodString>;
|
|
338
|
+
robots: z.ZodOptional<z.ZodString>;
|
|
339
|
+
}, z.core.$strip>>>;
|
|
340
|
+
analyticsId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
341
|
+
allowAgentEdits: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
342
|
+
agentRestrictions: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
343
|
+
canPublish: z.ZodDefault<z.ZodBoolean>;
|
|
344
|
+
canDeletePages: z.ZodDefault<z.ZodBoolean>;
|
|
345
|
+
canModifySettings: z.ZodDefault<z.ZodBoolean>;
|
|
346
|
+
protectedPages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
347
|
+
}, z.core.$strip>>>;
|
|
348
|
+
notFoundPageId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
349
|
+
faviconUrl: z.ZodOptional<z.ZodOptional<z.ZodURL>>;
|
|
350
|
+
socialLinks: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
351
|
+
platform: z.ZodString;
|
|
352
|
+
url: z.ZodURL;
|
|
353
|
+
}, z.core.$strip>>>>;
|
|
354
|
+
}, z.core.$strip>>;
|
|
355
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
primaryColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
357
|
+
secondaryColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
358
|
+
accentColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
359
|
+
backgroundColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
360
|
+
textColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
361
|
+
fontFamily: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
362
|
+
headingFontFamily: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
363
|
+
borderRadius: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
364
|
+
sm: "sm";
|
|
365
|
+
md: "md";
|
|
366
|
+
lg: "lg";
|
|
367
|
+
none: "none";
|
|
368
|
+
full: "full";
|
|
369
|
+
}>>>;
|
|
370
|
+
mode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
371
|
+
light: "light";
|
|
372
|
+
dark: "dark";
|
|
373
|
+
auto: "auto";
|
|
374
|
+
}>>>;
|
|
375
|
+
customVariables: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
376
|
+
}, z.core.$strip>>;
|
|
377
|
+
}, z.core.$strip>;
|
|
378
|
+
export type UpdateSiteInput = z.infer<typeof UpdateSiteInputSchema>;
|
|
379
|
+
/**
|
|
380
|
+
* Checks if a user has permission to perform an action on a site
|
|
381
|
+
*/
|
|
382
|
+
export declare function canUserPerformAction(site: Site, userId: string, action: 'view' | 'edit' | 'admin' | 'delete'): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Checks if an agent can edit this site
|
|
385
|
+
*/
|
|
386
|
+
export declare function canAgentEditSite(site: Site): boolean;
|
|
387
|
+
//# sourceMappingURL=site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../src/entities/site.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAe1B,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAMpC,eAAO,MAAM,gBAAgB;;;;;EAK3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAMzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;iBA6C1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAMvD,eAAO,MAAM,aAA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