@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.
Files changed (52) hide show
  1. package/lib/cjs/content.js +12 -70
  2. package/lib/cjs/data-crud.js +24 -117
  3. package/lib/cjs/index.js +8 -1
  4. package/lib/cjs/lists.js +22 -176
  5. package/lib/cjs/messaging.js +8 -59
  6. package/lib/cjs/preferences.js +75 -0
  7. package/lib/cjs/sdk-general.js +6 -18
  8. package/lib/cjs/types/content.d.ts +12 -70
  9. package/lib/cjs/types/content.d.ts.map +1 -1
  10. package/lib/cjs/types/data-crud.d.ts +24 -117
  11. package/lib/cjs/types/data-crud.d.ts.map +1 -1
  12. package/lib/cjs/types/filter-expressions.d.ts +35 -107
  13. package/lib/cjs/types/filter-expressions.d.ts.map +1 -1
  14. package/lib/cjs/types/index.d.ts +1 -0
  15. package/lib/cjs/types/index.d.ts.map +1 -1
  16. package/lib/cjs/types/lists.d.ts +22 -177
  17. package/lib/cjs/types/lists.d.ts.map +1 -1
  18. package/lib/cjs/types/messaging.d.ts +8 -59
  19. package/lib/cjs/types/messaging.d.ts.map +1 -1
  20. package/lib/cjs/types/preferences.d.ts +17 -0
  21. package/lib/cjs/types/preferences.d.ts.map +1 -0
  22. package/lib/cjs/types/sdk-general.d.ts +23 -78
  23. package/lib/cjs/types/sdk-general.d.ts.map +1 -1
  24. package/lib/cjs/types/utilities.d.ts +9 -29
  25. package/lib/cjs/types/utilities.d.ts.map +1 -1
  26. package/lib/cjs/utilities.js +9 -29
  27. package/lib/esm/content.js +12 -70
  28. package/lib/esm/content.js.map +1 -1
  29. package/lib/esm/data-crud.js +24 -117
  30. package/lib/esm/data-crud.js.map +1 -1
  31. package/lib/esm/index.js.map +1 -1
  32. package/lib/esm/index.mjs +6 -0
  33. package/lib/esm/lists.js +22 -176
  34. package/lib/esm/lists.js.map +1 -1
  35. package/lib/esm/messaging.js +8 -59
  36. package/lib/esm/messaging.js.map +1 -1
  37. package/lib/esm/preferences.js +57 -0
  38. package/lib/esm/preferences.js.map +1 -0
  39. package/lib/esm/sdk-general.js +13 -45
  40. package/lib/esm/sdk-general.js.map +1 -1
  41. package/lib/esm/types/content.d.ts +12 -70
  42. package/lib/esm/types/data-crud.d.ts +24 -117
  43. package/lib/esm/types/filter-expressions.d.ts +35 -107
  44. package/lib/esm/types/index.d.ts +1 -0
  45. package/lib/esm/types/lists.d.ts +22 -177
  46. package/lib/esm/types/messaging.d.ts +8 -59
  47. package/lib/esm/types/preferences.d.ts +16 -0
  48. package/lib/esm/types/sdk-general.d.ts +23 -78
  49. package/lib/esm/types/utilities.d.ts +9 -29
  50. package/lib/esm/utilities.js +9 -29
  51. package/lib/esm/utilities.js.map +1 -1
  52. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/messaging.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,aAAa,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEzE,mFAAmF;AACnF,oBAAoB;AACpB,mFAAmF;AAEnF;;GAEG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,oBAAoB;IACpB,gCAAe,CAAA;IACf,uBAAuB;IACvB,8BAAa,CAAA;IACb,kCAAkC;IAClC,4CAA2B,CAAA;AAC/B,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAgED,mFAAmF;AACnF,sBAAsB;AACtB,mFAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;A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OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,aAAa,CAAC,KAAK;QACzD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB;KACjD,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,GAAG,GAAG,GAAG,cAAc,2BAA2B,UAAU,gBAAgB,iBAAiB,IAAI,WAAW,EAAE,CAAC;IAEnH,IAAI,SAAS,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IAEpD,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;IAE3E,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE;QACjC,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,SAAS,EAAE,EAAE;KACtD,CAAC,CAAC;IAEH,uEAAuE;IACvE,wFAAwF;AAC5F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,iBAAyB,EAAE,WAAmB,EAAE,OAAuB;IAC3G,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,57 @@
1
+ // Halix SDK License v1.0
2
+ // Copyright (c) 2025 halix.io LLC.
3
+ //
4
+ // This source code is licensed for use **only** within applications
5
+ // running on the Halix platform, in accordance with Halix SDK guidelines.
6
+ //
7
+ // Unauthorized use outside the Halix platform is prohibited.
8
+ // Full license terms available in the LICENSE file.
9
+ /**
10
+ * @module @halix/action-sdk/preferences
11
+ * @description Preference management functions for the Halix Platform action SDK. This module
12
+ * provides functions for retrieving preference values.
13
+ */
14
+ import axios from 'axios';
15
+ import { from, lastValueFrom } from 'rxjs';
16
+ import { serviceAddress, getAuthToken, userContext } from './sdk-general';
17
+ // ================================================================================
18
+ // PREFERENCE RETRIEVAL FUNCTIONS
19
+ // ================================================================================
20
+ /**
21
+ * Retrieves a preference value for the current user.
22
+ *
23
+ * @param prefID - The preference ID to retrieve
24
+ * @returns Promise<any> - the preference value
25
+ * @throws Error if SDK not initialized or user context not available
26
+ *
27
+ * @example
28
+ * const preferenceValue = await getPreference('myPreferenceId');
29
+ */
30
+ export async function getPreference(prefID) {
31
+ if (!getAuthToken) {
32
+ const errorMessage = 'SDK not initialized.';
33
+ console.error(errorMessage);
34
+ throw new Error(errorMessage);
35
+ }
36
+ if (!userContext?.user?.objKey) {
37
+ const errorMessage = 'User context not available. Cannot retrieve preference value.';
38
+ console.error(errorMessage);
39
+ throw new Error(errorMessage);
40
+ }
41
+ const ownerElementID = 'user';
42
+ const ownerKey = userContext.user.objKey;
43
+ let url = `${serviceAddress}/sysapi/preference/${prefID}/${ownerElementID}/${ownerKey}`;
44
+ let authToken = await lastValueFrom(getAuthToken());
45
+ console.log("Sending GET request to " + url + " with token " + authToken);
46
+ let response = await axios.get(url, {
47
+ headers: { "Authorization": `Bearer ${authToken}` },
48
+ });
49
+ return response.data;
50
+ }
51
+ /**
52
+ * Observable version of getPreference. See getPreference for details.
53
+ */
54
+ export function getPreferenceAsObservable(prefID) {
55
+ return from(getPreference(prefID));
56
+ }
57
+ //# sourceMappingURL=preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/preferences.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E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AAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACpD,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -24,59 +24,37 @@ import { of } from 'rxjs';
24
24
  // GLOBAL VARIABLES AND INITIALIZATION
25
25
  // ================================================================================
26
26
  /**
27
- * authToken contains the authentication token that the action handler can use to make API requests
28
- * to Halix web services. This value is set upon calling the initialize function with incoming event
29
- * data.
27
+ * Authentication token for API requests. Set by initialize().
30
28
  */
31
29
  export let getAuthToken;
32
30
  /**
33
- * sandboxKey contains the sandbox key identifier; identifies the sandbox that the action handler is
34
- * running in. The sandbox identifies the current solution. This value is set upon calling the
35
- * initialize function with incoming event data.
31
+ * Sandbox key identifier for the current solution. Set by initialize().
36
32
  */
37
33
  export let sandboxKey;
38
34
  /**
39
- * serviceAddress contains the URL of the Halix service that the action handler can use to make API
40
- * requests to. This value is set upon calling the initialize function with incoming event data.
35
+ * Halix service URL for API requests. Set by initialize().
41
36
  */
42
37
  export let serviceAddress;
43
38
  /**
44
- * actionSubject contains the identifier of the subject of the action. The subject is the object
45
- * that the action is being performed on. The action subject's contents will differ depending on the
46
- * context in which the action is being executed. This value is set upon calling the initialize
47
- * function with incoming event data.
48
- * - for formTemplateActions, the action subject is the data being edited on the form
49
- * - for pageTemplateActions, the action subject is record containing the context variables and
50
- * their corresponding values on the page
51
- * - for objectSaveActions, the action subject is the object being saved
52
- * - for calculatedFieldActions, the action subject is the object containing the calculated field
53
- * - for singleValueActions, the action subject may differ depending on the caller
39
+ * Subject of the action (context-dependent: form data, page variables, object being saved, etc.). Set by initialize().
54
40
  */
55
41
  export let actionSubject;
56
42
  /**
57
- * userContext contains the user context information for the user that is executing the action.
58
- * This value is set upon calling the initialize function with incoming event data.
43
+ * User context (user, userProxy, orgProxy, keys). Set by initialize().
59
44
  */
60
45
  export let userContext;
61
46
  /**
62
- * params contains the parameters passed to the action. If an input dialog is used, params will
63
- * contain the values entered in the dialog. This value is set upon calling the initialize
64
- * function with incoming event data.
47
+ * Parameters passed to the action (e.g., from input dialog). Set by initialize().
65
48
  */
66
49
  export let params;
67
50
  /**
68
- * useBody is a flag indicating how responses should be formatted. If true, the response will be
69
- * returned as an object with the HTTP response code and ActionResponse in the body field. If false,
70
- * the ActionResponse will be returned directly. Typically, this does not need to be set by the
71
- * action handler and should remain false.
51
+ * Response format flag (internal). Typically leave as false.
72
52
  */
73
53
  export let useBody;
74
54
  /**
75
- * initialize initializes the SDK with event data. This should be called at the beginning of the
76
- * action handler to set up the SDK with incoming information, including context information, input
77
- * parameters, and authentication information needed to make API requests to the Halix service.
55
+ * Initializes SDK with event data. Call at the beginning of action handler to set up authentication, context, and parameters.
78
56
  *
79
- * @param event - The event object containing authentication and context information
57
+ * @param event - Event object with body containing IncomingEventBody
80
58
  */
81
59
  export function initialize(event) {
82
60
  let body = event;
@@ -98,14 +76,9 @@ export function initialize(event) {
98
76
  // RESPONSE HELPER FUNCTIONS
99
77
  // ================================================================================
100
78
  /**
101
- * prepareSuccessResponse prepares a success response in the appropriate format. The action handler
102
- * should return an ActionResponse response when the action is successful. If useBody is true, the
103
- * response will be returned as an object with the HTTP response code and the ActionResponse in the
104
- * body field. If useBody is false, the ActionResponse will be returned directly.
79
+ * Formats a success response. Returns ActionResponse directly, or wrapped with statusCode if useBody is true.
105
80
  *
106
- * @param successResponse - The value to return
107
- *
108
- * @returns Formatted success response; an ActionResponse unless useBody is true
81
+ * @returns ActionResponse or {statusCode: 200, body: string}
109
82
  */
110
83
  export function prepareSuccessResponse(successResponse) {
111
84
  if (useBody) {
@@ -117,14 +90,9 @@ export function prepareSuccessResponse(successResponse) {
117
90
  return successResponse;
118
91
  }
119
92
  /**
120
- * prepareErrorResponse prepares an error response in the appropriate format. The action handler
121
- * should return an ErrorResponse response when the action is not successful. If useBody is true,
122
- * the response will be returned as an object with the HTTP response code and the ErrorResponse in
123
- * the body field. If useBody is false, the ErrorResponse will be returned directly.
124
- *
125
- * @param errorMessage - The error message
93
+ * Formats an error response. Returns ErrorResponse directly, or wrapped with statusCode if useBody is true.
126
94
  *
127
- * @returns Formatted error response; an ErrorResponse unless useBody is true
95
+ * @returns ErrorResponse or {statusCode: 400, body: string}
128
96
  */
129
97
  export function prepareErrorResponse(errorMessage) {
130
98
  if (useBody) {
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-general.js","sourceRoot":"","sources":["../../src/sdk-general.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAc,EAAE,EAAE,MAAM,MAAM,CAAC;AAEtC,mFAAmF;AACnF,sCAAsC;AACtC,mFAAmF;AAEnF;;;;GAIG;AACH,MAAM,CAAC,IAAI,YAAsC,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,IAAI,UAAkB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,IAAI,cAAsB,CAAC;AAElC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,IAAI,aAAkB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,IAAI,WAAwB,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,IAAI,MAAc,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,IAAI,OAAgB,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAmC;IAE1D,IAAI,IAAI,GAAQ,KAAK,CAAC;IACtB,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAClB,OAAO,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACP,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,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IACrD,IAAI,OAAO,EAAE,CAAC;QACV,OAAO;YACH,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;SACzC,CAAC;IACN,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACnD,CAAC"}
@@ -19,100 +19,42 @@ export interface ContentResource {
19
19
  deserialize?: (data: any) => ContentResource;
20
20
  }
21
21
  /**
22
- * getOrCreateResource retrieves an existing content resource by its key, or creates a new one
23
- * if the key is not provided. If a resource key is provided, it attempts to fetch the existing
24
- * resource from the server. If no key is provided, it creates a new resource with the specified
25
- * properties.
22
+ * Retrieves an existing content resource by key, or creates a new one if key is null.
26
23
  *
27
- * @param resourceKey - Optional key of the existing resource to retrieve
28
- * @param fileToUpload - Optional file or blob to upload
29
- * @param publicFlag - Whether the resource should be public
30
- * @param resourceType - The type of resource
31
- * @param tags - Array of tags for the resource
32
- *
33
- * @returns Promise resolving to a ContentResource
24
+ * @returns Promise<ContentResource>
34
25
  */
35
26
  export declare function getOrCreateResource(resourceKey: string | null, fileToUpload: File | Blob | null, publicFlag: boolean, resourceType: string, tags: string[]): Promise<ContentResource>;
36
27
  /**
37
- * getOrCreateResourceAsObservable retrieves an existing content resource by its key, or creates a new one
38
- * if the key is not provided. If a resource key is provided, it attempts to fetch the existing
39
- * resource from the server. If no key is provided, it creates a new resource with the specified
40
- * properties.
41
- *
42
- * @param resourceKey - Optional key of the existing resource to retrieve
43
- * @param fileToUpload - Optional file or blob to upload
44
- * @param publicFlag - Whether the resource should be public
45
- * @param resourceType - The type of resource
46
- * @param tags - Array of tags for the resource
47
- *
48
- * @returns Observable resolving to a ContentResource
28
+ * Observable version of getOrCreateResource. See getOrCreateResource for details.
49
29
  */
50
30
  export declare function getOrCreateResourceAsObservable(resourceKey: string | null, fileToUpload: File | Blob | null, publicFlag: boolean, resourceType: string, tags: string[]): Observable<ContentResource>;
51
31
  /**
52
- * saveResource saves a content resource to the server. The resource is saved with appropriate
53
- * ownership parameters based on the current context (solution builder vs regular organization view).
32
+ * Saves a content resource with appropriate ownership based on context (solution builder vs org view).
54
33
  *
55
- * @param resource - The ContentResource to save
56
- *
57
- * @returns Promise resolving to the saved ContentResource
34
+ * @returns Promise<ContentResource>
58
35
  */
59
36
  export declare function saveResource(resource: ContentResource): Promise<ContentResource>;
60
37
  /**
61
- * saveResourceAsObservable saves a content resource to the server. The resource is saved with appropriate
62
- * ownership parameters based on the current context (solution builder vs regular organization view).
63
- *
64
- * @param resource - The ContentResource to save
65
- *
66
- * @returns Observable resolving to the saved ContentResource
38
+ * Observable version of saveResource. See saveResource for details.
67
39
  */
68
40
  export declare function saveResourceAsObservable(resource: ContentResource): Observable<ContentResource>;
69
41
  /**
70
- * sendFileContents uploads file contents to the server for a specific resource. The file is uploaded
71
- * via FormData with the appropriate scope and public flag settings.
42
+ * Uploads file contents to a resource via FormData.
72
43
  *
73
- * @param resourceKey - The key of the resource to upload file contents for
74
- * @param fileToUpload - The file or blob to upload
75
- * @param publicFlag - Whether the file should be public
76
- *
77
- * @returns Promise resolving to true if upload was successful
44
+ * @returns Promise<boolean> - true if successful
78
45
  */
79
46
  export declare function sendFileContents(resourceKey: string, fileToUpload: File | Blob, publicFlag: boolean): Promise<boolean>;
80
47
  /**
81
- * sendFileContentsAsObservable uploads file contents to the server for a specific resource. The file is uploaded
82
- * via FormData with the appropriate scope and public flag settings.
83
- *
84
- * @param resourceKey - The key of the resource to upload file contents for
85
- * @param fileToUpload - The file or blob to upload
86
- * @param publicFlag - Whether the file should be public
87
- *
88
- * @returns Observable resolving to true if upload was successful
48
+ * Observable version of sendFileContents. See sendFileContents for details.
89
49
  */
90
50
  export declare function sendFileContentsAsObservable(resourceKey: string, fileToUpload: File | Blob, publicFlag: boolean): Observable<boolean>;
91
51
  /**
92
- * createOrUpdateResource creates a new content resource or updates an existing one, then uploads
93
- * the file contents to that resource. If a resourceKey is provided, it updates the existing resource;
94
- * otherwise, it creates a new resource and uploads the file to the newly created resource.
52
+ * Creates or updates a content resource and uploads file contents. If resourceKey is provided, updates existing; otherwise creates new.
95
53
  *
96
- * @param resourceKey - Optional key of the existing resource to update; if not provided, a new resource is created
97
- * @param fileToUpload - The file or blob to upload
98
- * @param publicFlag - Whether the resource should be public
99
- * @param resourceType - The type of resource
100
- * @param tags - Array of tags for the resource
101
- *
102
- * @returns Promise resolving to the ContentResource with uploaded file
54
+ * @returns Promise<ContentResource> with uploaded file metadata
103
55
  */
104
56
  export declare function createOrUpdateResource(resourceKey: string | null, fileToUpload: File | Blob, publicFlag: boolean, resourceType: string, tags: string[]): Promise<ContentResource>;
105
57
  /**
106
- * createOrUpdateResourceAsObservable creates a new content resource or updates an existing one, then uploads
107
- * the file contents to that resource. If a resourceKey is provided, it updates the existing resource;
108
- * otherwise, it creates a new resource and uploads the file to the newly created resource.
109
- *
110
- * @param resourceKey - Optional key of the existing resource to update; if not provided, a new resource is created
111
- * @param fileToUpload - The file or blob to upload
112
- * @param publicFlag - Whether the resource should be public
113
- * @param resourceType - The type of resource
114
- * @param tags - Array of tags for the resource
115
- *
116
- * @returns Observable resolving to the ContentResource with uploaded file
58
+ * Observable version of createOrUpdateResource. See createOrUpdateResource for details.
117
59
  */
118
60
  export declare function createOrUpdateResourceAsObservable(resourceKey: string | null, fileToUpload: File | Blob, publicFlag: boolean, resourceType: string, tags: string[]): Observable<ContentResource>;
@@ -8,153 +8,60 @@ export interface SaveOptions {
8
8
  bypassValidation?: boolean;
9
9
  }
10
10
  /**
11
- * getObject retrieves a single object from the database by its data element ID and key.
11
+ * Retrieves a single object by dataElementId and key. Optionally fetch related objects.
12
12
  *
13
- * @param dataElementId - The ID of the data element
14
- * @param key - The key of the object
15
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
16
- * object will include the specified related objects as nested objects
17
- * @returns Promise resolving to the object data
13
+ * @returns Promise<any> - the object data
18
14
  */
19
15
  export declare function getObject(dataElementId: string, key: string, fetchedRelationships?: string[]): Promise<any>;
20
16
  /**
21
- * getObjectAsObservable retrieves a single object from the database by its data element ID and key.
22
- *
23
- * @param dataElementId - The ID of the data element
24
- * @param key - The key of the object
25
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
26
- * object will include the specified related objects as nested objects
27
- *
28
- * @returns Observable resolving to the object data
17
+ * Observable version of getObject. See getObject for details.
29
18
  */
30
19
  export declare function getObjectAsObservable(dataElementId: string, key: string, fetchedRelationships?: string[]): Observable<any>;
31
20
  /**
32
- * getRelatedObjects retrieves an array of objects from the the database. The objects returned are
33
- * related to a parent through a defined relationship in the schema. In a typical setup, action's
34
- * auth token must have scope access to the parent object in order to access all of its related
35
- * objects.
36
- *
37
- * It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
38
- * or organization proxy. For example, in a user context where the current user proxy element is
39
- * "customer," an action might want to retrieve all "purchase" objects related to the current
40
- * customer. Similarly, in an organization context where the current organization proxy is
41
- * "business," an action might want to retrieve all "employee" objects related to the current
42
- * business.
43
- *
44
- * @param parentElementId - The ID of the parent element
45
- * @param parentKey - The key of the parent object
46
- * @param elementId - The ID of the element
47
- * @param filter - Optional filter criteria for the query; if not provided, all related objects will
48
- * be returned
49
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
50
- * objects will include the specified related objects as nested objects
51
- *
52
- * @returns Promise resolving to an array of objects
53
- *
54
- * @see {@link FilterExpression} for filter syntax and examples
21
+ * Retrieves all objects related to a parent through a schema relationship. Commonly used to get objects belonging to current user/org proxy.
22
+ *
23
+ * @param parentElementId - Parent element ID
24
+ * @param parentKey - Parent object key
25
+ * @param elementId - Child element ID
26
+ * @param filter - Optional filter (see FilterExpression)
27
+ * @param fetchedRelationships - Optional relationships to include as nested objects
28
+ * @returns Promise<any[]>
55
29
  */
56
30
  export declare function getRelatedObjects(parentElementId: string, parentKey: string, elementId: string, filter?: FilterExpression, fetchedRelationships?: string[]): Promise<any[]>;
57
31
  /**
58
- * getRelatedObjectsAsObservable retrieves an array of objects from the the database. The objects
59
- * returned are related to a parent through a defined relationship in the schema. In a typical
60
- * setup, action's auth token must have scope access to the parent object in order to access all of
61
- * its related objects.
62
- *
63
- * It is common to use getRelatedObjects to retrieve all objects belonging to the current user proxy
64
- * or organization proxy. For example, in a user context where the current user proxy element is
65
- * "customer," an action might want to retrieve all "purchase" objects related to the current
66
- * customer. Similarly, in an organization context where the current organization proxy is
67
- * "business," an action might want to retrieve all "employee" objects related to the current
68
- * business.
69
- *
70
- * @param parentElementId - The ID of the parent element
71
- * @param parentKey - The key of the parent element
72
- * @param elementId - The ID of the element
73
- * @param filter - Optional filter criteria for the query; if not provided, all related objects will
74
- * be returned
75
- * @param fetchedRelationships - Optional array of relationships to fetch; if provided, the returned
76
- * objects will include the specified related objects as nested objects
77
- *
78
- * @returns Observable resolving to an array of objects
79
- *
80
- * @see {@link FilterExpression} for filter syntax and examples
32
+ * Observable version of getRelatedObjects. See getRelatedObjects for details.
81
33
  */
82
34
  export declare function getRelatedObjectsAsObservable(parentElementId: string, parentKey: string, elementId: string, filter?: FilterExpression, fetchedRelationships?: string[]): Observable<any[]>;
83
35
  /**
84
- * saveRelatedObject saves a related object to the database. The objectToSave is saved, and its
85
- * relationship to the parent object is established based on the relationship specified in the
86
- * schema. The objectToSave must have a relationship to the parent object and the user must have
87
- * scope access to the parent object.
36
+ * Saves a related object and establishes relationship to parent. Returns saved object with any server-assigned values (objKey, calculated fields).
88
37
  *
89
- * @param parentElementId - The ID of the parent element
90
- * @param parentKey - The key of the parent object
91
- * @param elementId - The element ID of the object to save
92
- * @param objectToSave - The object data to save (as a JSON string)
93
- * @param opts - Optional save options
94
- *
95
- * @returns Promise resolving to saved object, including any updates made to the object during the
96
- * save operation (such as assigning an objKey if the object is new), or the assignment of
97
- * calculated values
38
+ * @param objectToSave - JSON string of object data
39
+ * @param opts - Optional: bypassValidation
40
+ * @returns Promise<any> - saved object with updates
98
41
  */
99
42
  export declare function saveRelatedObject(parentElementId: string, parentKey: string, elementId: string, objectToSave: string, opts?: SaveOptions): Promise<any>;
100
43
  /**
101
- * saveRelatedObjectAsObservable saves a related object to the database. The objectToSave is saved,
102
- * and its relationship to the parent object is established based on the relationship specified in
103
- * the schema. The objectToSave must have a relationship to the parent object and the user must have
104
- * scope access to the parent object.
105
- *
106
- * @param parentElementId - The ID of the parent element
107
- * @param parentKey - The key of the parent object
108
- * @param elementId - The element ID of the object to save
109
- * @param objectToSave - The object data to save (as a JSON string)
110
- * @param opts - Optional save options
111
- *
112
- * @returns Observable resolving to saved object, including any updates made to the object during
113
- * the save operation (such as assigning an objKey if the object is new), or the assignment of
114
- * calculated values
44
+ * Observable version of saveRelatedObject. See saveRelatedObject for details.
115
45
  */
116
46
  export declare function saveRelatedObjectAsObservable(parentElementId: string, parentKey: string, elementId: string, objectToSave: string, opts?: SaveOptions): Observable<any>;
117
47
  /**
118
- * deleteRelatedObject deletes a single object related to a specific parent.
48
+ * Deletes a single object related to a parent.
119
49
  *
120
- * @param parentElementId - The ID of the parent element
121
- * @param parentKey - The key of the parent object
122
- * @param childElementId - The ID of the child element to delete
123
- * @param childKey - The key of the child object to delete
124
- *
125
- * @returns Promise resolving to true if deletion was successful
50
+ * @returns Promise<boolean> - true if successful
126
51
  */
127
52
  export declare function deleteRelatedObject(parentElementId: string, parentKey: string, childElementId: string, childKey: string): Promise<boolean>;
128
53
  /**
129
- * deleteRelatedObjectAsObservable deletes a single object related to a specific parent.
130
- *
131
- * @param parentElementId - The ID of the parent element
132
- * @param parentKey - The key of the parent object
133
- * @param childElementId - The ID of the child element to delete
134
- * @param childKey - The key of the child object to delete
135
- *
136
- * @returns Observable resolving to true if deletion was successful
54
+ * Observable version of deleteRelatedObject. See deleteRelatedObject for details.
137
55
  */
138
56
  export declare function deleteRelatedObjectAsObservable(parentElementId: string, parentKey: string, childElementId: string, childKey: string): Observable<boolean>;
139
57
  /**
140
- * deleteRelatedObjects deletes multiple objects related to a specific parent.
141
- *
142
- * @param parentElementId - The ID of the parent element
143
- * @param parentKey - The key of the parent object
144
- * @param childElementId - The ID of the child element to delete
145
- * @param childKeys - Array of keys of the child objects to delete
58
+ * Deletes multiple objects related to a parent.
146
59
  *
147
- * @returns Promise resolving to true if deletion was successful
60
+ * @param childKeys - Array of child object keys to delete
61
+ * @returns Promise<boolean> - true if successful
148
62
  */
149
63
  export declare function deleteRelatedObjects(parentElementId: string, parentKey: string, childElementId: string, childKeys: string[]): Promise<boolean>;
150
64
  /**
151
- * deleteRelatedObjectsAsObservable deletes multiple objects related to a specific parent.
152
- *
153
- * @param parentElementId - The ID of the parent element
154
- * @param parentKey - The key of the parent object
155
- * @param childElementId - The ID of the child element to delete
156
- * @param childKeys - Array of keys of the child objects to delete
157
- *
158
- * @returns Observable resolving to true if deletion was successful
65
+ * Observable version of deleteRelatedObjects. See deleteRelatedObjects for details.
159
66
  */
160
67
  export declare function deleteRelatedObjectsAsObservable(parentElementId: string, parentKey: string, childElementId: string, childKeys: string[]): Observable<boolean>;