@halix/action-sdk 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/lib/cjs/content.js +12 -70
  2. package/lib/cjs/data-aggregate.js +101 -0
  3. package/lib/cjs/data-crud.js +24 -117
  4. package/lib/cjs/index.js +15 -1
  5. package/lib/cjs/lists.js +22 -176
  6. package/lib/cjs/messaging.js +8 -59
  7. package/lib/cjs/preferences.js +75 -0
  8. package/lib/cjs/sdk-general.js +6 -18
  9. package/lib/cjs/types/content.d.ts +12 -70
  10. package/lib/cjs/types/content.d.ts.map +1 -1
  11. package/lib/cjs/types/data-aggregate.d.ts +140 -0
  12. package/lib/cjs/types/data-aggregate.d.ts.map +1 -0
  13. package/lib/cjs/types/data-crud.d.ts +24 -117
  14. package/lib/cjs/types/data-crud.d.ts.map +1 -1
  15. package/lib/cjs/types/filter-expressions.d.ts +35 -107
  16. package/lib/cjs/types/filter-expressions.d.ts.map +1 -1
  17. package/lib/cjs/types/index.d.ts +2 -0
  18. package/lib/cjs/types/index.d.ts.map +1 -1
  19. package/lib/cjs/types/lists.d.ts +22 -177
  20. package/lib/cjs/types/lists.d.ts.map +1 -1
  21. package/lib/cjs/types/messaging.d.ts +8 -59
  22. package/lib/cjs/types/messaging.d.ts.map +1 -1
  23. package/lib/cjs/types/preferences.d.ts +17 -0
  24. package/lib/cjs/types/preferences.d.ts.map +1 -0
  25. package/lib/cjs/types/sdk-general.d.ts +23 -78
  26. package/lib/cjs/types/sdk-general.d.ts.map +1 -1
  27. package/lib/cjs/types/utilities.d.ts +9 -29
  28. package/lib/cjs/types/utilities.d.ts.map +1 -1
  29. package/lib/cjs/utilities.js +9 -29
  30. package/lib/esm/content.js +12 -70
  31. package/lib/esm/content.js.map +1 -1
  32. package/lib/esm/data-aggregate.js +84 -0
  33. package/lib/esm/data-aggregate.js.map +1 -0
  34. package/lib/esm/data-crud.js +24 -117
  35. package/lib/esm/data-crud.js.map +1 -1
  36. package/lib/esm/index.js.map +1 -1
  37. package/lib/esm/index.mjs +12 -0
  38. package/lib/esm/lists.js +22 -176
  39. package/lib/esm/lists.js.map +1 -1
  40. package/lib/esm/messaging.js +8 -59
  41. package/lib/esm/messaging.js.map +1 -1
  42. package/lib/esm/preferences.js +57 -0
  43. package/lib/esm/preferences.js.map +1 -0
  44. package/lib/esm/sdk-general.js +13 -45
  45. package/lib/esm/sdk-general.js.map +1 -1
  46. package/lib/esm/types/content.d.ts +12 -70
  47. package/lib/esm/types/data-aggregate.d.ts +139 -0
  48. package/lib/esm/types/data-crud.d.ts +24 -117
  49. package/lib/esm/types/filter-expressions.d.ts +35 -107
  50. package/lib/esm/types/index.d.ts +2 -0
  51. package/lib/esm/types/lists.d.ts +22 -177
  52. package/lib/esm/types/messaging.d.ts +8 -59
  53. package/lib/esm/types/preferences.d.ts +16 -0
  54. package/lib/esm/types/sdk-general.d.ts +23 -78
  55. package/lib/esm/types/utilities.d.ts +9 -29
  56. package/lib/esm/utilities.js +9 -29
  57. package/lib/esm/utilities.js.map +1 -1
  58. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * TransformType specifies the type of transformation to apply to a group field.
4
+ */
5
+ export type TransformType = 'Year' | 'Month' | 'Week' | 'Day' | 'Hour' | 'Minute' | 'Substring';
6
+ /**
7
+ * AggregationType specifies the type of aggregation to perform on a field.
8
+ */
9
+ export type AggregationType = 'Average' | 'Count' | 'Sum' | 'Max' | 'Min' | 'Median';
10
+ /**
11
+ * AggregationGroupTransform represents a transform function with parameters to be applied to a group field.
12
+ */
13
+ export interface AggregationGroupTransform {
14
+ /** The transformation function to apply */
15
+ transform: TransformType;
16
+ /** Arguments for the transformation function */
17
+ args?: {
18
+ [key: string]: any;
19
+ };
20
+ }
21
+ /**
22
+ * AggregationGroup defines a grouping field with optional transforms and sort direction.
23
+ */
24
+ export interface AggregationGroup {
25
+ /** The field to group by (can include relationship paths with dots, e.g. "customer.lastName") */
26
+ groupField: string;
27
+ /** Sort direction for this group ('asc' or 'desc') */
28
+ groupDirection: 'asc' | 'desc';
29
+ /** Optional transforms to apply to the grouping field */
30
+ transforms?: AggregationGroupTransform[];
31
+ }
32
+ /**
33
+ * AggregationSort defines a secondary sort field for aggregated results.
34
+ */
35
+ export interface AggregationSort {
36
+ /** The field to sort by (can include relationship paths with dots) */
37
+ sortField: string;
38
+ /** Sort direction ('asc' or 'desc') */
39
+ sortDirection: 'asc' | 'desc';
40
+ /** The aggregation type to sort by (must match an aggregation in the request) */
41
+ sortAggregation: AggregationType;
42
+ }
43
+ /**
44
+ * Aggregation defines an aggregation operation to perform on a field.
45
+ */
46
+ export interface Aggregation {
47
+ /** The aggregation function to apply ('Average', 'Count', 'Sum', 'Max', 'Min', 'Median') */
48
+ aggregation: AggregationType;
49
+ /** The field to aggregate (can include relationship paths with dots) */
50
+ aggregationField: string;
51
+ }
52
+ /**
53
+ * AggregationRequest defines the parameters for an aggregation query.
54
+ * The data scope is controlled by parentDataElementId, parentKey, and dataElementId.
55
+ */
56
+ export interface AggregationRequest {
57
+ /**
58
+ * The ID of the data element to aggregate.
59
+ */
60
+ dataElementId: string;
61
+ /**
62
+ * The ID of the parent data element that defines the overall scope of records.
63
+ * The dataElementId must be related to this through a foreign key or key array.
64
+ */
65
+ parentDataElementId?: string;
66
+ /**
67
+ * The key of a parent object that all records must be related to.
68
+ * Works with parentDataElementId to scope results.
69
+ */
70
+ parentKey?: string;
71
+ /**
72
+ * Optional field to specify the foreign key field on the data element that defines
73
+ * the relationship to the parent. If omitted, a derived key is assumed.
74
+ */
75
+ parentKeyField?: string;
76
+ /**
77
+ * Filter expression to limit records before aggregation.
78
+ * @see the filter-expressions module for filter syntax and examples
79
+ */
80
+ filter?: string;
81
+ /**
82
+ * List of grouping specifications. Groups are formed by field values with optional transforms.
83
+ * Results will be grouped by these fields in the order specified.
84
+ */
85
+ groups: AggregationGroup[];
86
+ /**
87
+ * List of secondary sort specifications for the aggregated results.
88
+ * Groups are the primary sorts; these are additional sorting criteria.
89
+ */
90
+ sort?: AggregationSort[];
91
+ /**
92
+ * List of aggregation operations to perform on the grouped data.
93
+ */
94
+ aggregations: Aggregation[];
95
+ }
96
+ /**
97
+ * AggregationResponse wraps the aggregated data results.
98
+ */
99
+ export interface AggregationResponse {
100
+ /** The aggregated data results */
101
+ data: any[];
102
+ }
103
+ /**
104
+ * Performs data aggregation operations (count, sum, average, etc.) on grouped data.
105
+ * Supports filtering, grouping with transforms, sorting, and multiple aggregations.
106
+ *
107
+ * @param request - Aggregation configuration including dataElementId, parent scope, groups, aggregations
108
+ * @returns Promise<AggregationResponse> with aggregated data array
109
+ *
110
+ * @example
111
+ * const results = await getAggregateData({
112
+ * dataElementId: 'order',
113
+ * parentDataElementId: 'company',
114
+ * parentKey: orgProxyKey,
115
+ * groups: [{
116
+ * groupField: 'status',
117
+ * groupDirection: 'asc'
118
+ * }],
119
+ * aggregations: [{
120
+ * aggregation: 'Count',
121
+ * aggregationField: 'objKey'
122
+ * }, {
123
+ * aggregation: 'Sum',
124
+ * aggregationField: 'totalAmount'
125
+ * }]
126
+ * });
127
+ */
128
+ export declare function getAggregateData(request: AggregationRequest): Promise<AggregationResponse>;
129
+ /**
130
+ * Observable version of getAggregateData. See getAggregateData for details.
131
+ *
132
+ * @example
133
+ * getAggregateDataAsObservable({
134
+ * dataElementId: 'order',
135
+ * groups: [{ groupField: 'status', groupDirection: 'asc' }],
136
+ * aggregations: [{ aggregation: 'Count', aggregationField: 'objKey' }]
137
+ * }).subscribe(response => console.log(response.data));
138
+ */
139
+ export declare function getAggregateDataAsObservable(request: AggregationRequest): Observable<AggregationResponse>;
140
+ //# sourceMappingURL=data-aggregate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-aggregate.d.ts","sourceRoot":"","sources":["../../../src/data-aggregate.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MA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AAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAE3B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,EAAE,CAAC;IAEzB;;OAEG;IACH,YAAY,EAAE,WAAW,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,kCAAkC;IAClC,IAAI,EAAE,GAAG,EAAE,CAAC;CACf;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqBhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAEzG"}
@@ -8,154 +8,61 @@ export interface SaveOptions {
8
8
  bypassValidation?: boolean;
9
9
  }
10
10
  /**
11
- * getObject retrieves a single object from the database by its data element ID and key.
11
+ * Retrieves a single object by dataElementId and key. Optionally fetch related objects.
12
12
  *
13
- * @param dataElementId - The ID of the data element
14
- * @param key - The key of the object
15
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
16
- * object will include the specified related objects as nested objects
17
- * @returns Promise resolving to the object data
13
+ * @returns Promise<any> - the object data
18
14
  */
19
15
  export declare function getObject(dataElementId: string, key: string, fetchedRelationships?: string[]): Promise<any>;
20
16
  /**
21
- * getObjectAsObservable retrieves a single object from the database by its data element ID and key.
22
- *
23
- * @param dataElementId - The ID of the data element
24
- * @param key - The key of the object
25
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
26
- * object will include the specified related objects as nested objects
27
- *
28
- * @returns Observable resolving to the object data
17
+ * Observable version of getObject. See getObject for details.
29
18
  */
30
19
  export declare function getObjectAsObservable(dataElementId: string, key: string, fetchedRelationships?: string[]): Observable<any>;
31
20
  /**
32
- * getRelatedObjects retrieves an array of objects from the the database. The objects returned are
33
- * related to a parent through a defined relationship in the schema. In a typical setup, action's
34
- * auth token must have scope access to the parent object in order to access all of its related
35
- * objects.
36
- *
37
- * It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
38
- * or organization proxy. For example, in a user context where the current user proxy element is
39
- * "customer," an action might want to retrieve all "purchase" objects related to the current
40
- * customer. Similarly, in an organization context where the current organization proxy is
41
- * "business," an action might want to retrieve all "employee" objects related to the current
42
- * business.
43
- *
44
- * @param parentElementId - The ID of the parent element
45
- * @param parentKey - The key of the parent object
46
- * @param elementId - The ID of the element
47
- * @param filter - Optional filter criteria for the query; if not provided, all related objects will
48
- * be returned
49
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
50
- * objects will include the specified related objects as nested objects
51
- *
52
- * @returns Promise resolving to an array of objects
53
- *
54
- * @see {@link FilterExpression} for filter syntax and examples
21
+ * Retrieves all objects related to a parent through a schema relationship. Commonly used to get objects belonging to current user/org proxy.
22
+ *
23
+ * @param parentElementId - Parent element ID
24
+ * @param parentKey - Parent object key
25
+ * @param elementId - Child element ID
26
+ * @param filter - Optional filter (see FilterExpression)
27
+ * @param fetchedRelationships - Optional relationships to include as nested objects
28
+ * @returns Promise<any[]>
55
29
  */
56
30
  export declare function getRelatedObjects(parentElementId: string, parentKey: string, elementId: string, filter?: FilterExpression, fetchedRelationships?: string[]): Promise<any[]>;
57
31
  /**
58
- * getRelatedObjectsAsObservable retrieves an array of objects from the the database. The objects
59
- * returned are related to a parent through a defined relationship in the schema. In a typical
60
- * setup, action's auth token must have scope access to the parent object in order to access all of
61
- * its related objects.
62
- *
63
- * It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
64
- * or organization proxy. For example, in a user context where the current user proxy element is
65
- * "customer," an action might want to retrieve all "purchase" objects related to the current
66
- * customer. Similarly, in an organization context where the current organization proxy is
67
- * "business," an action might want to retrieve all "employee" objects related to the current
68
- * business.
69
- *
70
- * @param parentElementId - The ID of the parent element
71
- * @param parentKey - The key of the parent element
72
- * @param elementId - The ID of the element
73
- * @param filter - Optional filter criteria for the query; if not provided, all related objects will
74
- * be returned
75
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
76
- * objects will include the specified related objects as nested objects
77
- *
78
- * @returns Observable resolving to an array of objects
79
- *
80
- * @see {@link FilterExpression} for filter syntax and examples
32
+ * Observable version of getRelatedObjects. See getRelatedObjects for details.
81
33
  */
82
34
  export declare function getRelatedObjectsAsObservable(parentElementId: string, parentKey: string, elementId: string, filter?: FilterExpression, fetchedRelationships?: string[]): Observable<any[]>;
83
35
  /**
84
- * saveRelatedObject saves a related object to the database. The objectToSave is saved, and its
85
- * relationship to the parent object is established based on the relationship specified in the
86
- * schema. The objectToSave must have a relationship to the parent object and the user must have
87
- * scope access to the parent object.
36
+ * Saves a related object and establishes relationship to parent. Returns saved object with any server-assigned values (objKey, calculated fields).
88
37
  *
89
- * @param parentElementId - The ID of the parent element
90
- * @param parentKey - The key of the parent object
91
- * @param elementId - The element ID of the object to save
92
- * @param objectToSave - The object data to save (as a JSON string)
93
- * @param opts - Optional save options
94
- *
95
- * @returns Promise resolving to saved object, including any updates made to the object during the
96
- * save operation (such as assigning an objKey if the object is new), or the assignment of
97
- * calculated values
38
+ * @param objectToSave - JSON string of object data
39
+ * @param opts - Optional: bypassValidation
40
+ * @returns Promise<any> - saved object with updates
98
41
  */
99
42
  export declare function saveRelatedObject(parentElementId: string, parentKey: string, elementId: string, objectToSave: string, opts?: SaveOptions): Promise<any>;
100
43
  /**
101
- * saveRelatedObjectAsObservable saves a related object to the database. The objectToSave is saved,
102
- * and its relationship to the parent object is established based on the relationship specified in
103
- * the schema. The objectToSave must have a relationship to the parent object and the user must have
104
- * scope access to the parent object.
105
- *
106
- * @param parentElementId - The ID of the parent element
107
- * @param parentKey - The key of the parent object
108
- * @param elementId - The element ID of the object to save
109
- * @param objectToSave - The object data to save (as a JSON string)
110
- * @param opts - Optional save options
111
- *
112
- * @returns Observable resolving to saved object, including any updates made to the object during
113
- * the save operation (such as assigning an objKey if the object is new), or the assignment of
114
- * calculated values
44
+ * Observable version of saveRelatedObject. See saveRelatedObject for details.
115
45
  */
116
46
  export declare function saveRelatedObjectAsObservable(parentElementId: string, parentKey: string, elementId: string, objectToSave: string, opts?: SaveOptions): Observable<any>;
117
47
  /**
118
- * deleteRelatedObject deletes a single object related to a specific parent.
48
+ * Deletes a single object related to a parent.
119
49
  *
120
- * @param parentElementId - The ID of the parent element
121
- * @param parentKey - The key of the parent object
122
- * @param childElementId - The ID of the child element to delete
123
- * @param childKey - The key of the child object to delete
124
- *
125
- * @returns Promise resolving to true if deletion was successful
50
+ * @returns Promise<boolean> - true if successful
126
51
  */
127
52
  export declare function deleteRelatedObject(parentElementId: string, parentKey: string, childElementId: string, childKey: string): Promise<boolean>;
128
53
  /**
129
- * deleteRelatedObjectAsObservable deletes a single object related to a specific parent.
130
- *
131
- * @param parentElementId - The ID of the parent element
132
- * @param parentKey - The key of the parent object
133
- * @param childElementId - The ID of the child element to delete
134
- * @param childKey - The key of the child object to delete
135
- *
136
- * @returns Observable resolving to true if deletion was successful
54
+ * Observable version of deleteRelatedObject. See deleteRelatedObject for details.
137
55
  */
138
56
  export declare function deleteRelatedObjectAsObservable(parentElementId: string, parentKey: string, childElementId: string, childKey: string): Observable<boolean>;
139
57
  /**
140
- * deleteRelatedObjects deletes multiple objects related to a specific parent.
141
- *
142
- * @param parentElementId - The ID of the parent element
143
- * @param parentKey - The key of the parent object
144
- * @param childElementId - The ID of the child element to delete
145
- * @param childKeys - Array of keys of the child objects to delete
58
+ * Deletes multiple objects related to a parent.
146
59
  *
147
- * @returns Promise resolving to true if deletion was successful
60
+ * @param childKeys - Array of child object keys to delete
61
+ * @returns Promise<boolean> - true if successful
148
62
  */
149
63
  export declare function deleteRelatedObjects(parentElementId: string, parentKey: string, childElementId: string, childKeys: string[]): Promise<boolean>;
150
64
  /**
151
- * deleteRelatedObjectsAsObservable deletes multiple objects related to a specific parent.
152
- *
153
- * @param parentElementId - The ID of the parent element
154
- * @param parentKey - The key of the parent object
155
- * @param childElementId - The ID of the child element to delete
156
- * @param childKeys - Array of keys of the child objects to delete
157
- *
158
- * @returns Observable resolving to true if deletion was successful
65
+ * Observable version of deleteRelatedObjects. See deleteRelatedObjects for details.
159
66
  */
160
67
  export declare function deleteRelatedObjectsAsObservable(parentElementId: string, parentKey: string, childElementId: string, childKeys: string[]): Observable<boolean>;
161
68
  //# sourceMappingURL=data-crud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-crud.d.ts","sourceRoot":"","sources":["../../../src/data-crud.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAMD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,gBA6BlG;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAE1H;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAgCjL;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE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,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAwB7J;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAEtK;AAMD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBhJ;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,CAEzJ;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBpJ;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAE7J"}
@@ -5,23 +5,15 @@
5
5
  */
6
6
  /**
7
7
  * FilterExpression represents a filter expression string in the Halix dataexpr format.
8
+ * Used to filter data based on logical comparisons and boolean conditions.
8
9
  *
9
- * Filter expressions are used to filter data based on logical comparisons and boolean conditions.
10
- * They support a wide range of operators, boolean logic, arrays, and special variables.
11
- *
12
- * ## Expression Structure
13
- *
14
- * An expression consists of:
15
- * - One or more comparisons
16
- * - Optionally combined using boolean operators (`AND`, `OR`)
17
- * - Grouped using parentheses `(...)` for logical grouping and precedence
18
- *
19
- * ### Basic Forms
10
+ * ## Basic Forms
20
11
  * ```
21
12
  * <left> <operator> <right>
22
13
  * (<expression1>) AND (<expression2>)
23
14
  * (<expression1>) OR (<expression2>)
24
15
  * ```
16
+ * Combine comparisons with AND/OR. Each operand must be in parentheses.
25
17
  *
26
18
  * ## Supported Operators
27
19
  *
@@ -43,111 +35,47 @@
43
35
  * | `!<empty> $void` | Value is not empty | `notes !<empty> $void` |
44
36
  *
45
37
  * ## Value Types
46
- *
47
- * Values in expressions can be:
48
- * - **String literals**: Must be wrapped in single quotes - `'value'`
49
- * - **Attribute references**: Must not be quoted - `status`, `score`
50
- * - **Arrays**: Literal arrays - `['A', 'B', 'C']`
51
- * - **Variables**: Special variables - `$today`, `$daysAgo:5`
52
- * - **Page/group variables**: Must be quoted - `'@{page.fieldName}'`, `'@{group.fieldName}'`
53
- *
54
- * ## Boolean Logic
55
- *
56
- * Combine comparisons using:
57
- * - `AND` – all subexpressions must be true
58
- * - `OR` – at least one subexpression must be true
59
- *
60
- * **Important**: Each operand of `AND`/`OR` must be enclosed in parentheses.
61
- *
62
- * ### Examples
63
- * ```
64
- * (status = 'active') AND (priority = 'high')
65
- * (status = 'active') AND ((priority = 'high') OR (escalated = 'true'))
66
- * ```
67
- *
68
- * ## Expression Variables
69
- *
70
- * Use special `$variables` for dynamic time-based filtering:
71
- *
72
- * | Variable | Meaning |
73
- * |----------|---------|
74
- * | `$today` | Current date (e.g. `2023-06-25`) |
75
- * | `$todayTimestamp` | Timestamp for midnight today |
76
- * | `$todayUnixTimestamp` | Unix timestamp (ms) for today |
77
- * | `$startOfMonth` | First day of the current month |
78
- * | `$endOfMonth` | Last day of the current month |
79
- * | `$yearsAgo:N` | Timestamp N years ago |
80
- * | `$monthsAgo:N` | Timestamp N months ago |
81
- * | `$weeksAgo:N` | Timestamp N weeks ago |
82
- * | `$daysAgo:N` | Timestamp N days ago |
83
- * | `$hoursAgo:N` | Timestamp N hours ago |
84
- * | `$minutesAgo:N` | Timestamp N minutes ago |
85
- * | `$secondsAgo:N` | Timestamp N seconds ago |
86
- * | `$yearsAhead:N` | Timestamp N years in the future |
87
- * | `$monthsAhead:N` | Timestamp N months in the future |
88
- * | `$weeksAhead:N` | Timestamp N weeks in the future |
89
- * | `$daysAhead:N` | Timestamp N days in the future |
90
- * | `$hoursAhead:N` | Timestamp N hours in the future |
91
- * | `$minutesAhead:N` | Timestamp N minutes in the future |
92
- * | `$secondsAhead:N` | Timestamp N seconds in the future |
93
- *
94
- * ## Common Examples
95
- *
96
- * ### Simple Comparison
38
+ * - **String literals**: `'value'` (single quotes required)
39
+ * - **Attribute references**: `status`, `score` (no quotes)
40
+ * - **Arrays**: `['A', 'B', 'C']`
41
+ * - **Variables**: `$today`, `$daysAgo:5`
42
+ * - **Page/group variables**: `'@{page.fieldName}'` (quoted)
43
+ *
44
+ * ## Time Variables
45
+ * - `$today`, `$todayTimestamp`, `$todayUnixTimestamp`
46
+ * - `$startOfMonth`, `$endOfMonth`
47
+ * - `$yearsAgo:N`, `$monthsAgo:N`, `$weeksAgo:N`, `$daysAgo:N`, `$hoursAgo:N`, `$minutesAgo:N`, `$secondsAgo:N`
48
+ * - `$yearsAhead:N`, `$monthsAhead:N`, `$weeksAhead:N`, `$daysAhead:N`, `$hoursAhead:N`, `$minutesAhead:N`, `$secondsAhead:N`
49
+ *
50
+ * ## Examples
97
51
  * ```typescript
98
- * const filter = "status = 'active'";
99
- * ```
52
+ * // Simple comparison
53
+ * "status = 'active'"
100
54
  *
101
- * ### Case-Insensitive Match
102
- * ```typescript
103
- * const filter = "role ~ 'ADMIN'";
104
- * ```
55
+ * // Case-insensitive
56
+ * "role ~ 'ADMIN'"
105
57
  *
106
- * ### Contains Check
107
- * ```typescript
108
- * const filter = "notes <> 'important'";
109
- * ```
58
+ * // Contains
59
+ * "notes <> 'important'"
110
60
  *
111
- * ### Array Contains
112
- * ```typescript
113
- * const filter = "['pending', 'active', 'review'] <> status";
114
- * ```
115
- *
116
- * ### Empty/Not Empty
117
- * ```typescript
118
- * const filter = "notes !<empty> $void"; // Has notes
119
- * ```
120
- *
121
- * ### Compound Expression
122
- * ```typescript
123
- * const filter = "(status = 'active') AND (priority = 'high')";
124
- * ```
61
+ * // Array contains
62
+ * "['pending', 'active'] <> status"
125
63
  *
126
- * ### Nested Logic
127
- * ```typescript
128
- * const filter = "(status = 'active') AND ((score > '90') OR (grade = 'A'))";
129
- * ```
64
+ * // Not empty
65
+ * "notes !<empty> $void"
130
66
  *
131
- * ### Time-Based Filtering
132
- * ```typescript
133
- * const filter = "createdAt > $daysAgo:30"; // Created in last 30 days
134
- * ```
67
+ * // Compound with AND/OR
68
+ * "(status = 'active') AND (priority = 'high')"
69
+ * "(status = 'active') AND ((score > '90') OR (grade = 'A'))"
135
70
  *
136
- * ### Boolean Values
137
- * ```typescript
138
- * const filter = "enabled = boolean:true";
139
- * ```
71
+ * // Time-based
72
+ * "createdAt > $daysAgo:30"
140
73
  *
141
- * ### Using Page Variables
142
- * ```typescript
143
- * const filter = "category = '@{page.selectedCategory.value}'";
144
- * ```
74
+ * // Boolean
75
+ * "enabled = boolean:true"
145
76
  *
146
- * ### Complex Multi-Condition Filter
147
- * ```typescript
148
- * const filter = "(status = 'active') AND " +
149
- * "((priority = 'high') OR (dueDate < $today)) AND " +
150
- * "(assignedTo !<empty> $void)";
77
+ * // Page variables
78
+ * "category = '@{page.selectedCategory.value}'"
151
79
  * ```
152
80
  */
153
81
  export type FilterExpression = string;
@@ -1 +1 @@
1
- {"version":3,"file":"filter-expressions.d.ts","sourceRoot":"","sources":["../../../src/filter-expressions.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"filter-expressions.d.ts","sourceRoot":"","sources":["../../../src/filter-expressions.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC"}
@@ -7,7 +7,9 @@ export { getAuthToken, sandboxKey, serviceAddress, actionSubject, userContext, p
7
7
  export { type SaveOptions, getObject, getObjectAsObservable, getRelatedObjects, getRelatedObjectsAsObservable, saveRelatedObject, saveRelatedObjectAsObservable, deleteRelatedObject, deleteRelatedObjectAsObservable, deleteRelatedObjects, deleteRelatedObjectsAsObservable } from './data-crud';
8
8
  export { type ContentResource, getOrCreateResource, getOrCreateResourceAsObservable, saveResource, saveResourceAsObservable, sendFileContents, sendFileContentsAsObservable, createOrUpdateResource, createOrUpdateResourceAsObservable } from './content';
9
9
  export { MessageMethod, type MessageRequest, sendMessage, sendMessageAsObservable } from './messaging';
10
+ export { getPreference, getPreferenceAsObservable } from './preferences';
10
11
  export { type FilterExpression } from './filter-expressions';
11
12
  export { type SortField, type DataSortField, type BaseListDataRequest, type PagedListDataRequest, type ListDataResponse, type ListDataOptions, type ListDataSearchOptions, type MassEditValueType, type MassEditRequest, type MassDeleteRequest, type MassChangeResponse, getListData, getListDataAsObservable, massEdit, massEditAsObservable, massDelete, massDeleteAsObservable } from './lists';
13
+ export { type AggregationRequest, type AggregationResponse, type AggregationGroup, type AggregationSort, type Aggregation, type AggregationGroupTransform, type TransformType, type AggregationType, getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
12
14
  export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/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