@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.
- package/lib/cjs/content.js +12 -70
- package/lib/cjs/data-crud.js +49 -117
- package/lib/cjs/index.js +8 -1
- package/lib/cjs/lists.js +37 -176
- package/lib/cjs/messaging.js +13 -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 +49 -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 +37 -176
- package/lib/esm/lists.js.map +1 -1
- package/lib/esm/messaging.js +13 -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,16 +49,17 @@ 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* () {
|
|
58
|
+
if (!sdk_general_1.getAuthToken) {
|
|
59
|
+
const errorMessage = 'SDK not initialized.';
|
|
60
|
+
console.error(errorMessage);
|
|
61
|
+
throw new Error(errorMessage);
|
|
62
|
+
}
|
|
62
63
|
let params;
|
|
63
64
|
if (fetchedRelationships) {
|
|
64
65
|
let p = {};
|
|
@@ -78,45 +79,28 @@ function getObject(dataElementId, key, fetchedRelationships) {
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @param dataElementId - The ID of the data element
|
|
84
|
-
* @param key - The key of the object
|
|
85
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
86
|
-
* object will include the specified related objects as nested objects
|
|
87
|
-
*
|
|
88
|
-
* @returns Observable resolving to the object data
|
|
82
|
+
* Observable version of getObject. See getObject for details.
|
|
89
83
|
*/
|
|
90
84
|
function getObjectAsObservable(dataElementId, key, fetchedRelationships) {
|
|
91
85
|
return (0, rxjs_1.from)(getObject(dataElementId, key, fetchedRelationships));
|
|
92
86
|
}
|
|
93
87
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* customer. Similarly, in an organization context where the current organization proxy is
|
|
103
|
-
* "business," an action might want to retrieve all "employee" objects related to the current
|
|
104
|
-
* business.
|
|
105
|
-
*
|
|
106
|
-
* @param parentElementId - The ID of the parent element
|
|
107
|
-
* @param parentKey - The key of the parent object
|
|
108
|
-
* @param elementId - The ID of the element
|
|
109
|
-
* @param filter - Optional filter criteria for the query; if not provided, all related objects will
|
|
110
|
-
* be returned
|
|
111
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
112
|
-
* objects will include the specified related objects as nested objects
|
|
113
|
-
*
|
|
114
|
-
* @returns Promise resolving to an array of objects
|
|
115
|
-
*
|
|
116
|
-
* @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[]>
|
|
117
96
|
*/
|
|
118
97
|
function getRelatedObjects(parentElementId, parentKey, elementId, filter, fetchedRelationships) {
|
|
119
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
if (!sdk_general_1.getAuthToken) {
|
|
100
|
+
const errorMessage = 'SDK not initialized.';
|
|
101
|
+
console.error(errorMessage);
|
|
102
|
+
throw new Error(errorMessage);
|
|
103
|
+
}
|
|
120
104
|
let params;
|
|
121
105
|
if (filter || fetchedRelationships) {
|
|
122
106
|
let p = {};
|
|
@@ -139,29 +123,7 @@ function getRelatedObjects(parentElementId, parentKey, elementId, filter, fetche
|
|
|
139
123
|
});
|
|
140
124
|
}
|
|
141
125
|
/**
|
|
142
|
-
*
|
|
143
|
-
* returned are related to a parent through a defined relationship in the schema. In a typical
|
|
144
|
-
* setup, action's auth token must have scope access to the parent object in order to access all of
|
|
145
|
-
* its related objects.
|
|
146
|
-
*
|
|
147
|
-
* It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
|
|
148
|
-
* or organization proxy. For example, in a user context where the current user proxy element is
|
|
149
|
-
* "customer," an action might want to retrieve all "purchase" objects related to the current
|
|
150
|
-
* customer. Similarly, in an organization context where the current organization proxy is
|
|
151
|
-
* "business," an action might want to retrieve all "employee" objects related to the current
|
|
152
|
-
* business.
|
|
153
|
-
*
|
|
154
|
-
* @param parentElementId - The ID of the parent element
|
|
155
|
-
* @param parentKey - The key of the parent element
|
|
156
|
-
* @param elementId - The ID of the element
|
|
157
|
-
* @param filter - Optional filter criteria for the query; if not provided, all related objects will
|
|
158
|
-
* be returned
|
|
159
|
-
* @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
|
|
160
|
-
* objects will include the specified related objects as nested objects
|
|
161
|
-
*
|
|
162
|
-
* @returns Observable resolving to an array of objects
|
|
163
|
-
*
|
|
164
|
-
* @see {@link FilterExpression} for filter syntax and examples
|
|
126
|
+
* Observable version of getRelatedObjects. See getRelatedObjects for details.
|
|
165
127
|
*/
|
|
166
128
|
function getRelatedObjectsAsObservable(parentElementId, parentKey, elementId, filter, fetchedRelationships) {
|
|
167
129
|
return (0, rxjs_1.from)(getRelatedObjects(parentElementId, parentKey, elementId, filter, fetchedRelationships));
|
|
@@ -170,23 +132,19 @@ function getRelatedObjectsAsObservable(parentElementId, parentKey, elementId, fi
|
|
|
170
132
|
// DATA SAVE FUNCTIONS
|
|
171
133
|
// ================================================================================
|
|
172
134
|
/**
|
|
173
|
-
*
|
|
174
|
-
* relationship to the parent object is established based on the relationship specified in the
|
|
175
|
-
* schema. The objectToSave must have a relationship to the parent object and the user must have
|
|
176
|
-
* 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).
|
|
177
136
|
*
|
|
178
|
-
* @param
|
|
179
|
-
* @param
|
|
180
|
-
* @
|
|
181
|
-
* @param objectToSave - The object data to save (as a JSON string)
|
|
182
|
-
* @param opts - Optional save options
|
|
183
|
-
*
|
|
184
|
-
* @returns Promise resolving to saved object, including any updates made to the object during the
|
|
185
|
-
* save operation (such as assigning an objKey if the object is new), or the assignment of
|
|
186
|
-
* calculated values
|
|
137
|
+
* @param objectToSave - JSON string of object data
|
|
138
|
+
* @param opts - Optional: bypassValidation
|
|
139
|
+
* @returns Promise<any> - saved object with updates
|
|
187
140
|
*/
|
|
188
141
|
function saveRelatedObject(parentElementId, parentKey, elementId, objectToSave, opts) {
|
|
189
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
if (!sdk_general_1.getAuthToken) {
|
|
144
|
+
const errorMessage = 'SDK not initialized.';
|
|
145
|
+
console.error(errorMessage);
|
|
146
|
+
throw new Error(errorMessage);
|
|
147
|
+
}
|
|
190
148
|
let url = `${sdk_general_1.serviceAddress}/schema/sandboxes/${sdk_general_1.sandboxKey}/${parentElementId}/${parentKey}/${elementId}`;
|
|
191
149
|
if ((opts === null || opts === void 0 ? void 0 : opts.bypassValidation) === false) {
|
|
192
150
|
url += "?bypassValidation=false";
|
|
@@ -203,20 +161,7 @@ function saveRelatedObject(parentElementId, parentKey, elementId, objectToSave,
|
|
|
203
161
|
});
|
|
204
162
|
}
|
|
205
163
|
/**
|
|
206
|
-
*
|
|
207
|
-
* and its relationship to the parent object is established based on the relationship specified in
|
|
208
|
-
* the schema. The objectToSave must have a relationship to the parent object and the user must have
|
|
209
|
-
* scope access to the parent object.
|
|
210
|
-
*
|
|
211
|
-
* @param parentElementId - The ID of the parent element
|
|
212
|
-
* @param parentKey - The key of the parent object
|
|
213
|
-
* @param elementId - The element ID of the object to save
|
|
214
|
-
* @param objectToSave - The object data to save (as a JSON string)
|
|
215
|
-
* @param opts - Optional save options
|
|
216
|
-
*
|
|
217
|
-
* @returns Observable resolving to saved object, including any updates made to the object during
|
|
218
|
-
* the save operation (such as assigning an objKey if the object is new), or the assignment of
|
|
219
|
-
* calculated values
|
|
164
|
+
* Observable version of saveRelatedObject. See saveRelatedObject for details.
|
|
220
165
|
*/
|
|
221
166
|
function saveRelatedObjectAsObservable(parentElementId, parentKey, elementId, objectToSave, opts) {
|
|
222
167
|
return (0, rxjs_1.from)(saveRelatedObject(parentElementId, parentKey, elementId, objectToSave, opts));
|
|
@@ -225,20 +170,20 @@ function saveRelatedObjectAsObservable(parentElementId, parentKey, elementId, ob
|
|
|
225
170
|
// DATA DELETE FUNCTIONS
|
|
226
171
|
// ================================================================================
|
|
227
172
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* @param parentElementId - The ID of the parent element
|
|
231
|
-
* @param parentKey - The key of the parent object
|
|
232
|
-
* @param childElementId - The ID of the child element to delete
|
|
233
|
-
* @param childKey - The key of the child object to delete
|
|
173
|
+
* Deletes a single object related to a parent.
|
|
234
174
|
*
|
|
235
|
-
* @returns Promise
|
|
175
|
+
* @returns Promise<boolean> - true if successful
|
|
236
176
|
*/
|
|
237
177
|
function deleteRelatedObject(parentElementId, parentKey, childElementId, childKey) {
|
|
238
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
179
|
if (!sdk_general_1.userContext) {
|
|
240
180
|
throw new Error("userContext is required but not available; check that the initialize function has been called");
|
|
241
181
|
}
|
|
182
|
+
if (!sdk_general_1.getAuthToken) {
|
|
183
|
+
const errorMessage = 'SDK not initialized.';
|
|
184
|
+
console.error(errorMessage);
|
|
185
|
+
throw new Error(errorMessage);
|
|
186
|
+
}
|
|
242
187
|
let url = `${sdk_general_1.serviceAddress}/schema/sandboxes/${sdk_general_1.sandboxKey}/${parentElementId}/${parentKey}/${childElementId}/${childKey}`;
|
|
243
188
|
let authToken = yield (0, rxjs_1.lastValueFrom)((0, sdk_general_1.getAuthToken)());
|
|
244
189
|
console.log("Sending DELETE request to " + url + " with token " + authToken);
|
|
@@ -249,33 +194,27 @@ function deleteRelatedObject(parentElementId, parentKey, childElementId, childKe
|
|
|
249
194
|
});
|
|
250
195
|
}
|
|
251
196
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* @param parentElementId - The ID of the parent element
|
|
255
|
-
* @param parentKey - The key of the parent object
|
|
256
|
-
* @param childElementId - The ID of the child element to delete
|
|
257
|
-
* @param childKey - The key of the child object to delete
|
|
258
|
-
*
|
|
259
|
-
* @returns Observable resolving to true if deletion was successful
|
|
197
|
+
* Observable version of deleteRelatedObject. See deleteRelatedObject for details.
|
|
260
198
|
*/
|
|
261
199
|
function deleteRelatedObjectAsObservable(parentElementId, parentKey, childElementId, childKey) {
|
|
262
200
|
return (0, rxjs_1.from)(deleteRelatedObject(parentElementId, parentKey, childElementId, childKey));
|
|
263
201
|
}
|
|
264
202
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* @param parentElementId - The ID of the parent element
|
|
268
|
-
* @param parentKey - The key of the parent object
|
|
269
|
-
* @param childElementId - The ID of the child element to delete
|
|
270
|
-
* @param childKeys - Array of keys of the child objects to delete
|
|
203
|
+
* Deletes multiple objects related to a parent.
|
|
271
204
|
*
|
|
272
|
-
* @
|
|
205
|
+
* @param childKeys - Array of child object keys to delete
|
|
206
|
+
* @returns Promise<boolean> - true if successful
|
|
273
207
|
*/
|
|
274
208
|
function deleteRelatedObjects(parentElementId, parentKey, childElementId, childKeys) {
|
|
275
209
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
210
|
if (!sdk_general_1.userContext) {
|
|
277
211
|
throw new Error("userContext is required but not available; check that the initialize function has been called");
|
|
278
212
|
}
|
|
213
|
+
if (!sdk_general_1.getAuthToken) {
|
|
214
|
+
const errorMessage = 'SDK not initialized.';
|
|
215
|
+
console.error(errorMessage);
|
|
216
|
+
throw new Error(errorMessage);
|
|
217
|
+
}
|
|
279
218
|
let url = `${sdk_general_1.serviceAddress}/schema/sandboxes/${sdk_general_1.sandboxKey}/${parentElementId}/${parentKey}/${childElementId}`;
|
|
280
219
|
let authToken = yield (0, rxjs_1.lastValueFrom)((0, sdk_general_1.getAuthToken)());
|
|
281
220
|
console.log("Sending DELETE request to " + url + " with token " + authToken);
|
|
@@ -287,14 +226,7 @@ function deleteRelatedObjects(parentElementId, parentKey, childElementId, childK
|
|
|
287
226
|
});
|
|
288
227
|
}
|
|
289
228
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* @param parentElementId - The ID of the parent element
|
|
293
|
-
* @param parentKey - The key of the parent object
|
|
294
|
-
* @param childElementId - The ID of the child element to delete
|
|
295
|
-
* @param childKeys - Array of keys of the child objects to delete
|
|
296
|
-
*
|
|
297
|
-
* @returns Observable resolving to true if deletion was successful
|
|
229
|
+
* Observable version of deleteRelatedObjects. See deleteRelatedObjects for details.
|
|
298
230
|
*/
|
|
299
231
|
function deleteRelatedObjectsAsObservable(parentElementId, parentKey, childElementId, childKeys) {
|
|
300
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");
|