@clearblade/ia-env v0.0.13
@clearblade/ia-env
A ClearBlade platform-exclusive package for managing Intelligent Asset (IA) entities and their configurations. This package is specifically designed to run only within the ClearBlade platform environment and will not function in other JavaScript environments (Node.js, browsers, Bun, etc.). It provides a comprehensive set of tools for managing assets, rules, groups, events, and user permissions within an IA system. It is designed to be used by IA components or custom code deployed inside an IA system, offering both modern (V8) and ES5 compatible interfaces for different runtime environments.
Installation
npm install @clearblade/ia-envUsage
The package provides two different entry points depending on your runtime environment:
// For V8 services (modern JavaScript runtime)
import { createRule } from '@clearblade/ia-env/modern';
// For duktape services (ES5 compatible runtime)
import { createRule } from '@clearblade/ia-env/es5';API Reference
Core Functions
Rule Management
createRule: Create a new rule in the IA environmentdeleteRule: Delete an existing rulecreateRuleType: Create a new rule typedeleteRuleType: Delete an existing rule type
Asset Management
createAsset: Create a new assetcreateAssetLock: Create a lock for asset operationsupdateAsset: Update an existing assetupdateAssetType: Update an asset type definition
Group Management
createGroup: Create a new groupcreateGroupLock: Create a lock for group operationsupdateGroupChildren: Update the children of a group
Event Management
createEventType: Create a new event typedeleteEventType: Delete an existing event type
User Management
updateUserRoles: Update roles for a userresetPassword: Reset a user's password
Types and Interfaces
The package exports several important types and interfaces:
Asset: Asset type definitionGroup: Group type definitionUser: User type definitionAttrSchema: Attribute schema definitionPermissionDefinition: Permission definition interfacePermissionDefinitionList: List of permission definitions
Error Types
The package includes several error classes for error handling:
AlreadyExistsErrorForbiddenErrorIAErrorInternalServerErrorInvalidArgumentErrorNotFoundErrorRouteRemovedError
Constants
IA_PERMISSION_CATEGORIES: Available permission categoriesUSER_INVITE_STATUS: User invitation status constantsATTR_DATA_TYPE: Attribute data type constantsCollectionName: Collection name constants
Utilities
Router: Router utility for handling routesRoute: Route type definitionRouteHandlerCreator: Route handler creator typeGetParams: Parameter type for GET requestscreateRoutes: Function to create routeswithMigration: Migration utilityAssetTypeCache: Cache for asset typesUserRoles: User roles utilityUserRoleIdsCache: Cache for user role IDs
Note on Current Scope
This package currently provides support for a subset of IA entities and their operations. Additional IA entities and their corresponding operations will be added in future releases. The current implementation focuses on core functionality for assets, rules, groups, events, and user management. Please check the package version and documentation for the most up-to-date list of supported entities and operations.