@halix/action-sdk 1.0.24 → 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.
- package/lib/cjs/content.js +12 -70
- package/lib/cjs/data-crud.js +24 -117
- package/lib/cjs/index.js +8 -1
- package/lib/cjs/lists.js +22 -176
- package/lib/cjs/messaging.js +8 -59
- package/lib/cjs/preferences.js +75 -0
- package/lib/cjs/sdk-general.js +6 -18
- package/lib/cjs/types/content.d.ts +12 -70
- package/lib/cjs/types/content.d.ts.map +1 -1
- package/lib/cjs/types/data-crud.d.ts +24 -117
- package/lib/cjs/types/data-crud.d.ts.map +1 -1
- package/lib/cjs/types/filter-expressions.d.ts +35 -107
- package/lib/cjs/types/filter-expressions.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/lists.d.ts +22 -177
- package/lib/cjs/types/lists.d.ts.map +1 -1
- package/lib/cjs/types/messaging.d.ts +8 -59
- package/lib/cjs/types/messaging.d.ts.map +1 -1
- package/lib/cjs/types/preferences.d.ts +17 -0
- package/lib/cjs/types/preferences.d.ts.map +1 -0
- package/lib/cjs/types/sdk-general.d.ts +23 -78
- package/lib/cjs/types/sdk-general.d.ts.map +1 -1
- package/lib/cjs/types/utilities.d.ts +9 -29
- package/lib/cjs/types/utilities.d.ts.map +1 -1
- package/lib/cjs/utilities.js +9 -29
- package/lib/esm/content.js +12 -70
- package/lib/esm/content.js.map +1 -1
- package/lib/esm/data-crud.js +24 -117
- package/lib/esm/data-crud.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.mjs +6 -0
- package/lib/esm/lists.js +22 -176
- package/lib/esm/lists.js.map +1 -1
- package/lib/esm/messaging.js +8 -59
- package/lib/esm/messaging.js.map +1 -1
- package/lib/esm/preferences.js +57 -0
- package/lib/esm/preferences.js.map +1 -0
- package/lib/esm/sdk-general.js +13 -45
- package/lib/esm/sdk-general.js.map +1 -1
- package/lib/esm/types/content.d.ts +12 -70
- package/lib/esm/types/data-crud.d.ts +24 -117
- package/lib/esm/types/filter-expressions.d.ts +35 -107
- package/lib/esm/types/index.d.ts +1 -0
- package/lib/esm/types/lists.d.ts +22 -177
- package/lib/esm/types/messaging.d.ts +8 -59
- package/lib/esm/types/preferences.d.ts +16 -0
- package/lib/esm/types/sdk-general.d.ts +23 -78
- package/lib/esm/types/utilities.d.ts +9 -29
- package/lib/esm/utilities.js +9 -29
- package/lib/esm/utilities.js.map +1 -1
- package/package.json +1 -1
package/lib/cjs/content.js
CHANGED
|
@@ -44,18 +44,9 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
44
44
|
// CONTENT RESOURCE FUNCTIONS
|
|
45
45
|
// ================================================================================
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* if the key is not provided. If a resource key is provided, it attempts to fetch the existing
|
|
49
|
-
* resource from the server. If no key is provided, it creates a new resource with the specified
|
|
50
|
-
* properties.
|
|
47
|
+
* Retrieves an existing content resource by key, or creates a new one if key is null.
|
|
51
48
|
*
|
|
52
|
-
* @
|
|
53
|
-
* @param fileToUpload - Optional file or blob to upload
|
|
54
|
-
* @param publicFlag - Whether the resource should be public
|
|
55
|
-
* @param resourceType - The type of resource
|
|
56
|
-
* @param tags - Array of tags for the resource
|
|
57
|
-
*
|
|
58
|
-
* @returns Promise resolving to a ContentResource
|
|
49
|
+
* @returns Promise<ContentResource>
|
|
59
50
|
*/
|
|
60
51
|
function getOrCreateResource(resourceKey, fileToUpload, publicFlag, resourceType, tags) {
|
|
61
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -96,29 +87,15 @@ function getOrCreateResource(resourceKey, fileToUpload, publicFlag, resourceType
|
|
|
96
87
|
});
|
|
97
88
|
}
|
|
98
89
|
/**
|
|
99
|
-
*
|
|
100
|
-
* if the key is not provided. If a resource key is provided, it attempts to fetch the existing
|
|
101
|
-
* resource from the server. If no key is provided, it creates a new resource with the specified
|
|
102
|
-
* properties.
|
|
103
|
-
*
|
|
104
|
-
* @param resourceKey - Optional key of the existing resource to retrieve
|
|
105
|
-
* @param fileToUpload - Optional file or blob to upload
|
|
106
|
-
* @param publicFlag - Whether the resource should be public
|
|
107
|
-
* @param resourceType - The type of resource
|
|
108
|
-
* @param tags - Array of tags for the resource
|
|
109
|
-
*
|
|
110
|
-
* @returns Observable resolving to a ContentResource
|
|
90
|
+
* Observable version of getOrCreateResource. See getOrCreateResource for details.
|
|
111
91
|
*/
|
|
112
92
|
function getOrCreateResourceAsObservable(resourceKey, fileToUpload, publicFlag, resourceType, tags) {
|
|
113
93
|
return (0, rxjs_1.from)(getOrCreateResource(resourceKey, fileToUpload, publicFlag, resourceType, tags));
|
|
114
94
|
}
|
|
115
95
|
/**
|
|
116
|
-
*
|
|
117
|
-
* ownership parameters based on the current context (solution builder vs regular organization view).
|
|
96
|
+
* Saves a content resource with appropriate ownership based on context (solution builder vs org view).
|
|
118
97
|
*
|
|
119
|
-
* @
|
|
120
|
-
*
|
|
121
|
-
* @returns Promise resolving to the saved ContentResource
|
|
98
|
+
* @returns Promise<ContentResource>
|
|
122
99
|
*/
|
|
123
100
|
function saveResource(resource) {
|
|
124
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -146,25 +123,15 @@ function saveResource(resource) {
|
|
|
146
123
|
});
|
|
147
124
|
}
|
|
148
125
|
/**
|
|
149
|
-
*
|
|
150
|
-
* ownership parameters based on the current context (solution builder vs regular organization view).
|
|
151
|
-
*
|
|
152
|
-
* @param resource - The ContentResource to save
|
|
153
|
-
*
|
|
154
|
-
* @returns Observable resolving to the saved ContentResource
|
|
126
|
+
* Observable version of saveResource. See saveResource for details.
|
|
155
127
|
*/
|
|
156
128
|
function saveResourceAsObservable(resource) {
|
|
157
129
|
return (0, rxjs_1.from)(saveResource(resource));
|
|
158
130
|
}
|
|
159
131
|
/**
|
|
160
|
-
*
|
|
161
|
-
* via FormData with the appropriate scope and public flag settings.
|
|
132
|
+
* Uploads file contents to a resource via FormData.
|
|
162
133
|
*
|
|
163
|
-
* @
|
|
164
|
-
* @param fileToUpload - The file or blob to upload
|
|
165
|
-
* @param publicFlag - Whether the file should be public
|
|
166
|
-
*
|
|
167
|
-
* @returns Promise resolving to true if upload was successful
|
|
134
|
+
* @returns Promise<boolean> - true if successful
|
|
168
135
|
*/
|
|
169
136
|
function sendFileContents(resourceKey, fileToUpload, publicFlag) {
|
|
170
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -188,30 +155,15 @@ function sendFileContents(resourceKey, fileToUpload, publicFlag) {
|
|
|
188
155
|
});
|
|
189
156
|
}
|
|
190
157
|
/**
|
|
191
|
-
*
|
|
192
|
-
* via FormData with the appropriate scope and public flag settings.
|
|
193
|
-
*
|
|
194
|
-
* @param resourceKey - The key of the resource to upload file contents for
|
|
195
|
-
* @param fileToUpload - The file or blob to upload
|
|
196
|
-
* @param publicFlag - Whether the file should be public
|
|
197
|
-
*
|
|
198
|
-
* @returns Observable resolving to true if upload was successful
|
|
158
|
+
* Observable version of sendFileContents. See sendFileContents for details.
|
|
199
159
|
*/
|
|
200
160
|
function sendFileContentsAsObservable(resourceKey, fileToUpload, publicFlag) {
|
|
201
161
|
return (0, rxjs_1.from)(sendFileContents(resourceKey, fileToUpload, publicFlag));
|
|
202
162
|
}
|
|
203
163
|
/**
|
|
204
|
-
*
|
|
205
|
-
* the file contents to that resource. If a resourceKey is provided, it updates the existing resource;
|
|
206
|
-
* otherwise, it creates a new resource and uploads the file to the newly created resource.
|
|
164
|
+
* Creates or updates a content resource and uploads file contents. If resourceKey is provided, updates existing; otherwise creates new.
|
|
207
165
|
*
|
|
208
|
-
* @
|
|
209
|
-
* @param fileToUpload - The file or blob to upload
|
|
210
|
-
* @param publicFlag - Whether the resource should be public
|
|
211
|
-
* @param resourceType - The type of resource
|
|
212
|
-
* @param tags - Array of tags for the resource
|
|
213
|
-
*
|
|
214
|
-
* @returns Promise resolving to the ContentResource with uploaded file
|
|
166
|
+
* @returns Promise<ContentResource> with uploaded file metadata
|
|
215
167
|
*/
|
|
216
168
|
function createOrUpdateResource(resourceKey, fileToUpload, publicFlag, resourceType, tags) {
|
|
217
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -240,17 +192,7 @@ function createOrUpdateResource(resourceKey, fileToUpload, publicFlag, resourceT
|
|
|
240
192
|
});
|
|
241
193
|
}
|
|
242
194
|
/**
|
|
243
|
-
*
|
|
244
|
-
* the file contents to that resource. If a resourceKey is provided, it updates the existing resource;
|
|
245
|
-
* otherwise, it creates a new resource and uploads the file to the newly created resource.
|
|
246
|
-
*
|
|
247
|
-
* @param resourceKey - Optional key of the existing resource to update; if not provided, a new resource is created
|
|
248
|
-
* @param fileToUpload - The file or blob to upload
|
|
249
|
-
* @param publicFlag - Whether the resource should be public
|
|
250
|
-
* @param resourceType - The type of resource
|
|
251
|
-
* @param tags - Array of tags for the resource
|
|
252
|
-
*
|
|
253
|
-
* @returns Observable resolving to the ContentResource with uploaded file
|
|
195
|
+
* Observable version of createOrUpdateResource. See createOrUpdateResource for details.
|
|
254
196
|
*/
|
|
255
197
|
function createOrUpdateResourceAsObservable(resourceKey, fileToUpload, publicFlag, resourceType, tags) {
|
|
256
198
|
return (0, rxjs_1.from)(createOrUpdateResource(resourceKey, fileToUpload, publicFlag, resourceType, tags));
|
package/lib/cjs/data-crud.js
CHANGED
|
@@ -49,13 +49,9 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
49
49
|
// DATA RETRIEVAL FUNCTIONS
|
|
50
50
|
// ================================================================================
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Retrieves a single object by dataElementId and key. Optionally fetch related objects.
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
55
|
-
* @param key - The key of the object
|
|
56
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
57
|
-
* object will include the specified related objects as nested objects
|
|
58
|
-
* @returns Promise resolving to the object data
|
|
54
|
+
* @returns Promise<any> - the object data
|
|
59
55
|
*/
|
|
60
56
|
function getObject(dataElementId, key, fetchedRelationships) {
|
|
61
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -83,42 +79,20 @@ function getObject(dataElementId, key, fetchedRelationships) {
|
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param dataElementId - The ID of the data element
|
|
89
|
-
* @param key - The key of the object
|
|
90
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
91
|
-
* object will include the specified related objects as nested objects
|
|
92
|
-
*
|
|
93
|
-
* @returns Observable resolving to the object data
|
|
82
|
+
* Observable version of getObject. See getObject for details.
|
|
94
83
|
*/
|
|
95
84
|
function getObjectAsObservable(dataElementId, key, fetchedRelationships) {
|
|
96
85
|
return (0, rxjs_1.from)(getObject(dataElementId, key, fetchedRelationships));
|
|
97
86
|
}
|
|
98
87
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* customer. Similarly, in an organization context where the current organization proxy is
|
|
108
|
-
* "business," an action might want to retrieve all "employee" objects related to the current
|
|
109
|
-
* business.
|
|
110
|
-
*
|
|
111
|
-
* @param parentElementId - The ID of the parent element
|
|
112
|
-
* @param parentKey - The key of the parent object
|
|
113
|
-
* @param elementId - The ID of the element
|
|
114
|
-
* @param filter - Optional filter criteria for the query; if not provided, all related objects will
|
|
115
|
-
* be returned
|
|
116
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
117
|
-
* objects will include the specified related objects as nested objects
|
|
118
|
-
*
|
|
119
|
-
* @returns Promise resolving to an array of objects
|
|
120
|
-
*
|
|
121
|
-
* @see {@link FilterExpression} for filter syntax and examples
|
|
88
|
+
* Retrieves all objects related to a parent through a schema relationship. Commonly used to get objects belonging to current user/org proxy.
|
|
89
|
+
*
|
|
90
|
+
* @param parentElementId - Parent element ID
|
|
91
|
+
* @param parentKey - Parent object key
|
|
92
|
+
* @param elementId - Child element ID
|
|
93
|
+
* @param filter - Optional filter (see FilterExpression)
|
|
94
|
+
* @param fetchedRelationships - Optional relationships to include as nested objects
|
|
95
|
+
* @returns Promise<any[]>
|
|
122
96
|
*/
|
|
123
97
|
function getRelatedObjects(parentElementId, parentKey, elementId, filter, fetchedRelationships) {
|
|
124
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -149,29 +123,7 @@ function getRelatedObjects(parentElementId, parentKey, elementId, filter, fetche
|
|
|
149
123
|
});
|
|
150
124
|
}
|
|
151
125
|
/**
|
|
152
|
-
*
|
|
153
|
-
* returned are related to a parent through a defined relationship in the schema. In a typical
|
|
154
|
-
* setup, action's auth token must have scope access to the parent object in order to access all of
|
|
155
|
-
* its related objects.
|
|
156
|
-
*
|
|
157
|
-
* It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
|
|
158
|
-
* or organization proxy. For example, in a user context where the current user proxy element is
|
|
159
|
-
* "customer," an action might want to retrieve all "purchase" objects related to the current
|
|
160
|
-
* customer. Similarly, in an organization context where the current organization proxy is
|
|
161
|
-
* "business," an action might want to retrieve all "employee" objects related to the current
|
|
162
|
-
* business.
|
|
163
|
-
*
|
|
164
|
-
* @param parentElementId - The ID of the parent element
|
|
165
|
-
* @param parentKey - The key of the parent element
|
|
166
|
-
* @param elementId - The ID of the element
|
|
167
|
-
* @param filter - Optional filter criteria for the query; if not provided, all related objects will
|
|
168
|
-
* be returned
|
|
169
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
170
|
-
* objects will include the specified related objects as nested objects
|
|
171
|
-
*
|
|
172
|
-
* @returns Observable resolving to an array of objects
|
|
173
|
-
*
|
|
174
|
-
* @see {@link FilterExpression} for filter syntax and examples
|
|
126
|
+
* Observable version of getRelatedObjects. See getRelatedObjects for details.
|
|
175
127
|
*/
|
|
176
128
|
function getRelatedObjectsAsObservable(parentElementId, parentKey, elementId, filter, fetchedRelationships) {
|
|
177
129
|
return (0, rxjs_1.from)(getRelatedObjects(parentElementId, parentKey, elementId, filter, fetchedRelationships));
|
|
@@ -180,20 +132,11 @@ function getRelatedObjectsAsObservable(parentElementId, parentKey, elementId, fi
|
|
|
180
132
|
// DATA SAVE FUNCTIONS
|
|
181
133
|
// ================================================================================
|
|
182
134
|
/**
|
|
183
|
-
*
|
|
184
|
-
* relationship to the parent object is established based on the relationship specified in the
|
|
185
|
-
* schema. The objectToSave must have a relationship to the parent object and the user must have
|
|
186
|
-
* scope access to the parent object.
|
|
135
|
+
* Saves a related object and establishes relationship to parent. Returns saved object with any server-assigned values (objKey, calculated fields).
|
|
187
136
|
*
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
190
|
-
* @
|
|
191
|
-
* @param objectToSave - The object data to save (as a JSON string)
|
|
192
|
-
* @param opts - Optional save options
|
|
193
|
-
*
|
|
194
|
-
* @returns Promise resolving to saved object, including any updates made to the object during the
|
|
195
|
-
* save operation (such as assigning an objKey if the object is new), or the assignment of
|
|
196
|
-
* calculated values
|
|
137
|
+
* @param objectToSave - JSON string of object data
|
|
138
|
+
* @param opts - Optional: bypassValidation
|
|
139
|
+
* @returns Promise<any> - saved object with updates
|
|
197
140
|
*/
|
|
198
141
|
function saveRelatedObject(parentElementId, parentKey, elementId, objectToSave, opts) {
|
|
199
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -218,20 +161,7 @@ function saveRelatedObject(parentElementId, parentKey, elementId, objectToSave,
|
|
|
218
161
|
});
|
|
219
162
|
}
|
|
220
163
|
/**
|
|
221
|
-
*
|
|
222
|
-
* and its relationship to the parent object is established based on the relationship specified in
|
|
223
|
-
* the schema. The objectToSave must have a relationship to the parent object and the user must have
|
|
224
|
-
* scope access to the parent object.
|
|
225
|
-
*
|
|
226
|
-
* @param parentElementId - The ID of the parent element
|
|
227
|
-
* @param parentKey - The key of the parent object
|
|
228
|
-
* @param elementId - The element ID of the object to save
|
|
229
|
-
* @param objectToSave - The object data to save (as a JSON string)
|
|
230
|
-
* @param opts - Optional save options
|
|
231
|
-
*
|
|
232
|
-
* @returns Observable resolving to saved object, including any updates made to the object during
|
|
233
|
-
* the save operation (such as assigning an objKey if the object is new), or the assignment of
|
|
234
|
-
* calculated values
|
|
164
|
+
* Observable version of saveRelatedObject. See saveRelatedObject for details.
|
|
235
165
|
*/
|
|
236
166
|
function saveRelatedObjectAsObservable(parentElementId, parentKey, elementId, objectToSave, opts) {
|
|
237
167
|
return (0, rxjs_1.from)(saveRelatedObject(parentElementId, parentKey, elementId, objectToSave, opts));
|
|
@@ -240,14 +170,9 @@ function saveRelatedObjectAsObservable(parentElementId, parentKey, elementId, ob
|
|
|
240
170
|
// DATA DELETE FUNCTIONS
|
|
241
171
|
// ================================================================================
|
|
242
172
|
/**
|
|
243
|
-
*
|
|
173
|
+
* Deletes a single object related to a parent.
|
|
244
174
|
*
|
|
245
|
-
* @
|
|
246
|
-
* @param parentKey - The key of the parent object
|
|
247
|
-
* @param childElementId - The ID of the child element to delete
|
|
248
|
-
* @param childKey - The key of the child object to delete
|
|
249
|
-
*
|
|
250
|
-
* @returns Promise resolving to true if deletion was successful
|
|
175
|
+
* @returns Promise<boolean> - true if successful
|
|
251
176
|
*/
|
|
252
177
|
function deleteRelatedObject(parentElementId, parentKey, childElementId, childKey) {
|
|
253
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -269,27 +194,16 @@ function deleteRelatedObject(parentElementId, parentKey, childElementId, childKe
|
|
|
269
194
|
});
|
|
270
195
|
}
|
|
271
196
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* @param parentElementId - The ID of the parent element
|
|
275
|
-
* @param parentKey - The key of the parent object
|
|
276
|
-
* @param childElementId - The ID of the child element to delete
|
|
277
|
-
* @param childKey - The key of the child object to delete
|
|
278
|
-
*
|
|
279
|
-
* @returns Observable resolving to true if deletion was successful
|
|
197
|
+
* Observable version of deleteRelatedObject. See deleteRelatedObject for details.
|
|
280
198
|
*/
|
|
281
199
|
function deleteRelatedObjectAsObservable(parentElementId, parentKey, childElementId, childKey) {
|
|
282
200
|
return (0, rxjs_1.from)(deleteRelatedObject(parentElementId, parentKey, childElementId, childKey));
|
|
283
201
|
}
|
|
284
202
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* @param parentElementId - The ID of the parent element
|
|
288
|
-
* @param parentKey - The key of the parent object
|
|
289
|
-
* @param childElementId - The ID of the child element to delete
|
|
290
|
-
* @param childKeys - Array of keys of the child objects to delete
|
|
203
|
+
* Deletes multiple objects related to a parent.
|
|
291
204
|
*
|
|
292
|
-
* @
|
|
205
|
+
* @param childKeys - Array of child object keys to delete
|
|
206
|
+
* @returns Promise<boolean> - true if successful
|
|
293
207
|
*/
|
|
294
208
|
function deleteRelatedObjects(parentElementId, parentKey, childElementId, childKeys) {
|
|
295
209
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -312,14 +226,7 @@ function deleteRelatedObjects(parentElementId, parentKey, childElementId, childK
|
|
|
312
226
|
});
|
|
313
227
|
}
|
|
314
228
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* @param parentElementId - The ID of the parent element
|
|
318
|
-
* @param parentKey - The key of the parent object
|
|
319
|
-
* @param childElementId - The ID of the child element to delete
|
|
320
|
-
* @param childKeys - Array of keys of the child objects to delete
|
|
321
|
-
*
|
|
322
|
-
* @returns Observable resolving to true if deletion was successful
|
|
229
|
+
* Observable version of deleteRelatedObjects. See deleteRelatedObjects for details.
|
|
323
230
|
*/
|
|
324
231
|
function deleteRelatedObjectsAsObservable(parentElementId, parentKey, childElementId, childKeys) {
|
|
325
232
|
return (0, rxjs_1.from)(deleteRelatedObjects(parentElementId, parentKey, childElementId, childKeys));
|
package/lib/cjs/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Unauthorized use outside the Halix platform is prohibited.
|
|
9
9
|
// Full license terms available in the LICENSE file.
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.debounceFn = exports.getValueFromObject = exports.compareValues = exports.sortObjectArray = exports.massDeleteAsObservable = exports.massDelete = exports.massEditAsObservable = exports.massEdit = exports.getListDataAsObservable = exports.getListData = exports.sendMessageAsObservable = exports.sendMessage = exports.MessageMethod = exports.createOrUpdateResourceAsObservable = exports.createOrUpdateResource = exports.sendFileContentsAsObservable = exports.sendFileContents = exports.saveResourceAsObservable = exports.saveResource = exports.getOrCreateResourceAsObservable = exports.getOrCreateResource = exports.deleteRelatedObjectsAsObservable = exports.deleteRelatedObjects = exports.deleteRelatedObjectAsObservable = exports.deleteRelatedObject = exports.saveRelatedObjectAsObservable = exports.saveRelatedObject = exports.getRelatedObjectsAsObservable = exports.getRelatedObjects = exports.getObjectAsObservable = exports.getObject = exports.prepareErrorResponse = exports.prepareSuccessResponse = exports.initialize = exports.useBody = exports.params = exports.userContext = exports.actionSubject = exports.serviceAddress = exports.sandboxKey = exports.getAuthToken = void 0;
|
|
11
|
+
exports.debounceFn = exports.getValueFromObject = exports.compareValues = exports.sortObjectArray = exports.massDeleteAsObservable = exports.massDelete = exports.massEditAsObservable = exports.massEdit = exports.getListDataAsObservable = exports.getListData = exports.getPreferenceAsObservable = exports.getPreference = exports.sendMessageAsObservable = exports.sendMessage = exports.MessageMethod = exports.createOrUpdateResourceAsObservable = exports.createOrUpdateResource = exports.sendFileContentsAsObservable = exports.sendFileContents = exports.saveResourceAsObservable = exports.saveResource = exports.getOrCreateResourceAsObservable = exports.getOrCreateResource = exports.deleteRelatedObjectsAsObservable = exports.deleteRelatedObjects = exports.deleteRelatedObjectAsObservable = exports.deleteRelatedObject = exports.saveRelatedObjectAsObservable = exports.saveRelatedObject = exports.getRelatedObjectsAsObservable = exports.getRelatedObjects = exports.getObjectAsObservable = exports.getObject = exports.prepareErrorResponse = exports.prepareSuccessResponse = exports.initialize = exports.useBody = exports.params = exports.userContext = exports.actionSubject = exports.serviceAddress = exports.sandboxKey = exports.getAuthToken = void 0;
|
|
12
12
|
/**
|
|
13
13
|
* @module @halix/action-sdk
|
|
14
14
|
* @description Halix Platform action SDK for developing NodeJS Lambda-based actions on the Halix
|
|
@@ -71,6 +71,13 @@ Object.defineProperty(exports, "MessageMethod", { enumerable: true, get: functio
|
|
|
71
71
|
Object.defineProperty(exports, "sendMessage", { enumerable: true, get: function () { return messaging_1.sendMessage; } });
|
|
72
72
|
Object.defineProperty(exports, "sendMessageAsObservable", { enumerable: true, get: function () { return messaging_1.sendMessageAsObservable; } });
|
|
73
73
|
// ================================================================================
|
|
74
|
+
// PREFERENCE FUNCTIONS
|
|
75
|
+
// ================================================================================
|
|
76
|
+
var preferences_1 = require("./preferences");
|
|
77
|
+
// Preference Functions
|
|
78
|
+
Object.defineProperty(exports, "getPreference", { enumerable: true, get: function () { return preferences_1.getPreference; } });
|
|
79
|
+
Object.defineProperty(exports, "getPreferenceAsObservable", { enumerable: true, get: function () { return preferences_1.getPreferenceAsObservable; } });
|
|
80
|
+
// ================================================================================
|
|
74
81
|
// LIST DATA FUNCTIONS
|
|
75
82
|
// ================================================================================
|
|
76
83
|
var lists_1 = require("./lists");
|
package/lib/cjs/lists.js
CHANGED
|
@@ -34,6 +34,7 @@ exports.massDeleteAsObservable = massDeleteAsObservable;
|
|
|
34
34
|
*
|
|
35
35
|
* Key features:
|
|
36
36
|
* - Efficient retrieval of one page of data at a time
|
|
37
|
+
* - Supports related object retrieval
|
|
37
38
|
* - Pagination
|
|
38
39
|
* - Sorting
|
|
39
40
|
* - Filtering
|
|
@@ -48,24 +49,13 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
48
49
|
// LIST DATA RETRIEVAL FUNCTIONS
|
|
49
50
|
// ================================================================================
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
-
* different modes based on the provided options:
|
|
52
|
+
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* 4. Public list data with search (when both isPublic and search options are provided)
|
|
58
|
-
*
|
|
59
|
-
* The search functionality uses binary search to efficiently locate items in a sorted list by
|
|
60
|
-
* a specific attribute value.
|
|
61
|
-
*
|
|
62
|
-
* @param request - The list data request containing list configuration and parameters
|
|
63
|
-
* @param options - Optional configuration for the request
|
|
64
|
-
*
|
|
65
|
-
* @returns Promise resolving to the list data response
|
|
54
|
+
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
55
|
+
* @param options - Optional: isPublic, bypassTotal, search
|
|
56
|
+
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
66
57
|
*
|
|
67
58
|
* @example
|
|
68
|
-
* // Basic authenticated list data retrieval
|
|
69
59
|
* const listData = await getListData({
|
|
70
60
|
* dataElementId: 'customer',
|
|
71
61
|
* parentDataElementId: 'company',
|
|
@@ -74,35 +64,6 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
74
64
|
* pageSize: 50,
|
|
75
65
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
76
66
|
* });
|
|
77
|
-
* console.log('Total customers:', listData.total);
|
|
78
|
-
* console.log('Page:', listData.pageNumber);
|
|
79
|
-
* console.log('Data:', listData.data);
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* // Public list data retrieval without authentication
|
|
83
|
-
* const publicData = await getListData({
|
|
84
|
-
* dataElementId: 'product',
|
|
85
|
-
* parentDataElementId: 'catalog',
|
|
86
|
-
* parentKey: orgProxyKey,
|
|
87
|
-
* pageNumber: 1,
|
|
88
|
-
* pageSize: 20
|
|
89
|
-
* }, { isPublic: true });
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* // List data retrieval with binary search
|
|
93
|
-
* const searchData = await getListData({
|
|
94
|
-
* dataElementId: 'purchases',
|
|
95
|
-
* parentDataElementId: 'customer',
|
|
96
|
-
* parentKey: userProxyKey,
|
|
97
|
-
* sort: [{ attributeId: 'invoiceNumber', descending: false }]
|
|
98
|
-
* }, {
|
|
99
|
-
* search: {
|
|
100
|
-
* attributeId: 'invoiceNumber',
|
|
101
|
-
* value: 'INV-123456',
|
|
102
|
-
* total: 1000
|
|
103
|
-
* }
|
|
104
|
-
* });
|
|
105
|
-
* console.log('Selected row index:', searchData.selectedRow);
|
|
106
67
|
*/
|
|
107
68
|
function getListData(request, options) {
|
|
108
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -159,27 +120,11 @@ function getListData(request, options) {
|
|
|
159
120
|
});
|
|
160
121
|
}
|
|
161
122
|
/**
|
|
162
|
-
*
|
|
163
|
-
* function operates in the same four modes as getListData.
|
|
164
|
-
*
|
|
165
|
-
* @param request - The list data request containing list configuration and parameters
|
|
166
|
-
* @param options - Optional configuration for the request
|
|
167
|
-
*
|
|
168
|
-
* @returns Observable resolving to the list data response
|
|
123
|
+
* Observable version of getListData. See getListData for details.
|
|
169
124
|
*
|
|
170
125
|
* @example
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* dataElementId: 'customer',
|
|
174
|
-
* parentDataElementId: 'company',
|
|
175
|
-
* parentKey: userContext.orgProxyKey,
|
|
176
|
-
* pageNumber: 1,
|
|
177
|
-
* pageSize: 50
|
|
178
|
-
* }).subscribe(response => {
|
|
179
|
-
* console.log('Total customers:', response.total);
|
|
180
|
-
* console.log('Page:', response.pageNumber);
|
|
181
|
-
* console.log('Data:', response.data);
|
|
182
|
-
* });
|
|
126
|
+
* getListDataAsObservable({ dataElementId: 'customer', parentDataElementId: 'company', parentKey: orgProxyKey })
|
|
127
|
+
* .subscribe(response => console.log(response.data));
|
|
183
128
|
*/
|
|
184
129
|
function getListDataAsObservable(request, options) {
|
|
185
130
|
return (0, rxjs_1.from)(getListData(request, options));
|
|
@@ -188,51 +133,21 @@ function getListDataAsObservable(request, options) {
|
|
|
188
133
|
// MASS EDIT AND DELETE FUNCTIONS
|
|
189
134
|
// ================================================================================
|
|
190
135
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
|
|
195
|
-
* be returned by the dataRequest can be updated. The keys array must reference records within
|
|
196
|
-
* this scope. This allows efficient security validation without checking each record individually.
|
|
197
|
-
*
|
|
198
|
-
* The value can be set in two ways based on valueType:
|
|
199
|
-
* - 'literal': Set the property to a literal value
|
|
200
|
-
* - 'property': Copy the value from another property on the same object
|
|
201
|
-
*
|
|
202
|
-
* @param request - The mass edit request specifying what to update and how
|
|
136
|
+
* Bulk update multiple records. The dataRequest defines security scope; only records within that scope can be updated.
|
|
137
|
+
* Use valueType 'literal' to set a value, or 'property' to copy from another field.
|
|
203
138
|
*
|
|
204
|
-
* @
|
|
139
|
+
* @param request - keys[], dataRequest (scope), dataElementId, property, valueType, value
|
|
140
|
+
* @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
|
|
205
141
|
*
|
|
206
142
|
* @example
|
|
207
|
-
* // Update the status of multiple orders to 'shipped'
|
|
208
143
|
* const result = await massEdit({
|
|
209
|
-
* keys: ['order-123', 'order-456'
|
|
210
|
-
* dataRequest: {
|
|
211
|
-
* dataElementId: 'order',
|
|
212
|
-
* parentDataElementId: 'company',
|
|
213
|
-
* parentKey: orgProxyKey
|
|
214
|
-
* },
|
|
144
|
+
* keys: ['order-123', 'order-456'],
|
|
145
|
+
* dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
|
|
215
146
|
* dataElementId: 'order',
|
|
216
147
|
* property: 'status',
|
|
217
148
|
* valueType: 'literal',
|
|
218
149
|
* value: 'shipped'
|
|
219
150
|
* });
|
|
220
|
-
* console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* // Copy shipping address to billing address for multiple customers
|
|
224
|
-
* const result = await massEdit({
|
|
225
|
-
* keys: selectedCustomerKeys,
|
|
226
|
-
* dataRequest: {
|
|
227
|
-
* dataElementId: 'customer',
|
|
228
|
-
* parentDataElementId: 'company',
|
|
229
|
-
* parentKey: orgProxyKey
|
|
230
|
-
* },
|
|
231
|
-
* dataElementId: 'customer',
|
|
232
|
-
* property: 'billingAddress',
|
|
233
|
-
* valueType: 'property',
|
|
234
|
-
* value: 'shippingAddress'
|
|
235
|
-
* });
|
|
236
151
|
*/
|
|
237
152
|
function massEdit(request) {
|
|
238
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -254,75 +169,24 @@ function massEdit(request) {
|
|
|
254
169
|
});
|
|
255
170
|
}
|
|
256
171
|
/**
|
|
257
|
-
*
|
|
258
|
-
* See massEdit for detailed documentation.
|
|
259
|
-
*
|
|
260
|
-
* @param request - The mass edit request specifying what to update and how
|
|
261
|
-
*
|
|
262
|
-
* @returns Observable resolving to statistics about the operation
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* massEditAsObservable({
|
|
266
|
-
* keys: ['order-123', 'order-456'],
|
|
267
|
-
* dataRequest: {
|
|
268
|
-
* dataElementId: 'order',
|
|
269
|
-
* parentDataElementId: 'company',
|
|
270
|
-
* parentKey: orgProxyKey
|
|
271
|
-
* },
|
|
272
|
-
* dataElementId: 'order',
|
|
273
|
-
* property: 'status',
|
|
274
|
-
* valueType: 'literal',
|
|
275
|
-
* value: 'shipped'
|
|
276
|
-
* }).subscribe(result => {
|
|
277
|
-
* console.log(`Updated ${result.succeeded} of ${result.tried} orders`);
|
|
278
|
-
* });
|
|
172
|
+
* Observable version of massEdit. See massEdit for details.
|
|
279
173
|
*/
|
|
280
174
|
function massEditAsObservable(request) {
|
|
281
175
|
return (0, rxjs_1.from)(massEdit(request));
|
|
282
176
|
}
|
|
283
177
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* **Security Scoping**: The dataRequest serves as a security boundary. Only records that would
|
|
288
|
-
* be returned by the dataRequest can be deleted. The keys array must reference records within
|
|
289
|
-
* this scope. This allows efficient security validation without checking each record individually.
|
|
290
|
-
*
|
|
291
|
-
* If emptyList is set to true, all records returned by the dataRequest will be deleted,
|
|
292
|
-
* ignoring the keys array.
|
|
293
|
-
*
|
|
294
|
-
* @param request - The mass delete request specifying what to delete
|
|
178
|
+
* Bulk soft-delete multiple records. The dataRequest defines security scope; only records within that scope can be deleted.
|
|
179
|
+
* Set emptyList: true to delete all records matching dataRequest (ignores keys array).
|
|
295
180
|
*
|
|
296
|
-
* @
|
|
181
|
+
* @param request - keys[], dataRequest (scope), dataElementId, emptyList?
|
|
182
|
+
* @returns Promise<MassChangeResponse> with tried/succeeded/failed counts
|
|
297
183
|
*
|
|
298
184
|
* @example
|
|
299
|
-
* // Delete specific orders
|
|
300
185
|
* const result = await massDelete({
|
|
301
|
-
* keys: ['order-123', 'order-456'
|
|
302
|
-
* dataRequest: {
|
|
303
|
-
* dataElementId: 'order',
|
|
304
|
-
* parentDataElementId: 'company',
|
|
305
|
-
* parentKey: orgProxyKey,
|
|
306
|
-
* filter: { field: 'status', operator: '==', value: 'cancelled' }
|
|
307
|
-
* },
|
|
186
|
+
* keys: ['order-123', 'order-456'],
|
|
187
|
+
* dataRequest: { dataElementId: 'order', parentDataElementId: 'company', parentKey: orgProxyKey },
|
|
308
188
|
* dataElementId: 'order'
|
|
309
189
|
* });
|
|
310
|
-
* console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
|
|
311
|
-
*
|
|
312
|
-
* @example
|
|
313
|
-
* // Delete all records matching the filter
|
|
314
|
-
* const result = await massDelete({
|
|
315
|
-
* keys: [],
|
|
316
|
-
* dataRequest: {
|
|
317
|
-
* dataElementId: 'tempRecord',
|
|
318
|
-
* parentDataElementId: 'company',
|
|
319
|
-
* parentKey: orgProxyKey,
|
|
320
|
-
* filter: { field: 'createdDate', operator: '<', value: '2023-01-01' }
|
|
321
|
-
* },
|
|
322
|
-
* dataElementId: 'tempRecord',
|
|
323
|
-
* emptyList: true
|
|
324
|
-
* });
|
|
325
|
-
* console.log(`Deleted ${result.succeeded} old records`);
|
|
326
190
|
*/
|
|
327
191
|
function massDelete(request) {
|
|
328
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -344,25 +208,7 @@ function massDelete(request) {
|
|
|
344
208
|
});
|
|
345
209
|
}
|
|
346
210
|
/**
|
|
347
|
-
*
|
|
348
|
-
* See massDelete for detailed documentation.
|
|
349
|
-
*
|
|
350
|
-
* @param request - The mass delete request specifying what to delete
|
|
351
|
-
*
|
|
352
|
-
* @returns Observable resolving to statistics about the operation
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* massDeleteAsObservable({
|
|
356
|
-
* keys: ['order-123', 'order-456'],
|
|
357
|
-
* dataRequest: {
|
|
358
|
-
* dataElementId: 'order',
|
|
359
|
-
* parentDataElementId: 'company',
|
|
360
|
-
* parentKey: orgProxyKey
|
|
361
|
-
* },
|
|
362
|
-
* dataElementId: 'order'
|
|
363
|
-
* }).subscribe(result => {
|
|
364
|
-
* console.log(`Deleted ${result.succeeded} of ${result.tried} orders`);
|
|
365
|
-
* });
|
|
211
|
+
* Observable version of massDelete. See massDelete for details.
|
|
366
212
|
*/
|
|
367
213
|
function massDeleteAsObservable(request) {
|
|
368
214
|
return (0, rxjs_1.from)(massDelete(request));
|