@gzl10/nexus-sdk 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UBKKV4XF.js → chunk-WHLUKKQO.js} +1 -0
- package/dist/collection/index.d.ts +2 -2
- package/dist/collection/index.js +1 -1
- package/dist/{entity-DkGTh6I1.d.ts → entity-B5WrLI1H.d.ts} +92 -2
- package/dist/{field-ByR7eH7v.d.ts → field-Bs1fIux8.d.ts} +15 -2
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/index.d.ts +13 -8
- package/dist/index.js +11 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LocalizedString, b as FieldDefinition } from '../field-
|
|
2
|
-
import { d as CollectionEntityDefinition, f as DagEntityDefinition, e as EventEntityDefinition, aK as RolePermission } from '../entity-
|
|
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-B5WrLI1H.js';
|
|
3
3
|
import 'knex';
|
|
4
4
|
import 'express';
|
|
5
5
|
import 'pino';
|
package/dist/collection/index.js
CHANGED
|
@@ -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-
|
|
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
|
/**
|
|
@@ -1385,6 +1385,8 @@ interface DbContext {
|
|
|
1385
1385
|
getPagination: (query?: EntityQuery) => PaginationParamsWithOffset;
|
|
1386
1386
|
buildPaginatedResult: <T>(items: T[], total: number, pagination: PaginationParamsWithOffset) => PaginatedResult<T>;
|
|
1387
1387
|
getKnex: (adapter?: string) => Knex;
|
|
1388
|
+
/** Run full seed for a module (manifest seed + entity auto-seed). Injected from db layer. */
|
|
1389
|
+
seedModule: (mod: ModuleManifest) => Promise<boolean>;
|
|
1388
1390
|
}
|
|
1389
1391
|
/**
|
|
1390
1392
|
* Runtime namespace.
|
|
@@ -1475,6 +1477,8 @@ interface ModuleContext {
|
|
|
1475
1477
|
/** Semantic event API for cross-module communication (notify/query/command). */
|
|
1476
1478
|
events: ContextEvents;
|
|
1477
1479
|
createRouter: () => Router;
|
|
1480
|
+
/** Supported locales for the platform */
|
|
1481
|
+
locales: LocaleConfig[];
|
|
1478
1482
|
}
|
|
1479
1483
|
/**
|
|
1480
1484
|
* HTTP method for custom routes
|
|
@@ -1519,6 +1523,86 @@ interface CustomRouteDefinition {
|
|
|
1519
1523
|
operationId?: string;
|
|
1520
1524
|
tags?: string[];
|
|
1521
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Seed context passed to onSeed hook.
|
|
1528
|
+
* Provides typed helpers for seeding data without direct DB access.
|
|
1529
|
+
*
|
|
1530
|
+
* Note: masters.register() is lazy (data flushed after onSeed completes).
|
|
1531
|
+
* All other methods (roles.add, users.add, plugin().entity().upsert, raw) are eager.
|
|
1532
|
+
*/
|
|
1533
|
+
interface SeedContext {
|
|
1534
|
+
/** Register master reference data. Lazy: flushed after onSeed completes. */
|
|
1535
|
+
masters: {
|
|
1536
|
+
register(type: string, entries: Array<{
|
|
1537
|
+
code: string;
|
|
1538
|
+
label: string | {
|
|
1539
|
+
en?: string;
|
|
1540
|
+
es?: string;
|
|
1541
|
+
[key: string]: string | undefined;
|
|
1542
|
+
};
|
|
1543
|
+
order?: number;
|
|
1544
|
+
is_active?: boolean;
|
|
1545
|
+
metadata?: Record<string, unknown>;
|
|
1546
|
+
}>, options?: {
|
|
1547
|
+
seed?: 'if-empty' | 'always';
|
|
1548
|
+
}): void;
|
|
1549
|
+
};
|
|
1550
|
+
/**
|
|
1551
|
+
* Add roles to the system. Eager: inserts immediately. Idempotent by name.
|
|
1552
|
+
*
|
|
1553
|
+
* Optional `permissions` map assigns CASL abilities to the role.
|
|
1554
|
+
* Keys are subject names (case-insensitive: 'masters' = 'Masters').
|
|
1555
|
+
* Values are action arrays.
|
|
1556
|
+
*
|
|
1557
|
+
* Core subjects: Masters, Users, Roles, Auth, Mail, Storage, System.
|
|
1558
|
+
* Plugin subjects: documented in each plugin's llms.txt.
|
|
1559
|
+
*
|
|
1560
|
+
* @example
|
|
1561
|
+
* ```typescript
|
|
1562
|
+
* await seed.roles.add({
|
|
1563
|
+
* name: 'SALES',
|
|
1564
|
+
* description: { en: 'Sales team' },
|
|
1565
|
+
* permissions: {
|
|
1566
|
+
* 'masters': ['read'],
|
|
1567
|
+
* 'contacts': ['read', 'create', 'update'],
|
|
1568
|
+
* }
|
|
1569
|
+
* })
|
|
1570
|
+
* ```
|
|
1571
|
+
*/
|
|
1572
|
+
roles: {
|
|
1573
|
+
add(role: {
|
|
1574
|
+
name: string;
|
|
1575
|
+
description?: string | {
|
|
1576
|
+
en?: string;
|
|
1577
|
+
es?: string;
|
|
1578
|
+
[key: string]: string | undefined;
|
|
1579
|
+
};
|
|
1580
|
+
is_system?: boolean;
|
|
1581
|
+
/** CASL permissions. Keys: subject (case-insensitive). Values: action arrays. */
|
|
1582
|
+
permissions?: Record<string, Array<'read' | 'create' | 'update' | 'delete' | 'manage' | 'execute'>>;
|
|
1583
|
+
}): Promise<void>;
|
|
1584
|
+
};
|
|
1585
|
+
/** Add users to the system. Eager: inserts immediately. Idempotent by email. */
|
|
1586
|
+
users: {
|
|
1587
|
+
add(user: {
|
|
1588
|
+
email: string;
|
|
1589
|
+
password: string;
|
|
1590
|
+
name?: string;
|
|
1591
|
+
type?: 'human' | 'bot' | 'service';
|
|
1592
|
+
roles?: string[];
|
|
1593
|
+
}): Promise<void>;
|
|
1594
|
+
};
|
|
1595
|
+
/** Access plugin entities for seeding. Resolves table prefix automatically. */
|
|
1596
|
+
plugin(name: string): {
|
|
1597
|
+
entity(name: string): {
|
|
1598
|
+
upsert(data: Record<string, unknown>[], options?: {
|
|
1599
|
+
key?: string;
|
|
1600
|
+
}): Promise<number>;
|
|
1601
|
+
};
|
|
1602
|
+
};
|
|
1603
|
+
/** Raw table insert (escape hatch). Returns number of rows inserted. */
|
|
1604
|
+
raw(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<number>;
|
|
1605
|
+
}
|
|
1522
1606
|
|
|
1523
1607
|
/**
|
|
1524
1608
|
* Entity definition types - discriminated union for all entity types
|
|
@@ -1693,10 +1777,16 @@ interface BaseEntityDefinition {
|
|
|
1693
1777
|
order?: number;
|
|
1694
1778
|
/** UI display mode */
|
|
1695
1779
|
displayMode?: DisplayMode;
|
|
1780
|
+
/** Restrict available display modes. If omitted, auto-detected from entity config. */
|
|
1781
|
+
availableDisplayModes?: DisplayMode[];
|
|
1696
1782
|
/** Field name to group by in board/list/masonry displays */
|
|
1697
1783
|
groupBy?: string;
|
|
1698
1784
|
/** Field name for secondary grouping (collapsible) */
|
|
1699
1785
|
subgroupBy?: string;
|
|
1786
|
+
/** Explicit list of fields eligible for grouping. If omitted, auto-detected from field input types. */
|
|
1787
|
+
groupableFields?: string[];
|
|
1788
|
+
/** Subset of groupableFields where drag between board columns is allowed. Default: all groupable. */
|
|
1789
|
+
columnDragFields?: string[];
|
|
1700
1790
|
/** Date field for calendar start (enables calendar display) */
|
|
1701
1791
|
calendarFrom?: string;
|
|
1702
1792
|
/** Date field for calendar end (range display) */
|
|
@@ -1959,4 +2049,4 @@ type TempEntityDefinition = Omit<CollectionEntityDefinition, 'type'> & {
|
|
|
1959
2049
|
*/
|
|
1960
2050
|
type EntityDefinition = CollectionEntityDefinition | SingleEntityDefinition | ExternalEntityDefinition | VirtualEntityDefinition | ComputedEntityDefinition | ViewEntityDefinition | ReferenceEntityDefinition | TreeEntityDefinition | DagEntityDefinition | EventEntityDefinition;
|
|
1961
2051
|
|
|
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
|
|
2052
|
+
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,
|
|
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 };
|
package/dist/fields/index.d.ts
CHANGED
package/dist/fields/index.js
CHANGED
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-
|
|
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
|
|
7
|
-
import { L as LocalizedString, F as FieldCondition, I as InputType, a as FieldMeta, b as FieldDefinition } from './field-
|
|
8
|
-
export { A as AuthProviderInfo, c as AuthProviderService, C as ConditionalBoolean, D as DbType, E as EntityIndex,
|
|
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-B5WrLI1H.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-B5WrLI1H.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?:
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
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[
|
|
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,
|