@dyrected/core 2.12.0 → 2.13.1
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/dist/access-P6Z2XAFS.js +10 -0
- package/dist/ai-X3M2SE5A.js +17 -0
- package/dist/ai-tools-UPKJY3TX.js +14 -0
- package/dist/{app-config-C6hYM8WO.d.cts → app-De-3eNn1.d.cts} +476 -2
- package/dist/{app-config-C6hYM8WO.d.ts → app-De-3eNn1.d.ts} +476 -2
- package/dist/chunk-254THFDS.js +202 -0
- package/dist/chunk-27YRIGK5.js +1758 -0
- package/dist/chunk-4RAQJVJM.js +18 -0
- package/dist/chunk-HRRJ3RYT.js +70 -0
- package/dist/{chunk-VOE2LOLF.js → chunk-LYENW2EN.js} +280 -1760
- package/dist/chunk-W7GKJM2X.js +1136 -0
- package/dist/chunk-ZYYDTHF3.js +635 -0
- package/dist/index.cjs +518 -525
- package/dist/index.d.cts +91 -4
- package/dist/index.d.ts +91 -4
- package/dist/index.js +45 -2
- package/dist/rag.service-YDGEYTXS.js +11 -0
- package/dist/server.cjs +5004 -1391
- package/dist/server.d.cts +358 -328
- package/dist/server.d.ts +358 -328
- package/dist/server.js +2059 -267
- package/package.json +4 -1
- package/dist/chunk-FRSJJO27.js +0 -519
- package/dist/observability-HQF4EUSV.js +0 -35
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { F as Field, B as Block, D as DyrectedConfig, C as CollectionConfig, A as AdminAuthConfig, P as PublicAdminAuthConfig, G as GlobalConfig, a as DeclarativeHookExpression, W as WorkflowConfig, b as AuthenticatedUser, c as WorkflowTransition, L as LifecycleEventName, d as LifecycleEvent, e as BaseDocument, H as HookRequestContext, f as DetailComputedOptions, g as ComputedHandler, h as DetailComputed, i as DetailCustomOptions, j as DetailCustom, k as DetailDividerOptions, l as DetailDivider, m as DisplayFieldOptions, n as DetailField, o as DetailItem, p as DetailGridOptions, q as DetailGrid, r as DetailRepeatOptions, s as DetailRepeat, t as DetailSectionOptions, u as DetailSection, v as DetailTabOptions, w as DetailTab, x as DetailTabsOptions, y as DetailTabs, z as DetailTextOptions, E as DetailText, I as DetailSchema, J as
|
|
2
|
-
export {
|
|
1
|
+
import { F as Field, B as Block, D as DyrectedConfig, C as CollectionConfig, A as AdminAuthConfig, P as PublicAdminAuthConfig, G as GlobalConfig, a as DeclarativeHookExpression, W as WorkflowConfig, b as AuthenticatedUser, c as WorkflowTransition, L as LifecycleEventName, d as LifecycleEvent, e as BaseDocument, H as HookRequestContext, f as DetailComputedOptions, g as ComputedHandler, h as DetailComputed, i as DetailCustomOptions, j as DetailCustom, k as DetailDividerOptions, l as DetailDivider, m as DisplayFieldOptions, n as DetailField, o as DetailItem, p as DetailGridOptions, q as DetailGrid, r as DetailRepeatOptions, s as DetailRepeat, t as DetailSectionOptions, u as DetailSection, v as DetailTabOptions, w as DetailTab, x as DetailTabsOptions, y as DetailTabs, z as DetailTextOptions, E as DetailText, I as DetailSchema, J as DyrectedContext, K as AIConfig, M as AIPIIConfig, N as ArrayField, O as BlocksField, Q as BooleanField, R as AuthConfig, S as AccessPolicyResolver, T as DateField, U as DateTimeField, V as EmailField, X as IconField, Y as ImageField, Z as JoinField, _ as JsonField, $ as MultiSelectField, a0 as NumberField, a1 as ObjectField, a2 as RadioField, a3 as RelationshipField, a4 as RichTextField, a5 as RowField, a6 as SelectField, a7 as TextField, a8 as TextareaField, a9 as TimeField, aa as UrlField } from './app-De-3eNn1.cjs';
|
|
2
|
+
export { ab as AIAction, ac as AIActionStatus, ad as AIActionType, ae as AIAuditActionType, af as AIAuditRecord, ag as AIChunk, ah as AIMessage, ai as AIPIIPattern, aj as AIRateLimitResult, ak as AIRateLimitStore, al as AIThread, am as AIToolContext, an as AIToolDefinition, ao as AI_ACTIONS_COLLECTION, ap as AI_AUDIT_COLLECTION, aq as AI_CHUNKS_COLLECTION, ar as AI_MESSAGES_COLLECTION, as as AI_THREADS_COLLECTION, at as AccessConfig, au as AccessFunction, av as AccessFunctionArgs, aw as AccessResult, ax as AccessRule, ay as ActionConfig, az as ActionContext, aA as ActionType, aB as AdminAuthAccessResolution, aC as AdminAuthClaimMapping, aD as AdminAuthMember, aE as AdminAuthProvider, aF as AdminAuthProviderMembersConfig, aG as AdminAuthProvisioningMode, aH as AdminAuthResolveAccessArgs, aI as AdminAuthResolvedIdentity, aJ as AdminConfig, aK as AdminDashboardComponentSlots, aL as AdminIconName, aM as AggregateArgs, aN as AggregateCastType, aO as AggregateCollectionResult, aP as AggregateInput, aQ as AggregateOperation, aR as AggregateResult, aS as BaseAdminAuthProvider, aT as BaseFieldAdmin, aU as BlockVariant, aV as BooleanFieldAdmin, aW as BooleanFormat, aX as CharacterLimitFieldAdmin, aY as CharacterLimitFieldConfig, aZ as CollectionAfterChangeHook, a_ as CollectionAfterDeleteHook, a$ as CollectionAfterReadHook, b0 as CollectionAfterReadHookEntry, b1 as CollectionAfterTransitionHook, b2 as CollectionBeforeChangeHook, b3 as CollectionBeforeChangeHookEntry, b4 as CollectionBeforeDeleteHook, b5 as CollectionBeforeReadHook, b6 as CollectionBeforeReadHookEntry, b7 as CollectionBeforeTransitionHook, b8 as CollectionListComponentSlots, b9 as CollectionRAGConfig, ba as CollectionSchemaResult, bb as CollectionSummaryResult, bc as CollectionViewComponentSlots, bd as CountOperation, be as CustomAdminAuthProvider, bf as DatabaseAdapter, bg as DateFieldAdmin, bh as DateFormat, bi as DefineActionOptions, bj as DefineViewOptions, bk as DetailSpan, bl as DisplayTone, bm as DisplayVariant, bn as DistinctCountOperation, bo as DistinctValuesOperation, bp as DynamicOptionItem, bq as DynamicOptionsConfig, br as DynamicOptionsResolver, bs as DynamicOptionsResolverArgs, bt as DyrectedAIContext, bu as DyrectedLoggerConfig, bv as DyrectedObservabilityConfig, bw as EmailFieldAdmin, bx as FieldAdminHooks, by as FieldAdminOnChangeHook, bz as FieldAdminOnChangeHookArgs, bA as FieldAdminOptionsHook, bB as FieldAdminOptionsHookArgs, bC as FieldAdminOptionsHookResult, bD as FieldAfterReadHook, bE as FieldAfterReadHookArgs, bF as FieldBase, bG as FieldBeforeChangeHook, bH as FieldBeforeChangeHookArgs, bI as FieldHook, bJ as FieldHooks, bK as FieldType, bL as FileData, bM as GetDocumentResult, bN as GlobalAfterChangeHook, bO as GlobalAfterReadHook, bP as GlobalAfterReadHookEntry, bQ as GlobalBeforeChangeHook, bR as GlobalBeforeChangeHookEntry, bS as GlobalBeforeReadHook, bT as GlobalBeforeReadHookEntry, bU as GlobalRAGConfig, bV as GlobalSchemaResult, bW as GlobalSummaryResult, bX as HeadingLevel, bY as HookFunction, bZ as IconFieldAdmin, b_ as ImageService, b$ as ImageTransformOptions, c0 as InferAggregateResult, c1 as JoinFieldAdmin, c2 as JsonFieldAdmin, c3 as JsonFormat, c4 as LIFECYCLE_EVENT_NAMES, c5 as LifecycleEventHandler, c6 as LinkFormat, c7 as MetricColor, c8 as MultiSelectFieldAdmin, c9 as NamedAccessPolicy, ca as NumberFieldAdmin, cb as NumberFormat, cc as NumberLimitFieldAdmin, cd as NumberLimitFieldConfig, ce as NumericOperation, cf as OIDCAdminAuthProvider, cg as OptionFormat, ch as PaginatedResult, ci as PublicAdminAuthProvider, cj as QueryCollectionResult, ck as RAGSearchResult, cl as RadioFieldAdmin, cm as RateLimitConfig, cn as ReadonlyDatabaseAdapter, co as RichTextFeature, cp as RichTextFieldConfig, cq as SelectFieldAdmin, cr as SqlWhereResult, cs as StorageAdapter, ct as TextFieldAdmin, cu as TextFormat, cv as TextareaFieldAdmin, cw as TrustProxyConfig, cx as TypedField, cy as UploadConfig, cz as UrlFieldAdmin, cA as UrlLinkValue, cB as ViewActionFeatures, cC as ViewComponentSlots, cD as ViewConfig, cE as ViewLayout, cF as ViewMetric, cG as ViewSubMetric, cH as WhereClause, cI as WhereOperator, cJ as WhereOperatorName, cK as WordLimitFieldAdmin, cL as WordLimitFieldConfig, cM as WorkflowMetadata, cN as WorkflowRole, cO as WorkflowState, cP as WorkflowTransitionContext, cQ as defineAction, cR as defineView, cS as isAICollection, cT as parseMongoWhere, cU as parseSqlWhere } from './app-De-3eNn1.cjs';
|
|
3
3
|
import jexl from 'jexl';
|
|
4
|
-
import '
|
|
4
|
+
import { Context } from 'hono';
|
|
5
|
+
export { z } from 'zod';
|
|
6
|
+
import 'hono/types';
|
|
5
7
|
import 'pino';
|
|
8
|
+
import 'lucide-react';
|
|
9
|
+
import 'jose';
|
|
10
|
+
import '@opentelemetry/api';
|
|
11
|
+
import '@opentelemetry/exporter-prometheus';
|
|
6
12
|
|
|
7
13
|
type Prettify<T> = {
|
|
8
14
|
[K in keyof T]: T[K];
|
|
@@ -75,6 +81,21 @@ type UploadDocFields = {
|
|
|
75
81
|
}>;
|
|
76
82
|
};
|
|
77
83
|
|
|
84
|
+
type AIErrorCode = 'AI_UNCONFIGURED' | 'AI_RATE_LIMITED' | 'AI_QUOTA_EXHAUSTED' | 'AI_TIMEOUT' | 'AI_TOOL_VALIDATION_ERROR' | 'AI_PERMISSION_DENIED' | 'AI_TENANT_VIOLATION' | 'AI_ACTION_EXPIRED' | 'AI_ACTION_ALREADY_EXECUTED' | 'AI_INTERNAL_ERROR';
|
|
85
|
+
declare class DyrectedAIError extends Error {
|
|
86
|
+
readonly code: AIErrorCode;
|
|
87
|
+
readonly status: number;
|
|
88
|
+
readonly details?: Record<string, unknown>;
|
|
89
|
+
constructor(code: AIErrorCode, message: string, status?: number, details?: Record<string, unknown>);
|
|
90
|
+
toJSON(): {
|
|
91
|
+
error: boolean;
|
|
92
|
+
code: AIErrorCode;
|
|
93
|
+
message: string;
|
|
94
|
+
status: number;
|
|
95
|
+
details: Record<string, unknown> | undefined;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
78
99
|
/**
|
|
79
100
|
* Normalizes the Dyrected configuration by injecting system fields
|
|
80
101
|
* (createdAt, updatedAt, createdBy, updatedBy) into every collection and
|
|
@@ -85,6 +106,17 @@ declare function normalizeConfig(config: DyrectedConfig): DyrectedConfig;
|
|
|
85
106
|
declare function getAdminAuthCollection(config: Pick<DyrectedConfig, "collections" | "adminAuth">): CollectionConfig | null;
|
|
86
107
|
declare function resolveAdminAuthCollection(collections: CollectionConfig[], collectionSlug?: string): CollectionConfig | undefined;
|
|
87
108
|
declare function getPublicAdminAuthConfig(adminAuth?: AdminAuthConfig, collections?: CollectionConfig[]): PublicAdminAuthConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Resolves the configured admin role for a collection or returns "admin" as default.
|
|
111
|
+
*/
|
|
112
|
+
declare function getAdminRoleForCollection(collection?: CollectionConfig | null): string;
|
|
113
|
+
/**
|
|
114
|
+
* Checks whether a user possesses an administrative role.
|
|
115
|
+
* Considers:
|
|
116
|
+
* 1. The collection's configured `adminRole` (e.g. 'super_admin')
|
|
117
|
+
* 2. Standard admin roles ('admin', 'super_admin')
|
|
118
|
+
*/
|
|
119
|
+
declare function isUserAdmin(user: any, collection?: CollectionConfig | null): boolean;
|
|
88
120
|
|
|
89
121
|
type SortDirection = 'ASC' | 'DESC';
|
|
90
122
|
interface SortClause {
|
|
@@ -1143,6 +1175,61 @@ declare const expr: ExprFunction;
|
|
|
1143
1175
|
*/
|
|
1144
1176
|
declare const when: ExprFunction;
|
|
1145
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* Extracts the list of allowed site IDs for a given authenticated user or token payload.
|
|
1180
|
+
* Checks common tenant membership properties: `allowedSites`, `siteIds`, `siteAccess`, and singular `siteId`.
|
|
1181
|
+
*/
|
|
1182
|
+
declare function getAllowedSitesForUser(user?: Record<string, unknown> | null, payload?: Record<string, unknown> | null): string[] | undefined;
|
|
1183
|
+
/**
|
|
1184
|
+
* Checks whether an authenticated user is permitted to access a given site ID.
|
|
1185
|
+
* If the user has no tenant restrictions configured, access is unrestricted (returns true).
|
|
1186
|
+
*/
|
|
1187
|
+
declare function isSiteAuthorized(user: Record<string, unknown> | null | undefined, payload: Record<string, unknown> | null | undefined, requestedSiteId: string | undefined): boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Resolves the authorized site ID for the current request.
|
|
1190
|
+
* Prioritizes `c.get("siteId")` (set upstream) and `X-Site-Id` header.
|
|
1191
|
+
* Enforces that restricted users cannot spoof or access unauthorized site IDs.
|
|
1192
|
+
*
|
|
1193
|
+
* @throws HTTPException(403) if the user is not authorized for the requested site.
|
|
1194
|
+
*/
|
|
1195
|
+
declare function resolveAuthorizedSiteId(c: Context<DyrectedContext>): string;
|
|
1196
|
+
|
|
1197
|
+
declare const NON_NEGOTIABLE_CREDENTIAL_FIELDS: Set<string>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Masks an email address to protect privacy (e.g. "john.doe@example.com" -> "j***@example.com").
|
|
1200
|
+
*/
|
|
1201
|
+
declare function maskEmail(email: string, strategy?: "mask" | "token"): string;
|
|
1202
|
+
/**
|
|
1203
|
+
* Masks a phone number (e.g. "+1 555-234-5678" -> "+1 ***-***-5678").
|
|
1204
|
+
*/
|
|
1205
|
+
declare function maskPhone(phone: string, strategy?: "mask" | "token"): string;
|
|
1206
|
+
/**
|
|
1207
|
+
* High-performance regex patterns for common PII.
|
|
1208
|
+
*/
|
|
1209
|
+
declare const PII_REGEX_PATTERNS: Record<string, RegExp>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Scrubs unstructured free text using configured regex patterns and custom scrubbers.
|
|
1212
|
+
*/
|
|
1213
|
+
declare function maskTextPII(text: string, piiConfig?: AIPIIConfig): string;
|
|
1214
|
+
interface SanitizeDocForAIOptions {
|
|
1215
|
+
doc: Record<string, unknown>;
|
|
1216
|
+
collectionConfig?: CollectionConfig;
|
|
1217
|
+
globalAIConfig?: AIConfig;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Deterministically sanitizes a CMS document before sending it to an AI assistant or RAG pipeline:
|
|
1221
|
+
* 1. Non-negotiably strips passwords, secrets, hashes, and session tokens.
|
|
1222
|
+
* 2. Strips collection-level `excludeFields`.
|
|
1223
|
+
* 3. Applies field-level definitions:
|
|
1224
|
+
* - Automatically masks `email` and `phone` by default (opt-out privacy) unless `ai: { allowRaw: true }`.
|
|
1225
|
+
* - Strips fields configured with `ai: { exclude: true }`.
|
|
1226
|
+
* - Masks fields configured with `ai: { redact: true }`.
|
|
1227
|
+
* 4. Applies collection-level `redactFields`.
|
|
1228
|
+
* 5. Calls custom programmatic `collectionConfig.ai.sanitizeDoc` hook if provided.
|
|
1229
|
+
* 6. Scrubs unstructured text across string fields if `config.ai.pii.enabled === true`.
|
|
1230
|
+
*/
|
|
1231
|
+
declare function sanitizeDocForAI(options: SanitizeDocForAIOptions): Record<string, unknown>;
|
|
1232
|
+
|
|
1146
1233
|
type TopLevelFieldName<TFields extends readonly Field[]> = Extract<TFields[number], {
|
|
1147
1234
|
name: string;
|
|
1148
1235
|
}>["name"];
|
|
@@ -1562,4 +1649,4 @@ declare function defineTab<const T extends readonly Field[]>(args: {
|
|
|
1562
1649
|
fields: T;
|
|
1563
1650
|
}): T;
|
|
1564
1651
|
|
|
1565
|
-
export { type AccessConditions, AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BlocksField, BooleanField, CollectionConfig, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DyrectedConfig, EmailField, type ExprFunction, Field, FieldConditionBuilder, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MatchBuilder, MultiSelectField, NumberField, ObjectField, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidPreviewUrlsInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, compact, count, createLifecycleEvent, createWorkflowDocument, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRowField, defineSelectField, defineTab, defineTextField, defineTextareaField, defineTimeField, defineUrlField, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, endsWith, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateOpenApi, get, getAdminAuthCollection, getPublicAdminAuthConfig, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, join, last, length, lower, materializeWorkflowDocument, max, min, normalizeConfig, normalizeDetailItem, now, numericFieldNames, parseSort, pow, publishedStateName, publishingWorkflow, readingTime, registerJexlHelpers, replace, resolveAdminAuthCollection, round, runCollectionHooks, saveWorkflowDraft, simplePublishingWorkflow, slugify, sqrt, startsWith, sum, today, transitionWorkflow, trim, truncate, unique, upper, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
|
1652
|
+
export { AIConfig, type AIErrorCode, AIPIIConfig, type AccessConditions, AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BlocksField, BooleanField, CollectionConfig, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DyrectedAIError, DyrectedConfig, EmailField, type ExprFunction, Field, FieldConditionBuilder, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MatchBuilder, MultiSelectField, NON_NEGOTIABLE_CREDENTIAL_FIELDS, NumberField, ObjectField, PII_REGEX_PATTERNS, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, type SanitizeDocForAIOptions, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidPreviewUrlsInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, compact, count, createLifecycleEvent, createWorkflowDocument, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRowField, defineSelectField, defineTab, defineTextField, defineTextareaField, defineTimeField, defineUrlField, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, endsWith, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateOpenApi, get, getAdminAuthCollection, getAdminRoleForCollection, getAllowedSitesForUser, getPublicAdminAuthConfig, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, isSiteAuthorized, isUserAdmin, join, last, length, lower, maskEmail, maskPhone, maskTextPII, materializeWorkflowDocument, max, min, normalizeConfig, normalizeDetailItem, now, numericFieldNames, parseSort, pow, publishedStateName, publishingWorkflow, readingTime, registerJexlHelpers, replace, resolveAdminAuthCollection, resolveAuthorizedSiteId, round, runCollectionHooks, sanitizeDocForAI, saveWorkflowDraft, simplePublishingWorkflow, slugify, sqrt, startsWith, sum, today, transitionWorkflow, trim, truncate, unique, upper, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { F as Field, B as Block, D as DyrectedConfig, C as CollectionConfig, A as AdminAuthConfig, P as PublicAdminAuthConfig, G as GlobalConfig, a as DeclarativeHookExpression, W as WorkflowConfig, b as AuthenticatedUser, c as WorkflowTransition, L as LifecycleEventName, d as LifecycleEvent, e as BaseDocument, H as HookRequestContext, f as DetailComputedOptions, g as ComputedHandler, h as DetailComputed, i as DetailCustomOptions, j as DetailCustom, k as DetailDividerOptions, l as DetailDivider, m as DisplayFieldOptions, n as DetailField, o as DetailItem, p as DetailGridOptions, q as DetailGrid, r as DetailRepeatOptions, s as DetailRepeat, t as DetailSectionOptions, u as DetailSection, v as DetailTabOptions, w as DetailTab, x as DetailTabsOptions, y as DetailTabs, z as DetailTextOptions, E as DetailText, I as DetailSchema, J as
|
|
2
|
-
export {
|
|
1
|
+
import { F as Field, B as Block, D as DyrectedConfig, C as CollectionConfig, A as AdminAuthConfig, P as PublicAdminAuthConfig, G as GlobalConfig, a as DeclarativeHookExpression, W as WorkflowConfig, b as AuthenticatedUser, c as WorkflowTransition, L as LifecycleEventName, d as LifecycleEvent, e as BaseDocument, H as HookRequestContext, f as DetailComputedOptions, g as ComputedHandler, h as DetailComputed, i as DetailCustomOptions, j as DetailCustom, k as DetailDividerOptions, l as DetailDivider, m as DisplayFieldOptions, n as DetailField, o as DetailItem, p as DetailGridOptions, q as DetailGrid, r as DetailRepeatOptions, s as DetailRepeat, t as DetailSectionOptions, u as DetailSection, v as DetailTabOptions, w as DetailTab, x as DetailTabsOptions, y as DetailTabs, z as DetailTextOptions, E as DetailText, I as DetailSchema, J as DyrectedContext, K as AIConfig, M as AIPIIConfig, N as ArrayField, O as BlocksField, Q as BooleanField, R as AuthConfig, S as AccessPolicyResolver, T as DateField, U as DateTimeField, V as EmailField, X as IconField, Y as ImageField, Z as JoinField, _ as JsonField, $ as MultiSelectField, a0 as NumberField, a1 as ObjectField, a2 as RadioField, a3 as RelationshipField, a4 as RichTextField, a5 as RowField, a6 as SelectField, a7 as TextField, a8 as TextareaField, a9 as TimeField, aa as UrlField } from './app-De-3eNn1.js';
|
|
2
|
+
export { ab as AIAction, ac as AIActionStatus, ad as AIActionType, ae as AIAuditActionType, af as AIAuditRecord, ag as AIChunk, ah as AIMessage, ai as AIPIIPattern, aj as AIRateLimitResult, ak as AIRateLimitStore, al as AIThread, am as AIToolContext, an as AIToolDefinition, ao as AI_ACTIONS_COLLECTION, ap as AI_AUDIT_COLLECTION, aq as AI_CHUNKS_COLLECTION, ar as AI_MESSAGES_COLLECTION, as as AI_THREADS_COLLECTION, at as AccessConfig, au as AccessFunction, av as AccessFunctionArgs, aw as AccessResult, ax as AccessRule, ay as ActionConfig, az as ActionContext, aA as ActionType, aB as AdminAuthAccessResolution, aC as AdminAuthClaimMapping, aD as AdminAuthMember, aE as AdminAuthProvider, aF as AdminAuthProviderMembersConfig, aG as AdminAuthProvisioningMode, aH as AdminAuthResolveAccessArgs, aI as AdminAuthResolvedIdentity, aJ as AdminConfig, aK as AdminDashboardComponentSlots, aL as AdminIconName, aM as AggregateArgs, aN as AggregateCastType, aO as AggregateCollectionResult, aP as AggregateInput, aQ as AggregateOperation, aR as AggregateResult, aS as BaseAdminAuthProvider, aT as BaseFieldAdmin, aU as BlockVariant, aV as BooleanFieldAdmin, aW as BooleanFormat, aX as CharacterLimitFieldAdmin, aY as CharacterLimitFieldConfig, aZ as CollectionAfterChangeHook, a_ as CollectionAfterDeleteHook, a$ as CollectionAfterReadHook, b0 as CollectionAfterReadHookEntry, b1 as CollectionAfterTransitionHook, b2 as CollectionBeforeChangeHook, b3 as CollectionBeforeChangeHookEntry, b4 as CollectionBeforeDeleteHook, b5 as CollectionBeforeReadHook, b6 as CollectionBeforeReadHookEntry, b7 as CollectionBeforeTransitionHook, b8 as CollectionListComponentSlots, b9 as CollectionRAGConfig, ba as CollectionSchemaResult, bb as CollectionSummaryResult, bc as CollectionViewComponentSlots, bd as CountOperation, be as CustomAdminAuthProvider, bf as DatabaseAdapter, bg as DateFieldAdmin, bh as DateFormat, bi as DefineActionOptions, bj as DefineViewOptions, bk as DetailSpan, bl as DisplayTone, bm as DisplayVariant, bn as DistinctCountOperation, bo as DistinctValuesOperation, bp as DynamicOptionItem, bq as DynamicOptionsConfig, br as DynamicOptionsResolver, bs as DynamicOptionsResolverArgs, bt as DyrectedAIContext, bu as DyrectedLoggerConfig, bv as DyrectedObservabilityConfig, bw as EmailFieldAdmin, bx as FieldAdminHooks, by as FieldAdminOnChangeHook, bz as FieldAdminOnChangeHookArgs, bA as FieldAdminOptionsHook, bB as FieldAdminOptionsHookArgs, bC as FieldAdminOptionsHookResult, bD as FieldAfterReadHook, bE as FieldAfterReadHookArgs, bF as FieldBase, bG as FieldBeforeChangeHook, bH as FieldBeforeChangeHookArgs, bI as FieldHook, bJ as FieldHooks, bK as FieldType, bL as FileData, bM as GetDocumentResult, bN as GlobalAfterChangeHook, bO as GlobalAfterReadHook, bP as GlobalAfterReadHookEntry, bQ as GlobalBeforeChangeHook, bR as GlobalBeforeChangeHookEntry, bS as GlobalBeforeReadHook, bT as GlobalBeforeReadHookEntry, bU as GlobalRAGConfig, bV as GlobalSchemaResult, bW as GlobalSummaryResult, bX as HeadingLevel, bY as HookFunction, bZ as IconFieldAdmin, b_ as ImageService, b$ as ImageTransformOptions, c0 as InferAggregateResult, c1 as JoinFieldAdmin, c2 as JsonFieldAdmin, c3 as JsonFormat, c4 as LIFECYCLE_EVENT_NAMES, c5 as LifecycleEventHandler, c6 as LinkFormat, c7 as MetricColor, c8 as MultiSelectFieldAdmin, c9 as NamedAccessPolicy, ca as NumberFieldAdmin, cb as NumberFormat, cc as NumberLimitFieldAdmin, cd as NumberLimitFieldConfig, ce as NumericOperation, cf as OIDCAdminAuthProvider, cg as OptionFormat, ch as PaginatedResult, ci as PublicAdminAuthProvider, cj as QueryCollectionResult, ck as RAGSearchResult, cl as RadioFieldAdmin, cm as RateLimitConfig, cn as ReadonlyDatabaseAdapter, co as RichTextFeature, cp as RichTextFieldConfig, cq as SelectFieldAdmin, cr as SqlWhereResult, cs as StorageAdapter, ct as TextFieldAdmin, cu as TextFormat, cv as TextareaFieldAdmin, cw as TrustProxyConfig, cx as TypedField, cy as UploadConfig, cz as UrlFieldAdmin, cA as UrlLinkValue, cB as ViewActionFeatures, cC as ViewComponentSlots, cD as ViewConfig, cE as ViewLayout, cF as ViewMetric, cG as ViewSubMetric, cH as WhereClause, cI as WhereOperator, cJ as WhereOperatorName, cK as WordLimitFieldAdmin, cL as WordLimitFieldConfig, cM as WorkflowMetadata, cN as WorkflowRole, cO as WorkflowState, cP as WorkflowTransitionContext, cQ as defineAction, cR as defineView, cS as isAICollection, cT as parseMongoWhere, cU as parseSqlWhere } from './app-De-3eNn1.js';
|
|
3
3
|
import jexl from 'jexl';
|
|
4
|
-
import '
|
|
4
|
+
import { Context } from 'hono';
|
|
5
|
+
export { z } from 'zod';
|
|
6
|
+
import 'hono/types';
|
|
5
7
|
import 'pino';
|
|
8
|
+
import 'lucide-react';
|
|
9
|
+
import 'jose';
|
|
10
|
+
import '@opentelemetry/api';
|
|
11
|
+
import '@opentelemetry/exporter-prometheus';
|
|
6
12
|
|
|
7
13
|
type Prettify<T> = {
|
|
8
14
|
[K in keyof T]: T[K];
|
|
@@ -75,6 +81,21 @@ type UploadDocFields = {
|
|
|
75
81
|
}>;
|
|
76
82
|
};
|
|
77
83
|
|
|
84
|
+
type AIErrorCode = 'AI_UNCONFIGURED' | 'AI_RATE_LIMITED' | 'AI_QUOTA_EXHAUSTED' | 'AI_TIMEOUT' | 'AI_TOOL_VALIDATION_ERROR' | 'AI_PERMISSION_DENIED' | 'AI_TENANT_VIOLATION' | 'AI_ACTION_EXPIRED' | 'AI_ACTION_ALREADY_EXECUTED' | 'AI_INTERNAL_ERROR';
|
|
85
|
+
declare class DyrectedAIError extends Error {
|
|
86
|
+
readonly code: AIErrorCode;
|
|
87
|
+
readonly status: number;
|
|
88
|
+
readonly details?: Record<string, unknown>;
|
|
89
|
+
constructor(code: AIErrorCode, message: string, status?: number, details?: Record<string, unknown>);
|
|
90
|
+
toJSON(): {
|
|
91
|
+
error: boolean;
|
|
92
|
+
code: AIErrorCode;
|
|
93
|
+
message: string;
|
|
94
|
+
status: number;
|
|
95
|
+
details: Record<string, unknown> | undefined;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
78
99
|
/**
|
|
79
100
|
* Normalizes the Dyrected configuration by injecting system fields
|
|
80
101
|
* (createdAt, updatedAt, createdBy, updatedBy) into every collection and
|
|
@@ -85,6 +106,17 @@ declare function normalizeConfig(config: DyrectedConfig): DyrectedConfig;
|
|
|
85
106
|
declare function getAdminAuthCollection(config: Pick<DyrectedConfig, "collections" | "adminAuth">): CollectionConfig | null;
|
|
86
107
|
declare function resolveAdminAuthCollection(collections: CollectionConfig[], collectionSlug?: string): CollectionConfig | undefined;
|
|
87
108
|
declare function getPublicAdminAuthConfig(adminAuth?: AdminAuthConfig, collections?: CollectionConfig[]): PublicAdminAuthConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Resolves the configured admin role for a collection or returns "admin" as default.
|
|
111
|
+
*/
|
|
112
|
+
declare function getAdminRoleForCollection(collection?: CollectionConfig | null): string;
|
|
113
|
+
/**
|
|
114
|
+
* Checks whether a user possesses an administrative role.
|
|
115
|
+
* Considers:
|
|
116
|
+
* 1. The collection's configured `adminRole` (e.g. 'super_admin')
|
|
117
|
+
* 2. Standard admin roles ('admin', 'super_admin')
|
|
118
|
+
*/
|
|
119
|
+
declare function isUserAdmin(user: any, collection?: CollectionConfig | null): boolean;
|
|
88
120
|
|
|
89
121
|
type SortDirection = 'ASC' | 'DESC';
|
|
90
122
|
interface SortClause {
|
|
@@ -1143,6 +1175,61 @@ declare const expr: ExprFunction;
|
|
|
1143
1175
|
*/
|
|
1144
1176
|
declare const when: ExprFunction;
|
|
1145
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* Extracts the list of allowed site IDs for a given authenticated user or token payload.
|
|
1180
|
+
* Checks common tenant membership properties: `allowedSites`, `siteIds`, `siteAccess`, and singular `siteId`.
|
|
1181
|
+
*/
|
|
1182
|
+
declare function getAllowedSitesForUser(user?: Record<string, unknown> | null, payload?: Record<string, unknown> | null): string[] | undefined;
|
|
1183
|
+
/**
|
|
1184
|
+
* Checks whether an authenticated user is permitted to access a given site ID.
|
|
1185
|
+
* If the user has no tenant restrictions configured, access is unrestricted (returns true).
|
|
1186
|
+
*/
|
|
1187
|
+
declare function isSiteAuthorized(user: Record<string, unknown> | null | undefined, payload: Record<string, unknown> | null | undefined, requestedSiteId: string | undefined): boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Resolves the authorized site ID for the current request.
|
|
1190
|
+
* Prioritizes `c.get("siteId")` (set upstream) and `X-Site-Id` header.
|
|
1191
|
+
* Enforces that restricted users cannot spoof or access unauthorized site IDs.
|
|
1192
|
+
*
|
|
1193
|
+
* @throws HTTPException(403) if the user is not authorized for the requested site.
|
|
1194
|
+
*/
|
|
1195
|
+
declare function resolveAuthorizedSiteId(c: Context<DyrectedContext>): string;
|
|
1196
|
+
|
|
1197
|
+
declare const NON_NEGOTIABLE_CREDENTIAL_FIELDS: Set<string>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Masks an email address to protect privacy (e.g. "john.doe@example.com" -> "j***@example.com").
|
|
1200
|
+
*/
|
|
1201
|
+
declare function maskEmail(email: string, strategy?: "mask" | "token"): string;
|
|
1202
|
+
/**
|
|
1203
|
+
* Masks a phone number (e.g. "+1 555-234-5678" -> "+1 ***-***-5678").
|
|
1204
|
+
*/
|
|
1205
|
+
declare function maskPhone(phone: string, strategy?: "mask" | "token"): string;
|
|
1206
|
+
/**
|
|
1207
|
+
* High-performance regex patterns for common PII.
|
|
1208
|
+
*/
|
|
1209
|
+
declare const PII_REGEX_PATTERNS: Record<string, RegExp>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Scrubs unstructured free text using configured regex patterns and custom scrubbers.
|
|
1212
|
+
*/
|
|
1213
|
+
declare function maskTextPII(text: string, piiConfig?: AIPIIConfig): string;
|
|
1214
|
+
interface SanitizeDocForAIOptions {
|
|
1215
|
+
doc: Record<string, unknown>;
|
|
1216
|
+
collectionConfig?: CollectionConfig;
|
|
1217
|
+
globalAIConfig?: AIConfig;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Deterministically sanitizes a CMS document before sending it to an AI assistant or RAG pipeline:
|
|
1221
|
+
* 1. Non-negotiably strips passwords, secrets, hashes, and session tokens.
|
|
1222
|
+
* 2. Strips collection-level `excludeFields`.
|
|
1223
|
+
* 3. Applies field-level definitions:
|
|
1224
|
+
* - Automatically masks `email` and `phone` by default (opt-out privacy) unless `ai: { allowRaw: true }`.
|
|
1225
|
+
* - Strips fields configured with `ai: { exclude: true }`.
|
|
1226
|
+
* - Masks fields configured with `ai: { redact: true }`.
|
|
1227
|
+
* 4. Applies collection-level `redactFields`.
|
|
1228
|
+
* 5. Calls custom programmatic `collectionConfig.ai.sanitizeDoc` hook if provided.
|
|
1229
|
+
* 6. Scrubs unstructured text across string fields if `config.ai.pii.enabled === true`.
|
|
1230
|
+
*/
|
|
1231
|
+
declare function sanitizeDocForAI(options: SanitizeDocForAIOptions): Record<string, unknown>;
|
|
1232
|
+
|
|
1146
1233
|
type TopLevelFieldName<TFields extends readonly Field[]> = Extract<TFields[number], {
|
|
1147
1234
|
name: string;
|
|
1148
1235
|
}>["name"];
|
|
@@ -1562,4 +1649,4 @@ declare function defineTab<const T extends readonly Field[]>(args: {
|
|
|
1562
1649
|
fields: T;
|
|
1563
1650
|
}): T;
|
|
1564
1651
|
|
|
1565
|
-
export { type AccessConditions, AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BlocksField, BooleanField, CollectionConfig, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DyrectedConfig, EmailField, type ExprFunction, Field, FieldConditionBuilder, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MatchBuilder, MultiSelectField, NumberField, ObjectField, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidPreviewUrlsInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, compact, count, createLifecycleEvent, createWorkflowDocument, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRowField, defineSelectField, defineTab, defineTextField, defineTextareaField, defineTimeField, defineUrlField, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, endsWith, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateOpenApi, get, getAdminAuthCollection, getPublicAdminAuthConfig, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, join, last, length, lower, materializeWorkflowDocument, max, min, normalizeConfig, normalizeDetailItem, now, numericFieldNames, parseSort, pow, publishedStateName, publishingWorkflow, readingTime, registerJexlHelpers, replace, resolveAdminAuthCollection, round, runCollectionHooks, saveWorkflowDraft, simplePublishingWorkflow, slugify, sqrt, startsWith, sum, today, transitionWorkflow, trim, truncate, unique, upper, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
|
1652
|
+
export { AIConfig, type AIErrorCode, AIPIIConfig, type AccessConditions, AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BlocksField, BooleanField, CollectionConfig, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DyrectedAIError, DyrectedConfig, EmailField, type ExprFunction, Field, FieldConditionBuilder, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MatchBuilder, MultiSelectField, NON_NEGOTIABLE_CREDENTIAL_FIELDS, NumberField, ObjectField, PII_REGEX_PATTERNS, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, type SanitizeDocForAIOptions, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidPreviewUrlsInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, compact, count, createLifecycleEvent, createWorkflowDocument, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRowField, defineSelectField, defineTab, defineTextField, defineTextareaField, defineTimeField, defineUrlField, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, endsWith, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateOpenApi, get, getAdminAuthCollection, getAdminRoleForCollection, getAllowedSitesForUser, getPublicAdminAuthConfig, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, isSiteAuthorized, isUserAdmin, join, last, length, lower, maskEmail, maskPhone, maskTextPII, materializeWorkflowDocument, max, min, normalizeConfig, normalizeDetailItem, now, numericFieldNames, parseSort, pow, publishedStateName, publishingWorkflow, readingTime, registerJexlHelpers, replace, resolveAdminAuthCollection, resolveAuthorizedSiteId, round, runCollectionHooks, sanitizeDocForAI, saveWorkflowDraft, simplePublishingWorkflow, slugify, sqrt, startsWith, sum, today, transitionWorkflow, trim, truncate, unique, upper, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_JEXL_HELPERS,
|
|
3
3
|
ConfigValidationError,
|
|
4
|
+
DyrectedAIError,
|
|
4
5
|
LIFECYCLE_EVENTS_COLLECTION,
|
|
5
6
|
WORKFLOW_HISTORY_COLLECTION,
|
|
6
7
|
abs,
|
|
@@ -56,6 +57,8 @@ import {
|
|
|
56
57
|
generateOpenApi,
|
|
57
58
|
get,
|
|
58
59
|
getAdminAuthCollection,
|
|
60
|
+
getAdminRoleForCollection,
|
|
61
|
+
getAllowedSitesForUser,
|
|
59
62
|
getPublicAdminAuthConfig,
|
|
60
63
|
includes,
|
|
61
64
|
initializeWorkflowDocument,
|
|
@@ -64,6 +67,8 @@ import {
|
|
|
64
67
|
isEmpty,
|
|
65
68
|
isFuture,
|
|
66
69
|
isPast,
|
|
70
|
+
isSiteAuthorized,
|
|
71
|
+
isUserAdmin,
|
|
67
72
|
join,
|
|
68
73
|
last,
|
|
69
74
|
length,
|
|
@@ -81,6 +86,7 @@ import {
|
|
|
81
86
|
registerJexlHelpers,
|
|
82
87
|
replace,
|
|
83
88
|
resolveAdminAuthCollection,
|
|
89
|
+
resolveAuthorizedSiteId,
|
|
84
90
|
round,
|
|
85
91
|
runCollectionHooks,
|
|
86
92
|
saveWorkflowDraft,
|
|
@@ -101,7 +107,24 @@ import {
|
|
|
101
107
|
validatePreviewUrlExpression,
|
|
102
108
|
wordCount,
|
|
103
109
|
workflowCapabilities
|
|
104
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-LYENW2EN.js";
|
|
111
|
+
import {
|
|
112
|
+
NON_NEGOTIABLE_CREDENTIAL_FIELDS,
|
|
113
|
+
PII_REGEX_PATTERNS,
|
|
114
|
+
maskEmail,
|
|
115
|
+
maskPhone,
|
|
116
|
+
maskTextPII,
|
|
117
|
+
sanitizeDocForAI
|
|
118
|
+
} from "./chunk-254THFDS.js";
|
|
119
|
+
import {
|
|
120
|
+
AI_ACTIONS_COLLECTION,
|
|
121
|
+
AI_AUDIT_COLLECTION,
|
|
122
|
+
AI_CHUNKS_COLLECTION,
|
|
123
|
+
AI_MESSAGES_COLLECTION,
|
|
124
|
+
AI_THREADS_COLLECTION,
|
|
125
|
+
isAICollection
|
|
126
|
+
} from "./chunk-4RAQJVJM.js";
|
|
127
|
+
import "./chunk-27YRIGK5.js";
|
|
105
128
|
import "./chunk-JSBRDJBE.js";
|
|
106
129
|
|
|
107
130
|
// src/types/workflows.ts
|
|
@@ -778,6 +801,7 @@ var expr = createExpr();
|
|
|
778
801
|
var when = expr;
|
|
779
802
|
|
|
780
803
|
// src/index.ts
|
|
804
|
+
import { z } from "zod";
|
|
781
805
|
function defineCollection(config) {
|
|
782
806
|
return config;
|
|
783
807
|
}
|
|
@@ -825,12 +849,20 @@ function defineTab(args) {
|
|
|
825
849
|
}));
|
|
826
850
|
}
|
|
827
851
|
export {
|
|
852
|
+
AI_ACTIONS_COLLECTION,
|
|
853
|
+
AI_AUDIT_COLLECTION,
|
|
854
|
+
AI_CHUNKS_COLLECTION,
|
|
855
|
+
AI_MESSAGES_COLLECTION,
|
|
856
|
+
AI_THREADS_COLLECTION,
|
|
828
857
|
BUILTIN_JEXL_HELPERS,
|
|
829
858
|
ConfigValidationError,
|
|
859
|
+
DyrectedAIError,
|
|
830
860
|
FieldConditionBuilder,
|
|
831
861
|
LIFECYCLE_EVENTS_COLLECTION,
|
|
832
862
|
LIFECYCLE_EVENT_NAMES,
|
|
833
863
|
MatchBuilder,
|
|
864
|
+
NON_NEGOTIABLE_CREDENTIAL_FIELDS,
|
|
865
|
+
PII_REGEX_PATTERNS,
|
|
834
866
|
WORKFLOW_HISTORY_COLLECTION,
|
|
835
867
|
abs,
|
|
836
868
|
addDays,
|
|
@@ -918,18 +950,26 @@ export {
|
|
|
918
950
|
generateOpenApi,
|
|
919
951
|
get,
|
|
920
952
|
getAdminAuthCollection,
|
|
953
|
+
getAdminRoleForCollection,
|
|
954
|
+
getAllowedSitesForUser,
|
|
921
955
|
getPublicAdminAuthConfig,
|
|
922
956
|
includes,
|
|
923
957
|
initializeWorkflowDocument,
|
|
958
|
+
isAICollection,
|
|
924
959
|
isConfigValidationError,
|
|
925
960
|
isDetailItemVisible,
|
|
926
961
|
isEmpty,
|
|
927
962
|
isFuture,
|
|
928
963
|
isPast,
|
|
964
|
+
isSiteAuthorized,
|
|
965
|
+
isUserAdmin,
|
|
929
966
|
join,
|
|
930
967
|
last,
|
|
931
968
|
length,
|
|
932
969
|
lower,
|
|
970
|
+
maskEmail,
|
|
971
|
+
maskPhone,
|
|
972
|
+
maskTextPII,
|
|
933
973
|
materializeWorkflowDocument,
|
|
934
974
|
max,
|
|
935
975
|
min,
|
|
@@ -947,8 +987,10 @@ export {
|
|
|
947
987
|
registerJexlHelpers,
|
|
948
988
|
replace,
|
|
949
989
|
resolveAdminAuthCollection,
|
|
990
|
+
resolveAuthorizedSiteId,
|
|
950
991
|
round,
|
|
951
992
|
runCollectionHooks,
|
|
993
|
+
sanitizeDocForAI,
|
|
952
994
|
saveWorkflowDraft,
|
|
953
995
|
simplePublishingWorkflow,
|
|
954
996
|
slugify,
|
|
@@ -967,5 +1009,6 @@ export {
|
|
|
967
1009
|
validatePreviewUrlExpression,
|
|
968
1010
|
when,
|
|
969
1011
|
wordCount,
|
|
970
|
-
workflowCapabilities
|
|
1012
|
+
workflowCapabilities,
|
|
1013
|
+
z
|
|
971
1014
|
};
|