@dyrected/core 2.23.0 → 2.24.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/{app-DregJnqR.d.cts → app-Bg34iyUz.d.cts} +36 -3
- package/dist/{app-DregJnqR.d.ts → app-Bg34iyUz.d.ts} +36 -3
- package/dist/index.cjs +90 -3
- package/dist/index.d.cts +25 -7
- package/dist/index.d.ts +25 -7
- package/dist/index.js +87 -3
- package/dist/server.cjs +370 -104
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +370 -104
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as Field, B as Block, C as CollectionConfig, D as DyrectedConfig, 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 DatabaseAdapter, f as BaseDocument, H as HookRequestContext, T as TaskRunResult, g as TaskConfig, h as DetailActionOptions, i as DetailAction, j as DetailComputedOptions, k as ComputedHandler, l as DetailComputed, m as DetailCustomOptions, n as DetailCustom, o as DetailDividerOptions, p as DetailDivider, q as DisplayFieldOptions, r as DetailField, s as DetailItem, t as DetailGridOptions, u as DetailGrid, v as DetailRepeatOptions, w as DetailRepeat, x as DetailSectionOptions, y as DetailSection, z as DetailTabOptions, E as DetailTab, I as DetailTabsOptions, J as DetailTabs, K as DetailTextOptions, M as DetailText, N as DetailSchema, O as DyrectedContext, Q as AIConfig, R as AIPIIConfig, S as IdStrategy, U as CompiledNavTree, V as CompiledNavItem, X as UserNavigationPreferences, Y as DefineWorkspaceOptions, Z as ViewConfig, _ as DateTimeField, $ as RelationshipField, a0 as SelectField, a1 as ArrayField, a2 as FieldType, a3 as BooleanField, a4 as AuthConfig, a5 as AccessPolicyResolver, a6 as DateField, a7 as TextField, a8 as EmailField, a9 as IconField, aa as ImageField, ab as JoinField, ac as JsonField, ad as MoneyField, ae as MultiSelectField, af as NumberField, ag as ObjectField, ah as RadioField, ai as RichTextField, aj as RowField, ak as TextareaField, al as TimeField, am as UrlField } from './app-
|
|
2
|
-
export { an as AIAction, ao as AIActionStatus, ap as AIActionType, aq as AIAuditActionType, ar as AIAuditRecord, as as AIChunk, at as AIMessage, au as AIPIIPattern, av as AIRateLimitResult, aw as AIRateLimitStore, ax as AIThread, ay as AIToolContext, az as AIToolDefinition, aA as AI_ACTIONS_COLLECTION, aB as AI_AUDIT_COLLECTION, aC as AI_CHUNKS_COLLECTION, aD as AI_MESSAGES_COLLECTION, aE as AI_THREADS_COLLECTION, aF as AccessConfig, aG as AccessFunction, aH as AccessFunctionArgs, aI as AccessResult, aJ as AccessRule, aK as ActionConfig, aL as ActionConfigBase, aM as ActionConfigWithHandler, aN as ActionConfigWithMutation, aO as ActionContext, aP as ActionType, aQ as AdminAuthAccessResolution, aR as AdminAuthClaimMapping, aS as AdminAuthMember, aT as AdminAuthProvider, aU as AdminAuthProviderMembersConfig, aV as AdminAuthProvisioningMode, aW as AdminAuthResolveAccessArgs, aX as AdminAuthResolvedIdentity, aY as AdminConfig, aZ as AdminDashboardComponentSlots, a_ as AdminIconName, a$ as AggregateArgs, b0 as AggregateCastType, b1 as AggregateCollectionResult, b2 as AggregateInput, b3 as AggregateOperation, b4 as AggregateResult, b5 as AppTrashConfig, b6 as BaseAdminAuthProvider, b7 as BaseFieldAdmin, b8 as BlockVariant, b9 as BlocksField, ba as BooleanFieldAdmin, bb as BooleanFormat, bc as CURRENT_NAV_PREFERENCES_VERSION, bd as CUSTOM_VIEW_FETCH_ALL_LIMIT, be as CalendarViewConfig, bf as CardsViewConfig, bg as CharacterLimitFieldAdmin, bh as CharacterLimitFieldConfig, bi as CollectionAfterChangeHook, bj as CollectionAfterDeleteHook, bk as CollectionAfterReadHook, bl as CollectionAfterReadHookEntry, bm as CollectionAfterRestoreHook, bn as CollectionAfterTransitionHook, bo as CollectionAfterTrashHook, bp as CollectionBeforeChangeHook, bq as CollectionBeforeChangeHookEntry, br as CollectionBeforeCommitHook, bs as CollectionBeforeDeleteHook, bt as CollectionBeforeReadHook, bu as CollectionBeforeReadHookEntry, bv as CollectionBeforeRestoreHook, bw as CollectionBeforeTransitionHook, bx as CollectionBeforeTrashHook, by as CollectionEmailConfig, bz as CollectionIndex, bA as CollectionListComponentSlots, bB as CollectionRAGConfig, bC as CollectionSchemaResult, bD as CollectionSummaryResult, bE as CollectionViewComponentSlots, bF as CompiledNavGroup, bG as CountOperation, bH as CustomAdminAuthProvider, bI as CustomViewConfig, bJ as CustomViewDataConfig, bK as DEFAULT_USER_NAV_PREFERENCES, bL as DateFieldAdmin, bM as DateFormat, bN as DefaultValueContext, bO as DefineActionOptions, bP as DefineCalendarViewOptions, bQ as DefineCardsViewOptions, bR as DefineCustomViewOptions, bS as DefineGanttViewOptions, bT as DefineKanbanViewOptions, bU as DefinePageInput, bV as DefineTableViewOptions, bW as DefineViewBaseOptions, bX as DefineViewOptions, bY as DetailSpan, bZ as DisplayTone, b_ as DisplayVariant, b$ as DistinctCountOperation, c0 as DistinctValuesOperation, c1 as
|
|
1
|
+
import { F as Field, B as Block, C as CollectionConfig, D as DyrectedConfig, 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 DatabaseAdapter, f as BaseDocument, H as HookRequestContext, T as TaskRunResult, g as TaskConfig, h as DetailActionOptions, i as DetailAction, j as DetailComputedOptions, k as ComputedHandler, l as DetailComputed, m as DetailCustomOptions, n as DetailCustom, o as DetailDividerOptions, p as DetailDivider, q as DisplayFieldOptions, r as DetailField, s as DetailItem, t as DetailGridOptions, u as DetailGrid, v as DetailRepeatOptions, w as DetailRepeat, x as DetailSectionOptions, y as DetailSection, z as DetailTabOptions, E as DetailTab, I as DetailTabsOptions, J as DetailTabs, K as DetailTextOptions, M as DetailText, N as DetailSchema, O as DyrectedContext, Q as AIConfig, R as AIPIIConfig, S as IdStrategy, U as CompiledNavTree, V as CompiledNavItem, X as UserNavigationPreferences, Y as DefineWorkspaceOptions, Z as ViewConfig, _ as DateTimeField, $ as RelationshipField, a0 as SelectField, a1 as ArrayField, a2 as FieldType, a3 as BooleanField, a4 as AuthConfig, a5 as AccessPolicyResolver, a6 as DateField, a7 as TextField, a8 as EmailField, a9 as IconField, aa as ImageField, ab as JoinField, ac as JsonField, ad as MoneyField, ae as MultiSelectField, af as NumberField, ag as ObjectField, ah as RadioField, ai as RichTextField, aj as RowField, ak as TextareaField, al as TimeField, am as UrlField } from './app-Bg34iyUz.js';
|
|
2
|
+
export { an as AIAction, ao as AIActionStatus, ap as AIActionType, aq as AIAuditActionType, ar as AIAuditRecord, as as AIChunk, at as AIMessage, au as AIPIIPattern, av as AIRateLimitResult, aw as AIRateLimitStore, ax as AIThread, ay as AIToolContext, az as AIToolDefinition, aA as AI_ACTIONS_COLLECTION, aB as AI_AUDIT_COLLECTION, aC as AI_CHUNKS_COLLECTION, aD as AI_MESSAGES_COLLECTION, aE as AI_THREADS_COLLECTION, aF as AccessConfig, aG as AccessFunction, aH as AccessFunctionArgs, aI as AccessResult, aJ as AccessRule, aK as ActionConfig, aL as ActionConfigBase, aM as ActionConfigWithHandler, aN as ActionConfigWithMutation, aO as ActionContext, aP as ActionType, aQ as AdminAuthAccessResolution, aR as AdminAuthClaimMapping, aS as AdminAuthMember, aT as AdminAuthProvider, aU as AdminAuthProviderMembersConfig, aV as AdminAuthProvisioningMode, aW as AdminAuthResolveAccessArgs, aX as AdminAuthResolvedIdentity, aY as AdminConfig, aZ as AdminDashboardComponentSlots, a_ as AdminIconName, a$ as AggregateArgs, b0 as AggregateCastType, b1 as AggregateCollectionResult, b2 as AggregateInput, b3 as AggregateOperation, b4 as AggregateResult, b5 as AppTrashConfig, b6 as BaseAdminAuthProvider, b7 as BaseFieldAdmin, b8 as BlockVariant, b9 as BlocksField, ba as BooleanFieldAdmin, bb as BooleanFormat, bc as CURRENT_NAV_PREFERENCES_VERSION, bd as CUSTOM_VIEW_FETCH_ALL_LIMIT, be as CalendarViewConfig, bf as CardsViewConfig, bg as CharacterLimitFieldAdmin, bh as CharacterLimitFieldConfig, bi as CollectionAfterChangeHook, bj as CollectionAfterDeleteHook, bk as CollectionAfterReadHook, bl as CollectionAfterReadHookEntry, bm as CollectionAfterRestoreHook, bn as CollectionAfterTransitionHook, bo as CollectionAfterTrashHook, bp as CollectionBeforeChangeHook, bq as CollectionBeforeChangeHookEntry, br as CollectionBeforeCommitHook, bs as CollectionBeforeDeleteHook, bt as CollectionBeforeReadHook, bu as CollectionBeforeReadHookEntry, bv as CollectionBeforeRestoreHook, bw as CollectionBeforeTransitionHook, bx as CollectionBeforeTrashHook, by as CollectionEmailConfig, bz as CollectionIndex, bA as CollectionListComponentSlots, bB as CollectionRAGConfig, bC as CollectionSchemaResult, bD as CollectionSummaryResult, bE as CollectionViewComponentSlots, bF as CompiledNavGroup, bG as CountOperation, bH as CustomAdminAuthProvider, bI as CustomViewConfig, bJ as CustomViewDataConfig, bK as DEFAULT_USER_NAV_PREFERENCES, bL as DateFieldAdmin, bM as DateFormat, bN as DefaultValueContext, bO as DefineActionOptions, bP as DefineCalendarViewOptions, bQ as DefineCardsViewOptions, bR as DefineCustomViewOptions, bS as DefineGanttViewOptions, bT as DefineKanbanViewOptions, bU as DefinePageInput, bV as DefineTableViewOptions, bW as DefineViewBaseOptions, bX as DefineViewOptions, bY as DetailSpan, bZ as DisplayTone, b_ as DisplayVariant, b$ as DistinctCountOperation, c0 as DistinctValuesOperation, c1 as DocumentFormComponentSlots, c2 as DynamicOptionItem, c3 as DynamicOptionsConfig, c4 as DynamicOptionsResolver, c5 as DynamicOptionsResolverArgs, c6 as DyrectedAIContext, c7 as DyrectedLoggerConfig, c8 as DyrectedObservabilityConfig, c9 as EmailFieldAdmin, ca as EmailTemplateArgs, cb as EmailTemplateResult, cc as FORM_SHELLS, cd as FieldAdminHooks, ce as FieldAdminOnChangeHook, cf as FieldAdminOnChangeHookArgs, cg as FieldAdminOptionsHook, ch as FieldAdminOptionsHookArgs, ci as FieldAdminOptionsHookResult, cj as FieldAfterReadHook, ck as FieldAfterReadHookArgs, cl as FieldBase, cm as FieldBeforeChangeHook, cn as FieldBeforeChangeHookArgs, co as FieldHook, cp as FieldHooks, cq as FileData, cr as FormShell, cs as GanttViewConfig, ct as GetDocumentResult, cu as GlobalAfterChangeHook, cv as GlobalAfterReadHook, cw as GlobalAfterReadHookEntry, cx as GlobalBeforeChangeHook, cy as GlobalBeforeChangeHookEntry, cz as GlobalBeforeReadHook, cA as GlobalBeforeReadHookEntry, cB as GlobalFormComponentSlots, cC as GlobalRAGConfig, cD as GlobalSchemaResult, cE as GlobalSummaryResult, cF as HeadingLevel, cG as HookFunction, cH as IconFieldAdmin, cI as ImageService, cJ as ImageTransformOptions, cK as InferAggregateResult, cL as JoinFieldAdmin, cM as JsonFieldAdmin, cN as JsonFormat, cO as KanbanViewConfig, cP as LIFECYCLE_EVENT_NAMES, cQ as LifecycleEventHandler, cR as LinkFormat, cS as MetricColor, cT as MoneyFieldAdmin, cU as MoneyFieldConfig, cV as MultiSelectFieldAdmin, cW as NamedAccessPolicy, cX as NavBadgeConfig, cY as NavGroup, cZ as NumberFieldAdmin, c_ as NumberFormat, c$ as NumberLimitFieldAdmin, d0 as NumberLimitFieldConfig, d1 as NumericOperation, d2 as NumericUpdateOperator, d3 as OIDCAdminAuthProvider, d4 as OptionFormat, d5 as OutboundEmail, d6 as PageAction, d7 as PageBreadcrumbItem, d8 as PageConfig, d9 as PaginatedResult, da as PinnedNavItemRef, db as PublicAdminAuthProvider, dc as QueryCollectionResult, dd as RAGSearchResult, de as RadioFieldAdmin, df as RateLimitConfig, dg as ReadonlyDatabaseAdapter, dh as RichTextFeature, di as RichTextFieldConfig, dj as SelectFieldAdmin, dk as SqlWhereResult, dl as StorageAdapter, dm as TableViewConfig, dn as TaskContext, dp as TaskLogger, dq as TaskRunStatus, dr as TextFieldAdmin, ds as TextFormat, dt as TextareaFieldAdmin, du as TrashConfig, dv as TrustProxyConfig, dw as TypedField, dx as UploadConfig, dy as UrlFieldAdmin, dz as UrlLinkValue, dA as ViewActionFeatures, dB as ViewComponentSlots, dC as ViewConfigBase, dD as ViewLayout, dE as ViewMetric, dF as ViewMetricGroupBy, dG as ViewMetricGroupByConfig, dH as ViewMetricTrendConfig, dI as ViewSubMetric, dJ as WhereClause, dK as WhereOperator, dL as WhereOperatorName, dM as WordLimitFieldAdmin, dN as WordLimitFieldConfig, dO as WorkflowMetadata, dP as WorkflowOnTransitionContext, dQ as WorkflowOnTransitionHook, dR as WorkflowRole, dS as WorkflowState, dT as WorkflowTransitionContext, dU as coerceBooleanWhere, dV as defineAction, dW as defineCalendarView, dX as defineCardsView, dY as defineCustomView, dZ as defineGanttView, d_ as defineKanbanView, d$ as definePage, e0 as defineTableView, e1 as defineView, e2 as defineWorkspace, e3 as isAICollection, e4 as parseMongoWhere, e5 as parseSqlWhere } from './app-Bg34iyUz.js';
|
|
3
3
|
import jexl from 'jexl';
|
|
4
4
|
import { Context } from 'hono';
|
|
5
5
|
export { z } from 'zod';
|
|
@@ -280,7 +280,7 @@ interface DeclarativePreviewValidationIssue {
|
|
|
280
280
|
}
|
|
281
281
|
interface ConfigDiagnostic {
|
|
282
282
|
severity: "error" | "warning";
|
|
283
|
-
source: "declarativeHook" | "declarativeAccess" | "adminCondition" | "previewUrl";
|
|
283
|
+
source: "declarativeHook" | "declarativeAccess" | "adminCondition" | "previewUrl" | "adminComponents";
|
|
284
284
|
path: string;
|
|
285
285
|
surface: string;
|
|
286
286
|
message: string;
|
|
@@ -292,7 +292,7 @@ type DiagnosticFormatOptions = {
|
|
|
292
292
|
type DeclarativeValidationConfig = {
|
|
293
293
|
blocks?: Array<Pick<Block, "fields"> & Partial<Pick<Block, "slug">>>;
|
|
294
294
|
collections: Array<Pick<CollectionConfig, "fields" | "hooks" | "access" | "admin"> & Partial<Pick<CollectionConfig, "slug">>>;
|
|
295
|
-
globals?: Array<Pick<GlobalConfig, "fields" | "hooks" | "access"> & Partial<Pick<GlobalConfig, "slug">>>;
|
|
295
|
+
globals?: Array<Pick<GlobalConfig, "fields" | "hooks" | "access" | "admin"> & Partial<Pick<GlobalConfig, "slug">>>;
|
|
296
296
|
accessPolicies?: Record<string, unknown>;
|
|
297
297
|
};
|
|
298
298
|
declare function validateDeclarativeHookExpression(expression: string, surface: DeclarativeHookSurface, path: string): DeclarativeHookValidationIssue[];
|
|
@@ -305,6 +305,14 @@ declare function collectDeclarativeHookValidationIssues(config: DeclarativeValid
|
|
|
305
305
|
declare function collectDeclarativeAccessValidationIssues(config: DeclarativeValidationConfig): DeclarativeAccessValidationIssue[];
|
|
306
306
|
declare function collectAdminConditionValidationIssues(config: DeclarativeValidationConfig): DeclarativeAdminValidationIssue[];
|
|
307
307
|
declare function collectPreviewUrlValidationIssues(config: DeclarativeValidationConfig): DeclarativePreviewValidationIssue[];
|
|
308
|
+
interface AdminComponentsValidationIssue {
|
|
309
|
+
path: string;
|
|
310
|
+
surface: "collection.admin.components" | "global.admin.components";
|
|
311
|
+
message: string;
|
|
312
|
+
expression: string;
|
|
313
|
+
}
|
|
314
|
+
/** Flags malformed `createForm`, `editForm`, `form` and `formShell` settings. */
|
|
315
|
+
declare function collectAdminComponentsValidationIssues(config: DeclarativeValidationConfig): AdminComponentsValidationIssue[];
|
|
308
316
|
declare function assertValidAdminConditionsInConfig(config: DeclarativeValidationConfig, source?: string): void;
|
|
309
317
|
declare function assertValidPreviewUrlsInConfig(config: DeclarativeValidationConfig, source?: string): void;
|
|
310
318
|
declare function collectConfigDiagnostics(config: DeclarativeValidationConfig): ConfigDiagnostic[];
|
|
@@ -335,7 +343,7 @@ interface ReferencedComponentKeys {
|
|
|
335
343
|
collectionList: Set<string>;
|
|
336
344
|
/** Operational view slots (`collectionView` and per-view `components`). */
|
|
337
345
|
collectionView: Set<string>;
|
|
338
|
-
/**
|
|
346
|
+
/** `createForm`, `editForm` and `form` keys on collections, and `editForm`/`form` on globals. */
|
|
339
347
|
forms: Set<string>;
|
|
340
348
|
/** `component` of views with `layout: "custom"`. */
|
|
341
349
|
viewLayouts: Set<string>;
|
|
@@ -1575,7 +1583,17 @@ declare function compileNavigation(config: DyrectedConfig<any> | {
|
|
|
1575
1583
|
};
|
|
1576
1584
|
}): CompiledNavTree;
|
|
1577
1585
|
/**
|
|
1578
|
-
* Filter compiled navigation
|
|
1586
|
+
* Filter compiled navigation using an async access check.
|
|
1587
|
+
*
|
|
1588
|
+
* Unlike {@link pruneNavigationForUser}, which only understands role arrays,
|
|
1589
|
+
* this accepts any resolver so function, Jexl and named-policy rules can be
|
|
1590
|
+
* evaluated against the current request. Groups left with no visible items
|
|
1591
|
+
* are removed.
|
|
1592
|
+
*/
|
|
1593
|
+
declare function pruneNavigationByAccess(tree: CompiledNavTree, canAccess: (item: CompiledNavItem) => Promise<boolean>, canAccessView?: (view: ViewConfig, item: CompiledNavItem) => Promise<boolean>): Promise<CompiledNavTree>;
|
|
1594
|
+
/**
|
|
1595
|
+
* Filter compiled navigation based on user role arrays only.
|
|
1596
|
+
* Non-array rules are kept; use {@link pruneNavigationByAccess} to evaluate them.
|
|
1579
1597
|
*/
|
|
1580
1598
|
declare function pruneNavigationForUser(tree: CompiledNavTree, user?: any): CompiledNavTree;
|
|
1581
1599
|
/**
|
|
@@ -2372,4 +2390,4 @@ declare function defineTab<const T extends readonly Field[]>(args: {
|
|
|
2372
2390
|
fields: T;
|
|
2373
2391
|
}): T;
|
|
2374
2392
|
|
|
2375
|
-
export { AIConfig, type AIErrorCode, AIPIIConfig, type AccessConditions, AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BASE62_ALPHABET, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BooleanField, CROCKFORD_BASE32, CollectionConfig, CompiledNavItem, CompiledNavTree, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, ConflictError, type CreatedAtFieldOptions, type CreatedByFieldOptions, DatabaseAdapter, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DefineWorkspaceOptions, DetailAction, DetailActionOptions, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DuplicateKeyError, DyrectedAIError, DyrectedConfig, DyrectedError, EMAIL_TEMPLATES_COLLECTION_CONFIG, EMAIL_TEMPLATES_COLLECTION_SLUG, EmailField, type ExprFunction, type ExtractCollectionSlugs, Field, FieldConditionBuilder, FieldType, ForbiddenError, type GenerateIdOptions, GlobalConfig, HookRequestContext, INTERNAL_SYSTEM_COLLECTIONS, IconField, IdStrategy, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, type LayoutOptions, LifecycleEvent, LifecycleEventName, MatchBuilder, MoneyField, MultiSelectField, NANOID_ALPHABET, NON_NEGOTIABLE_CREDENTIAL_FIELDS, NotFoundError, NumberField, ObjectField, PII_REGEX_PATTERNS, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RESERVED_NAVIGATION_SLUGS, RadioField, type ReconcileNavigationOptions, type ReconciledNavTree, type ReferencedComponentKeys, RelationshipField, type ResolvedTrashConfig, type RestoreDocumentOptions, RichTextField, type RoleOption, type RolesFieldOptions, RowField, type SanitizeDocForAIOptions, SelectField, type SoftDeleteOptions, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TASK_LOCKS_COLLECTION, TASK_LOCKS_COLLECTION_CONFIG, TRASH_COLLECTION, TRASH_COLLECTION_CONFIG, TaskConfig, TaskRunResult, type TaskRunner, type TemplateBlock, TextField, TextareaField, TimeField, UNASSIGNED_GROUP_KEY, type UpdatedAtFieldOptions, type UpdatedByFieldOptions, type UploadDocFields, UrlField, UserNavigationPreferences, ValidationError, ViewConfig, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, alertBox, asCollection, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidNavigationSlugs, assertValidPreviewUrlsInConfig, assertValidTrashInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, collectReferencedComponentKeys, compact, compileNavigation, count, createLifecycleEvent, createTaskRunner, createTrashPurgeTask, createWorkflowDocument, ctaButton, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineCreatedAtField, defineCreatedByField, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMoneyField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRoles, defineRolesField, defineRowField, defineSelectField, defineTab, defineTask, defineTextField, defineTextareaField, defineTimeField, defineUpdatedAtField, defineUpdatedByField, defineUrlField, detailBox, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayAction, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, divider, emailTokens, endsWith, escapeHtml, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, eventList, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateDocumentId, generateId, generateOpenApi, get, getAdminAuthCollection, getAdminRoleForCollection, getAllowedSitesForUser, getDefaultEmailTemplate, getPublicAdminAuthConfig, getTrashEntryId, heading, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, isSiteAuthorized, isUserAdmin, join, last, layout, length, lower, maskEmail, maskPhone, maskTextPII, materializeWorkflowDocument, max, min, nanoid, nextCronRun, normalizeConfig, normalizeDetailItem, normalizeGroupKey, now, numericFieldNames, paragraph, parseCron, parseSort, pow, prefixedId, pruneNavigationForUser, publishedStateName, publishingWorkflow, readingTime, reconcileNavigation, registerJexlHelpers, replace, resolveAdminAuthCollection, resolveAllCollectionViews, resolveAuthorizedSiteId, resolveBlocks, resolveDocumentTitle, resolveIndexName, resolvePrefix, resolveTrashConfig, restoreDocument, round, row, runCollectionHooks, safeLinkDetailBox, sanitizeDocForAI, saveWorkflowDraft, sectionLabel, simplePublishingWorkflow, slugify, softDeleteDocument, spacer, sqrt, startsWith, sum, table, today, transitionWorkflow, trim, truncate, ulid, unique, upper, uuid, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
|
2393
|
+
export { AIConfig, type AIErrorCode, AIPIIConfig, type AccessConditions, AccessPolicyResolver, AdminAuthConfig, type AdminComponentsValidationIssue, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BASE62_ALPHABET, BUILTIN_JEXL_HELPERS, BaseDocument, Block, BooleanField, CROCKFORD_BASE32, CollectionConfig, CompiledNavItem, CompiledNavTree, ComputedHandler, type ConfigDiagnostic, ConfigValidationError, ConflictError, type CreatedAtFieldOptions, type CreatedByFieldOptions, DatabaseAdapter, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DefineWorkspaceOptions, DetailAction, DetailActionOptions, DetailComputed, DetailComputedOptions, DetailCustom, DetailCustomOptions, DetailDivider, DetailDividerOptions, DetailField, DetailGrid, DetailGridOptions, DetailItem, DetailRepeat, DetailRepeatOptions, DetailSchema, DetailSection, DetailSectionOptions, DetailTab, DetailTabOptions, DetailTabs, DetailTabsOptions, DetailText, DetailTextOptions, DisplayFieldOptions, DuplicateKeyError, DyrectedAIError, DyrectedConfig, DyrectedError, EMAIL_TEMPLATES_COLLECTION_CONFIG, EMAIL_TEMPLATES_COLLECTION_SLUG, EmailField, type ExprFunction, type ExtractCollectionSlugs, Field, FieldConditionBuilder, FieldType, ForbiddenError, type GenerateIdOptions, GlobalConfig, HookRequestContext, INTERNAL_SYSTEM_COLLECTIONS, IconField, IdStrategy, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, type LayoutOptions, LifecycleEvent, LifecycleEventName, MatchBuilder, MoneyField, MultiSelectField, NANOID_ALPHABET, NON_NEGOTIABLE_CREDENTIAL_FIELDS, NotFoundError, NumberField, ObjectField, PII_REGEX_PATTERNS, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RESERVED_NAVIGATION_SLUGS, RadioField, type ReconcileNavigationOptions, type ReconciledNavTree, type ReferencedComponentKeys, RelationshipField, type ResolvedTrashConfig, type RestoreDocumentOptions, RichTextField, type RoleOption, type RolesFieldOptions, RowField, type SanitizeDocForAIOptions, SelectField, type SoftDeleteOptions, type SortClause, type SortDirection, type SqlSortDialect, type SystemDocFields, TASK_LOCKS_COLLECTION, TASK_LOCKS_COLLECTION_CONFIG, TRASH_COLLECTION, TRASH_COLLECTION_CONFIG, TaskConfig, TaskRunResult, type TaskRunner, type TemplateBlock, TextField, TextareaField, TimeField, UNASSIGNED_GROUP_KEY, type UpdatedAtFieldOptions, type UpdatedByFieldOptions, type UploadDocFields, UrlField, UserNavigationPreferences, ValidationError, ViewConfig, WORKFLOW_HISTORY_COLLECTION, type WhenFunction, WorkflowConfig, WorkflowTransition, abs, addDays, alertBox, asCollection, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidNavigationSlugs, assertValidPreviewUrlsInConfig, assertValidTrashInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, capitalize, ceil, clamp, coalesce, collectAdminComponentsValidationIssues, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, collectReferencedComponentKeys, compact, compileNavigation, count, createLifecycleEvent, createTaskRunner, createTrashPurgeTask, createWorkflowDocument, ctaButton, defaultValue, defineArrayField, defineBlock, defineBlocksField, defineBooleanField, defineCollection, defineConfig, defineCreatedAtField, defineCreatedByField, defineDateField, defineDateTimeField, defineEmailField, defineField, defineGlobal, defineIconField, defineImageField, defineJoinField, defineJsonField, defineMoneyField, defineMultiSelectField, defineNumberField, defineObjectField, definePublishingWorkflow, defineRadioField, defineRelationshipField, defineRichTextField, defineRoles, defineRolesField, defineRowField, defineSelectField, defineTab, defineTask, defineTextField, defineTextareaField, defineTimeField, defineUpdatedAtField, defineUpdatedByField, defineUrlField, detailBox, diffDays, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, displayAction, displayComputed, displayCustom, displayCustomComponent, displayDivider, displayField, displayGrid, displayRepeat, displaySection, displayTab, displayTabs, displayText, divider, emailTokens, endsWith, escapeHtml, evaluateDetailComputed, evaluateJexl, evaluateJexlSync, eventList, executeFieldAfterRead, executeFieldBeforeChange, expr, first, floor, formatConfigDiagnostics, formatDate, formatJexlValue, generateDefaultDetailSchema, generateDocumentId, generateId, generateOpenApi, get, getAdminAuthCollection, getAdminRoleForCollection, getAllowedSitesForUser, getDefaultEmailTemplate, getPublicAdminAuthConfig, getTrashEntryId, heading, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, isSiteAuthorized, isUserAdmin, join, last, layout, length, lower, maskEmail, maskPhone, maskTextPII, materializeWorkflowDocument, max, min, nanoid, nextCronRun, normalizeConfig, normalizeDetailItem, normalizeGroupKey, now, numericFieldNames, paragraph, parseCron, parseSort, pow, prefixedId, pruneNavigationByAccess, pruneNavigationForUser, publishedStateName, publishingWorkflow, readingTime, reconcileNavigation, registerJexlHelpers, replace, resolveAdminAuthCollection, resolveAllCollectionViews, resolveAuthorizedSiteId, resolveBlocks, resolveDocumentTitle, resolveIndexName, resolvePrefix, resolveTrashConfig, restoreDocument, round, row, runCollectionHooks, safeLinkDetailBox, sanitizeDocForAI, saveWorkflowDraft, sectionLabel, simplePublishingWorkflow, slugify, softDeleteDocument, spacer, sqrt, startsWith, sum, table, today, transitionWorkflow, trim, truncate, ulid, unique, upper, uuid, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, when, wordCount, workflowCapabilities };
|
package/dist/index.js
CHANGED
|
@@ -1780,6 +1780,9 @@ function asCollection(config) {
|
|
|
1780
1780
|
return config;
|
|
1781
1781
|
}
|
|
1782
1782
|
|
|
1783
|
+
// src/types/admin.ts
|
|
1784
|
+
var FORM_SHELLS = ["full", "header", "none"];
|
|
1785
|
+
|
|
1783
1786
|
// src/types/workflows.ts
|
|
1784
1787
|
var LIFECYCLE_EVENT_NAMES = [
|
|
1785
1788
|
"revision.created",
|
|
@@ -2730,6 +2733,54 @@ function collectPreviewUrlValidationIssues(config) {
|
|
|
2730
2733
|
});
|
|
2731
2734
|
return issues;
|
|
2732
2735
|
}
|
|
2736
|
+
var FORM_COMPONENT_KEYS = ["createForm", "editForm", "form"];
|
|
2737
|
+
var GLOBAL_FORM_COMPONENT_KEYS = ["editForm", "form"];
|
|
2738
|
+
function collectFormComponentIssues(components, path, surface, keys, issues) {
|
|
2739
|
+
if (!isPlainObject(components)) return;
|
|
2740
|
+
for (const key of keys) {
|
|
2741
|
+
const value = components[key];
|
|
2742
|
+
if (value === void 0) continue;
|
|
2743
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
2744
|
+
issues.push({
|
|
2745
|
+
path: `${path}.admin.components.${key}`,
|
|
2746
|
+
surface,
|
|
2747
|
+
message: `\`${key}\` must be the registry key of a component, such as "check_ins.scanForm".`,
|
|
2748
|
+
expression: String(value)
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
const shell = components.formShell;
|
|
2753
|
+
if (shell !== void 0 && !FORM_SHELLS.includes(shell)) {
|
|
2754
|
+
issues.push({
|
|
2755
|
+
path: `${path}.admin.components.formShell`,
|
|
2756
|
+
surface,
|
|
2757
|
+
message: `Unknown formShell "${String(shell)}". Use ${FORM_SHELLS.map((value) => `"${value}"`).join(", ")}.`,
|
|
2758
|
+
expression: String(shell)
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
function collectAdminComponentsValidationIssues(config) {
|
|
2763
|
+
const issues = [];
|
|
2764
|
+
config.collections.forEach((collection, index) => {
|
|
2765
|
+
collectFormComponentIssues(
|
|
2766
|
+
collection.admin?.components,
|
|
2767
|
+
collectionSegment(collection, index),
|
|
2768
|
+
"collection.admin.components",
|
|
2769
|
+
FORM_COMPONENT_KEYS,
|
|
2770
|
+
issues
|
|
2771
|
+
);
|
|
2772
|
+
});
|
|
2773
|
+
config.globals?.forEach((global, index) => {
|
|
2774
|
+
collectFormComponentIssues(
|
|
2775
|
+
global.admin?.components,
|
|
2776
|
+
globalSegment(global, index),
|
|
2777
|
+
"global.admin.components",
|
|
2778
|
+
GLOBAL_FORM_COMPONENT_KEYS,
|
|
2779
|
+
issues
|
|
2780
|
+
);
|
|
2781
|
+
});
|
|
2782
|
+
return issues;
|
|
2783
|
+
}
|
|
2733
2784
|
function assertValidAdminConditionsInConfig(config, source = "config") {
|
|
2734
2785
|
const diagnostics = collectAdminConditionValidationIssues(config).map((issue) => ({
|
|
2735
2786
|
severity: "error",
|
|
@@ -2787,7 +2838,15 @@ function collectConfigDiagnostics(config) {
|
|
|
2787
2838
|
message: issue.message,
|
|
2788
2839
|
expression: issue.expression
|
|
2789
2840
|
}));
|
|
2790
|
-
|
|
2841
|
+
const adminComponentIssues = collectAdminComponentsValidationIssues(config).map((issue) => ({
|
|
2842
|
+
severity: "error",
|
|
2843
|
+
source: "adminComponents",
|
|
2844
|
+
path: issue.path,
|
|
2845
|
+
surface: issue.surface,
|
|
2846
|
+
message: issue.message,
|
|
2847
|
+
expression: issue.expression
|
|
2848
|
+
}));
|
|
2849
|
+
return [...hookIssues, ...accessIssues, ...adminConditionIssues, ...previewUrlIssues, ...adminComponentIssues];
|
|
2791
2850
|
}
|
|
2792
2851
|
function formatConfigDiagnostics(source, diagnostics, options = {}) {
|
|
2793
2852
|
const color = options.color ?? false;
|
|
@@ -5608,6 +5667,7 @@ function buildSqlOrderBy(sort, existingColumns, numericFields, dialect) {
|
|
|
5608
5667
|
// src/utils/component-keys.ts
|
|
5609
5668
|
var DASHBOARD_SLOTS = ["beforeDashboard", "afterDashboard"];
|
|
5610
5669
|
var LIST_SLOTS = ["beforeList", "beforeListTable", "afterListTable", "afterList"];
|
|
5670
|
+
var FORM_SLOTS = ["createForm", "editForm", "form"];
|
|
5611
5671
|
var VIEW_SLOTS = ["beforeViewHeader", "afterViewHeader", "beforeViewContent", "afterViewContent"];
|
|
5612
5672
|
function addKeys(target, value) {
|
|
5613
5673
|
for (const key of Array.isArray(value) ? value : [value]) {
|
|
@@ -5687,10 +5747,12 @@ function collectReferencedComponentKeys(schema) {
|
|
|
5687
5747
|
addSlots(keys.collectionList, slots, LIST_SLOTS);
|
|
5688
5748
|
addSlots(keys.collectionView, slots, VIEW_SLOTS);
|
|
5689
5749
|
addSlots(keys.collectionView, slots?.collectionView, VIEW_SLOTS);
|
|
5750
|
+
addSlots(keys.forms, slots, FORM_SLOTS);
|
|
5690
5751
|
}
|
|
5691
5752
|
for (const global of root.globals ?? []) {
|
|
5692
5753
|
scanFields(global.fields, keys);
|
|
5693
5754
|
scanDetail(global.detail, keys);
|
|
5755
|
+
addSlots(keys.forms, global.admin?.components, FORM_SLOTS);
|
|
5694
5756
|
}
|
|
5695
5757
|
return keys;
|
|
5696
5758
|
}
|
|
@@ -8343,7 +8405,7 @@ function compileNavigation(config) {
|
|
|
8343
8405
|
order: item.order ?? 100,
|
|
8344
8406
|
views: [],
|
|
8345
8407
|
badge: item.badge,
|
|
8346
|
-
access: item.access
|
|
8408
|
+
access: item.access || gl?.access?.read
|
|
8347
8409
|
});
|
|
8348
8410
|
continue;
|
|
8349
8411
|
}
|
|
@@ -8451,7 +8513,8 @@ function compileNavigation(config) {
|
|
|
8451
8513
|
icon: "Settings",
|
|
8452
8514
|
group: groupName,
|
|
8453
8515
|
order: 100,
|
|
8454
|
-
views: []
|
|
8516
|
+
views: [],
|
|
8517
|
+
access: gl.access?.read
|
|
8455
8518
|
});
|
|
8456
8519
|
}
|
|
8457
8520
|
const mentionedTrash = explicitNav.some((i) => i.trash || i.slug === "trash");
|
|
@@ -8534,6 +8597,24 @@ function compileNavigation(config) {
|
|
|
8534
8597
|
ungrouped: sortAndSpliceItems(ungroupedItems)
|
|
8535
8598
|
};
|
|
8536
8599
|
}
|
|
8600
|
+
async function pruneNavigationByAccess(tree, canAccess, canAccessView) {
|
|
8601
|
+
const resolveItem = async (item) => {
|
|
8602
|
+
if (!await canAccess(item)) return null;
|
|
8603
|
+
if (!canAccessView || !item.views?.length) return item;
|
|
8604
|
+
const allowed = await Promise.all(item.views.map((view) => canAccessView(view, item)));
|
|
8605
|
+
const views = item.views.filter((_, i) => allowed[i]);
|
|
8606
|
+
if (views.length === item.views.length) return item;
|
|
8607
|
+
if (views.length === 0 && item.type === "workspace") return null;
|
|
8608
|
+
return { ...item, views };
|
|
8609
|
+
};
|
|
8610
|
+
const filterItems = async (items) => (await Promise.all(items.map(resolveItem))).filter((item) => item !== null);
|
|
8611
|
+
const groups = [];
|
|
8612
|
+
for (const group of tree.groups) {
|
|
8613
|
+
const items = await filterItems(group.items);
|
|
8614
|
+
if (items.length > 0) groups.push({ ...group, items });
|
|
8615
|
+
}
|
|
8616
|
+
return { groups, ungrouped: await filterItems(tree.ungrouped) };
|
|
8617
|
+
}
|
|
8537
8618
|
function pruneNavigationForUser(tree, user) {
|
|
8538
8619
|
const userRoles = /* @__PURE__ */ new Set();
|
|
8539
8620
|
if (user?.role) userRoles.add(user.role);
|
|
@@ -8790,6 +8871,7 @@ export {
|
|
|
8790
8871
|
DyrectedError,
|
|
8791
8872
|
EMAIL_TEMPLATES_COLLECTION_CONFIG,
|
|
8792
8873
|
EMAIL_TEMPLATES_COLLECTION_SLUG,
|
|
8874
|
+
FORM_SHELLS,
|
|
8793
8875
|
FieldConditionBuilder,
|
|
8794
8876
|
ForbiddenError,
|
|
8795
8877
|
INTERNAL_SYSTEM_COLLECTIONS,
|
|
@@ -8828,6 +8910,7 @@ export {
|
|
|
8828
8910
|
clamp,
|
|
8829
8911
|
coalesce,
|
|
8830
8912
|
coerceBooleanWhere,
|
|
8913
|
+
collectAdminComponentsValidationIssues,
|
|
8831
8914
|
collectAdminConditionValidationIssues,
|
|
8832
8915
|
collectConfigDiagnostics,
|
|
8833
8916
|
collectDeclarativeAccessValidationIssues,
|
|
@@ -8969,6 +9052,7 @@ export {
|
|
|
8969
9052
|
parseSqlWhere,
|
|
8970
9053
|
pow,
|
|
8971
9054
|
prefixedId,
|
|
9055
|
+
pruneNavigationByAccess,
|
|
8972
9056
|
pruneNavigationForUser,
|
|
8973
9057
|
publishedStateName,
|
|
8974
9058
|
publishingWorkflow,
|