@halix/action-sdk 1.0.23 → 1.0.25

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 (52) hide show
  1. package/lib/cjs/content.js +12 -70
  2. package/lib/cjs/data-crud.js +49 -117
  3. package/lib/cjs/index.js +8 -1
  4. package/lib/cjs/lists.js +37 -176
  5. package/lib/cjs/messaging.js +13 -59
  6. package/lib/cjs/preferences.js +75 -0
  7. package/lib/cjs/sdk-general.js +6 -18
  8. package/lib/cjs/types/content.d.ts +12 -70
  9. package/lib/cjs/types/content.d.ts.map +1 -1
  10. package/lib/cjs/types/data-crud.d.ts +24 -117
  11. package/lib/cjs/types/data-crud.d.ts.map +1 -1
  12. package/lib/cjs/types/filter-expressions.d.ts +35 -107
  13. package/lib/cjs/types/filter-expressions.d.ts.map +1 -1
  14. package/lib/cjs/types/index.d.ts +1 -0
  15. package/lib/cjs/types/index.d.ts.map +1 -1
  16. package/lib/cjs/types/lists.d.ts +22 -177
  17. package/lib/cjs/types/lists.d.ts.map +1 -1
  18. package/lib/cjs/types/messaging.d.ts +8 -59
  19. package/lib/cjs/types/messaging.d.ts.map +1 -1
  20. package/lib/cjs/types/preferences.d.ts +17 -0
  21. package/lib/cjs/types/preferences.d.ts.map +1 -0
  22. package/lib/cjs/types/sdk-general.d.ts +23 -78
  23. package/lib/cjs/types/sdk-general.d.ts.map +1 -1
  24. package/lib/cjs/types/utilities.d.ts +9 -29
  25. package/lib/cjs/types/utilities.d.ts.map +1 -1
  26. package/lib/cjs/utilities.js +9 -29
  27. package/lib/esm/content.js +12 -70
  28. package/lib/esm/content.js.map +1 -1
  29. package/lib/esm/data-crud.js +49 -117
  30. package/lib/esm/data-crud.js.map +1 -1
  31. package/lib/esm/index.js.map +1 -1
  32. package/lib/esm/index.mjs +6 -0
  33. package/lib/esm/lists.js +37 -176
  34. package/lib/esm/lists.js.map +1 -1
  35. package/lib/esm/messaging.js +13 -59
  36. package/lib/esm/messaging.js.map +1 -1
  37. package/lib/esm/preferences.js +57 -0
  38. package/lib/esm/preferences.js.map +1 -0
  39. package/lib/esm/sdk-general.js +13 -45
  40. package/lib/esm/sdk-general.js.map +1 -1
  41. package/lib/esm/types/content.d.ts +12 -70
  42. package/lib/esm/types/data-crud.d.ts +24 -117
  43. package/lib/esm/types/filter-expressions.d.ts +35 -107
  44. package/lib/esm/types/index.d.ts +1 -0
  45. package/lib/esm/types/lists.d.ts +22 -177
  46. package/lib/esm/types/messaging.d.ts +8 -59
  47. package/lib/esm/types/preferences.d.ts +16 -0
  48. package/lib/esm/types/sdk-general.d.ts +23 -78
  49. package/lib/esm/types/utilities.d.ts +9 -29
  50. package/lib/esm/utilities.js +9 -29
  51. package/lib/esm/utilities.js.map +1 -1
  52. package/package.json +1 -1
@@ -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,gBAwBlG;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,CA2BjL;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EA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AG,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,6 +7,7 @@ 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';
12
13
  export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAMH,OAAO,EAEH,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,MAAM,EACN,OAAO,EAGP,UAAU,EAGV,KAAK,WAAW,EAChB,KAAK,iBAAiB,EAGtB,KAAK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iBAAiB,EACtB,KAAK,kBAAkB,EAGvB,WAAW,EACX,uBAAuB,EACvB,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACzB,MAAM,SAAS,CAAC;AAMjB,OAAO,EACH,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACb,MAAM,aAAa,CAAC"}
@@ -60,7 +60,7 @@ export interface BaseListDataRequest {
60
60
  childKeysField?: string;
61
61
  /**
62
62
  * Filter expression to limit results. Evaluated within the parent key scope.
63
- * @see {@link FilterExpression} for filter syntax and examples
63
+ * @see the filter-expressions module for filter syntax and examples
64
64
  */
65
65
  filter?: FilterExpression;
66
66
  /**
@@ -201,24 +201,13 @@ export interface MassChangeResponse {
201
201
  failed: number;
202
202
  }
203
203
  /**
204
- * getListData retrieves list data from the Halix platform. This function can operate in four
205
- * different modes based on the provided options:
204
+ * Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
206
205
  *
207
- * 1. Authenticated list data retrieval (default)
208
- * 2. Public list data retrieval (when isPublic is true)
209
- * 3. Authenticated list data with search (when search options are provided)
210
- * 4. Public list data with search (when both isPublic and search options are provided)
211
- *
212
- * The search functionality uses binary search to efficiently locate items in a sorted list by
213
- * a specific attribute value.
214
- *
215
- * @param request - The list data request containing list configuration and parameters
216
- * @param options - Optional configuration for the request
217
- *
218
- * @returns Promise resolving to the list data response
206
+ * @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
207
+ * @param options - Optional: isPublic, bypassTotal, search
208
+ * @returns Promise<ListDataResponse> with data array, total count, pageNumber
219
209
  *
220
210
  * @example
221
- * // Basic authenticated list data retrieval
222
211
  * const listData = await getListData({
223
212
  * dataElementId: 'customer',
224
213
  * parentDataElementId: 'company',
@@ -227,199 +216,55 @@ export interface MassChangeResponse {
227
216
  * pageSize: 50,
228
217
  * displayFields: ['firstName', 'lastName', 'email']
229
218
  * });
230
- * console.log('Total customers:', listData.total);
231
- * console.log('Page:', listData.pageNumber);
232
- * console.log('Data:', listData.data);
233
- *
234
- * @example
235
- * // Public list data retrieval without authentication
236
- * const publicData = await getListData({
237
- * dataElementId: 'product',
238
- * parentDataElementId: 'catalog',
239
- * parentKey: orgProxyKey,
240
- * pageNumber: 1,
241
- * pageSize: 20
242
- * }, { isPublic: true });
243
- *
244
- * @example
245
- * // List data retrieval with binary search
246
- * const searchData = await getListData({
247
- * dataElementId: 'purchases',
248
- * parentDataElementId: 'customer',
249
- * parentKey: userProxyKey,
250
- * sort: [{ attributeId: 'invoiceNumber', descending: false }]
251
- * }, {
252
- * search: {
253
- * attributeId: 'invoiceNumber',
254
- * value: 'INV-123456',
255
- * total: 1000
256
- * }
257
- * });
258
- * console.log('Selected row index:', searchData.selectedRow);
259
219
  */
260
220
  export declare function getListData(request: PagedListDataRequest, options?: ListDataOptions): Promise<ListDataResponse>;
261
221
  /**
262
- * getListDataAsObservable retrieves list data from the Halix platform as an Observable. This
263
- * function operates in the same four modes as getListData.
264
- *
265
- * @param request - The list data request containing list configuration and parameters
266
- * @param options - Optional configuration for the request
267
- *
268
- * @returns Observable resolving to the list data response
222
+ * Observable version of getListData. See getListData for details.
269
223
  *
270
224
  * @example
271
- * // Basic authenticated list data retrieval as Observable
272
- * getListDataAsObservable({
273
- * dataElementId: 'customer',
274
- * parentDataElementId: 'company',
275
- * parentKey: userContext.orgProxyKey,
276
- * pageNumber: 1,
277
- * pageSize: 50
278
- * }).subscribe(response => {
279
- * console.log('Total customers:', response.total);
280
- * console.log('Page:', response.pageNumber);
281
- * console.log('Data:', response.data);
282
- * });
225
+ * getListDataAsObservable({ dataElementId: 'customer', parentDataElementId: 'company', parentKey: orgProxyKey })
226
+ * .subscribe(response => console.log(response.data));
283
227
  */
284
228
  export declare function getListDataAsObservable(request: PagedListDataRequest, options?: ListDataOptions): Observable<ListDataResponse>;
285
229
  /**
286
- * massEdit performs a bulk update operation on multiple records. This function allows you to
287
- * update a specific property on multiple objects in a single request.
288
- *
289
- * **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
290
- * be returned by the dataRequest can be updated. The keys array must reference records within
291
- * this scope. This allows efficient security validation without checking each record individually.
292
- *
293
- * The value can be set in two ways based on valueType:
294
- * - 'literal': Set the property to a literal value
295
- * - 'property': Copy the value from another property on the same object
296
- *
297
- * @param request - The mass edit request specifying what to update and how
230
+ * Bulk update multiple records. The dataRequest defines security scope; only records within that scope can be updated.
231
+ * Use valueType 'literal' to set a value, or 'property' to copy from another field.
298
232
  *
299
- * @returns Promise resolving to statistics about the operation
233
+ * @param request - keys[], dataRequest (scope), dataElementId, property, valueType, value
234
+ * @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
300
235
  *
301
236
  * @example
302
- * // Update the status of multiple orders to 'shipped'
303
237
  * const result = await massEdit({
304
- * keys: ['order-123', 'order-456', 'order-789'],
305
- * dataRequest: {
306
- * dataElementId: 'order',
307
- * parentDataElementId: 'company',
308
- * parentKey: orgProxyKey
309
- * },
238
+ * keys: ['order-123', 'order-456'],
239
+ * dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
310
240
  * dataElementId: 'order',
311
241
  * property: 'status',
312
242
  * valueType: 'literal',
313
243
  * value: 'shipped'
314
244
  * });
315
- * console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
316
- *
317
- * @example
318
- * // Copy shipping address to billing address for multiple customers
319
- * const result = await massEdit({
320
- * keys: selectedCustomerKeys,
321
- * dataRequest: {
322
- * dataElementId: 'customer',
323
- * parentDataElementId: 'company',
324
- * parentKey: orgProxyKey
325
- * },
326
- * dataElementId: 'customer',
327
- * property: 'billingAddress',
328
- * valueType: 'property',
329
- * value: 'shippingAddress'
330
- * });
331
245
  */
332
246
  export declare function massEdit(request: MassEditRequest): Promise<MassChangeResponse>;
333
247
  /**
334
- * massEditAsObservable performs a bulk update operation on multiple records, returning an Observable.
335
- * See massEdit for detailed documentation.
336
- *
337
- * @param request - The mass edit request specifying what to update and how
338
- *
339
- * @returns Observable resolving to statistics about the operation
340
- *
341
- * @example
342
- * massEditAsObservable({
343
- * keys: ['order-123', 'order-456'],
344
- * dataRequest: {
345
- * dataElementId: 'order',
346
- * parentDataElementId: 'company',
347
- * parentKey: orgProxyKey
348
- * },
349
- * dataElementId: 'order',
350
- * property: 'status',
351
- * valueType: 'literal',
352
- * value: 'shipped'
353
- * }).subscribe(result => {
354
- * console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
355
- * });
248
+ * Observable version of massEdit. See massEdit for details.
356
249
  */
357
250
  export declare function massEditAsObservable(request: MassEditRequest): Observable<MassChangeResponse>;
358
251
  /**
359
- * massDelete performs a bulk delete operation on multiple records. This function allows you to
360
- * soft-delete multiple objects in a single request.
361
- *
362
- * **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
363
- * be returned by the dataRequest can be deleted. The keys array must reference records within
364
- * this scope. This allows efficient security validation without checking each record individually.
365
- *
366
- * If emptyList is set to true, all records returned by the dataRequest will be deleted,
367
- * ignoring the keys array.
368
- *
369
- * @param request - The mass delete request specifying what to delete
252
+ * Bulk soft-delete multiple records. The dataRequest defines security scope; only records within that scope can be deleted.
253
+ * Set emptyList: true to delete all records matching dataRequest (ignores keys array).
370
254
  *
371
- * @returns Promise resolving to statistics about the operation
255
+ * @param request - keys[], dataRequest (scope), dataElementId, emptyList?
256
+ * @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
372
257
  *
373
258
  * @example
374
- * // Delete specific orders
375
259
  * const result = await massDelete({
376
- * keys: ['order-123', 'order-456', 'order-789'],
377
- * dataRequest: {
378
- * dataElementId: 'order',
379
- * parentDataElementId: 'company',
380
- * parentKey: orgProxyKey,
381
- * filter: { field: 'status', operator: '==', value: 'cancelled' }
382
- * },
260
+ * keys: ['order-123', 'order-456'],
261
+ * dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
383
262
  * dataElementId: 'order'
384
263
  * });
385
- * console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
386
- *
387
- * @example
388
- * // Delete all records matching the filter
389
- * const result = await massDelete({
390
- * keys: [],
391
- * dataRequest: {
392
- * dataElementId: 'tempRecord',
393
- * parentDataElementId: 'company',
394
- * parentKey: orgProxyKey,
395
- * filter: { field: 'createdDate', operator: '<', value: '2023-01-01' }
396
- * },
397
- * dataElementId: 'tempRecord',
398
- * emptyList: true
399
- * });
400
- * console.log(`Deleted ${result.succeeded} old records`);
401
264
  */
402
265
  export declare function massDelete(request: MassDeleteRequest): Promise<MassChangeResponse>;
403
266
  /**
404
- * massDeleteAsObservable performs a bulk delete operation on multiple records, returning an Observable.
405
- * See massDelete for detailed documentation.
406
- *
407
- * @param request - The mass delete request specifying what to delete
408
- *
409
- * @returns Observable resolving to statistics about the operation
410
- *
411
- * @example
412
- * massDeleteAsObservable({
413
- * keys: ['order-123', 'order-456'],
414
- * dataRequest: {
415
- * dataElementId: 'order',
416
- * parentDataElementId: 'company',
417
- * parentKey: orgProxyKey
418
- * },
419
- * dataElementId: 'order'
420
- * }).subscribe(result => {
421
- * console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
422
- * });
267
+ * Observable version of massDelete. See massDelete for details.
423
268
  */
424
269
  export declare function massDeleteAsObservable(request: MassDeleteRequest): Observable<MassChangeResponse>;
425
270
  //# sourceMappingURL=lists.d.ts.map