1.0.9 โ€ข Published 7 months ago

@halix/action-sdk v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

Halix Action SDK

The Halix Action SDK (@halix/action-sdk) provides a development framework for creating NodeJS Lambda-based actions that run inside the Halix Platform. It offers a streamlined API for handling incoming events, interacting with Halix data services, and sending structured responses back to the platform.

๐Ÿ“Œ Note: This SDK is source-available and is licensed for use only within applications running on the Halix platform.
See the LICENSE file for full terms.


๐Ÿ“ฆ Installation

No installation is required.

The @halix/action-sdk is natively available in the Halix platform runtime and does not need to be manually installed or included via NPM.

Import the SDK using ECMAScript module syntax:

import * as hx from '@halix/action-sdk';

This makes all SDK utilities available under the hx. namespace for clean and consistent access throughout your action logic.


๐Ÿš€ Getting Started

Hereโ€™s a minimal example of a Halix action written in Node.js with ES module syntax:

import * as hx from '@halix/action-sdk';

export const handler = async (event) => {
  // Initialize the SDK with incoming event context
  hx.initialize(event);

  // Get the subject of the action
  const obj = hx.actionSubject;

  // Refresh the object from the server
  let fullObj;
  try {
    fullObj = await hx.getObject("exampleType", obj.objKey);
  } catch (err) {
    console.error("Error fetching object", err);
    return hx.prepareErrorResponse("Failed to retrieve data");
  }

  // Perform updates or logic
  fullObj.status = "Updated";

  // Save the updated object
  let saved;
  try {
    saved = await hx.saveRelatedObject("parentType", fullObj.parentKey, "exampleType", fullObj);
  } catch (err) {
    console.error("Error saving object", err);
    return hx.prepareErrorResponse("Failed to save data");
  }

  // Return a success response
  return hx.prepareSuccessResponse({
    responseType: "formTemplateAction",
    updatedSubject: saved,
    successMessage: "Object saved successfully",
    isError: false
  });
};

This action pattern is typical for use in Halixโ€™s Lambda-style runtime environment.


๐Ÿ“˜ Key Concepts

  • authToken: Auth token for secure API calls
  • sandboxKey: Identifies the current Halix solution environment
  • actionSubject: Object being acted on (varies by context)
  • userContext: Info about the executing user
  • params: Inputs passed to the action

๐Ÿ› ๏ธ Core Functions

FunctionDescription
initialize(event)Initializes the SDK with event context
getObject(...), getRelatedObjects(...)Retrieve objects from the Halix data layer
saveRelatedObject(...)Save objects and establish relationships
prepareSuccessResponse(...)Create a success response
prepareErrorResponse(...)Create an error response
sortObjectArray(...)Utility to sort object arrays
getValueFromObject(...)Access nested or relationship-based attributes

See Full Documentation for more information.


๐Ÿ” License

Halix SDK License v1.0

This SDK is licensed for use only within applications running on the Halix platform, in accordance with Halix SDK guidelines.

  • You may not use this SDK outside the Halix platform.
  • Full license text is available in the LICENSE file.

For commercial licensing outside this scope, contact hello@halix.io.


๐Ÿงฐ Contributing

This repository is source-available but not open source. Contributions are currently limited to internal Halix developers and partners. Please open an issue to discuss improvements or bug reports.


๐Ÿงญ About Halix

Halix is a low-code platform designed to empower developers and business users to build powerful applications quickly. Learn more at halix.io.

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

8 months ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago