@stndrds/schema 0.1.0-alpha.17 → 0.1.0-alpha.19
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-2PBQNUTS.mjs +7400 -0
- package/dist/chunk-4D476S25.mjs +7713 -0
- package/dist/chunk-BKOV4XVX.mjs +8816 -0
- package/dist/chunk-CWPOGEK2.mjs +7707 -0
- package/dist/chunk-DPOXIK3M.mjs +8816 -0
- package/dist/chunk-DU2HLOQH.mjs +8813 -0
- package/dist/chunk-EWNSOD22.mjs +7707 -0
- package/dist/chunk-JD2MVLTW.mjs +8814 -0
- package/dist/chunk-KZSM5546.mjs +7706 -0
- package/dist/chunk-L7AQ7SZC.mjs +7432 -0
- package/dist/chunk-LZW2MI43.mjs +7404 -0
- package/dist/chunk-SD2UXOSF.mjs +8814 -0
- package/dist/chunk-V5QXU2OK.mjs +82 -0
- package/dist/chunk-XMGMXAHW.mjs +7706 -0
- package/dist/chunk-YLVZT3H4.mjs +8793 -0
- package/dist/default-roles-AKWIWTLE.mjs +20 -0
- package/dist/index.d.mts +127 -8
- package/dist/index.d.ts +127 -8
- package/dist/index.js +1787 -182
- package/dist/index.mjs +90 -3
- package/dist/runtime-CPggQqoW.d.mts +6428 -0
- package/dist/runtime-CPggQqoW.d.ts +6428 -0
- package/dist/runtime-DSMMZRLE.d.mts +6430 -0
- package/dist/runtime-DSMMZRLE.d.ts +6430 -0
- package/dist/runtime-DWhSpnn4.d.mts +5256 -0
- package/dist/runtime-DWhSpnn4.d.ts +5256 -0
- package/dist/runtime-Dw2exb5q.d.mts +5601 -0
- package/dist/runtime-Dw2exb5q.d.ts +5601 -0
- package/dist/runtime-DySuNV6Y.d.mts +5245 -0
- package/dist/runtime-DySuNV6Y.d.ts +5245 -0
- package/dist/runtime-DzdsFCyL.d.mts +5601 -0
- package/dist/runtime-DzdsFCyL.d.ts +5601 -0
- package/dist/runtime-uXhTgSIx.d.mts +5260 -0
- package/dist/runtime-uXhTgSIx.d.ts +5260 -0
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1520 -59
- package/dist/runtime.mjs +59 -1
- package/package.json +4 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALL_SYSTEM_RESOURCES,
|
|
3
|
+
DEFAULT_ROLES,
|
|
4
|
+
DEFAULT_ROLE_DESCRIPTIONS,
|
|
5
|
+
DEFAULT_ROLE_LABELS,
|
|
6
|
+
DEFAULT_ROLE_PERMISSIONS,
|
|
7
|
+
SYSTEM_RESOURCES,
|
|
8
|
+
SYSTEM_RESOURCE_LABELS,
|
|
9
|
+
isDefaultRole
|
|
10
|
+
} from "./chunk-V5QXU2OK.mjs";
|
|
11
|
+
export {
|
|
12
|
+
ALL_SYSTEM_RESOURCES,
|
|
13
|
+
DEFAULT_ROLES,
|
|
14
|
+
DEFAULT_ROLE_DESCRIPTIONS,
|
|
15
|
+
DEFAULT_ROLE_LABELS,
|
|
16
|
+
DEFAULT_ROLE_PERMISSIONS,
|
|
17
|
+
SYSTEM_RESOURCES,
|
|
18
|
+
SYSTEM_RESOURCE_LABELS,
|
|
19
|
+
isDefaultRole
|
|
20
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute,
|
|
2
|
-
export {
|
|
1
|
+
import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, F as FormulaAttribute, R as RollupAttribute, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, k as FileAttribute, U as UserAttribute, l as SingleRelationAttribute, m as MultiRelationAttribute, n as RelationTarget, o as RatingAttribute, p as FormulaReturnType, q as RollupFunction, r as FlowDefinition, s as FlowPage, t as FlowRow, u as ObjectDefinition, v as Field, w as AttributeGroupField, G as Group, V as ViewDefinition, x as Tab } from './runtime-DSMMZRLE.mjs';
|
|
2
|
+
export { bb as ActivityTab, d9 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cT as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cZ as AuditRepository, _ as AuditResourceType, d0 as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d8 as CreateCustomObjectInput, d_ as CreateDBAttribute, ec as CreateDBFlow, dW as CreateDBObject, e8 as CreateDBView, a9 as CreateFile, d3 as CreateFlowInput, e1 as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dz as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dZ as DBAttribute, eb as DBFlow, dV as DBObject, e7 as DBView, dQ as DEFAULT_LABEL_FALLBACK, cc as DatabaseAdapter, ae as DateFilterOperator, I as DateFormat, J as DateValue, W as DocumentFace, Q as DocumentType, X as DocumentTypeConfig, aX as EffectivePermissions, a8 as File, dC as FileContent, e6 as FileListOptions, d2 as FileService, d1 as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cV as FilesRepository, ao as FilterCombinator, aq as FilterGroup, ai as FilterOperator, an as FilterRule, ap as FilterState, am as FilterValue, aE as FlowRelation, aD as FlowRowField, d5 as FlowService, aC as FlowSlot, aF as FlowStatus, cY as FlowsRepository, b8 as FormTab, cp as FormulaResult, dO as FullSyncOptions, dN as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d6 as GeocodingService, aJ as GeocodingSuggestion, dl as GetRelationOptionsParams, e4 as GlobalSearchOptions, e5 as GlobalSearchResultItem, d7 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, e2 as ListOptions, K as LocationGranularity, cu as MaxDepthExceededError, ag as MultiselectFilterOperator, aA as NO_VALUE_OPERATORS, az as NoValueOperator, aO as NoopGeocodingAdapter, cM as NoopHookRegistry, ac as NumberFilterOperator, H as NumberUnit, ay as OPERATORS_BY_TYPE, aQ as ObjectAttribute, aY as ObjectPermissions, aS as ObjectRecord, cW as ObjectRecordsRepository, dc as ObjectSchemaService, db as ObjectSchemaServiceOptions, cS as ObjectsRepository, ee as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, de as PermissionService, dd as PermissionServiceOptions, c_ as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dg as RecordService, df as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dj as RelationOption, dk as RelationOptionsResponse, dp as RelationResolverService, dm as RelationService, di as RelationValidationError, dh as RelationValidationResult, aj as RelativeDateValue, dn as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, cQ as RollupHooksConfig, dq as RollupResult, dt as RollupScheduler, ds as RollupSchedulerOptions, dr as RollupService, cB as SchemaResolver, e3 as SearchOptions, af as SelectFilterOperator, dF as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dG as StorageAdapter, a6 as StorageProvider, dD as StorageUploadInput, dE as StorageUploadResult, dJ as SyncOptions, dI as SyncResult, aZ as SystemPermissions, b7 as TabType, b9 as TableTab, bh as TenantId, ab as TextFilterOperator, aP as Timestamps, cF as TraversalOptions, cG as TraversalResult, d$ as UpdateDBAttribute, ed as UpdateDBFlow, dX as UpdateDBObject, e9 as UpdateDBView, aa as UpdateFile, d4 as UpdateFlowInput, da as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dA as UpdateViewInput, dH as UploadFileInput, e0 as UpsertDBAttribute, dY as UpsertDBObject, ea as UpsertDBView, b4 as UserProfile, dv as UserProfileService, du as UserProfileServiceOptions, cU as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dy as UserService, b3 as UserStatus, dx as UserValidationError, dw as UserValidationResult, bg as Uuid, c2 as ValidationResult, dB as ViewService, eg as ViewSyncOptions, ef as ViewSyncResult, cX as ViewsRepository, bE as attributeConfigSchemas, c$ as buildAuditChanges, bp as checkboxConfigSchema, cb as computeRecordStatus, c0 as createAttributeValidator, bL as createCheckboxValidator, bO as createCurrencyValidator, bM as createDateValidator, c6 as createDraftValidator, bU as createFileValidator, b_ as createFormulaValidator, bS as createLocationValidator, cR as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, cO as createRollupHooks, b$ as createRollupValidator, bQ as createSelectValidator, bW as createSingleRelationValidator, bP as createStatusValidator, bJ as createTextValidator, bT as createTimestampValidator, bV as createUserValidator, bs as currencyConfigSchema, bq as dateConfigSchema, dU as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dT as extractAttributeNames, ci as extractFormulaVariables, cj as extractRelationNames, ck as extractRelationReferences, by as fileConfigSchema, cl as flattenRelationsForEval, cm as formatFormulaResult, bC as formulaConfigSchema, bi as generateId, bj as generatePrefixedId, bF as getAttributeConfigSchema, c9 as getMissingRequiredAttributes, cq as getPathDepth, cr as getRelationPath, dM as getSyncPreview, cs as getTargetAttributeName, ej as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dS as isLabelExpression, aB as isNoValueOperator, ca as isRecordComplete, aI as isSystemFlow, bd as isTableTab, bu as locationConfigSchema, bx as multiselectConfigSchema, bo as numberConfigSchema, bH as parseAttributeConfig, cv as parsePath, cw as pathHasManyCardinality, br as phoneConfigSchema, bB as ratingConfigSchema, cP as registerAllRollupHooks, bk as registry, bA as relationConfigSchema, dR as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dP as syncAll, dK as syncNativeObjects, eh as syncNativeViews, bm as textConfigSchema, bn as textareaConfigSchema, bv as timestampConfigSchema, at as toAdvancedFilterState, au as toSimpleFilterState, cE as traversePath, bz as userConfigSchema, c3 as validateAttribute, bG as validateAttributeConfig, c7 as validateDraft, c8 as validateDraftOrThrow, co as validateFormulaExpression, c4 as validateObject, c5 as validateObjectOrThrow, cx as validatePath, dL as verifyNativeObjectsSync, ei as verifyNativeViewsSync, bl as viewRegistry } from './runtime-DSMMZRLE.mjs';
|
|
3
3
|
import { IconName, CountryIso3, CurrencyCode, MimeType, ColorId } from '@stndrds/constants';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -214,8 +214,9 @@ type InferRecordUpdate<TMap extends AttributeMap> = Partial<InferRecordFromSchem
|
|
|
214
214
|
/**
|
|
215
215
|
* Base type for custom attribute values added via UI
|
|
216
216
|
* Supports all possible attribute value types
|
|
217
|
+
* Formula and Rollup attributes don't have defaultValue, so we exclude them
|
|
217
218
|
*/
|
|
218
|
-
type CustomAttributeValue = Attribute["defaultValue"] | undefined;
|
|
219
|
+
type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribute>["defaultValue"] | undefined;
|
|
219
220
|
/**
|
|
220
221
|
* Adds support for custom attributes (added via UI) to a record type
|
|
221
222
|
* Preserves autocompletion for known attributes while allowing additional properties
|
|
@@ -353,6 +354,8 @@ declare const SYSTEM_RESOURCES: {
|
|
|
353
354
|
readonly SETTINGS: "settings";
|
|
354
355
|
/** Audit logs and activity trail */
|
|
355
356
|
readonly AUDIT: "audit";
|
|
357
|
+
/** File uploads and storage management */
|
|
358
|
+
readonly FILES: "files";
|
|
356
359
|
};
|
|
357
360
|
/**
|
|
358
361
|
* All system resources as an array (for iteration)
|
|
@@ -427,6 +430,7 @@ declare const SchemaErrorCode: {
|
|
|
427
430
|
readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
|
|
428
431
|
readonly PROTECTED_OBJECT: "SCHEMA_PROTECTED_OBJECT";
|
|
429
432
|
readonly PROTECTED_ATTRIBUTE: "SCHEMA_PROTECTED_ATTRIBUTE";
|
|
433
|
+
readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
|
|
430
434
|
readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
|
|
431
435
|
readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
|
|
432
436
|
readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
|
|
@@ -513,10 +517,10 @@ declare class ValidationError extends SchemaError {
|
|
|
513
517
|
* Error thrown when attempting to modify a protected (system) resource
|
|
514
518
|
*/
|
|
515
519
|
declare class ProtectedResourceError extends SchemaError {
|
|
516
|
-
readonly resourceType: "object" | "attribute";
|
|
520
|
+
readonly resourceType: "object" | "attribute" | "view";
|
|
517
521
|
readonly resourceName: string;
|
|
518
522
|
readonly operation: "delete" | "modify";
|
|
519
|
-
constructor(resourceType: "object" | "attribute", resourceName: string, operation: "delete" | "modify");
|
|
523
|
+
constructor(resourceType: "object" | "attribute" | "view", resourceName: string, operation: "delete" | "modify");
|
|
520
524
|
}
|
|
521
525
|
/**
|
|
522
526
|
* Error thrown during native object synchronization
|
|
@@ -606,7 +610,7 @@ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
|
|
|
606
610
|
description(value: string): this;
|
|
607
611
|
icon(value: IconName): this;
|
|
608
612
|
order(value: number): this;
|
|
609
|
-
defaultValue(value: TAttr["defaultValue"]): this;
|
|
613
|
+
defaultValue(value: "defaultValue" extends keyof TAttr ? TAttr["defaultValue"] : never): this;
|
|
610
614
|
metadata(value: Record<string, unknown>): this;
|
|
611
615
|
build(): TAttr;
|
|
612
616
|
}
|
|
@@ -813,6 +817,10 @@ declare class FileAttributeBuilder<TName extends string, TRequired extends boole
|
|
|
813
817
|
maxSize(bytes: number): this;
|
|
814
818
|
allowedTypes(types: MimeType[] | readonly MimeType[]): this;
|
|
815
819
|
verification(config: FileAttribute["verification"]): this;
|
|
820
|
+
/**
|
|
821
|
+
* Allow multiple files to be uploaded
|
|
822
|
+
*/
|
|
823
|
+
multiple(): this;
|
|
816
824
|
required(): FileAttributeBuilder<TName, true>;
|
|
817
825
|
optional(): FileAttributeBuilder<TName, false>;
|
|
818
826
|
}
|
|
@@ -825,6 +833,10 @@ declare class UserAttributeBuilder<TName extends string, TRequired extends boole
|
|
|
825
833
|
};
|
|
826
834
|
constructor(name: TName, label: string);
|
|
827
835
|
allowedRoles(roles: string[]): this;
|
|
836
|
+
/**
|
|
837
|
+
* Allow multiple users to be selected
|
|
838
|
+
*/
|
|
839
|
+
multiple(): this;
|
|
828
840
|
required(): UserAttributeBuilder<TName, true>;
|
|
829
841
|
optional(): UserAttributeBuilder<TName, false>;
|
|
830
842
|
}
|
|
@@ -935,10 +947,117 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
|
|
|
935
947
|
optional(): RatingAttributeBuilder<TName, false>;
|
|
936
948
|
}
|
|
937
949
|
declare function rating<TName extends string>(config: TypedBuilderConfig<TName>): RatingAttributeBuilder<TName, false>;
|
|
950
|
+
/**
|
|
951
|
+
* Builder for formula attributes (computed values)
|
|
952
|
+
*
|
|
953
|
+
* Formula attributes are always read-only and cannot be required.
|
|
954
|
+
*/
|
|
955
|
+
declare class FormulaAttributeBuilder<TName extends string> extends BaseAttributeBuilder<FormulaAttribute> {
|
|
956
|
+
readonly _types: {
|
|
957
|
+
name: TName;
|
|
958
|
+
attribute: FormulaAttribute;
|
|
959
|
+
required: false;
|
|
960
|
+
};
|
|
961
|
+
constructor(name: TName, label: string);
|
|
962
|
+
/**
|
|
963
|
+
* Set the formula expression
|
|
964
|
+
* @param expr - Expression to evaluate (e.g., "price * quantity")
|
|
965
|
+
*/
|
|
966
|
+
expression(expr: string): this;
|
|
967
|
+
/**
|
|
968
|
+
* Set the expected return type for formatting
|
|
969
|
+
* @param type - Return type: "text", "number", "boolean", or "date"
|
|
970
|
+
*/
|
|
971
|
+
returns(type: FormulaReturnType): this;
|
|
972
|
+
/**
|
|
973
|
+
* Set decimal places for number results
|
|
974
|
+
*/
|
|
975
|
+
decimals(value: number): this;
|
|
976
|
+
required(): any;
|
|
977
|
+
optional(): any;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Create a formula attribute builder
|
|
981
|
+
*
|
|
982
|
+
* @example Simple calculation
|
|
983
|
+
* ```typescript
|
|
984
|
+
* formula({ name: "total", label: "Total" })
|
|
985
|
+
* .expression("price * quantity")
|
|
986
|
+
* .returns("number")
|
|
987
|
+
* .decimals(2)
|
|
988
|
+
* ```
|
|
989
|
+
*
|
|
990
|
+
* @example With functions
|
|
991
|
+
* ```typescript
|
|
992
|
+
* formula({ name: "fullName", label: "Full Name" })
|
|
993
|
+
* .expression("CONCAT(firstName, ' ', lastName)")
|
|
994
|
+
* .returns("text")
|
|
995
|
+
* ```
|
|
996
|
+
*/
|
|
997
|
+
declare function formula<TName extends string>(config: TypedBuilderConfig<TName>): FormulaAttributeBuilder<TName>;
|
|
998
|
+
/**
|
|
999
|
+
* Builder for rollup attributes (aggregations from related records)
|
|
1000
|
+
*
|
|
1001
|
+
* Rollup attributes are always read-only and cannot be required.
|
|
1002
|
+
*/
|
|
1003
|
+
declare class RollupAttributeBuilder<TName extends string> extends BaseAttributeBuilder<RollupAttribute> {
|
|
1004
|
+
readonly _types: {
|
|
1005
|
+
name: TName;
|
|
1006
|
+
attribute: RollupAttribute;
|
|
1007
|
+
required: false;
|
|
1008
|
+
};
|
|
1009
|
+
constructor(name: TName, label: string);
|
|
1010
|
+
/**
|
|
1011
|
+
* Set the relation attribute to aggregate from
|
|
1012
|
+
* @param relationName - Name of the relation attribute on this object
|
|
1013
|
+
*/
|
|
1014
|
+
from(relationName: string): this;
|
|
1015
|
+
/**
|
|
1016
|
+
* Set the target attribute to aggregate
|
|
1017
|
+
* @param attrName - Name of the attribute on the related object
|
|
1018
|
+
*/
|
|
1019
|
+
aggregate(attrName: string): this;
|
|
1020
|
+
/**
|
|
1021
|
+
* Set the aggregation function
|
|
1022
|
+
*/
|
|
1023
|
+
using(fn: RollupFunction): this;
|
|
1024
|
+
/**
|
|
1025
|
+
* Set decimal places for numeric results
|
|
1026
|
+
*/
|
|
1027
|
+
decimals(value: number): this;
|
|
1028
|
+
/**
|
|
1029
|
+
* Set multi-level path for traversing nested relations (Phase 4+)
|
|
1030
|
+
* @param path - Dot notation path (e.g., "orders.items")
|
|
1031
|
+
*/
|
|
1032
|
+
path(relationPath: string): this;
|
|
1033
|
+
required(): any;
|
|
1034
|
+
optional(): any;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Create a rollup attribute builder
|
|
1038
|
+
*
|
|
1039
|
+
* @example Sum of related amounts
|
|
1040
|
+
* ```typescript
|
|
1041
|
+
* rollup({ name: "totalOrders", label: "Total Orders" })
|
|
1042
|
+
* .from("orders") // relation attribute name
|
|
1043
|
+
* .aggregate("amount") // target attribute to sum
|
|
1044
|
+
* .using("sum")
|
|
1045
|
+
* .decimals(2)
|
|
1046
|
+
* ```
|
|
1047
|
+
*
|
|
1048
|
+
* @example Count of related records
|
|
1049
|
+
* ```typescript
|
|
1050
|
+
* rollup({ name: "orderCount", label: "Number of Orders" })
|
|
1051
|
+
* .from("orders")
|
|
1052
|
+
* .aggregate("id") // any attribute works for count
|
|
1053
|
+
* .using("count")
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
|
|
938
1057
|
/**
|
|
939
1058
|
* Union of all attribute builder types
|
|
940
1059
|
*/
|
|
941
|
-
type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean>;
|
|
1060
|
+
type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean> | FormulaAttributeBuilder<string> | RollupAttributeBuilder<string>;
|
|
942
1061
|
/**
|
|
943
1062
|
* Extract the attribute name from a builder
|
|
944
1063
|
*/
|
|
@@ -1661,4 +1780,4 @@ declare function view(name: string, label: string): ViewBuilder;
|
|
|
1661
1780
|
*/
|
|
1662
1781
|
declare function group(id: string, label: string): GroupBuilder;
|
|
1663
1782
|
|
|
1664
|
-
export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, select, status, text, textarea, timestamp, user, view };
|
|
1783
|
+
export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, FormulaAttribute, FormulaReturnType, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, formula, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, rollup, select, status, text, textarea, timestamp, user, view };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute,
|
|
2
|
-
export {
|
|
1
|
+
import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, F as FormulaAttribute, R as RollupAttribute, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, k as FileAttribute, U as UserAttribute, l as SingleRelationAttribute, m as MultiRelationAttribute, n as RelationTarget, o as RatingAttribute, p as FormulaReturnType, q as RollupFunction, r as FlowDefinition, s as FlowPage, t as FlowRow, u as ObjectDefinition, v as Field, w as AttributeGroupField, G as Group, V as ViewDefinition, x as Tab } from './runtime-DSMMZRLE.js';
|
|
2
|
+
export { bb as ActivityTab, d9 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cT as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cZ as AuditRepository, _ as AuditResourceType, d0 as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d8 as CreateCustomObjectInput, d_ as CreateDBAttribute, ec as CreateDBFlow, dW as CreateDBObject, e8 as CreateDBView, a9 as CreateFile, d3 as CreateFlowInput, e1 as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dz as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dZ as DBAttribute, eb as DBFlow, dV as DBObject, e7 as DBView, dQ as DEFAULT_LABEL_FALLBACK, cc as DatabaseAdapter, ae as DateFilterOperator, I as DateFormat, J as DateValue, W as DocumentFace, Q as DocumentType, X as DocumentTypeConfig, aX as EffectivePermissions, a8 as File, dC as FileContent, e6 as FileListOptions, d2 as FileService, d1 as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cV as FilesRepository, ao as FilterCombinator, aq as FilterGroup, ai as FilterOperator, an as FilterRule, ap as FilterState, am as FilterValue, aE as FlowRelation, aD as FlowRowField, d5 as FlowService, aC as FlowSlot, aF as FlowStatus, cY as FlowsRepository, b8 as FormTab, cp as FormulaResult, dO as FullSyncOptions, dN as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d6 as GeocodingService, aJ as GeocodingSuggestion, dl as GetRelationOptionsParams, e4 as GlobalSearchOptions, e5 as GlobalSearchResultItem, d7 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, e2 as ListOptions, K as LocationGranularity, cu as MaxDepthExceededError, ag as MultiselectFilterOperator, aA as NO_VALUE_OPERATORS, az as NoValueOperator, aO as NoopGeocodingAdapter, cM as NoopHookRegistry, ac as NumberFilterOperator, H as NumberUnit, ay as OPERATORS_BY_TYPE, aQ as ObjectAttribute, aY as ObjectPermissions, aS as ObjectRecord, cW as ObjectRecordsRepository, dc as ObjectSchemaService, db as ObjectSchemaServiceOptions, cS as ObjectsRepository, ee as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, de as PermissionService, dd as PermissionServiceOptions, c_ as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dg as RecordService, df as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dj as RelationOption, dk as RelationOptionsResponse, dp as RelationResolverService, dm as RelationService, di as RelationValidationError, dh as RelationValidationResult, aj as RelativeDateValue, dn as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, cQ as RollupHooksConfig, dq as RollupResult, dt as RollupScheduler, ds as RollupSchedulerOptions, dr as RollupService, cB as SchemaResolver, e3 as SearchOptions, af as SelectFilterOperator, dF as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dG as StorageAdapter, a6 as StorageProvider, dD as StorageUploadInput, dE as StorageUploadResult, dJ as SyncOptions, dI as SyncResult, aZ as SystemPermissions, b7 as TabType, b9 as TableTab, bh as TenantId, ab as TextFilterOperator, aP as Timestamps, cF as TraversalOptions, cG as TraversalResult, d$ as UpdateDBAttribute, ed as UpdateDBFlow, dX as UpdateDBObject, e9 as UpdateDBView, aa as UpdateFile, d4 as UpdateFlowInput, da as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dA as UpdateViewInput, dH as UploadFileInput, e0 as UpsertDBAttribute, dY as UpsertDBObject, ea as UpsertDBView, b4 as UserProfile, dv as UserProfileService, du as UserProfileServiceOptions, cU as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dy as UserService, b3 as UserStatus, dx as UserValidationError, dw as UserValidationResult, bg as Uuid, c2 as ValidationResult, dB as ViewService, eg as ViewSyncOptions, ef as ViewSyncResult, cX as ViewsRepository, bE as attributeConfigSchemas, c$ as buildAuditChanges, bp as checkboxConfigSchema, cb as computeRecordStatus, c0 as createAttributeValidator, bL as createCheckboxValidator, bO as createCurrencyValidator, bM as createDateValidator, c6 as createDraftValidator, bU as createFileValidator, b_ as createFormulaValidator, bS as createLocationValidator, cR as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, cO as createRollupHooks, b$ as createRollupValidator, bQ as createSelectValidator, bW as createSingleRelationValidator, bP as createStatusValidator, bJ as createTextValidator, bT as createTimestampValidator, bV as createUserValidator, bs as currencyConfigSchema, bq as dateConfigSchema, dU as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dT as extractAttributeNames, ci as extractFormulaVariables, cj as extractRelationNames, ck as extractRelationReferences, by as fileConfigSchema, cl as flattenRelationsForEval, cm as formatFormulaResult, bC as formulaConfigSchema, bi as generateId, bj as generatePrefixedId, bF as getAttributeConfigSchema, c9 as getMissingRequiredAttributes, cq as getPathDepth, cr as getRelationPath, dM as getSyncPreview, cs as getTargetAttributeName, ej as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dS as isLabelExpression, aB as isNoValueOperator, ca as isRecordComplete, aI as isSystemFlow, bd as isTableTab, bu as locationConfigSchema, bx as multiselectConfigSchema, bo as numberConfigSchema, bH as parseAttributeConfig, cv as parsePath, cw as pathHasManyCardinality, br as phoneConfigSchema, bB as ratingConfigSchema, cP as registerAllRollupHooks, bk as registry, bA as relationConfigSchema, dR as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dP as syncAll, dK as syncNativeObjects, eh as syncNativeViews, bm as textConfigSchema, bn as textareaConfigSchema, bv as timestampConfigSchema, at as toAdvancedFilterState, au as toSimpleFilterState, cE as traversePath, bz as userConfigSchema, c3 as validateAttribute, bG as validateAttributeConfig, c7 as validateDraft, c8 as validateDraftOrThrow, co as validateFormulaExpression, c4 as validateObject, c5 as validateObjectOrThrow, cx as validatePath, dL as verifyNativeObjectsSync, ei as verifyNativeViewsSync, bl as viewRegistry } from './runtime-DSMMZRLE.js';
|
|
3
3
|
import { IconName, CountryIso3, CurrencyCode, MimeType, ColorId } from '@stndrds/constants';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -214,8 +214,9 @@ type InferRecordUpdate<TMap extends AttributeMap> = Partial<InferRecordFromSchem
|
|
|
214
214
|
/**
|
|
215
215
|
* Base type for custom attribute values added via UI
|
|
216
216
|
* Supports all possible attribute value types
|
|
217
|
+
* Formula and Rollup attributes don't have defaultValue, so we exclude them
|
|
217
218
|
*/
|
|
218
|
-
type CustomAttributeValue = Attribute["defaultValue"] | undefined;
|
|
219
|
+
type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribute>["defaultValue"] | undefined;
|
|
219
220
|
/**
|
|
220
221
|
* Adds support for custom attributes (added via UI) to a record type
|
|
221
222
|
* Preserves autocompletion for known attributes while allowing additional properties
|
|
@@ -353,6 +354,8 @@ declare const SYSTEM_RESOURCES: {
|
|
|
353
354
|
readonly SETTINGS: "settings";
|
|
354
355
|
/** Audit logs and activity trail */
|
|
355
356
|
readonly AUDIT: "audit";
|
|
357
|
+
/** File uploads and storage management */
|
|
358
|
+
readonly FILES: "files";
|
|
356
359
|
};
|
|
357
360
|
/**
|
|
358
361
|
* All system resources as an array (for iteration)
|
|
@@ -427,6 +430,7 @@ declare const SchemaErrorCode: {
|
|
|
427
430
|
readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
|
|
428
431
|
readonly PROTECTED_OBJECT: "SCHEMA_PROTECTED_OBJECT";
|
|
429
432
|
readonly PROTECTED_ATTRIBUTE: "SCHEMA_PROTECTED_ATTRIBUTE";
|
|
433
|
+
readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
|
|
430
434
|
readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
|
|
431
435
|
readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
|
|
432
436
|
readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
|
|
@@ -513,10 +517,10 @@ declare class ValidationError extends SchemaError {
|
|
|
513
517
|
* Error thrown when attempting to modify a protected (system) resource
|
|
514
518
|
*/
|
|
515
519
|
declare class ProtectedResourceError extends SchemaError {
|
|
516
|
-
readonly resourceType: "object" | "attribute";
|
|
520
|
+
readonly resourceType: "object" | "attribute" | "view";
|
|
517
521
|
readonly resourceName: string;
|
|
518
522
|
readonly operation: "delete" | "modify";
|
|
519
|
-
constructor(resourceType: "object" | "attribute", resourceName: string, operation: "delete" | "modify");
|
|
523
|
+
constructor(resourceType: "object" | "attribute" | "view", resourceName: string, operation: "delete" | "modify");
|
|
520
524
|
}
|
|
521
525
|
/**
|
|
522
526
|
* Error thrown during native object synchronization
|
|
@@ -606,7 +610,7 @@ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
|
|
|
606
610
|
description(value: string): this;
|
|
607
611
|
icon(value: IconName): this;
|
|
608
612
|
order(value: number): this;
|
|
609
|
-
defaultValue(value: TAttr["defaultValue"]): this;
|
|
613
|
+
defaultValue(value: "defaultValue" extends keyof TAttr ? TAttr["defaultValue"] : never): this;
|
|
610
614
|
metadata(value: Record<string, unknown>): this;
|
|
611
615
|
build(): TAttr;
|
|
612
616
|
}
|
|
@@ -813,6 +817,10 @@ declare class FileAttributeBuilder<TName extends string, TRequired extends boole
|
|
|
813
817
|
maxSize(bytes: number): this;
|
|
814
818
|
allowedTypes(types: MimeType[] | readonly MimeType[]): this;
|
|
815
819
|
verification(config: FileAttribute["verification"]): this;
|
|
820
|
+
/**
|
|
821
|
+
* Allow multiple files to be uploaded
|
|
822
|
+
*/
|
|
823
|
+
multiple(): this;
|
|
816
824
|
required(): FileAttributeBuilder<TName, true>;
|
|
817
825
|
optional(): FileAttributeBuilder<TName, false>;
|
|
818
826
|
}
|
|
@@ -825,6 +833,10 @@ declare class UserAttributeBuilder<TName extends string, TRequired extends boole
|
|
|
825
833
|
};
|
|
826
834
|
constructor(name: TName, label: string);
|
|
827
835
|
allowedRoles(roles: string[]): this;
|
|
836
|
+
/**
|
|
837
|
+
* Allow multiple users to be selected
|
|
838
|
+
*/
|
|
839
|
+
multiple(): this;
|
|
828
840
|
required(): UserAttributeBuilder<TName, true>;
|
|
829
841
|
optional(): UserAttributeBuilder<TName, false>;
|
|
830
842
|
}
|
|
@@ -935,10 +947,117 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
|
|
|
935
947
|
optional(): RatingAttributeBuilder<TName, false>;
|
|
936
948
|
}
|
|
937
949
|
declare function rating<TName extends string>(config: TypedBuilderConfig<TName>): RatingAttributeBuilder<TName, false>;
|
|
950
|
+
/**
|
|
951
|
+
* Builder for formula attributes (computed values)
|
|
952
|
+
*
|
|
953
|
+
* Formula attributes are always read-only and cannot be required.
|
|
954
|
+
*/
|
|
955
|
+
declare class FormulaAttributeBuilder<TName extends string> extends BaseAttributeBuilder<FormulaAttribute> {
|
|
956
|
+
readonly _types: {
|
|
957
|
+
name: TName;
|
|
958
|
+
attribute: FormulaAttribute;
|
|
959
|
+
required: false;
|
|
960
|
+
};
|
|
961
|
+
constructor(name: TName, label: string);
|
|
962
|
+
/**
|
|
963
|
+
* Set the formula expression
|
|
964
|
+
* @param expr - Expression to evaluate (e.g., "price * quantity")
|
|
965
|
+
*/
|
|
966
|
+
expression(expr: string): this;
|
|
967
|
+
/**
|
|
968
|
+
* Set the expected return type for formatting
|
|
969
|
+
* @param type - Return type: "text", "number", "boolean", or "date"
|
|
970
|
+
*/
|
|
971
|
+
returns(type: FormulaReturnType): this;
|
|
972
|
+
/**
|
|
973
|
+
* Set decimal places for number results
|
|
974
|
+
*/
|
|
975
|
+
decimals(value: number): this;
|
|
976
|
+
required(): any;
|
|
977
|
+
optional(): any;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Create a formula attribute builder
|
|
981
|
+
*
|
|
982
|
+
* @example Simple calculation
|
|
983
|
+
* ```typescript
|
|
984
|
+
* formula({ name: "total", label: "Total" })
|
|
985
|
+
* .expression("price * quantity")
|
|
986
|
+
* .returns("number")
|
|
987
|
+
* .decimals(2)
|
|
988
|
+
* ```
|
|
989
|
+
*
|
|
990
|
+
* @example With functions
|
|
991
|
+
* ```typescript
|
|
992
|
+
* formula({ name: "fullName", label: "Full Name" })
|
|
993
|
+
* .expression("CONCAT(firstName, ' ', lastName)")
|
|
994
|
+
* .returns("text")
|
|
995
|
+
* ```
|
|
996
|
+
*/
|
|
997
|
+
declare function formula<TName extends string>(config: TypedBuilderConfig<TName>): FormulaAttributeBuilder<TName>;
|
|
998
|
+
/**
|
|
999
|
+
* Builder for rollup attributes (aggregations from related records)
|
|
1000
|
+
*
|
|
1001
|
+
* Rollup attributes are always read-only and cannot be required.
|
|
1002
|
+
*/
|
|
1003
|
+
declare class RollupAttributeBuilder<TName extends string> extends BaseAttributeBuilder<RollupAttribute> {
|
|
1004
|
+
readonly _types: {
|
|
1005
|
+
name: TName;
|
|
1006
|
+
attribute: RollupAttribute;
|
|
1007
|
+
required: false;
|
|
1008
|
+
};
|
|
1009
|
+
constructor(name: TName, label: string);
|
|
1010
|
+
/**
|
|
1011
|
+
* Set the relation attribute to aggregate from
|
|
1012
|
+
* @param relationName - Name of the relation attribute on this object
|
|
1013
|
+
*/
|
|
1014
|
+
from(relationName: string): this;
|
|
1015
|
+
/**
|
|
1016
|
+
* Set the target attribute to aggregate
|
|
1017
|
+
* @param attrName - Name of the attribute on the related object
|
|
1018
|
+
*/
|
|
1019
|
+
aggregate(attrName: string): this;
|
|
1020
|
+
/**
|
|
1021
|
+
* Set the aggregation function
|
|
1022
|
+
*/
|
|
1023
|
+
using(fn: RollupFunction): this;
|
|
1024
|
+
/**
|
|
1025
|
+
* Set decimal places for numeric results
|
|
1026
|
+
*/
|
|
1027
|
+
decimals(value: number): this;
|
|
1028
|
+
/**
|
|
1029
|
+
* Set multi-level path for traversing nested relations (Phase 4+)
|
|
1030
|
+
* @param path - Dot notation path (e.g., "orders.items")
|
|
1031
|
+
*/
|
|
1032
|
+
path(relationPath: string): this;
|
|
1033
|
+
required(): any;
|
|
1034
|
+
optional(): any;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Create a rollup attribute builder
|
|
1038
|
+
*
|
|
1039
|
+
* @example Sum of related amounts
|
|
1040
|
+
* ```typescript
|
|
1041
|
+
* rollup({ name: "totalOrders", label: "Total Orders" })
|
|
1042
|
+
* .from("orders") // relation attribute name
|
|
1043
|
+
* .aggregate("amount") // target attribute to sum
|
|
1044
|
+
* .using("sum")
|
|
1045
|
+
* .decimals(2)
|
|
1046
|
+
* ```
|
|
1047
|
+
*
|
|
1048
|
+
* @example Count of related records
|
|
1049
|
+
* ```typescript
|
|
1050
|
+
* rollup({ name: "orderCount", label: "Number of Orders" })
|
|
1051
|
+
* .from("orders")
|
|
1052
|
+
* .aggregate("id") // any attribute works for count
|
|
1053
|
+
* .using("count")
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
|
|
938
1057
|
/**
|
|
939
1058
|
* Union of all attribute builder types
|
|
940
1059
|
*/
|
|
941
|
-
type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean>;
|
|
1060
|
+
type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean> | FormulaAttributeBuilder<string> | RollupAttributeBuilder<string>;
|
|
942
1061
|
/**
|
|
943
1062
|
* Extract the attribute name from a builder
|
|
944
1063
|
*/
|
|
@@ -1661,4 +1780,4 @@ declare function view(name: string, label: string): ViewBuilder;
|
|
|
1661
1780
|
*/
|
|
1662
1781
|
declare function group(id: string, label: string): GroupBuilder;
|
|
1663
1782
|
|
|
1664
|
-
export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, select, status, text, textarea, timestamp, user, view };
|
|
1783
|
+
export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, FormulaAttribute, FormulaReturnType, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, formula, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, rollup, select, status, text, textarea, timestamp, user, view };
|