Introduction
LOC SDK is a downloadable NPM package that defines the interfaces of data context as well as agents - a series of features provided by LOC's logic runtime that can read and/or write internal and external storages.
The data context contains the following features:
The following agents can be imported:
- Session Storage
- Local Storage
- Event Store
- Result
- Logging
- Local Variable
- HTTP
- Database
- File Storage
This section is currently based on SDK v0.8.0
(which is used for LOC Core v0.8.0
and Studio v1.3.0
).
Supported logic code languages/version:
- JavaScript
ES6/ES2015
and above - TypeScript
3.7.0
and above
You do not need to install SDK in Studio. For installing SDK in CLI workspaces, see Install SDK and Dependencies.
Some of the agents require agent configuration. See tutorial for details.
How to Import Agents
From v0.7.0
all logic have to explicitly import agents and related classes from LOC SDK using ECMAScript 6 imports. Below is a short demostration:
If you are using LOC Studio, the imports will be automatically added in the code blocks.
- JavaScript
- TypeScript
import {
LoggingAgent,
SessionStorageAgent,
EventAgent,
} from "@fstnetwork/loc-logic-sdk";
export async function run(ctx) {
// ...
}
import {
GenericContext,
RailwayError,
LoggingAgent,
SessionStorageAgent,
EventAgent,
Event,
} from "@fstnetwork/loc-logic-sdk";
export async function run(ctx: GenericContext) {
// ...
}
Agent Configuration
Four of the agents - HTTP, database, file storage and mail - requires agent configuration to connect external data sources. You can set them either via Studio.