@gzl10/nexus-sdk 0.17.0 → 0.19.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.
@@ -617,6 +617,7 @@ function useLocalizedField(config) {
617
617
  input: "text",
618
618
  hint,
619
619
  required,
620
+ defaultValue: {},
620
621
  db: {
621
622
  type: "json",
622
623
  nullable: !required
@@ -1,5 +1,5 @@
1
- import { L as LocalizedString, b as FieldDefinition } from '../field-ByR7eH7v.js';
2
- import { d as CollectionEntityDefinition, f as DagEntityDefinition, e as EventEntityDefinition, aK as RolePermission } from '../entity-DkGTh6I1.js';
1
+ import { L as LocalizedString, b as FieldDefinition } from '../field-Bs1fIux8.js';
2
+ import { d as CollectionEntityDefinition, f as DagEntityDefinition, e as EventEntityDefinition, aK as RolePermission } from '../entity-1_53kUfz.js';
3
3
  import 'knex';
4
4
  import 'express';
5
5
  import 'pino';
@@ -17,7 +17,7 @@ import {
17
17
  useTextareaField,
18
18
  useUrlField,
19
19
  userIdField
20
- } from "../chunk-UBKKV4XF.js";
20
+ } from "../chunk-WHLUKKQO.js";
21
21
 
22
22
  // src/collection/helpers.ts
23
23
  var polymorphicCaslPermissions = {
@@ -1,6 +1,6 @@
1
1
  import { Knex } from 'knex';
2
2
  import { Request, Router, RequestHandler, Response } from 'express';
3
- import { L as LocalizedString, b as FieldDefinition, E as EntityIndex, F as FieldCondition } from './field-ByR7eH7v.js';
3
+ import { L as LocalizedString, b as FieldDefinition, j as LocaleConfig, E as EntityIndex, F as FieldCondition } from './field-Bs1fIux8.js';
4
4
  import { Logger } from 'pino';
5
5
 
6
6
  /**
@@ -925,6 +925,12 @@ interface PageDefinition {
925
925
  widgets?: WidgetDefinition[];
926
926
  /** Component name (for type: 'custom') — resolves to plugin/module UI asset */
927
927
  component?: string;
928
+ /**
929
+ * Backend endpoint that returns `{ title: string, content: string }` HTML.
930
+ * StandalonePage/PageTab fetch and render it in a generic layout.
931
+ * Mutually exclusive with `component`.
932
+ */
933
+ contentEndpoint?: string;
928
934
  /** Standalone pages render with full layout, not as tabs inside ModulePage */
929
935
  standalone?: boolean;
930
936
  /** Route meta for the standalone page (auth, guest, permissions) */
@@ -949,6 +955,7 @@ interface PageDefinitionDTO {
949
955
  };
950
956
  widgets?: WidgetDefinition[];
951
957
  component?: string;
958
+ contentEndpoint?: string;
952
959
  standalone?: boolean;
953
960
  meta?: Record<string, unknown>;
954
961
  layout?: 'admin' | 'public' | 'centered';
@@ -1385,6 +1392,8 @@ interface DbContext {
1385
1392
  getPagination: (query?: EntityQuery) => PaginationParamsWithOffset;
1386
1393
  buildPaginatedResult: <T>(items: T[], total: number, pagination: PaginationParamsWithOffset) => PaginatedResult<T>;
1387
1394
  getKnex: (adapter?: string) => Knex;
1395
+ /** Run full seed for a module (manifest seed + entity auto-seed). Injected from db layer. */
1396
+ seedModule: (mod: ModuleManifest) => Promise<boolean>;
1388
1397
  }
1389
1398
  /**
1390
1399
  * Runtime namespace.
@@ -1475,6 +1484,8 @@ interface ModuleContext {
1475
1484
  /** Semantic event API for cross-module communication (notify/query/command). */
1476
1485
  events: ContextEvents;
1477
1486
  createRouter: () => Router;
1487
+ /** Supported locales for the platform */
1488
+ locales: LocaleConfig[];
1478
1489
  }
1479
1490
  /**
1480
1491
  * HTTP method for custom routes
@@ -1519,6 +1530,86 @@ interface CustomRouteDefinition {
1519
1530
  operationId?: string;
1520
1531
  tags?: string[];
1521
1532
  }
1533
+ /**
1534
+ * Seed context passed to onSeed hook.
1535
+ * Provides typed helpers for seeding data without direct DB access.
1536
+ *
1537
+ * Note: masters.register() is lazy (data flushed after onSeed completes).
1538
+ * All other methods (roles.add, users.add, plugin().entity().upsert, raw) are eager.
1539
+ */
1540
+ interface SeedContext {
1541
+ /** Register master reference data. Lazy: flushed after onSeed completes. */
1542
+ masters: {
1543
+ register(type: string, entries: Array<{
1544
+ code: string;
1545
+ label: string | {
1546
+ en?: string;
1547
+ es?: string;
1548
+ [key: string]: string | undefined;
1549
+ };
1550
+ order?: number;
1551
+ is_active?: boolean;
1552
+ metadata?: Record<string, unknown>;
1553
+ }>, options?: {
1554
+ seed?: 'if-empty' | 'always';
1555
+ }): void;
1556
+ };
1557
+ /**
1558
+ * Add roles to the system. Eager: inserts immediately. Idempotent by name.
1559
+ *
1560
+ * Optional `permissions` map assigns CASL abilities to the role.
1561
+ * Keys are subject names (case-insensitive: 'masters' = 'Masters').
1562
+ * Values are action arrays.
1563
+ *
1564
+ * Core subjects: Masters, Users, Roles, Auth, Mail, Storage, System.
1565
+ * Plugin subjects: documented in each plugin's llms.txt.
1566
+ *
1567
+ * @example
1568
+ * ```typescript
1569
+ * await seed.roles.add({
1570
+ * name: 'SALES',
1571
+ * description: { en: 'Sales team' },
1572
+ * permissions: {
1573
+ * 'masters': ['read'],
1574
+ * 'contacts': ['read', 'create', 'update'],
1575
+ * }
1576
+ * })
1577
+ * ```
1578
+ */
1579
+ roles: {
1580
+ add(role: {
1581
+ name: string;
1582
+ description?: string | {
1583
+ en?: string;
1584
+ es?: string;
1585
+ [key: string]: string | undefined;
1586
+ };
1587
+ is_system?: boolean;
1588
+ /** CASL permissions. Keys: subject (case-insensitive). Values: action arrays. */
1589
+ permissions?: Record<string, Array<'read' | 'create' | 'update' | 'delete' | 'manage' | 'execute'>>;
1590
+ }): Promise<void>;
1591
+ };
1592
+ /** Add users to the system. Eager: inserts immediately. Idempotent by email. */
1593
+ users: {
1594
+ add(user: {
1595
+ email: string;
1596
+ password: string;
1597
+ name?: string;
1598
+ type?: 'human' | 'bot' | 'service';
1599
+ roles?: string[];
1600
+ }): Promise<void>;
1601
+ };
1602
+ /** Access plugin entities for seeding. Resolves table prefix automatically. */
1603
+ plugin(name: string): {
1604
+ entity(name: string): {
1605
+ upsert(data: Record<string, unknown>[], options?: {
1606
+ key?: string;
1607
+ }): Promise<number>;
1608
+ };
1609
+ };
1610
+ /** Raw table insert (escape hatch). Returns number of rows inserted. */
1611
+ raw(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<number>;
1612
+ }
1522
1613
 
1523
1614
  /**
1524
1615
  * Entity definition types - discriminated union for all entity types
@@ -1693,10 +1784,16 @@ interface BaseEntityDefinition {
1693
1784
  order?: number;
1694
1785
  /** UI display mode */
1695
1786
  displayMode?: DisplayMode;
1787
+ /** Restrict available display modes. If omitted, auto-detected from entity config. */
1788
+ availableDisplayModes?: DisplayMode[];
1696
1789
  /** Field name to group by in board/list/masonry displays */
1697
1790
  groupBy?: string;
1698
1791
  /** Field name for secondary grouping (collapsible) */
1699
1792
  subgroupBy?: string;
1793
+ /** Explicit list of fields eligible for grouping. If omitted, auto-detected from field input types. */
1794
+ groupableFields?: string[];
1795
+ /** Subset of groupableFields where drag between board columns is allowed. Default: all groupable. */
1796
+ columnDragFields?: string[];
1700
1797
  /** Date field for calendar start (enables calendar display) */
1701
1798
  calendarFrom?: string;
1702
1799
  /** Date field for calendar end (range display) */
@@ -1718,6 +1815,12 @@ interface BaseEntityDefinition {
1718
1815
  hooks?: (ctx: ModuleContext) => EntityServiceHooks;
1719
1816
  /** Real-time mode: 'live' (push), 'sync' (bidirectional), or false (default) */
1720
1817
  realtime?: RealtimeMode;
1818
+ /**
1819
+ * If true, entity data can be exported/imported via data/seeds/.
1820
+ * Use `nexus seed export` to snapshot DB data into versionable JSON files.
1821
+ * On startup, JSONs from data/seeds/ are imported with upsert semantics.
1822
+ */
1823
+ seedable?: boolean;
1721
1824
  }
1722
1825
  /**
1723
1826
  * Public type exposing the common properties shared by all entity definition types.
@@ -1959,4 +2062,4 @@ type TempEntityDefinition = Omit<CollectionEntityDefinition, 'type'> & {
1959
2062
  */
1960
2063
  type EntityDefinition = CollectionEntityDefinition | SingleEntityDefinition | ExternalEntityDefinition | VirtualEntityDefinition | ComputedEntityDefinition | ViewEntityDefinition | ReferenceEntityDefinition | TreeEntityDefinition | DagEntityDefinition | EventEntityDefinition;
1961
2064
 
1962
- export { type CreateEntityServiceOptions as $, type ActionDefinition as A, type BaseAuthRequest as B, type ConfirmConfig as C, type DisplayMode as D, type EntityType as E, type CacheStats as F, type CaslAction as G, type CategoryMeta as H, type CollectionEntityService as I, type ComputedEntityService as J, type ConfigContext as K, type ConfigEntityDefinition as L, type ModuleContext as M, type ConfigEntityService as N, type ConfirmationType as O, type PostActionPipeline as P, type ContextCrypto as Q, type RealtimeMode as R, type SingleEntityDefinition as S, type TreeEntityDefinition as T, type ContextEvents as U, type ViewEntityDefinition as V, type ContextEventsHub as W, type ContextHelpers as X, type ContextSocket as Y, type CoreContext as Z, type CoreServices as _, type Category as a, type ServicesContext as a$, type CustomRouteDefinition as a0, DEFAULT_TENANT_ID as a1, type DagEntityService as a2, type DatabaseAdapter as a3, type DbContext as a4, type EngineContext as a5, type EntityAction as a6, type EntityCaslConfig as a7, type EntityChangePayload as a8, type EntityController as a9, type PluginConfigSchema as aA, type PluginEnvVar as aB, type PluginManifest as aC, type PluginSetupInfo as aD, type PostAction as aE, type RateLimitOptions as aF, type ReferenceEntityDefinition as aG, type ReferenceEntityService as aH, type RegisterPluginOptions as aI, type RetentionPolicy as aJ, type RolePermission as aK, type RouteParameterDefinition as aL, type RouteResponseDefinition as aM, type RuntimeContext as aN, type SSEHelper as aO, type SSEOptions as aP, type SSESender as aQ, type SchemaAdapter as aR, type SchemaAlterTableBuilder as aS, type SchemaColumnBuilder as aT, type SchemaColumnInfo as aU, type SchemaForeignKeyBuilder as aV, type SchemaTableBuilder as aW, type ScopedCacheManager as aX, type SeedConfig as aY, type SendMailOptions as aZ, type SendMailResult as a_, type EntityHandler as aa, type EntityQuery as ab, type EntityRealtimeEmits as ac, type EntityRealtimeEvents as ad, type EntityServiceHooks as ae, type EventEmitterLike as af, type EventEntityService as ag, type ExternalEntityDefinition as ah, type ExternalEntityService as ai, type FilterOperators as aj, type FilterValue as ak, type ForbiddenErrorConstructor as al, type ForbiddenErrorInstance as am, type HttpMethod as an, type LoggerReporter as ao, type ManagedCache as ap, type ModuleAbilities as aq, type ModuleManifest as ar, type ModuleMiddlewares as as, type ModuleRequirements as at, type PageDefinition as au, type PageType as av, type PaginatedResult as aw, type PaginationParams as ax, type PaginationParamsWithOffset as ay, type PluginConfigField as az, type PageDefinitionDTO as b, type SharedEntityProperties as b0, type SingleEntityService as b1, type SocketIOBroadcastOperator as b2, type SocketIOServer as b3, type TempEntityDefinition as b4, type TempEntityService as b5, type TempRetentionPolicy as b6, type TreeEntityService as b7, type TreeNode as b8, type TypedEntityQuery as b9, type ValidateSchemas as ba, type ValidationDetail as bb, type ValidationSchema as bc, type ViewEntityService as bd, type VirtualEntityDefinition as be, type VirtualEntityService as bf, type WidgetDefinition as bg, type WidgetLayout as bh, entityRoom as bi, type ComputedEntityDefinition as c, type CollectionEntityDefinition as d, type EventEntityDefinition as e, type DagEntityDefinition as f, type EntityDefinition as g, type AbilityLike as h, type ActionEntityService as i, type ActionInjection as j, type AdaptersContext as k, type AppManifest as l, type AuthRequest as m, type BaseEntityService as n, type BaseMailService as o, type BaseRolesService as p, type BaseUser as q, type BaseUsersService as r, type BatchLogEntry as s, type BatchProgressEvent as t, type BridgeRule as u, type BridgeTarget as v, CATEGORIES as w, CATEGORY_ORDER as x, type CacheManagerContract as y, type CacheOptions as z };
2065
+ export { type CreateEntityServiceOptions as $, type ActionDefinition as A, type BaseAuthRequest as B, type ConfirmConfig as C, type DisplayMode as D, type EntityType as E, type CacheStats as F, type CaslAction as G, type CategoryMeta as H, type CollectionEntityService as I, type ComputedEntityService as J, type ConfigContext as K, type ConfigEntityDefinition as L, type ModuleContext as M, type ConfigEntityService as N, type ConfirmationType as O, type PostActionPipeline as P, type ContextCrypto as Q, type RealtimeMode as R, type SingleEntityDefinition as S, type TreeEntityDefinition as T, type ContextEvents as U, type ViewEntityDefinition as V, type ContextEventsHub as W, type ContextHelpers as X, type ContextSocket as Y, type CoreContext as Z, type CoreServices as _, type Category as a, type SendMailResult as a$, type CustomRouteDefinition as a0, DEFAULT_TENANT_ID as a1, type DagEntityService as a2, type DatabaseAdapter as a3, type DbContext as a4, type EngineContext as a5, type EntityAction as a6, type EntityCaslConfig as a7, type EntityChangePayload as a8, type EntityController as a9, type PluginConfigSchema as aA, type PluginEnvVar as aB, type PluginManifest as aC, type PluginSetupInfo as aD, type PostAction as aE, type RateLimitOptions as aF, type ReferenceEntityDefinition as aG, type ReferenceEntityService as aH, type RegisterPluginOptions as aI, type RetentionPolicy as aJ, type RolePermission as aK, type RouteParameterDefinition as aL, type RouteResponseDefinition as aM, type RuntimeContext as aN, type SSEHelper as aO, type SSEOptions as aP, type SSESender as aQ, type SchemaAdapter as aR, type SchemaAlterTableBuilder as aS, type SchemaColumnBuilder as aT, type SchemaColumnInfo as aU, type SchemaForeignKeyBuilder as aV, type SchemaTableBuilder as aW, type ScopedCacheManager as aX, type SeedConfig as aY, type SeedContext as aZ, type SendMailOptions as a_, type EntityHandler as aa, type EntityQuery as ab, type EntityRealtimeEmits as ac, type EntityRealtimeEvents as ad, type EntityServiceHooks as ae, type EventEmitterLike as af, type EventEntityService as ag, type ExternalEntityDefinition as ah, type ExternalEntityService as ai, type FilterOperators as aj, type FilterValue as ak, type ForbiddenErrorConstructor as al, type ForbiddenErrorInstance as am, type HttpMethod as an, type LoggerReporter as ao, type ManagedCache as ap, type ModuleAbilities as aq, type ModuleManifest as ar, type ModuleMiddlewares as as, type ModuleRequirements as at, type PageDefinition as au, type PageType as av, type PaginatedResult as aw, type PaginationParams as ax, type PaginationParamsWithOffset as ay, type PluginConfigField as az, type PageDefinitionDTO as b, type ServicesContext as b0, type SharedEntityProperties as b1, type SingleEntityService as b2, type SocketIOBroadcastOperator as b3, type SocketIOServer as b4, type TempEntityDefinition as b5, type TempEntityService as b6, type TempRetentionPolicy as b7, type TreeEntityService as b8, type TreeNode as b9, type TypedEntityQuery as ba, type ValidateSchemas as bb, type ValidationDetail as bc, type ValidationSchema as bd, type ViewEntityService as be, type VirtualEntityDefinition as bf, type VirtualEntityService as bg, type WidgetDefinition as bh, type WidgetLayout as bi, entityRoom as bj, type ComputedEntityDefinition as c, type CollectionEntityDefinition as d, type EventEntityDefinition as e, type DagEntityDefinition as f, type EntityDefinition as g, type AbilityLike as h, type ActionEntityService as i, type ActionInjection as j, type AdaptersContext as k, type AppManifest as l, type AuthRequest as m, type BaseEntityService as n, type BaseMailService as o, type BaseRolesService as p, type BaseUser as q, type BaseUsersService as r, type BatchLogEntry as s, type BatchProgressEvent as t, type BridgeRule as u, type BridgeTarget as v, CATEGORIES as w, CATEGORY_ORDER as x, type CacheManagerContract as y, type CacheOptions as z };
@@ -15,6 +15,19 @@
15
15
  type LocalizedString = string | ({
16
16
  en: string;
17
17
  } & Record<string, string>);
18
+ /** Configuration for a supported locale */
19
+ interface LocaleConfig {
20
+ /** ISO 639-1 code (e.g. 'en', 'es', 'fr') */
21
+ code: string;
22
+ /** Human-readable label (e.g. 'English', 'Español') */
23
+ label: string;
24
+ /** Is this the fallback locale? Only one should be true. Default: false */
25
+ fallback?: boolean;
26
+ }
27
+ /** Default supported locales — used when no config is provided */
28
+ declare const DEFAULT_LOCALES: LocaleConfig[];
29
+ /** Get the fallback locale code from a locales array */
30
+ declare function getFallbackLocale(locales: LocaleConfig[]): string;
18
31
  /**
19
32
  * Auth provider information for dynamic login buttons.
20
33
  * Plugins register this info so the UI can render buttons without knowing provider details.
@@ -63,7 +76,7 @@ interface AuthProviderService {
63
76
  * @param locale - The target locale (e.g., 'en', 'es')
64
77
  * @returns The resolved string for the given locale
65
78
  */
66
- declare function resolveLocalized(value: LocalizedString | undefined, locale: string): string;
79
+ declare function resolveLocalized(value: LocalizedString | undefined, locale: string, fallback?: string): string;
67
80
  /**
68
81
  * Gets the appropriate label based on count (pluralization).
69
82
  * Returns labelPlural for count !== 1, label otherwise.
@@ -375,4 +388,4 @@ declare function refOptions(module: string, entityOrLabel?: string, labelField?:
375
388
  labelField: string;
376
389
  };
377
390
 
378
- export { type AuthProviderInfo as A, type ConditionalBoolean as C, type DbType as D, type EntityIndex as E, type FieldCondition as F, type InputType as I, type LocalizedString as L, type FieldMeta as a, type FieldDefinition as b, type AuthProviderService as c, type FieldDbConfig as d, type FieldOptions as e, type FieldRelation as f, type FieldStorageConfig as g, type FieldValidationConfig as h, getCountLabel as i, resolveLocalized as j, refOptions as r };
391
+ export { type AuthProviderInfo as A, type ConditionalBoolean as C, DEFAULT_LOCALES as D, type EntityIndex as E, type FieldCondition as F, type InputType as I, type LocalizedString as L, type FieldMeta as a, type FieldDefinition as b, type AuthProviderService as c, type DbType as d, type FieldDbConfig as e, type FieldOptions as f, type FieldRelation as g, type FieldStorageConfig as h, type FieldValidationConfig as i, type LocaleConfig as j, getCountLabel as k, getFallbackLocale as l, resolveLocalized as m, refOptions as r };
@@ -1,4 +1,4 @@
1
- import { b as FieldDefinition } from '../field-ByR7eH7v.js';
1
+ import { b as FieldDefinition } from '../field-Bs1fIux8.js';
2
2
  import { MasterType } from '../masters/index.js';
3
3
 
4
4
  /**
@@ -35,7 +35,7 @@ import {
35
35
  useTextareaField,
36
36
  useUrlField,
37
37
  userIdField
38
- } from "../chunk-UBKKV4XF.js";
38
+ } from "../chunk-WHLUKKQO.js";
39
39
  export {
40
40
  auditFields,
41
41
  idField,
package/dist/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { Knex } from 'knex';
2
2
  export { Knex } from 'knex';
3
3
  import { Request, Response } from 'express';
4
4
  export { CookieOptions, NextFunction, Request, RequestHandler, Response, Router } from 'express';
5
- import { C as ConfirmConfig, P as PostActionPipeline, a as Category, E as EntityType, D as DisplayMode, R as RealtimeMode, b as PageDefinitionDTO, c as ComputedEntityDefinition, d as CollectionEntityDefinition, e as EventEntityDefinition, V as ViewEntityDefinition, T as TreeEntityDefinition, f as DagEntityDefinition, g as EntityDefinition, S as SingleEntityDefinition, A as ActionDefinition, M as ModuleContext } from './entity-DkGTh6I1.js';
6
- export { h as AbilityLike, i as ActionEntityService, j as ActionInjection, k as AdaptersContext, l as AppManifest, m as AuthRequest, B as BaseAuthRequest, n as BaseEntityService, o as BaseMailService, p as BaseRolesService, q as BaseUser, r as BaseUsersService, s as BatchLogEntry, t as BatchProgressEvent, u as BridgeRule, v as BridgeTarget, w as CATEGORIES, x as CATEGORY_ORDER, y as CacheManagerContract, z as CacheOptions, F as CacheStats, G as CaslAction, H as CategoryMeta, I as CollectionEntityService, J as ComputedEntityService, K as ConfigContext, L as ConfigEntityDefinition, N as ConfigEntityService, O as ConfirmationType, Q as ContextCrypto, U as ContextEvents, W as ContextEventsHub, X as ContextHelpers, Y as ContextSocket, Z as CoreContext, _ as CoreServices, $ as CreateEntityServiceOptions, a0 as CustomRouteDefinition, a1 as DEFAULT_TENANT_ID, a2 as DagEntityService, a3 as DatabaseAdapter, a4 as DbContext, a5 as EngineContext, a6 as EntityAction, a7 as EntityCaslConfig, a8 as EntityChangePayload, a9 as EntityController, aa as EntityHandler, ab as EntityQuery, ac as EntityRealtimeEmits, ad as EntityRealtimeEvents, ae as EntityServiceHooks, af as EventEmitterLike, ag as EventEntityService, ah as ExternalEntityDefinition, ai as ExternalEntityService, aj as FilterOperators, ak as FilterValue, al as ForbiddenErrorConstructor, am as ForbiddenErrorInstance, an as HttpMethod, ao as LoggerReporter, ap as ManagedCache, aq as ModuleAbilities, ar as ModuleManifest, as as ModuleMiddlewares, at as ModuleRequirements, au as PageDefinition, av as PageType, aw as PaginatedResult, ax as PaginationParams, ay as PaginationParamsWithOffset, az as PluginConfigField, aA as PluginConfigSchema, aB as PluginEnvVar, aC as PluginManifest, aD as PluginSetupInfo, aE as PostAction, aF as RateLimitOptions, aG as ReferenceEntityDefinition, aH as ReferenceEntityService, aI as RegisterPluginOptions, aJ as RetentionPolicy, aK as RolePermission, aL as RouteParameterDefinition, aM as RouteResponseDefinition, aN as RuntimeContext, aO as SSEHelper, aP as SSEOptions, aQ as SSESender, aR as SchemaAdapter, aS as SchemaAlterTableBuilder, aT as SchemaColumnBuilder, aU as SchemaColumnInfo, aV as SchemaForeignKeyBuilder, aW as SchemaTableBuilder, aX as ScopedCacheManager, aY as SeedConfig, aZ as SendMailOptions, a_ as SendMailResult, a$ as ServicesContext, b0 as SharedEntityProperties, b1 as SingleEntityService, b2 as SocketIOBroadcastOperator, b3 as SocketIOServer, b4 as TempEntityDefinition, b5 as TempEntityService, b6 as TempRetentionPolicy, b7 as TreeEntityService, b8 as TreeNode, b9 as TypedEntityQuery, ba as ValidateSchemas, bb as ValidationDetail, bc as ValidationSchema, bd as ViewEntityService, be as VirtualEntityDefinition, bf as VirtualEntityService, bg as WidgetDefinition, bh as WidgetLayout, bi as entityRoom } from './entity-DkGTh6I1.js';
7
- import { L as LocalizedString, F as FieldCondition, I as InputType, a as FieldMeta, b as FieldDefinition } from './field-ByR7eH7v.js';
8
- export { A as AuthProviderInfo, c as AuthProviderService, C as ConditionalBoolean, D as DbType, E as EntityIndex, d as FieldDbConfig, e as FieldOptions, f as FieldRelation, g as FieldStorageConfig, h as FieldValidationConfig, i as getCountLabel, r as refOptions, j as resolveLocalized } from './field-ByR7eH7v.js';
5
+ import { C as ConfirmConfig, P as PostActionPipeline, a as Category, E as EntityType, D as DisplayMode, R as RealtimeMode, b as PageDefinitionDTO, c as ComputedEntityDefinition, d as CollectionEntityDefinition, e as EventEntityDefinition, V as ViewEntityDefinition, T as TreeEntityDefinition, f as DagEntityDefinition, g as EntityDefinition, S as SingleEntityDefinition, A as ActionDefinition, M as ModuleContext } from './entity-1_53kUfz.js';
6
+ export { h as AbilityLike, i as ActionEntityService, j as ActionInjection, k as AdaptersContext, l as AppManifest, m as AuthRequest, B as BaseAuthRequest, n as BaseEntityService, o as BaseMailService, p as BaseRolesService, q as BaseUser, r as BaseUsersService, s as BatchLogEntry, t as BatchProgressEvent, u as BridgeRule, v as BridgeTarget, w as CATEGORIES, x as CATEGORY_ORDER, y as CacheManagerContract, z as CacheOptions, F as CacheStats, G as CaslAction, H as CategoryMeta, I as CollectionEntityService, J as ComputedEntityService, K as ConfigContext, L as ConfigEntityDefinition, N as ConfigEntityService, O as ConfirmationType, Q as ContextCrypto, U as ContextEvents, W as ContextEventsHub, X as ContextHelpers, Y as ContextSocket, Z as CoreContext, _ as CoreServices, $ as CreateEntityServiceOptions, a0 as CustomRouteDefinition, a1 as DEFAULT_TENANT_ID, a2 as DagEntityService, a3 as DatabaseAdapter, a4 as DbContext, a5 as EngineContext, a6 as EntityAction, a7 as EntityCaslConfig, a8 as EntityChangePayload, a9 as EntityController, aa as EntityHandler, ab as EntityQuery, ac as EntityRealtimeEmits, ad as EntityRealtimeEvents, ae as EntityServiceHooks, af as EventEmitterLike, ag as EventEntityService, ah as ExternalEntityDefinition, ai as ExternalEntityService, aj as FilterOperators, ak as FilterValue, al as ForbiddenErrorConstructor, am as ForbiddenErrorInstance, an as HttpMethod, ao as LoggerReporter, ap as ManagedCache, aq as ModuleAbilities, ar as ModuleManifest, as as ModuleMiddlewares, at as ModuleRequirements, au as PageDefinition, av as PageType, aw as PaginatedResult, ax as PaginationParams, ay as PaginationParamsWithOffset, az as PluginConfigField, aA as PluginConfigSchema, aB as PluginEnvVar, aC as PluginManifest, aD as PluginSetupInfo, aE as PostAction, aF as RateLimitOptions, aG as ReferenceEntityDefinition, aH as ReferenceEntityService, aI as RegisterPluginOptions, aJ as RetentionPolicy, aK as RolePermission, aL as RouteParameterDefinition, aM as RouteResponseDefinition, aN as RuntimeContext, aO as SSEHelper, aP as SSEOptions, aQ as SSESender, aR as SchemaAdapter, aS as SchemaAlterTableBuilder, aT as SchemaColumnBuilder, aU as SchemaColumnInfo, aV as SchemaForeignKeyBuilder, aW as SchemaTableBuilder, aX as ScopedCacheManager, aY as SeedConfig, aZ as SeedContext, a_ as SendMailOptions, a$ as SendMailResult, b0 as ServicesContext, b1 as SharedEntityProperties, b2 as SingleEntityService, b3 as SocketIOBroadcastOperator, b4 as SocketIOServer, b5 as TempEntityDefinition, b6 as TempEntityService, b7 as TempRetentionPolicy, b8 as TreeEntityService, b9 as TreeNode, ba as TypedEntityQuery, bb as ValidateSchemas, bc as ValidationDetail, bd as ValidationSchema, be as ViewEntityService, bf as VirtualEntityDefinition, bg as VirtualEntityService, bh as WidgetDefinition, bi as WidgetLayout, bj as entityRoom } from './entity-1_53kUfz.js';
7
+ import { L as LocalizedString, F as FieldCondition, I as InputType, a as FieldMeta, b as FieldDefinition } from './field-Bs1fIux8.js';
8
+ export { A as AuthProviderInfo, c as AuthProviderService, C as ConditionalBoolean, D as DEFAULT_LOCALES, d as DbType, E as EntityIndex, e as FieldDbConfig, f as FieldOptions, g as FieldRelation, h as FieldStorageConfig, i as FieldValidationConfig, j as LocaleConfig, k as getCountLabel, l as getFallbackLocale, r as refOptions, m as resolveLocalized } from './field-Bs1fIux8.js';
9
9
  import 'pino';
10
10
 
11
11
  /** Webhook configuration record */
@@ -178,10 +178,9 @@ interface EntityDefinitionDTO {
178
178
  label: string;
179
179
  }>;
180
180
  /** Fields eligible for grouping (select, boolean, relation, tags) */
181
- groupableFields?: Array<{
182
- value: string;
183
- label: string;
184
- }>;
181
+ groupableFields?: string[];
182
+ /** Subset of groupableFields where drag between board columns is allowed (default: all) */
183
+ columnDragFields?: string[];
185
184
  /** Default groupBy field from entity definition */
186
185
  groupBy?: string;
187
186
  /** Default subgroupBy field from entity definition */
@@ -336,6 +335,12 @@ interface CapabilitiesDTO {
336
335
  version: string;
337
336
  /** 3-char codes of registered plugins */
338
337
  plugins: string[];
338
+ /** Supported locales for the platform */
339
+ locales: Array<{
340
+ code: string;
341
+ label: string;
342
+ fallback?: boolean;
343
+ }>;
339
344
  }
340
345
 
341
346
  /** Status of a ticket as seen by the end user */
package/dist/index.js CHANGED
@@ -1,8 +1,15 @@
1
1
  // src/types/localization.ts
2
- function resolveLocalized(value, locale) {
2
+ var DEFAULT_LOCALES = [
3
+ { code: "en", label: "English", fallback: true },
4
+ { code: "es", label: "Espa\xF1ol" }
5
+ ];
6
+ function getFallbackLocale(locales) {
7
+ return locales.find((l) => l.fallback)?.code ?? "en";
8
+ }
9
+ function resolveLocalized(value, locale, fallback = "en") {
3
10
  if (!value) return "";
4
11
  if (typeof value === "string") return value;
5
- return value[locale] || value["en"] || Object.values(value)[0] || "";
12
+ return value[locale] || value[fallback] || Object.values(value)[0] || "";
6
13
  }
7
14
  function getCountLabel(label, labelPlural, count, locale) {
8
15
  const resolved = count === 1 ? label : labelPlural || label;
@@ -312,6 +319,7 @@ function validateEntityDefinition(def) {
312
319
  export {
313
320
  CATEGORIES,
314
321
  CATEGORY_ORDER,
322
+ DEFAULT_LOCALES,
315
323
  DEFAULT_TENANT_ID,
316
324
  OFFICIAL_PLUGINS,
317
325
  assertAllowedDomain,
@@ -325,6 +333,7 @@ export {
325
333
  getCountLabel,
326
334
  getEntityName,
327
335
  getEntitySubject,
336
+ getFallbackLocale,
328
337
  getOidcClient,
329
338
  hasTable,
330
339
  isPersistentEntity,
@@ -8,6 +8,6 @@
8
8
  /** Predefined master type slugs (can be extended with any string) */
9
9
  type MasterType = string;
10
10
  /** Predefined master type slugs included with Nexus */
11
- declare const PREDEFINED_MASTER_TYPES: readonly ["currencies", "languages", "timezones", "social-networks", "genders", "marital-statuses", "education-levels", "industries", "company-types", "units", "product-categories", "phone-prefixes", "document-types"];
11
+ declare const PREDEFINED_MASTER_TYPES: readonly ["currencies", "languages", "timezones", "social-networks", "genders", "marital-statuses", "education-levels", "industries", "company-types", "units", "countries", "product-categories", "phone-prefixes", "document-types"];
12
12
 
13
13
  export { type MasterType, PREDEFINED_MASTER_TYPES };
@@ -10,6 +10,7 @@ var PREDEFINED_MASTER_TYPES = [
10
10
  "industries",
11
11
  "company-types",
12
12
  "units",
13
+ "countries",
13
14
  "product-categories",
14
15
  "phone-prefixes",
15
16
  "document-types"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gzl10/nexus-sdk",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "SDK types for creating Nexus plugins and modules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",