@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
package/lib/esm/index.mjs CHANGED
@@ -46,12 +46,24 @@ MessageMethod,
46
46
  // Messaging Functions
47
47
  sendMessage, sendMessageAsObservable } from './messaging';
48
48
  // ================================================================================
49
+ // PREFERENCE FUNCTIONS
50
+ // ================================================================================
51
+ export {
52
+ // Preference Functions
53
+ getPreference, getPreferenceAsObservable } from './preferences';
54
+ // ================================================================================
49
55
  // LIST DATA FUNCTIONS
50
56
  // ================================================================================
51
57
  export {
52
58
  // Functions
53
59
  getListData, getListDataAsObservable, massEdit, massEditAsObservable, massDelete, massDeleteAsObservable } from './lists';
54
60
  // ================================================================================
61
+ // DATA AGGREGATE FUNCTIONS
62
+ // ================================================================================
63
+ export {
64
+ // Functions
65
+ getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
66
+ // ================================================================================
55
67
  // UTILITY FUNCTIONS
56
68
  // ================================================================================
57
69
  export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
package/lib/esm/lists.js CHANGED
@@ -14,6 +14,7 @@
14
14
  *
15
15
  * Key features:
16
16
  * - Efficient retrieval of one page of data at a time
17
+ * - Supports related object retrieval
17
18
  * - Pagination
18
19
  * - Sorting
19
20
  * - Filtering
@@ -28,24 +29,13 @@ import { sandboxKey, serviceAddress, getAuthToken } from './sdk-general';
28
29
  // LIST DATA RETRIEVAL FUNCTIONS
29
30
  // ================================================================================
30
31
  /**
31
- * getListData retrieves list data from the Halix platform. This function can operate in four
32
- * different modes based on the provided options:
32
+ * Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
33
33
  *
34
- * 1. Authenticated list data retrieval (default)
35
- * 2. Public list data retrieval (when isPublic is true)
36
- * 3. Authenticated list data with search (when search options are provided)
37
- * 4. Public list data with search (when both isPublic and search options are provided)
38
- *
39
- * The search functionality uses binary search to efficiently locate items in a sorted list by
40
- * a specific attribute value.
41
- *
42
- * @param request - The list data request containing list configuration and parameters
43
- * @param options - Optional configuration for the request
44
- *
45
- * @returns Promise resolving to the list data response
34
+ * @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
35
+ * @param options - Optional: isPublic, bypassTotal, search
36
+ * @returns Promise<ListDataResponse> with data array, total count, pageNumber
46
37
  *
47
38
  * @example
48
- * // Basic authenticated list data retrieval
49
39
  * const listData = await getListData({
50
40
  * dataElementId: 'customer',
51
41
  * parentDataElementId: 'company',
@@ -54,35 +44,6 @@ import { sandboxKey, serviceAddress, getAuthToken } from './sdk-general';
54
44
  * pageSize: 50,
55
45
  * displayFields: ['firstName', 'lastName', 'email']
56
46
  * });
57
- * console.log('Total customers:', listData.total);
58
- * console.log('Page:', listData.pageNumber);
59
- * console.log('Data:', listData.data);
60
- *
61
- * @example
62
- * // Public list data retrieval without authentication
63
- * const publicData = await getListData({
64
- * dataElementId: 'product',
65
- * parentDataElementId: 'catalog',
66
- * parentKey: orgProxyKey,
67
- * pageNumber: 1,
68
- * pageSize: 20
69
- * }, { isPublic: true });
70
- *
71
- * @example
72
- * // List data retrieval with binary search
73
- * const searchData = await getListData({
74
- * dataElementId: 'purchases',
75
- * parentDataElementId: 'customer',
76
- * parentKey: userProxyKey,
77
- * sort: [{ attributeId: 'invoiceNumber', descending: false }]
78
- * }, {
79
- * search: {
80
- * attributeId: 'invoiceNumber',
81
- * value: 'INV-123456',
82
- * total: 1000
83
- * }
84
- * });
85
- * console.log('Selected row index:', searchData.selectedRow);
86
47
  */
87
48
  export async function getListData(request, options) {
88
49
  const isPublic = options?.isPublic ?? false;
@@ -136,27 +97,11 @@ export async function getListData(request, options) {
136
97
  return response.data;
137
98
  }
138
99
  /**
139
- * getListDataAsObservable retrieves list data from the Halix platform as an Observable. This
140
- * function operates in the same four modes as getListData.
141
- *
142
- * @param request - The list data request containing list configuration and parameters
143
- * @param options - Optional configuration for the request
144
- *
145
- * @returns Observable resolving to the list data response
100
+ * Observable version of getListData. See getListData for details.
146
101
  *
147
102
  * @example
148
- * // Basic authenticated list data retrieval as Observable
149
- * getListDataAsObservable({
150
- * dataElementId: 'customer',
151
- * parentDataElementId: 'company',
152
- * parentKey: userContext.orgProxyKey,
153
- * pageNumber: 1,
154
- * pageSize: 50
155
- * }).subscribe(response => {
156
- * console.log('Total customers:', response.total);
157
- * console.log('Page:', response.pageNumber);
158
- * console.log('Data:', response.data);
159
- * });
103
+ * getListDataAsObservable({ dataElementId: 'customer', parentDataElementId: 'company', parentKey: orgProxyKey })
104
+ * .subscribe(response => console.log(response.data));
160
105
  */
161
106
  export function getListDataAsObservable(request, options) {
162
107
  return from(getListData(request, options));
@@ -165,51 +110,21 @@ export function getListDataAsObservable(request, options) {
165
110
  // MASS EDIT AND DELETE FUNCTIONS
166
111
  // ================================================================================
167
112
  /**
168
- * massEdit performs a bulk update operation on multiple records. This function allows you to
169
- * update a specific property on multiple objects in a single request.
170
- *
171
- * **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
172
- * be returned by the dataRequest can be updated. The keys array must reference records within
173
- * this scope. This allows efficient security validation without checking each record individually.
174
- *
175
- * The value can be set in two ways based on valueType:
176
- * - 'literal': Set the property to a literal value
177
- * - 'property': Copy the value from another property on the same object
178
- *
179
- * @param request - The mass edit request specifying what to update and how
113
+ * Bulk update multiple records. The dataRequest defines security scope; only records within that scope can be updated.
114
+ * Use valueType 'literal' to set a value, or 'property' to copy from another field.
180
115
  *
181
- * @returns Promise resolving to statistics about the operation
116
+ * @param request - keys[], dataRequest (scope), dataElementId, property, valueType, value
117
+ * @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
182
118
  *
183
119
  * @example
184
- * // Update the status of multiple orders to 'shipped'
185
120
  * const result = await massEdit({
186
- * keys: ['order-123', 'order-456', 'order-789'],
187
- * dataRequest: {
188
- * dataElementId: 'order',
189
- * parentDataElementId: 'company',
190
- * parentKey: orgProxyKey
191
- * },
121
+ * keys: ['order-123', 'order-456'],
122
+ * dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
192
123
  * dataElementId: 'order',
193
124
  * property: 'status',
194
125
  * valueType: 'literal',
195
126
  * value: 'shipped'
196
127
  * });
197
- * console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
198
- *
199
- * @example
200
- * // Copy shipping address to billing address for multiple customers
201
- * const result = await massEdit({
202
- * keys: selectedCustomerKeys,
203
- * dataRequest: {
204
- * dataElementId: 'customer',
205
- * parentDataElementId: 'company',
206
- * parentKey: orgProxyKey
207
- * },
208
- * dataElementId: 'customer',
209
- * property: 'billingAddress',
210
- * valueType: 'property',
211
- * value: 'shippingAddress'
212
- * });
213
128
  */
214
129
  export async function massEdit(request) {
215
130
  if (!getAuthToken) {
@@ -229,75 +144,24 @@ export async function massEdit(request) {
229
144
  return response.data;
230
145
  }
231
146
  /**
232
- * massEditAsObservable performs a bulk update operation on multiple records, returning an Observable.
233
- * See massEdit for detailed documentation.
234
- *
235
- * @param request - The mass edit request specifying what to update and how
236
- *
237
- * @returns Observable resolving to statistics about the operation
238
- *
239
- * @example
240
- * massEditAsObservable({
241
- * keys: ['order-123', 'order-456'],
242
- * dataRequest: {
243
- * dataElementId: 'order',
244
- * parentDataElementId: 'company',
245
- * parentKey: orgProxyKey
246
- * },
247
- * dataElementId: 'order',
248
- * property: 'status',
249
- * valueType: 'literal',
250
- * value: 'shipped'
251
- * }).subscribe(result => {
252
- * console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
253
- * });
147
+ * Observable version of massEdit. See massEdit for details.
254
148
  */
255
149
  export function massEditAsObservable(request) {
256
150
  return from(massEdit(request));
257
151
  }
258
152
  /**
259
- * massDelete performs a bulk delete operation on multiple records. This function allows you to
260
- * soft-delete multiple objects in a single request.
261
- *
262
- * **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
263
- * be returned by the dataRequest can be deleted. The keys array must reference records within
264
- * this scope. This allows efficient security validation without checking each record individually.
265
- *
266
- * If emptyList is set to true, all records returned by the dataRequest will be deleted,
267
- * ignoring the keys array.
268
- *
269
- * @param request - The mass delete request specifying what to delete
153
+ * Bulk soft-delete multiple records. The dataRequest defines security scope; only records within that scope can be deleted.
154
+ * Set emptyList: true to delete all records matching dataRequest (ignores keys array).
270
155
  *
271
- * @returns Promise resolving to statistics about the operation
156
+ * @param request - keys[], dataRequest (scope), dataElementId, emptyList?
157
+ * @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
272
158
  *
273
159
  * @example
274
- * // Delete specific orders
275
160
  * const result = await massDelete({
276
- * keys: ['order-123', 'order-456', 'order-789'],
277
- * dataRequest: {
278
- * dataElementId: 'order',
279
- * parentDataElementId: 'company',
280
- * parentKey: orgProxyKey,
281
- * filter: { field: 'status', operator: '==', value: 'cancelled' }
282
- * },
161
+ * keys: ['order-123', 'order-456'],
162
+ * dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
283
163
  * dataElementId: 'order'
284
164
  * });
285
- * console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
286
- *
287
- * @example
288
- * // Delete all records matching the filter
289
- * const result = await massDelete({
290
- * keys: [],
291
- * dataRequest: {
292
- * dataElementId: 'tempRecord',
293
- * parentDataElementId: 'company',
294
- * parentKey: orgProxyKey,
295
- * filter: { field: 'createdDate', operator: '<', value: '2023-01-01' }
296
- * },
297
- * dataElementId: 'tempRecord',
298
- * emptyList: true
299
- * });
300
- * console.log(`Deleted ${result.succeeded} old records`);
301
165
  */
302
166
  export async function massDelete(request) {
303
167
  if (!getAuthToken) {
@@ -317,25 +181,7 @@ export async function massDelete(request) {
317
181
  return response.data;
318
182
  }
319
183
  /**
320
- * massDeleteAsObservable performs a bulk delete operation on multiple records, returning an Observable.
321
- * See massDelete for detailed documentation.
322
- *
323
- * @param request - The mass delete request specifying what to delete
324
- *
325
- * @returns Observable resolving to statistics about the operation
326
- *
327
- * @example
328
- * massDeleteAsObservable({
329
- * keys: ['order-123', 'order-456'],
330
- * dataRequest: {
331
- * dataElementId: 'order',
332
- * parentDataElementId: 'company',
333
- * parentKey: orgProxyKey
334
- * },
335
- * dataElementId: 'order'
336
- * }).subscribe(result => {
337
- * console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
338
- * });
184
+ * Observable version of massDelete. See massDelete for details.
339
185
  */
340
186
  export function massDeleteAsObservable(request) {
341
187
  return from(massDelete(request));
@@ -1 +1 @@
1
- {"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/lists.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,aAAa,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsOzE,mFAAmF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AAC,CAAC,CAAC;AACrC,CAAC"}
@@ -33,49 +33,19 @@ export var MessageMethod;
33
33
  // MESSAGING FUNCTIONS
34
34
  // ================================================================================
35
35
  /**
36
- * sendMessage sends a message (email and/or text) to recipients through the Halix notification
37
- * service. The message is sent asynchronously - this function returns immediately after the
38
- * message is queued for sending.
36
+ * Sends email/text message to recipients. Returns when message is queued (sent asynchronously).
39
37
  *
40
- * @param orgProxyElementId - The ID of the organization proxy element (e.g., "business", "school")
41
- * @param orgProxyKey - The key of the organization proxy object
42
- * @param message - The message request object containing recipients, content, and delivery options
43
- *
44
- * @returns Promise that resolves when the message has been queued for sending
38
+ * @param orgProxyElementId - Org proxy element ID (e.g., "business")
39
+ * @param orgProxyKey - Org proxy key
40
+ * @param message - MessageRequest with userProxyKeys/directEmailAddresses, subject, body, sentAs, replyToEmail, resourceKeys
41
+ * @returns Promise<void> - resolves when queued
45
42
  *
46
43
  * @example
47
- * ```typescript
48
- * // Send an email to customers (sentAs defaults to email)
49
44
  * await sendMessage('business', businessKey, {
50
- * userProxyKeys: [customerKey1, customerKey2, customerKey3],
45
+ * userProxyKeys: [customerKey1, customerKey2],
51
46
  * subject: 'Important Announcement',
52
- * body: '<p>This is an important announcement.</p>',
53
- * replyToEmail: 'sender@example.com'
54
- * });
55
- * ```
56
- *
57
- * @example
58
- * ```typescript
59
- * // Send to user proxies and direct email addresses
60
- * await sendMessage('business', businessKey, {
61
- * userProxyKeys: [clientKey1, clientKey2],
62
- * directEmailAddresses: ['manager@example.com'],
63
- * sentAs: MessageMethod.EmailAndText,
64
- * subject: 'Project Reminder',
65
- * body: '<p>Don\'t forget about the deadline.</p>',
66
- * resourceKeys: [attachmentKey]
67
- * });
68
- * ```
69
- *
70
- * @example
71
- * ```typescript
72
- * // Send email to direct addresses only (no user proxies)
73
- * await sendMessage('business', businessKey, {
74
- * directEmailAddresses: ['partner@example.com', 'vendor@example.com'],
75
- * subject: 'External Notification',
76
- * body: '<p>Important information for external stakeholders.</p>'
47
+ * body: '<p>This is an important announcement.</p>'
77
48
  * });
78
- * ```
79
49
  */
80
50
  export async function sendMessage(orgProxyElementId, orgProxyKey, message) {
81
51
  // Build the server request from the simplified client request
@@ -109,28 +79,7 @@ export async function sendMessage(orgProxyElementId, orgProxyKey, message) {
109
79
  // This function returns once the message has been queued, not when delivery is complete
110
80
  }
111
81
  /**
112
- * sendMessageAsObservable sends a message (email and/or text) to recipients through the Halix
113
- * notification service. The message is sent asynchronously - this observable completes immediately
114
- * after the message is queued for sending.
115
- *
116
- * @param orgProxyElementId - The ID of the organization proxy element (e.g., "business", "school")
117
- * @param orgProxyKey - The key of the organization proxy object
118
- * @param message - The message request object containing recipients, content, and delivery options
119
- *
120
- * @returns Observable that completes when the message has been queued for sending
121
- *
122
- * @example
123
- * ```typescript
124
- * sendMessageAsObservable('business', businessKey, {
125
- * userProxyKeys: [customerKey1, customerKey2],
126
- * directEmailAddresses: ['admin@example.com'],
127
- * subject: 'Monthly Newsletter',
128
- * body: '<p>Newsletter content here...</p>'
129
- * }).subscribe({
130
- * next: () => console.log('Message queued for sending'),
131
- * error: (err) => console.error('Failed to send message:', err)
132
- * });
133
- * ```
82
+ * Observable version of sendMessage. See sendMessage for details.
134
83
  */
135
84
  export function sendMessageAsObservable(orgProxyElementId, orgProxyKey, message) {
136
85
  return from(sendMessage(orgProxyElementId, orgProxyKey, message));
@@ -1 +1 @@
1
- {"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/messaging.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,aAAa,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEzE,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wF;AAC5F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,iBAAyB,EAAE,WAAmB,EAAE,OAAuB;IAC3G,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,57 @@
1
+ // Halix SDK License v1.0
2
+ // Copyright (c) 2025 halix.io LLC.
3
+ //
4
+ // This source code is licensed for use **only** within applications
5
+ // running on the Halix platform, in accordance with Halix SDK guidelines.
6
+ //
7
+ // Unauthorized use outside the Halix platform is prohibited.
8
+ // Full license terms available in the LICENSE file.
9
+ /**
10
+ * @module @halix/action-sdk/preferences
11
+ * @description Preference management functions for the Halix Platform action SDK. This module
12
+ * provides functions for retrieving preference values.
13
+ */
14
+ import axios from 'axios';
15
+ import { from, lastValueFrom } from 'rxjs';
16
+ import { serviceAddress, getAuthToken, userContext } from './sdk-general';
17
+ // ================================================================================
18
+ // PREFERENCE RETRIEVAL FUNCTIONS
19
+ // ================================================================================
20
+ /**
21
+ * Retrieves a preference value for the current user.
22
+ *
23
+ * @param prefID - The preference ID to retrieve
24
+ * @returns Promise<any> - the preference value
25
+ * @throws Error if SDK not initialized or user context not available
26
+ *
27
+ * @example
28
+ * const preferenceValue = await getPreference('myPreferenceId');
29
+ */
30
+ export async function getPreference(prefID) {
31
+ if (!getAuthToken) {
32
+ const errorMessage = 'SDK not initialized.';
33
+ console.error(errorMessage);
34
+ throw new Error(errorMessage);
35
+ }
36
+ if (!userContext?.user?.objKey) {
37
+ const errorMessage = 'User context not available. Cannot retrieve preference value.';
38
+ console.error(errorMessage);
39
+ throw new Error(errorMessage);
40
+ }
41
+ const ownerElementID = 'user';
42
+ const ownerKey = userContext.user.objKey;
43
+ let url = `${serviceAddress}/sysapi/preference/${prefID}/${ownerElementID}/${ownerKey}`;
44
+ let authToken = await lastValueFrom(getAuthToken());
45
+ console.log("Sending GET request to " + url + " with token " + authToken);
46
+ let response = await axios.get(url, {
47
+ headers: { "Authorization": `Bearer ${authToken}` },
48
+ });
49
+ return response.data;
50
+ }
51
+ /**
52
+ * Observable version of getPreference. See getPreference for details.
53
+ */
54
+ export function getPreferenceAsObservable(prefID) {
55
+ return from(getPreference(prefID));
56
+ }
57
+ //# sourceMappingURL=preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/preferences.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,aAAa,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE1E,mFAAmF;AACnF,iCAAiC;AACjC,mFAAmF;AAEnF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC7B,MAAM,YAAY,GAAG,+DAA+D,CAAC;QACrF,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC;IAC9B,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IAEzC,IAAI,GAAG,GAAG,GAAG,cAAc,sBAAsB,MAAM,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;IAExF,IAAI,SAAS,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IAEpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;IAE1E,IAAI,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;QAChC,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,SAAS,EAAE,EAAE;KACtD,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACpD,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -24,59 +24,37 @@ import { of } from 'rxjs';
24
24
  // GLOBAL VARIABLES AND INITIALIZATION
25
25
  // ================================================================================
26
26
  /**
27
- * authToken contains the authentication token that the action handler can use to make API requests
28
- * to Halix web services. This value is set upon calling the initialize function with incoming event
29
- * data.
27
+ * Authentication token for API requests. Set by initialize().
30
28
  */
31
29
  export let getAuthToken;
32
30
  /**
33
- * sandboxKey contains the sandbox key identifier; identifies the sandbox that the action handler is
34
- * running in. The sandbox identifies the current solution. This value is set upon calling the
35
- * initialize function with incoming event data.
31
+ * Sandbox key identifier for the current solution. Set by initialize().
36
32
  */
37
33
  export let sandboxKey;
38
34
  /**
39
- * serviceAddress contains the URL of the Halix service that the action handler can use to make API
40
- * requests to. This value is set upon calling the initialize function with incoming event data.
35
+ * Halix service URL for API requests. Set by initialize().
41
36
  */
42
37
  export let serviceAddress;
43
38
  /**
44
- * actionSubject contains the identifier of the subject of the action. The subject is the object
45
- * that the action is being performed on. The action subject's contents will differ depending on the
46
- * context in which the action is being executed. This value is set upon calling the initialize
47
- * function with incoming event data.
48
- * - for formTemplateActions, the action subject is the data being edited on the form
49
- * - for pageTemplateActions, the action subject is record containing the context variables and
50
- * their corresponding values on the page
51
- * - for objectSaveActions, the action subject is the object being saved
52
- * - for calculatedFieldActions, the action subject is the object containing the calculated field
53
- * - for singleValueActions, the action subject may differ depending on the caller
39
+ * Subject of the action (context-dependent: form data, page variables, object being saved, etc.). Set by initialize().
54
40
  */
55
41
  export let actionSubject;
56
42
  /**
57
- * userContext contains the user context information for the user that is executing the action.
58
- * This value is set upon calling the initialize function with incoming event data.
43
+ * User context (user, userProxy, orgProxy, keys). Set by initialize().
59
44
  */
60
45
  export let userContext;
61
46
  /**
62
- * params contains the parameters passed to the action. If an input dialog is used, params will
63
- * contain the values entered in the dialog. This value is set upon calling the initialize
64
- * function with incoming event data.
47
+ * Parameters passed to the action (e.g., from input dialog). Set by initialize().
65
48
  */
66
49
  export let params;
67
50
  /**
68
- * useBody is a flag indicating how responses should be formatted. If true, the response will be
69
- * returned as an object with the HTTP response code and ActionResponse in the body field. If false,
70
- * the ActionResponse will be returned directly. Typically, this does not need to be set by the
71
- * action handler and should remain false.
51
+ * Response format flag (internal). Typically leave as false.
72
52
  */
73
53
  export let useBody;
74
54
  /**
75
- * initialize initializes the SDK with event data. This should be called at the beginning of the
76
- * action handler to set up the SDK with incoming information, including context information, input
77
- * parameters, and authentication information needed to make API requests to the Halix service.
55
+ * Initializes SDK with event data. Call at the beginning of action handler to set up authentication, context, and parameters.
78
56
  *
79
- * @param event - The event object containing authentication and context information
57
+ * @param event - Event object with body containing IncomingEventBody
80
58
  */
81
59
  export function initialize(event) {
82
60
  let body = event;
@@ -98,14 +76,9 @@ export function initialize(event) {
98
76
  // RESPONSE HELPER FUNCTIONS
99
77
  // ================================================================================
100
78
  /**
101
- * prepareSuccessResponse prepares a success response in the appropriate format. The action handler
102
- * should return an ActionResponse response when the action is successful. If useBody is true, the
103
- * response will be returned as an object with the HTTP response code and the ActionResponse in the
104
- * body field. If useBody is false, the ActionResponse will be returned directly.
79
+ * Formats a success response. Returns ActionResponse directly, or wrapped with statusCode if useBody is true.
105
80
  *
106
- * @param successResponse - The value to return
107
- *
108
- * @returns Formatted success response; an ActionResponse unless useBody is true
81
+ * @returns ActionResponse or {statusCode: 200, body: string}
109
82
  */
110
83
  export function prepareSuccessResponse(successResponse) {
111
84
  if (useBody) {
@@ -117,14 +90,9 @@ export function prepareSuccessResponse(successResponse) {
117
90
  return successResponse;
118
91
  }
119
92
  /**
120
- * prepareErrorResponse prepares an error response in the appropriate format. The action handler
121
- * should return an ErrorResponse response when the action is not successful. If useBody is true,
122
- * the response will be returned as an object with the HTTP response code and the ErrorResponse in
123
- * the body field. If useBody is false, the ErrorResponse will be returned directly.
124
- *
125
- * @param errorMessage - The error message
93
+ * Formats an error response. Returns ErrorResponse directly, or wrapped with statusCode if useBody is true.
126
94
  *
127
- * @returns Formatted error response; an ErrorResponse unless useBody is true
95
+ * @returns ErrorResponse or {statusCode: 400, body: string}
128
96
  */
129
97
  export function prepareErrorResponse(errorMessage) {
130
98
  if (useBody) {
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-general.js","sourceRoot":"","sources":["../../src/sdk-general.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAc,EAAE,EAAE,MAAM,MAAM,CAAC;AAEtC,mFAAmF;AACnF,sCAAsC;AACtC,mFAAmF;AAEnF;;;;GAIG;AACH,MAAM,CAAC,IAAI,YAAsC,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,IAAI,UAAkB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,IAAI,cAAsB,CAAC;AAElC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,IAAI,aAAkB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,IAAI,WAAwB,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,IAAI,MAAc,C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