@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.
- package/lib/cjs/content.js +12 -70
- package/lib/cjs/data-aggregate.js +101 -0
- package/lib/cjs/data-crud.js +24 -117
- package/lib/cjs/index.js +15 -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-aggregate.d.ts +140 -0
- package/lib/cjs/types/data-aggregate.d.ts.map +1 -0
- 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 +2 -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-aggregate.js +84 -0
- package/lib/esm/data-aggregate.js.map +1 -0
- 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 +12 -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-aggregate.d.ts +139 -0
- 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 +2 -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));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Halix SDK License v1.0
|
|
3
|
+
// Copyright (c) 2025 halix.io LLC.
|
|
4
|
+
//
|
|
5
|
+
// This source code is licensed for use **only** within applications
|
|
6
|
+
// running on the Halix platform, in accordance with Halix SDK guidelines.
|
|
7
|
+
//
|
|
8
|
+
// Unauthorized use outside the Halix platform is prohibited.
|
|
9
|
+
// Full license terms available in the LICENSE file.
|
|
10
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
16
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.getAggregateData = getAggregateData;
|
|
24
|
+
exports.getAggregateDataAsObservable = getAggregateDataAsObservable;
|
|
25
|
+
/**
|
|
26
|
+
* @module @halix/action-sdk/data-aggregate
|
|
27
|
+
* @description Data aggregation operations for the Halix Platform action SDK. This module provides functions
|
|
28
|
+
* for performing aggregate queries (count, sum, average, etc.) on data objects grouped by specified fields.
|
|
29
|
+
* Results are returned as aggregated data suitable for charts, reports, and analytics dashboards.
|
|
30
|
+
*
|
|
31
|
+
* Key features:
|
|
32
|
+
* - Group data by one or more fields
|
|
33
|
+
* - Apply transformations to grouping fields (date functions, string functions)
|
|
34
|
+
* - Calculate aggregations (count, sum, average, min, max, median)
|
|
35
|
+
* - Sort aggregated results
|
|
36
|
+
* - Filter data before aggregation
|
|
37
|
+
* - Parent-child relationship scoping for security
|
|
38
|
+
*/
|
|
39
|
+
const axios_1 = __importDefault(require("axios"));
|
|
40
|
+
const rxjs_1 = require("rxjs");
|
|
41
|
+
const sdk_general_1 = require("./sdk-general");
|
|
42
|
+
// ================================================================================
|
|
43
|
+
// DATA AGGREGATION FUNCTIONS
|
|
44
|
+
// ================================================================================
|
|
45
|
+
/**
|
|
46
|
+
* Performs data aggregation operations (count, sum, average, etc.) on grouped data.
|
|
47
|
+
* Supports filtering, grouping with transforms, sorting, and multiple aggregations.
|
|
48
|
+
*
|
|
49
|
+
* @param request - Aggregation configuration including dataElementId, parent scope, groups, aggregations
|
|
50
|
+
* @returns Promise<AggregationResponse> with aggregated data array
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const results = await getAggregateData({
|
|
54
|
+
* dataElementId: 'order',
|
|
55
|
+
* parentDataElementId: 'company',
|
|
56
|
+
* parentKey: orgProxyKey,
|
|
57
|
+
* groups: [{
|
|
58
|
+
* groupField: 'status',
|
|
59
|
+
* groupDirection: 'asc'
|
|
60
|
+
* }],
|
|
61
|
+
* aggregations: [{
|
|
62
|
+
* aggregation: 'Count',
|
|
63
|
+
* aggregationField: 'objKey'
|
|
64
|
+
* }, {
|
|
65
|
+
* aggregation: 'Sum',
|
|
66
|
+
* aggregationField: 'totalAmount'
|
|
67
|
+
* }]
|
|
68
|
+
* });
|
|
69
|
+
*/
|
|
70
|
+
function getAggregateData(request) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
if (!sdk_general_1.getAuthToken) {
|
|
73
|
+
const errorMessage = 'SDK not initialized.';
|
|
74
|
+
console.error(errorMessage);
|
|
75
|
+
throw new Error(errorMessage);
|
|
76
|
+
}
|
|
77
|
+
const url = `${sdk_general_1.serviceAddress}/sandboxes/${sdk_general_1.sandboxKey}/aggregateData`;
|
|
78
|
+
// Build headers with authentication token
|
|
79
|
+
let authToken = yield (0, rxjs_1.lastValueFrom)((0, sdk_general_1.getAuthToken)());
|
|
80
|
+
let headers = {
|
|
81
|
+
Authorization: `Bearer ${authToken}`
|
|
82
|
+
};
|
|
83
|
+
console.log("Sending POST request to " + url + " with token " + authToken);
|
|
84
|
+
// Make the API request
|
|
85
|
+
let response = yield axios_1.default.post(url, request, { headers });
|
|
86
|
+
return response.data;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Observable version of getAggregateData. See getAggregateData for details.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* getAggregateDataAsObservable({
|
|
94
|
+
* dataElementId: 'order',
|
|
95
|
+
* groups: [{ groupField: 'status', groupDirection: 'asc' }],
|
|
96
|
+
* aggregations: [{ aggregation: 'Count', aggregationField: 'objKey' }]
|
|
97
|
+
* }).subscribe(response => console.log(response.data));
|
|
98
|
+
*/
|
|
99
|
+
function getAggregateDataAsObservable(request) {
|
|
100
|
+
return (0, rxjs_1.from)(getAggregateData(request));
|
|
101
|
+
}
|
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.getAggregateDataAsObservable = exports.getAggregateData = 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");
|
|
@@ -82,6 +89,13 @@ Object.defineProperty(exports, "massEditAsObservable", { enumerable: true, get:
|
|
|
82
89
|
Object.defineProperty(exports, "massDelete", { enumerable: true, get: function () { return lists_1.massDelete; } });
|
|
83
90
|
Object.defineProperty(exports, "massDeleteAsObservable", { enumerable: true, get: function () { return lists_1.massDeleteAsObservable; } });
|
|
84
91
|
// ================================================================================
|
|
92
|
+
// DATA AGGREGATE FUNCTIONS
|
|
93
|
+
// ================================================================================
|
|
94
|
+
var data_aggregate_1 = require("./data-aggregate");
|
|
95
|
+
// Functions
|
|
96
|
+
Object.defineProperty(exports, "getAggregateData", { enumerable: true, get: function () { return data_aggregate_1.getAggregateData; } });
|
|
97
|
+
Object.defineProperty(exports, "getAggregateDataAsObservable", { enumerable: true, get: function () { return data_aggregate_1.getAggregateDataAsObservable; } });
|
|
98
|
+
// ================================================================================
|
|
85
99
|
// UTILITY FUNCTIONS
|
|
86
100
|
// ================================================================================
|
|
87
101
|
var utilities_1 = require("./utilities");
|