@dyrected/core 2.7.0 → 2.8.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.
Files changed (62) hide show
  1. package/dist/app-config-7G-3tF_I.d.cts +2259 -0
  2. package/dist/app-config-7G-3tF_I.d.ts +2259 -0
  3. package/dist/app-config-B3ByBjCN.d.cts +2222 -0
  4. package/dist/app-config-B3ByBjCN.d.ts +2222 -0
  5. package/dist/app-config-BIkjQWzU.d.cts +2218 -0
  6. package/dist/app-config-BIkjQWzU.d.ts +2218 -0
  7. package/dist/app-config-BfpeE3bF.d.cts +2100 -0
  8. package/dist/app-config-BfpeE3bF.d.ts +2100 -0
  9. package/dist/app-config-CCe-yq9q.d.cts +2222 -0
  10. package/dist/app-config-CCe-yq9q.d.ts +2222 -0
  11. package/dist/app-config-CPOs7THF.d.cts +2217 -0
  12. package/dist/app-config-CPOs7THF.d.ts +2217 -0
  13. package/dist/app-config-Ctp454zB.d.cts +2214 -0
  14. package/dist/app-config-Ctp454zB.d.ts +2214 -0
  15. package/dist/app-config-DJmNYgYh.d.cts +2305 -0
  16. package/dist/app-config-DJmNYgYh.d.ts +2305 -0
  17. package/dist/app-config-DO3laV58.d.cts +2397 -0
  18. package/dist/app-config-DO3laV58.d.ts +2397 -0
  19. package/dist/app-config-DZf_mmi9.d.cts +2211 -0
  20. package/dist/app-config-DZf_mmi9.d.ts +2211 -0
  21. package/dist/app-config-SkUoN5JU.d.cts +2192 -0
  22. package/dist/app-config-SkUoN5JU.d.ts +2192 -0
  23. package/dist/app-config-oz8H_MOX.d.cts +2224 -0
  24. package/dist/app-config-oz8H_MOX.d.ts +2224 -0
  25. package/dist/chunk-2UXLA4YN.js +3139 -0
  26. package/dist/chunk-3TRRTN6U.js +3441 -0
  27. package/dist/chunk-5U2WRCNH.js +3140 -0
  28. package/dist/chunk-5ZIA5COH.js +3414 -0
  29. package/dist/chunk-6TWQ6GTD.js +3480 -0
  30. package/dist/chunk-AKYYGMFS.js +3365 -0
  31. package/dist/chunk-AQO4HI2Y.js +3204 -0
  32. package/dist/chunk-DFBLNYUH.js +3402 -0
  33. package/dist/chunk-EJG6AMYB.js +3537 -0
  34. package/dist/chunk-FRSJJO27.js +519 -0
  35. package/dist/chunk-G43REXPX.js +3147 -0
  36. package/dist/chunk-GFKBPBJJ.js +3637 -0
  37. package/dist/chunk-KEKOEAX6.js +3139 -0
  38. package/dist/chunk-LFGSRQLX.js +3568 -0
  39. package/dist/chunk-NNZRYF3U.js +3537 -0
  40. package/dist/chunk-PRQ2RF5C.js +3485 -0
  41. package/dist/chunk-PYE2JSY4.js +3568 -0
  42. package/dist/chunk-PZMDK3MH.js +3203 -0
  43. package/dist/chunk-QCXLDKZO.js +3272 -0
  44. package/dist/chunk-SM32ND5M.js +3472 -0
  45. package/dist/chunk-UKUEKTAO.js +513 -0
  46. package/dist/chunk-VM43G3IG.js +506 -0
  47. package/dist/chunk-VWJKFZQU.js +3139 -0
  48. package/dist/chunk-XX7N64NL.js +3550 -0
  49. package/dist/chunk-YSSHLGQ6.js +3139 -0
  50. package/dist/chunk-Z7CFUYVP.js +3653 -0
  51. package/dist/index.cjs +1421 -82
  52. package/dist/index.d.cts +362 -3
  53. package/dist/index.d.ts +362 -3
  54. package/dist/index.js +119 -1
  55. package/dist/observability-CNM4QFE4.js +34 -0
  56. package/dist/observability-KCMTV7GO.js +34 -0
  57. package/dist/observability-L5BORBB2.js +34 -0
  58. package/dist/server.cjs +1879 -1247
  59. package/dist/server.d.cts +52 -8
  60. package/dist/server.d.ts +52 -8
  61. package/dist/server.js +449 -387
  62. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
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 ArrayField, g as BlocksField, h as BooleanField, i as AuthConfig, j as AccessPolicyResolver, k as DateField, l as DateTimeField, E as EmailField, I as IconField, m as ImageField, J as JoinField, n as JsonField, M as MultiSelectField, N as NumberField, O as ObjectField, R as RadioField, o as RelationshipField, p as RichTextField, q as RowField, S as SelectField, T as TextField, r as TextareaField, s as TimeField, U as UrlField } from './app-config-ChsrBB7p.js';
2
- export { t as AccessFunction, u as AccessFunctionArgs, v as AccessResult, w as AccessRule, x as AdminAuthAccessResolution, y as AdminAuthClaimMapping, z as AdminAuthMember, K as AdminAuthProvider, Q as AdminAuthProviderMembersConfig, V as AdminAuthProvisioningMode, X as AdminAuthResolveAccessArgs, Y as AdminAuthResolvedIdentity, Z as AdminConfig, _ as AdminDashboardComponentSlots, $ as AdminIconName, a0 as BaseAdminAuthProvider, a1 as BaseFieldAdmin, a2 as BlockVariant, a3 as BooleanFieldAdmin, a4 as BooleanFormat, a5 as CharacterLimitFieldAdmin, a6 as CharacterLimitFieldConfig, a7 as CollectionAfterChangeHook, a8 as CollectionAfterDeleteHook, a9 as CollectionAfterReadHook, aa as CollectionAfterReadHookEntry, ab as CollectionAfterTransitionHook, ac as CollectionBeforeChangeHook, ad as CollectionBeforeChangeHookEntry, ae as CollectionBeforeDeleteHook, af as CollectionBeforeReadHook, ag as CollectionBeforeReadHookEntry, ah as CollectionBeforeTransitionHook, ai as CollectionListComponentSlots, aj as CustomAdminAuthProvider, ak as DatabaseAdapter, al as DateFieldAdmin, am as DateFormat, an as DisplayTone, ao as DynamicOptionItem, ap as DynamicOptionsConfig, aq as DynamicOptionsResolver, ar as DynamicOptionsResolverArgs, as as DyrectedLoggerConfig, at as DyrectedObservabilityConfig, au as EmailFieldAdmin, av as FieldAdminHooks, aw as FieldAdminOnChangeHook, ax as FieldAdminOnChangeHookArgs, ay as FieldAdminOptionsHook, az as FieldAdminOptionsHookArgs, aA as FieldAdminOptionsHookResult, aB as FieldAfterReadHook, aC as FieldAfterReadHookArgs, aD as FieldBase, aE as FieldBeforeChangeHook, aF as FieldBeforeChangeHookArgs, aG as FieldHook, aH as FieldHooks, aI as FieldType, aJ as FileData, aK as GlobalAfterChangeHook, aL as GlobalAfterReadHook, aM as GlobalAfterReadHookEntry, aN as GlobalBeforeChangeHook, aO as GlobalBeforeChangeHookEntry, aP as GlobalBeforeReadHook, aQ as GlobalBeforeReadHookEntry, aR as HeadingLevel, aS as HookFunction, aT as IconFieldAdmin, aU as ImageService, aV as JoinFieldAdmin, aW as JsonFieldAdmin, aX as JsonFormat, aY as LIFECYCLE_EVENT_NAMES, aZ as LifecycleEventHandler, a_ as LinkFormat, a$ as MultiSelectFieldAdmin, b0 as NamedAccessPolicy, b1 as NumberFieldAdmin, b2 as NumberFormat, b3 as NumberLimitFieldAdmin, b4 as NumberLimitFieldConfig, b5 as OIDCAdminAuthProvider, b6 as OptionFormat, b7 as PaginatedResult, b8 as PublicAdminAuthProvider, b9 as RadioFieldAdmin, ba as RateLimitConfig, bb as ReadonlyDatabaseAdapter, bc as RichTextFeature, bd as RichTextFieldConfig, be as SelectFieldAdmin, bf as StorageAdapter, bg as TextFieldAdmin, bh as TextFormat, bi as TextareaFieldAdmin, bj as TrustProxyConfig, bk as TypedField, bl as UploadConfig, bm as UrlFieldAdmin, bn as UrlLinkValue, bo as WordLimitFieldAdmin, bp as WordLimitFieldConfig, bq as WorkflowMetadata, br as WorkflowRole, bs as WorkflowState, bt as WorkflowTransitionContext } from './app-config-ChsrBB7p.js';
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 ArrayField, K as BlocksField, M as BooleanField, N as AuthConfig, O as AccessPolicyResolver, Q as DateField, R as DateTimeField, S as EmailField, T as IconField, U as ImageField, V as JoinField, X as JsonField, Y as MultiSelectField, Z as NumberField, _ as ObjectField, $ as RadioField, a0 as RelationshipField, a1 as RichTextField, a2 as RowField, a3 as SelectField, a4 as TextField, a5 as TextareaField, a6 as TimeField, a7 as UrlField } from './app-config-DO3laV58.js';
2
+ export { a8 as AccessFunction, a9 as AccessFunctionArgs, aa as AccessResult, ab as AccessRule, ac as AdminAuthAccessResolution, ad as AdminAuthClaimMapping, ae as AdminAuthMember, af as AdminAuthProvider, ag as AdminAuthProviderMembersConfig, ah as AdminAuthProvisioningMode, ai as AdminAuthResolveAccessArgs, aj as AdminAuthResolvedIdentity, ak as AdminConfig, al as AdminDashboardComponentSlots, am as AdminIconName, an as AggregateArgs, ao as AggregateCastType, 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, aA as CollectionAfterDeleteHook, aB as CollectionAfterReadHook, aC as CollectionAfterReadHookEntry, aD as CollectionAfterTransitionHook, aE as CollectionBeforeChangeHook, aF as CollectionBeforeChangeHookEntry, aG as CollectionBeforeDeleteHook, aH as CollectionBeforeReadHook, aI as CollectionBeforeReadHookEntry, aJ as CollectionBeforeTransitionHook, aK as CollectionListComponentSlots, aL as CountOperation, aM as CustomAdminAuthProvider, aN as DatabaseAdapter, aO as DateFieldAdmin, aP as DateFormat, aQ as DetailSpan, aR as DisplayTone, aS as DisplayVariant, aT as DynamicOptionItem, aU as DynamicOptionsConfig, aV as DynamicOptionsResolver, aW as DynamicOptionsResolverArgs, aX as DyrectedLoggerConfig, aY as DyrectedObservabilityConfig, aZ as EmailFieldAdmin, a_ as FieldAdminHooks, a$ as FieldAdminOnChangeHook, b0 as FieldAdminOnChangeHookArgs, b1 as FieldAdminOptionsHook, b2 as FieldAdminOptionsHookArgs, b3 as FieldAdminOptionsHookResult, b4 as FieldAfterReadHook, b5 as FieldAfterReadHookArgs, b6 as FieldBase, b7 as FieldBeforeChangeHook, b8 as FieldBeforeChangeHookArgs, b9 as FieldHook, ba as FieldHooks, bb as FieldType, bc as FileData, bd as GlobalAfterChangeHook, be as GlobalAfterReadHook, bf as GlobalAfterReadHookEntry, bg as GlobalBeforeChangeHook, bh as GlobalBeforeChangeHookEntry, bi as GlobalBeforeReadHook, bj as GlobalBeforeReadHookEntry, bk as HeadingLevel, bl as HookFunction, bm as IconFieldAdmin, bn as ImageService, bo as InferAggregateResult, bp as JoinFieldAdmin, bq as JsonFieldAdmin, br as JsonFormat, bs as LIFECYCLE_EVENT_NAMES, bt as LifecycleEventHandler, bu as LinkFormat, bv as MultiSelectFieldAdmin, bw as NamedAccessPolicy, bx as NumberFieldAdmin, by as NumberFormat, bz as NumberLimitFieldAdmin, bA as NumberLimitFieldConfig, bB as NumericOperation, bC as OIDCAdminAuthProvider, bD as OptionFormat, bE as PaginatedResult, bF as PublicAdminAuthProvider, bG as RadioFieldAdmin, bH as RateLimitConfig, bI as ReadonlyDatabaseAdapter, bJ as RichTextFeature, bK as RichTextFieldConfig, bL as SelectFieldAdmin, bM as StorageAdapter, bN as TextFieldAdmin, bO as TextFormat, bP as TextareaFieldAdmin, bQ as TrustProxyConfig, bR as TypedField, bS as UploadConfig, bT as UrlFieldAdmin, bU as UrlLinkValue, bV as WordLimitFieldAdmin, bW as WordLimitFieldConfig, bX as WorkflowMetadata, bY as WorkflowRole, bZ as WorkflowState, b_ as WorkflowTransitionContext } from './app-config-DO3laV58.js';
3
+ import jexl from 'jexl';
3
4
  import 'lucide-react';
4
5
  import 'pino';
5
6
 
@@ -264,6 +265,220 @@ declare function isConfigValidationError(error: unknown): error is ConfigValidat
264
265
  declare function assertValidDeclarativeHooksInConfig(config: DeclarativeValidationConfig, source?: string): void;
265
266
  declare function assertValidDeclarativeAccessInConfig(config: DeclarativeValidationConfig, source?: string): void;
266
267
 
268
+ /**
269
+ * Transforms a string into a clean, URL-safe slug.
270
+ * Strips accents, lowercases, removes non-alphanumeric characters, and hyphens whitespace.
271
+ *
272
+ * @example `slugify("Hello World!")` => `"hello-world"`
273
+ */
274
+ declare function slugify(val: unknown): string;
275
+ /**
276
+ * Converts a string value to lowercase.
277
+ *
278
+ * @example `lower("Dyrected")` => `"dyrected"`
279
+ */
280
+ declare function lower(val: unknown): string;
281
+ /**
282
+ * Converts a string value to uppercase.
283
+ *
284
+ * @example `upper("dyrected")` => `"DYRECTED"`
285
+ */
286
+ declare function upper(val: unknown): string;
287
+ /**
288
+ * Trims leading and trailing whitespace from a string.
289
+ *
290
+ * @example `trim(" hello ")` => `"hello"`
291
+ */
292
+ declare function trim(val: unknown): string;
293
+ /**
294
+ * Capitalizes the first letter of a string and lowercases the rest.
295
+ *
296
+ * @example `capitalize("hELLO")` => `"Hello"`
297
+ */
298
+ declare function capitalize(val: unknown): string;
299
+ /**
300
+ * Truncates a string to a maximum length and appends an ellipsis.
301
+ *
302
+ * @example `truncate("Long article text...", 10)` => `"Long artic..."`
303
+ */
304
+ declare function truncate(val: unknown, length: unknown, ellipsis?: string): string;
305
+ /**
306
+ * Calculates estimated reading time in minutes based on word count.
307
+ *
308
+ * @example `readingTime(articleText)` => `3`
309
+ */
310
+ declare function readingTime(val: unknown, wpm?: number): number;
311
+ /**
312
+ * Returns the word count of a text string.
313
+ *
314
+ * @example `wordCount("Quick brown fox")` => `3`
315
+ */
316
+ declare function wordCount(val: unknown): number;
317
+ /**
318
+ * Replaces occurrences of a substring or pattern with a replacement string.
319
+ *
320
+ * @example `replace("hello world", "world", "there")` => `"hello there"`
321
+ */
322
+ declare function replace(val: unknown, search: unknown, replacement: unknown): string;
323
+ /**
324
+ * Checks if a string starts with a given prefix.
325
+ *
326
+ * @example `startsWith("dyrected.com", "dyrected")` => `true`
327
+ */
328
+ declare function startsWith(str: unknown, prefix: unknown): boolean;
329
+ /**
330
+ * Checks if a string ends with a given suffix.
331
+ *
332
+ * @example `endsWith("image.png", ".png")` => `true`
333
+ */
334
+ declare function endsWith(str: unknown, suffix: unknown): boolean;
335
+ /**
336
+ * Returns the current date and time as an ISO 8601 string.
337
+ *
338
+ * @example `now()` => `"2026-07-27T00:00:00.000Z"`
339
+ */
340
+ declare function now(): string;
341
+ /**
342
+ * Returns the current date as a YYYY-MM-DD string.
343
+ *
344
+ * @example `today()` => `"2026-07-27"`
345
+ */
346
+ declare function today(): string;
347
+ /**
348
+ * Formats a date string, number, or Date instance into a formatted string.
349
+ *
350
+ * @param style `'short'` (default), `'iso'`, `'date'`, `'datetime'`, or `'full'`
351
+ * @example `formatDate("2026-07-27T12:00:00Z", "short")` => `"Jul 27, 2026"`
352
+ */
353
+ declare function formatDate(val: unknown, style?: unknown): string;
354
+ /**
355
+ * Adds or subtracts a specified number of days to a date.
356
+ *
357
+ * @example `addDays(now(), 7)` => `"2026-08-03T00:00:00.000Z"`
358
+ */
359
+ declare function addDays(val: unknown, days: unknown): string;
360
+ /**
361
+ * Calculates the integer difference in days between two dates.
362
+ *
363
+ * @example `diffDays("2026-07-27", "2026-07-20")` => `7`
364
+ */
365
+ declare function diffDays(dateA: unknown, dateB: unknown): number;
366
+ /**
367
+ * Checks if a date is in the past relative to the current timestamp.
368
+ *
369
+ * @example `isPast("2020-01-01")` => `true`
370
+ */
371
+ declare function isPast(val: unknown): boolean;
372
+ /**
373
+ * Checks if a date is in the future relative to the current timestamp.
374
+ *
375
+ * @example `isFuture("2030-01-01")` => `true`
376
+ */
377
+ declare function isFuture(val: unknown): boolean;
378
+ /**
379
+ * Checks if an item exists within an array or if a substring exists within a string.
380
+ *
381
+ * @example `includes(["admin", "editor"], "admin")` => `true`
382
+ */
383
+ declare function includes(arrOrStr: unknown, item: unknown): boolean;
384
+ /**
385
+ * Joins array elements into a string separated by a delimiter.
386
+ *
387
+ * @example `join(["Apple", "Banana"], ", ")` => `"Apple, Banana"`
388
+ */
389
+ declare function join(arr: unknown, separator?: string): string;
390
+ /**
391
+ * Returns the first item in an array.
392
+ *
393
+ * @example `first(["a", "b", "c"])` => `"a"`
394
+ */
395
+ declare function first(arr: unknown): unknown;
396
+ /**
397
+ * Returns the last item in an array.
398
+ *
399
+ * @example `last(["a", "b", "c"])` => `"c"`
400
+ */
401
+ declare function last(arr: unknown): unknown;
402
+ /**
403
+ * Removes null, undefined, and empty string elements from an array.
404
+ *
405
+ * @example `compact(["a", null, "b", ""])` => `["a", "b"]`
406
+ */
407
+ declare function compact(arr: unknown): unknown[];
408
+ /**
409
+ * Removes duplicate items from an array.
410
+ *
411
+ * @example `unique(["a", "b", "a"])` => `["a", "b"]`
412
+ */
413
+ declare function unique(arr: unknown): unknown[];
414
+ /**
415
+ * Returns the length of an array, string, or object.
416
+ *
417
+ * @example `length("hello")` => `5`
418
+ */
419
+ declare function length(val: unknown): number;
420
+ /**
421
+ * Rounds a number to a specified number of decimal places.
422
+ *
423
+ * @example `round(3.14159, 2)` => `3.14`
424
+ */
425
+ declare function round(val: unknown, decimals?: number): number;
426
+ /**
427
+ * Clamps a number between a minimum and maximum threshold.
428
+ *
429
+ * @example `clamp(150, 0, 100)` => `100`
430
+ */
431
+ declare function clamp(val: unknown, minVal: unknown, maxVal: unknown): number;
432
+ declare function ceil(val: unknown): number;
433
+ declare function floor(val: unknown): number;
434
+ declare function abs(val: unknown): number;
435
+ declare function min(...args: unknown[]): number;
436
+ declare function max(...args: unknown[]): number;
437
+ declare function pow(base: unknown, exp: unknown): number;
438
+ declare function sqrt(val: unknown): number;
439
+ declare function sum(arr: unknown): number;
440
+ declare function count(val: unknown): number;
441
+ /**
442
+ * Returns a fallback value if the target value is undefined, null, or an empty string.
443
+ *
444
+ * @example `default(siblingData.title, "Untitled")` => `"Untitled"`
445
+ */
446
+ declare function defaultValue(val: unknown, fallback: unknown): unknown;
447
+ /**
448
+ * Returns the first non-empty value among the arguments provided.
449
+ *
450
+ * @example `coalesce(null, "", "Fallback")` => `"Fallback"`
451
+ */
452
+ declare function coalesce(...args: unknown[]): unknown;
453
+ /**
454
+ * Checks if a value is empty (undefined, null, empty string, empty array, or empty object).
455
+ *
456
+ * @example `isEmpty([])` => `true`
457
+ */
458
+ declare function isEmpty(val: unknown): boolean;
459
+ /**
460
+ * Safely accesses a nested object property by a dot-separated key path.
461
+ *
462
+ * @example `get(siblingData, "author.name", "Guest")` => `"John"`
463
+ */
464
+ declare function get(obj: unknown, path: unknown, fallback?: unknown): unknown;
465
+ /**
466
+ * Registers all Dyrected built-in helper functions onto a Jexl evaluation instance.
467
+ */
468
+ declare function registerJexlHelpers(jexlInstance?: typeof jexl): void;
469
+ /**
470
+ * Standard shared evaluator for JEXL expressions across server and browser.
471
+ * Injects math namespace and standard helpers into the context.
472
+ */
473
+ declare function evaluateJexl(expression: string, context?: Record<string, any>): Promise<any>;
474
+ /**
475
+ * Synchronous standard shared evaluator for JEXL expressions.
476
+ * Injects math namespace and standard helpers into the context.
477
+ */
478
+ declare function evaluateJexlSync(expression: string, context?: Record<string, any>): any;
479
+ /** List of all built-in Jexl helper function names for AST validation. */
480
+ declare const BUILTIN_JEXL_HELPERS: readonly ["slugify", "lower", "upper", "trim", "capitalize", "truncate", "readingTime", "wordCount", "replace", "startsWith", "endsWith", "now", "today", "formatDate", "addDays", "diffDays", "isPast", "isFuture", "includes", "join", "first", "last", "compact", "unique", "length", "round", "clamp", "default", "coalesce", "isEmpty", "get"];
481
+
267
482
  type AnyHookFn = (args: any) => any;
268
483
  type AnyHook = AnyHookFn | DeclarativeHookExpression;
269
484
  /**
@@ -397,6 +612,150 @@ declare function transitionWorkflow(args: {
397
612
  req: HookRequestContext;
398
613
  }): Promise<BaseDocument>;
399
614
 
615
+ /**
616
+ * Normalizes a DetailItem (which may be a shorthand string) into a standard DetailItem object.
617
+ *
618
+ * @example `normalizeDetailItem('title')` => `{ type: 'field', field: 'title' }`
619
+ */
620
+ declare function normalizeDetailItem(item: DetailItem): Exclude<DetailItem, string>;
621
+ /**
622
+ * Creates a section container in a Detail View layout.
623
+ *
624
+ * @example
625
+ * ```ts
626
+ * displaySection('Product Information', [
627
+ * displayField('name', { span: 8 }),
628
+ * displayField('sku', { span: 4 }),
629
+ * ], { span: 8, icon: 'package' })
630
+ * ```
631
+ */
632
+ declare function displaySection(title: string, items: DetailItem[], options?: DetailSectionOptions): DetailSection;
633
+ /**
634
+ * Creates a single tab entry for use within `displayTabs()`.
635
+ */
636
+ declare function displayTab(label: string, items: DetailItem[], options?: DetailTabOptions): DetailTab;
637
+ /**
638
+ * Creates a tabbed container in a Detail View layout.
639
+ *
640
+ * @example
641
+ * ```ts
642
+ * displayTabs([
643
+ * displayTab('Specifications', [displayField('specs')]),
644
+ * displayTab('Reviews', [displayRepeat('reviews', [...])], { badge: '3' }),
645
+ * ])
646
+ * ```
647
+ */
648
+ declare function displayTabs(tabs: DetailTab[], options?: DetailTabsOptions): DetailTabs;
649
+ /**
650
+ * Creates a multi-column grid layout inside a section or detail schema.
651
+ *
652
+ * @example
653
+ * ```ts
654
+ * displayGrid(2, [
655
+ * displayField('firstName'),
656
+ * displayField('lastName'),
657
+ * ])
658
+ * ```
659
+ */
660
+ declare function displayGrid(columns: number, items: DetailItem[], options?: DetailGridOptions): DetailGrid;
661
+ /**
662
+ * Declares a field for presentation in a Detail View.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * displayField('status', { display: 'badge', badgeColors: { active: 'emerald' } })
667
+ * displayField('author.name', { label: 'Written By' })
668
+ * displayField('specs', { display: 'key-value', keyLabel: 'Spec', valueLabel: 'Detail' })
669
+ * ```
670
+ */
671
+ declare function displayField(fieldName: string, options?: DisplayFieldOptions): DetailField;
672
+ /**
673
+ * Renders an array/repeated field using a delegated display schema.
674
+ * Supports `'table'`, `'cards'`, and `'list'` layouts.
675
+ *
676
+ * @example
677
+ * ```ts
678
+ * displayRepeat('items', [
679
+ * displayField('product'),
680
+ * displayField('quantity'),
681
+ * displayField('price'),
682
+ * ], { layout: 'table' })
683
+ * ```
684
+ */
685
+ declare function displayRepeat(fieldName: string, items: DetailItem[], options?: DetailRepeatOptions): DetailRepeat;
686
+ /**
687
+ * Renders a computed value calculated from document and user context.
688
+ *
689
+ * @example
690
+ * ```ts
691
+ * displayComputed('Reading Time', 'math.ceil(doc.wordCount / 200) + " min"')
692
+ * displayComputed('Total', ({ doc }) => `$${doc.price * doc.quantity}`)
693
+ * ```
694
+ */
695
+ declare function displayComputed<TDoc = any>(label: string, expressionOrOptionsOrHandler: string | DetailComputedOptions<TDoc> | ComputedHandler<TDoc>, options?: DetailComputedOptions<TDoc>): DetailComputed<TDoc>;
696
+ /**
697
+ * Creates a horizontal divider line in a Detail View layout.
698
+ *
699
+ * @example
700
+ * ```ts
701
+ * displayDivider({ spacing: 'md' })
702
+ * ```
703
+ */
704
+ declare function displayDivider(options?: DetailDividerOptions): DetailDivider;
705
+ /**
706
+ * Renders static text, heading, callout, or information notice in a Detail View layout.
707
+ *
708
+ * @example
709
+ * ```ts
710
+ * displayText('Please note this action is permanent.', { variant: 'warning' })
711
+ * displayText('Overview Notes', { variant: 'heading' })
712
+ * ```
713
+ */
714
+ declare function displayText(content: string, options?: DetailTextOptions): DetailText;
715
+ /**
716
+ * Renders a custom React component registered by name in the Admin panel.
717
+ *
718
+ * @example
719
+ * ```ts
720
+ * displayCustom('AnalyticsChart', { props: { timeframe: '30d' } })
721
+ * ```
722
+ */
723
+ declare function displayCustom<TDoc = any>(name: string, options?: DetailCustomOptions<TDoc>): DetailCustom<TDoc>;
724
+ /**
725
+ * Alias for `displayCustom` to render a custom component in a Detail View layout.
726
+ */
727
+ declare function displayCustomComponent<TDoc = any>(name: string, options?: DetailCustomOptions<TDoc>): DetailCustom<TDoc>;
728
+ /**
729
+ * Evaluates server-side computed functions and JEXL expressions from a detail schema
730
+ * and attaches them to `doc._meta.computed`.
731
+ */
732
+ declare function evaluateDetailComputed(detail: DetailSchema | boolean | undefined, doc: any, user: any, db: any): Promise<any>;
733
+ /**
734
+ * Generates an automatic default 12-column Detail View schema for a collection or global
735
+ * when no explicit `detail` configuration is provided.
736
+ */
737
+ declare function generateDefaultDetailSchema(schema: {
738
+ fields?: Field[];
739
+ labels?: {
740
+ singular?: string;
741
+ plural?: string;
742
+ };
743
+ label?: string;
744
+ slug?: string;
745
+ }): DetailSchema;
746
+ /**
747
+ * Evaluates whether a detail item should be visible based on its `options.visible` rule.
748
+ * Supports boolean values or JEXL expressions evaluated against `{ doc, user }`.
749
+ * Works consistently for top-level and nested detail items.
750
+ *
751
+ * @example
752
+ * ```ts
753
+ * isDetailItemVisible(displayField('secret', { visible: false }), doc, user) // false
754
+ * isDetailItemVisible(displayField('publishedAt', { visible: "doc.status == 'published'" }), doc, user)
755
+ * ```
756
+ */
757
+ declare function isDetailItemVisible(item: DetailItem, doc: any, user?: any): boolean;
758
+
400
759
  type TopLevelFieldName<TFields extends readonly Field[]> = Extract<TFields[number], {
401
760
  name: string;
402
761
  }>["name"];
@@ -815,4 +1174,4 @@ declare function defineTab<const T extends readonly Field[]>(args: {
815
1174
  fields: T;
816
1175
  }): T;
817
1176
 
818
- export { AccessPolicyResolver, AdminAuthConfig, ArrayField, AuthConfig, type AuthDocFields, AuthenticatedUser, BaseDocument, Block, BlocksField, BooleanField, CollectionConfig, type ConfigDiagnostic, ConfigValidationError, DateField, DateTimeField, type DeclarativeAccessSurface, type DeclarativeAccessValidationIssue, type DeclarativeAdminSurface, type DeclarativeAdminValidationIssue, DeclarativeHookExpression, type DeclarativeHookSurface, type DeclarativeHookValidationIssue, type DeclarativePreviewSurface, type DeclarativePreviewValidationIssue, DyrectedConfig, EmailField, Field, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MultiSelectField, NumberField, ObjectField, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SqlWhereResult, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, WorkflowConfig, WorkflowTransition, assertValidAdminConditionsInConfig, assertValidDeclarativeAccessInConfig, assertValidDeclarativeHookExpression, assertValidDeclarativeHookResult, assertValidDeclarativeHooksInConfig, assertValidPreviewUrlsInConfig, availableWorkflowTransitions, buildSqlOrderBy, canViewWorkflowDraft, collectAdminConditionValidationIssues, collectConfigDiagnostics, collectDeclarativeAccessValidationIssues, collectDeclarativeHookValidationIssues, collectPreviewUrlValidationIssues, createLifecycleEvent, createWorkflowDocument, 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, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, executeFieldAfterRead, executeFieldBeforeChange, formatConfigDiagnostics, generateOpenApi, getAdminAuthCollection, getPublicAdminAuthConfig, initializeWorkflowDocument, isConfigValidationError, materializeWorkflowDocument, normalizeConfig, numericFieldNames, parseMongoWhere, parseSort, parseSqlWhere, publishedStateName, publishingWorkflow, resolveAdminAuthCollection, runCollectionHooks, saveWorkflowDraft, simplePublishingWorkflow, transitionWorkflow, validateAdminConditionExpression, validateDeclarativeAccessExpression, validateDeclarativeHookExpression, validatePreviewUrlExpression, workflowCapabilities };
1177
+ export { 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, Field, GlobalConfig, HookRequestContext, IconField, ImageField, type InferDocShape, JoinField, JsonField, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, MultiSelectField, NumberField, ObjectField, type Prettify, PublicAdminAuthConfig, type PublishingWorkflowOptions, RadioField, RelationshipField, RichTextField, RowField, SelectField, type SortClause, type SortDirection, type SqlSortDialect, type SqlWhereResult, type SystemDocFields, TextField, TextareaField, TimeField, type UploadDocFields, UrlField, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, 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, first, floor, formatConfigDiagnostics, formatDate, generateDefaultDetailSchema, generateOpenApi, get, getAdminAuthCollection, getPublicAdminAuthConfig, includes, initializeWorkflowDocument, isConfigValidationError, isDetailItemVisible, isEmpty, isFuture, isPast, join, last, length, lower, materializeWorkflowDocument, max, min, normalizeConfig, normalizeDetailItem, now, numericFieldNames, parseMongoWhere, parseSort, parseSqlWhere, 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, wordCount, workflowCapabilities };
package/dist/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import {
2
+ BUILTIN_JEXL_HELPERS,
2
3
  ConfigValidationError,
3
4
  LIFECYCLE_EVENTS_COLLECTION,
4
5
  WORKFLOW_HISTORY_COLLECTION,
6
+ abs,
7
+ addDays,
5
8
  assertValidAdminConditionsInConfig,
6
9
  assertValidDeclarativeAccessInConfig,
7
10
  assertValidDeclarativeHookExpression,
@@ -10,39 +13,95 @@ import {
10
13
  assertValidPreviewUrlsInConfig,
11
14
  availableWorkflowTransitions,
12
15
  canViewWorkflowDraft,
16
+ capitalize,
17
+ ceil,
18
+ clamp,
19
+ coalesce,
13
20
  collectAdminConditionValidationIssues,
14
21
  collectConfigDiagnostics,
15
22
  collectDeclarativeAccessValidationIssues,
16
23
  collectDeclarativeHookValidationIssues,
17
24
  collectPreviewUrlValidationIssues,
25
+ compact,
26
+ count,
18
27
  createLifecycleEvent,
19
28
  createWorkflowDocument,
29
+ defaultValue,
20
30
  definePublishingWorkflow,
31
+ diffDays,
21
32
  dispatchLifecycleEvent,
22
33
  dispatchPendingLifecycleEvents,
34
+ displayComputed,
35
+ displayCustom,
36
+ displayCustomComponent,
37
+ displayDivider,
38
+ displayField,
39
+ displayGrid,
40
+ displayRepeat,
41
+ displaySection,
42
+ displayTab,
43
+ displayTabs,
44
+ displayText,
45
+ endsWith,
46
+ evaluateDetailComputed,
47
+ evaluateJexl,
48
+ evaluateJexlSync,
23
49
  executeFieldAfterRead,
24
50
  executeFieldBeforeChange,
51
+ first,
52
+ floor,
25
53
  formatConfigDiagnostics,
54
+ formatDate,
55
+ generateDefaultDetailSchema,
26
56
  generateOpenApi,
57
+ get,
27
58
  getAdminAuthCollection,
28
59
  getPublicAdminAuthConfig,
60
+ includes,
29
61
  initializeWorkflowDocument,
30
62
  isConfigValidationError,
63
+ isDetailItemVisible,
64
+ isEmpty,
65
+ isFuture,
66
+ isPast,
67
+ join,
68
+ last,
69
+ length,
70
+ lower,
31
71
  materializeWorkflowDocument,
72
+ max,
73
+ min,
32
74
  normalizeConfig,
75
+ normalizeDetailItem,
76
+ now,
77
+ pow,
33
78
  publishedStateName,
34
79
  publishingWorkflow,
80
+ readingTime,
81
+ registerJexlHelpers,
82
+ replace,
35
83
  resolveAdminAuthCollection,
84
+ round,
36
85
  runCollectionHooks,
37
86
  saveWorkflowDraft,
38
87
  simplePublishingWorkflow,
88
+ slugify,
89
+ sqrt,
90
+ startsWith,
91
+ sum,
92
+ today,
39
93
  transitionWorkflow,
94
+ trim,
95
+ truncate,
96
+ unique,
97
+ upper,
40
98
  validateAdminConditionExpression,
41
99
  validateDeclarativeAccessExpression,
42
100
  validateDeclarativeHookExpression,
43
101
  validatePreviewUrlExpression,
102
+ wordCount,
44
103
  workflowCapabilities
45
- } from "./chunk-YEBCT77K.js";
104
+ } from "./chunk-XX7N64NL.js";
46
105
 
47
106
  // src/types/workflows.ts
48
107
  var LIFECYCLE_EVENT_NAMES = [
@@ -302,10 +361,13 @@ function defineTab(args) {
302
361
  }));
303
362
  }
304
363
  export {
364
+ BUILTIN_JEXL_HELPERS,
305
365
  ConfigValidationError,
306
366
  LIFECYCLE_EVENTS_COLLECTION,
307
367
  LIFECYCLE_EVENT_NAMES,
308
368
  WORKFLOW_HISTORY_COLLECTION,
369
+ abs,
370
+ addDays,
309
371
  assertValidAdminConditionsInConfig,
310
372
  assertValidDeclarativeAccessInConfig,
311
373
  assertValidDeclarativeHookExpression,
@@ -315,13 +377,20 @@ export {
315
377
  availableWorkflowTransitions,
316
378
  buildSqlOrderBy,
317
379
  canViewWorkflowDraft,
380
+ capitalize,
381
+ ceil,
382
+ clamp,
383
+ coalesce,
318
384
  collectAdminConditionValidationIssues,
319
385
  collectConfigDiagnostics,
320
386
  collectDeclarativeAccessValidationIssues,
321
387
  collectDeclarativeHookValidationIssues,
322
388
  collectPreviewUrlValidationIssues,
389
+ compact,
390
+ count,
323
391
  createLifecycleEvent,
324
392
  createWorkflowDocument,
393
+ defaultValue,
325
394
  defineArrayField,
326
395
  defineBlock,
327
396
  defineBlocksField,
@@ -351,32 +420,81 @@ export {
351
420
  defineTextareaField,
352
421
  defineTimeField,
353
422
  defineUrlField,
423
+ diffDays,
354
424
  dispatchLifecycleEvent,
355
425
  dispatchPendingLifecycleEvents,
426
+ displayComputed,
427
+ displayCustom,
428
+ displayCustomComponent,
429
+ displayDivider,
430
+ displayField,
431
+ displayGrid,
432
+ displayRepeat,
433
+ displaySection,
434
+ displayTab,
435
+ displayTabs,
436
+ displayText,
437
+ endsWith,
438
+ evaluateDetailComputed,
439
+ evaluateJexl,
440
+ evaluateJexlSync,
356
441
  executeFieldAfterRead,
357
442
  executeFieldBeforeChange,
443
+ first,
444
+ floor,
358
445
  formatConfigDiagnostics,
446
+ formatDate,
447
+ generateDefaultDetailSchema,
359
448
  generateOpenApi,
449
+ get,
360
450
  getAdminAuthCollection,
361
451
  getPublicAdminAuthConfig,
452
+ includes,
362
453
  initializeWorkflowDocument,
363
454
  isConfigValidationError,
455
+ isDetailItemVisible,
456
+ isEmpty,
457
+ isFuture,
458
+ isPast,
459
+ join,
460
+ last,
461
+ length,
462
+ lower,
364
463
  materializeWorkflowDocument,
464
+ max,
465
+ min,
365
466
  normalizeConfig,
467
+ normalizeDetailItem,
468
+ now,
366
469
  numericFieldNames,
367
470
  parseMongoWhere,
368
471
  parseSort,
369
472
  parseSqlWhere,
473
+ pow,
370
474
  publishedStateName,
371
475
  publishingWorkflow,
476
+ readingTime,
477
+ registerJexlHelpers,
478
+ replace,
372
479
  resolveAdminAuthCollection,
480
+ round,
373
481
  runCollectionHooks,
374
482
  saveWorkflowDraft,
375
483
  simplePublishingWorkflow,
484
+ slugify,
485
+ sqrt,
486
+ startsWith,
487
+ sum,
488
+ today,
376
489
  transitionWorkflow,
490
+ trim,
491
+ truncate,
492
+ unique,
493
+ upper,
377
494
  validateAdminConditionExpression,
378
495
  validateDeclarativeAccessExpression,
379
496
  validateDeclarativeHookExpression,
380
497
  validatePreviewUrlExpression,
498
+ wordCount,
381
499
  workflowCapabilities
382
500
  };
@@ -0,0 +1,34 @@
1
+ import {
2
+ attachRequestMetrics,
3
+ bindObservabilityRuntime,
4
+ buildRequestLogger,
5
+ captureRequestBody,
6
+ createObservabilityRuntime,
7
+ createRequestSpan,
8
+ endRequestSpan,
9
+ getConfigLogger,
10
+ getObservabilityRuntime,
11
+ getRequestLogger,
12
+ redactBody,
13
+ redactHeaders,
14
+ renderPrometheusMetrics,
15
+ resolveObservabilityConfig,
16
+ shouldSampleRequest
17
+ } from "./chunk-VM43G3IG.js";
18
+ export {
19
+ attachRequestMetrics,
20
+ bindObservabilityRuntime,
21
+ buildRequestLogger,
22
+ captureRequestBody,
23
+ createObservabilityRuntime,
24
+ createRequestSpan,
25
+ endRequestSpan,
26
+ getConfigLogger,
27
+ getObservabilityRuntime,
28
+ getRequestLogger,
29
+ redactBody,
30
+ redactHeaders,
31
+ renderPrometheusMetrics,
32
+ resolveObservabilityConfig,
33
+ shouldSampleRequest
34
+ };