Skip to content

Documentation · ARDOR

Types ​

This page lists the main public types of ARDOR, not every exported type (the hook option and return interfaces are on the hooks page), across three packages: @venizia/ardor-kernel (primitives, constants, network options, and repositories), @venizia/ardor-react (React context and hooks), and @venizia/ardor-admin (react-admin providers and application components). All symbols can be imported directly from @venizia/ardor (or @venizia/ardor/repository for repository classes and datasource settings).

ts
import type { IdType, ISendParams, ValueOrPromise } from '@venizia/ardor';

export interface UserItem {
  id: IdType;
  title: string;
}

export const loadUser = (id: IdType): ValueOrPromise<UserItem> => {
  return { id, title: 'Sample' };
};

export const exportParams: ISendParams = {
  query: { format: 'json' },
};

@venizia/ardor-kernel ​

Source files: packages/kernel/src/common/types.ts, packages/kernel/src/common/constants.ts, packages/kernel/src/common/keys.ts, and packages/kernel/src/base/services/network-request.ts.

Primitives and value helpers ​

TypeKindDefinition and usage
IdTypetypeEntity identifier (string | number), used by all CRUD and provider method signatures.
AnyTypetypeNamed alias for any, used at untyped boundaries and generic defaults.
AnyObjecttypeLoose record (Record<string | symbol | number, any>), used for untyped property dictionaries.
ValueOrPromise<T>typeSync or async value (T | Promise<T>), used in application lifecycle methods (preConfigure, start).
ValueOf<T>typeProperty value union (T[keyof T]), used to extract property value types from objects.
ValueOptional<T, K>typeMakes keys K optional in T, used to model partial creation payloads.
ValueOptionalExcept<T, K>typeMakes all keys optional in T except K, used to model patch payloads.
TPrettify<T>typeFlattens intersection types into a single object shape for editor hints.
TConstValue<T>typeExtracts string and number literal unions from a const class with regular literal types (& {}).
TStringConstValue<T>typeExtracts string literal unions from a const class with regular literal types (& {}).
TNumberConstValue<T>typeExtracts numeric literal unions from a const class with regular literal types (& {}).
TPaths<T>typeDotted path union over object keys up to 10 levels deep, stopping at arrays.
TFullPaths<T>typeDotted leaf path union over object keys up to 10 levels deep, descending into arrays.
ts
import type { IdType, TFullPaths, TPaths, ValueOf, ValueOptional } from '@venizia/ardor';

export interface UserRecord {
  id: IdType;
  name: string;
  email?: string;
  meta: { role: string };
}

export type UserValues = ValueOf<UserRecord>;
export type NewUser = ValueOptional<UserRecord, 'email'>;
export type UserPath = TPaths<UserRecord>;
export type UserLeaf = TFullPaths<UserRecord>;

Network and options ​

TypeKindDefinition and usage
TRequestMethodtypeHTTP methods union ('HEAD' | 'OPTIONS' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'), used in network requests.
TRequestTypetypeOperation types union (RequestTypes), used by data provider operations.
TRequestBodyTypetypePayload format union ('none' | 'form-data' | 'x-www-form-urlencoded' | 'json' | 'binary'), used in requests.
TEnvironmenttypeEnvironment names union ('development' | 'production'), used for runtime environment checks.
ISendParamsinterfaceParameters object for dataProvider.send (method, requestType, bodyType, body, query, headers, requestCountData, extra), used for arbitrary endpoint calls. It names every field it accepts: a typo is a compile error.
INetworkResponse<T>interfaceEnvelope returned by dataProvider.send and the network service (data, and total, count, filename, contentDisposition, extra where the response has them).
IGetRequestPropsParamsinterfaceInputs to getRequestProps, used by DefaultNetworkRequestService.
IGetRequestPropsResultinterfaceOutput headers and body from getRequestProps, used by network request callers.
ICustomParamsinterfaceParameter bag merged into react-admin calls via params.
INoAuthOptionsinterfaceUnauthenticated paths configuration (noAuthPaths, e.g. ['/auth/sign-in']; noAuthPathRegex), used in network services.
TNoAuthPathRegextypeRegex patterns (string | RegExp | Array<string | RegExp>) matched against no-auth request paths.
IAuthRecoveryOptionsinterfaceConfiguration for session refresh endpoint (refreshTokenPath, e.g. '/auth/refresh'), used in network auth recovery.
IRestDataProviderOptionsinterfaceConfiguration options for REST data provider (URL, headers, channel, auth recovery, no-auth).
ISignInSessioninterfaceSession data extracted on login (userId, token, roles), used in sign-in lifecycle hooks.
IAuthProviderOptionsinterfaceAuth provider endpoint paths (paths.signIn, e.g. '/auth/sign-in'; paths.checkAuth; paths.afterLogin), bound under CoreBindings.AUTH_PROVIDER_OPTIONS.
IAuthTokenRecordinterfaceAuth token payload (value, type, provider), returned by resolveAuthToken().
IDataSourceRequestContextinterfaceRequest context (paths) supplied to HttpDataSource auth hooks.
IDataSourceAuthinterfaceBridge settings (authTokenResolver, headersResolver, onUnauthorized, errorRootKey) returned by getDataSourceAuth().
IApplicationInfointerfaceApplication metadata (name, version, description, author; no other key), bound under CoreBindings.APPLICATION_INFO.
IFeatureBaseinterfaceBase feature configuration (name, configurations, permissions), bound under CoreBindings.FEATURES.
IArtifactIndexinterfaceArtifact registry index emitted by code generation and verified at application start().
IPermissionProviderinterfaceAuthorization checker contract (canAccess), bound under CoreBindings.PERMISSION_PROVIDER.
IArdorApplicationinterfaceApplication lifecycle contract implemented by AbstractArdorApplication.

Const classes ​

ClassKindDefinition and usage
CoreBindingsclassThe eleven container keys for instances, options, providers, and features.
LocalStorageKeysclassThe local storage keys for tokens, identities, and permissions (KEY_AUTH_*), and the two prefixes PREFIX_AUTH and PREFIX_STORE.
RequestMethodsclassHTTP method constants (HEAD, OPTIONS, GET, POST, PUT, PATCH, DELETE) with SCHEME_SET and isValid.
RequestTypesclassData operation constants (SEND, GET_LIST, GET_ONE, etc.) with SCHEME_SET and isValid.
RequestBodyTypesclassRequest body formats (JSON, FORM_DATA, BINARY, etc.) with SCHEME_SET and isValid.
EnvironmentsclassEnvironment constants (DEVELOPMENT, PRODUCTION) with SCHEME_SET and isValid.
RequestCountDataclassCount mode constants (DATA_ONLY: '0', DATA_WITH_COUNT: '1') with SCHEME_SET and isValid.
RequestChannelclassClient channel constant (WEB: '100_WEB') with SCHEME_SET and isValid.
AuthenticationclassAuth types and strategies (TYPE_BEARER, STRATEGY_JWT) with SCHEME_SET and isValid.
HeaderConstantsclassHTTP header string constants read and written by network services.
AppclassRuntime defaults for TIMEZONE, TIMEZONE_OFFSET and DEFAULT_DEBOUNCE_TIME. The i18n provider defaults to en.

Repositories (@venizia/ardor/repository) ​

Source files: packages/ardor/src/repository.ts and packages/kernel/src/base/repositories/index.ts.

TypeKindDefinition and usage
HttpDataSourceclassTransport class managing HTTP requests for repositories.
HttpRepository<E, P>classTyped CRUD repository reading and writing a backend resource.
IHttpDataSourceSettingsinterfaceConstructor options for HttpDataSource (baseUrl, headers, auth token, resolvers, retry hook).
IHttpReadResult<R>interfaceResponse from HttpDataSource.read containing rows, range flag, and count.
IHttpWriteResult<R>interfaceResponse from HttpDataSource.write containing affected rows, count, and extras.
IHttpCallOptionsinterfacePer-request options (headers, signal) accepted by repository calls.
THttpRepositoryOptionstypeOptions accepted by HttpRepository methods combining call options and query flags.
IAuthTokeninterfaceAuthentication token shape (value, type, provider) accepted by HttpDataSource.
TAuthTokenResolvertypeHook function returning IAuthToken | undefined for HttpDataSource.
THttpHeaderstypeHeader inputs (Headers | Array<[string, string]> | Record<string, string>) accepted by HttpDataSource.
THttpHeadersResolvertypeHook function returning dynamic THttpHeaders on each request.
THttpBodytypeRequest body types (string | object) accepted by HttpDataSource.
TExtraRequesttypeRequest specification for list extras (x-request-extra).
TExtraResult<T>typeType extraction helper for list extras returned in x-response-extra.
HttpExtraRequestclassUtility converting list extra definitions into x-request-extra header values.

@venizia/ardor-react ​

Source file: packages/react/src/hooks/use-injectable.ts.

TypeKindDefinition and usage
IUseInjectableKeysOverridesinterfaceAugmentation interface for registering custom string keys with useInjectable.
TUseInjectableKeysDefaulttypeUnion of default string keys extracted from CoreBindings.
TUseInjectableKeystypeComplete key union accepted by useInjectable (TUseInjectableKeysDefault | keyof IUseInjectableKeysOverrides).
TUseInjectableOptionstypeOptions discriminated union (key or target) accepted by useInjectable.

@venizia/ardor-admin ​

Source files: packages/admin/src/common/types.ts and packages/admin/src/features/feature.ts.

TypeKindDefinition and usage
IReactAdminDataProvider<TResource>typeNine standard react-admin data methods with positional arguments (resource, params).
IDataProvider<TResource>interfaceARDOR data provider contract extending react-admin with send, getNetworkService, and getDataSourceAuth.
IReactAdminAuthProvidertypeStandard react-admin auth provider contract (login, logout, checkAuth, checkError, getIdentity, getPermissions, canAccess).
IAuthProviderinterfaceARDOR auth provider extending react-admin with getRoles and refreshToken.
II18nProviderOptionsinterfacei18n configuration options (i18nSources, languages), bound under CoreBindings.I18N_PROVIDER_OPTIONS.
TI18nSourcetypeThe messages of one locale: an object, or a loader () => Promise<object> called the first time the locale is used.
IApplicationinterfaceProps accepted by <ArdorApplication> (container, reduxStore, suspense, resources, routes).
TFeaturetypeFull admin feature specification extending IFeatureBase with resources, custom routes, and messages.
TFeatureMessagestypeFeature message dictionary or lazy message bundle loaders keyed by locale.