0.0.13 • Published 7 months ago

@clearblade/ia-env v0.0.13

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

@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-env

Usage

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 environment
  • deleteRule: Delete an existing rule
  • createRuleType: Create a new rule type
  • deleteRuleType: Delete an existing rule type

Asset Management

  • createAsset: Create a new asset
  • createAssetLock: Create a lock for asset operations
  • updateAsset: Update an existing asset
  • updateAssetType: Update an asset type definition

Group Management

  • createGroup: Create a new group
  • createGroupLock: Create a lock for group operations
  • updateGroupChildren: Update the children of a group

Event Management

  • createEventType: Create a new event type
  • deleteEventType: Delete an existing event type

User Management

  • updateUserRoles: Update roles for a user
  • resetPassword: Reset a user's password

Types and Interfaces

The package exports several important types and interfaces:

  • Asset: Asset type definition
  • Group: Group type definition
  • User: User type definition
  • AttrSchema: Attribute schema definition
  • PermissionDefinition: Permission definition interface
  • PermissionDefinitionList: List of permission definitions

Error Types

The package includes several error classes for error handling:

  • AlreadyExistsError
  • ForbiddenError
  • IAError
  • InternalServerError
  • InvalidArgumentError
  • NotFoundError
  • RouteRemovedError

Constants

  • IA_PERMISSION_CATEGORIES: Available permission categories
  • USER_INVITE_STATUS: User invitation status constants
  • ATTR_DATA_TYPE: Attribute data type constants
  • CollectionName: Collection name constants

Utilities

  • Router: Router utility for handling routes
  • Route: Route type definition
  • RouteHandlerCreator: Route handler creator type
  • GetParams: Parameter type for GET requests
  • createRoutes: Function to create routes
  • withMigration: Migration utility
  • AssetTypeCache: Cache for asset types
  • UserRoles: User roles utility
  • UserRoleIdsCache: 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.

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago