> ISPO SDK documentation. [HTML](https://ispo.ai/docs/variables/core.entities.html) · [Documentation index](https://ispo.ai/docs/llms.txt)

# Variable entities`Const`

```typescript
entities: {
    content: {
        append: (
            input: {
                bytes: Uint8Array<ArrayBuffer>;
                entityId: string;
                idempotencyKey?: string;
                mediaType: string;
                metadata?: Record<string, CloudSyncJsonValue>;
                slotId: string;
                type: string;
            },
        ) => Promise<
            {
                byteLength: number;
                contentId: string;
                createdAt: string;
                entityId: string;
                mediaType: string;
                metadata?: Record<string, CloudSyncJsonValue>;
                redactedAt?: string;
                sha256: string;
                slotId: string;
                type: string;
            },
        >;
        read: (
            input: {
                contentId: string;
                entityId: string;
                slotId: string;
                type: string;
            },
        ) => Promise<
            {
                bytes: Uint8Array<ArrayBuffer>;
                content: {
                    byteLength: number;
                    contentId: string;
                    createdAt: string;
                    entityId: string;
                    mediaType: string;
                    metadata?: Record<string, CloudSyncJsonValue>;
                    redactedAt?: string;
                    sha256: string;
                    slotId: string;
                    type: string;
                };
            },
        >;
        redact: (
            input: {
                contentId: string;
                entityId: string;
                idempotencyKey?: string;
                slotId: string;
                type: string;
            },
        ) => Promise<
            {
                byteLength: number;
                contentId: string;
                createdAt: string;
                entityId: string;
                mediaType: string;
                metadata?: Record<string, CloudSyncJsonValue>;
                redactedAt?: string;
                sha256: string;
                slotId: string;
                type: string;
            },
        >;
    };
    create: <T = unknown>(
        type: string,
        data: T,
        options?: EntityCreateOptions,
    ) => Promise<EntityRecord<T>>;
    delete: <T = unknown>(
        type: string,
        id: string,
        options?: EntityDeleteOptions,
    ) => Promise<EntityRecord<T>>;
    get: <T = unknown>(type: string, id: string) => Promise<EntityRecord<T>>;
    grant: (input: EntityGrantInput) => Promise<EntityGrant>;
    listTypes: () => Promise<EntityTypeDefinition[]>;
    query: <T = unknown>(
        type: string,
        query?: EntityQuery,
    ) => Promise<EntityQueryResult<T>>;
    requestAccess: (
        type: string,
        operations: EntityAccessOperation[],
    ) => Promise<EntityAccessRequestResult>;
    revoke: (grantId: string) => Promise<EntityGrant>;
    subscribe: (
        input: EntityWatchInput,
        onChange: EntitySubscriptionChange,
    ) => EntitySubscription;
    subscribeQuery: <T = unknown>(
        type: string,
        query: EntityQuery,
        onChange: EntityQuerySubscriptionChange<T>,
        options?: { recoveryCursor?: string },
    ) => EntityQuerySubscription<T>;
    update: <T = unknown>(
        type: string,
        id: string,
        patch: EntityPatch<NoInfer<T>>,
        options?: EntityUpdateOptions,
    ) => Promise<EntityRecord<T>>;
    watch: (input?: EntityWatchInput) => Promise<EntityWatchResult>;
} = ...
```

Types: [CloudSyncJsonValue](../types/core.Supporting_types.CloudSyncJsonValue.md), [EntityCreateOptions](../interfaces/core.EntityCreateOptions.md), [EntityRecord](../interfaces/core.EntityRecord.md), [EntityDeleteOptions](../interfaces/core.Supporting_types.EntityDeleteOptions.md), [EntityGrantInput](../interfaces/core.EntityGrantInput.md), [EntityGrant](../interfaces/core.EntityGrant.md), [EntityTypeDefinition](../interfaces/core.EntityTypeDefinition.md), [EntityQuery](../interfaces/core.EntityQuery.md), [EntityQueryResult](../interfaces/core.EntityQueryResult.md), [EntityAccessOperation](../types/core.EntityAccessOperation.md), [EntityAccessRequestResult](../interfaces/core.EntityAccessRequestResult.md), [EntityWatchInput](../interfaces/core.EntityWatchInput.md), [EntitySubscriptionChange](../types/core.EntitySubscriptionChange.md), [EntitySubscription](../interfaces/core.EntitySubscription.md), [EntityQuerySubscriptionChange](../types/core.EntityQuerySubscriptionChange.md), [EntityQuerySubscription](../interfaces/core.EntityQuerySubscription.md), [EntityPatch](../types/core.Supporting_types.EntityPatch.md), [EntityUpdateOptions](../interfaces/core.EntityUpdateOptions.md), [EntityWatchResult](../interfaces/core.EntityWatchResult.md)

Host-owned entity records. These calls go through the same postMessage bridge as fs/shared APIs; the host checks the manifest request envelope and runtime entity grants before touching SQLite.

#### Type Declaration

*   ##### <a id="content"></a>content: {  
        append: (  
            input: {  
                bytes: Uint8Array<ArrayBuffer\>;  
                entityId: string;  
                idempotencyKey?: string;  
                mediaType: string;  
                metadata?: Record<string, [CloudSyncJsonValue](../types/core.Supporting_types.CloudSyncJsonValue.md)\>;  
                slotId: string;  
                type: string;  
            },  
        ) \=> Promise<  
            {  
                byteLength: number;  
                contentId: string;  
                createdAt: string;  
                entityId: string;  
                mediaType: string;  
                metadata?: Record<string, [CloudSyncJsonValue](../types/core.Supporting_types.CloudSyncJsonValue.md)\>;  
                redactedAt?: string;  
                sha256: string;  
                slotId: string;  
                type: string;  
            },  
        \>;  
        read: (  
            input: {  
                contentId: string;  
                entityId: string;  
                slotId: string;  
                type: string;  
            },  
        ) \=> Promise<  
            {  
                bytes: Uint8Array<ArrayBuffer\>;  
                content: {  
                    byteLength: number;  
                    contentId: string;  
                    createdAt: string;  
                    entityId: string;  
                    mediaType: string;  
                    metadata?: Record<string, [CloudSyncJsonValue](../types/core.Supporting_types.CloudSyncJsonValue.md)\>;  
                    redactedAt?: string;  
                    sha256: string;  
                    slotId: string;  
                    type: string;  
                };  
            },  
        \>;  
        redact: (  
            input: {  
                contentId: string;  
                entityId: string;  
                idempotencyKey?: string;  
                slotId: string;  
                type: string;  
            },  
        ) \=> Promise<  
            {  
                byteLength: number;  
                contentId: string;  
                createdAt: string;  
                entityId: string;  
                mediaType: string;  
                metadata?: Record<string, [CloudSyncJsonValue](../types/core.Supporting_types.CloudSyncJsonValue.md)\>;  
                redactedAt?: string;  
                sha256: string;  
                slotId: string;  
                type: string;  
            },  
        \>;  
    }
    
*   ##### <a id="create"></a>create: <T \= unknown\>(  
        type: string,  
        data: T,  
        options?: [EntityCreateOptions](../interfaces/core.EntityCreateOptions.md),  
    ) \=> Promise<[EntityRecord](../interfaces/core.EntityRecord.md)<T\>\>
    
*   ##### <a id="delete"></a>delete: <T \= unknown\>(  
        type: string,  
        id: string,  
        options?: [EntityDeleteOptions](../interfaces/core.Supporting_types.EntityDeleteOptions.md),  
    ) \=> Promise<[EntityRecord](../interfaces/core.EntityRecord.md)<T\>\>
    
*   ##### <a id="get"></a>get: <T \= unknown\>(type: string, id: string) \=> Promise<[EntityRecord](../interfaces/core.EntityRecord.md)<T\>\>
    
*   ##### <a id="grant"></a>grant: (input: [EntityGrantInput](../interfaces/core.EntityGrantInput.md)) \=> Promise<[EntityGrant](../interfaces/core.EntityGrant.md)\>
    
*   ##### <a id="listtypes"></a>listTypes: () \=> Promise<[EntityTypeDefinition](../interfaces/core.EntityTypeDefinition.md)\[\]\>
    
*   ##### <a id="query"></a>query: <T \= unknown\>(  
        type: string,  
        query?: [EntityQuery](../interfaces/core.EntityQuery.md),  
    ) \=> Promise<[EntityQueryResult](../interfaces/core.EntityQueryResult.md)<T\>\>
    
*   ##### <a id="requestaccess"></a>requestAccess: (  
        type: string,  
        operations: [EntityAccessOperation](../types/core.EntityAccessOperation.md)\[\],  
    ) \=> Promise<[EntityAccessRequestResult](../interfaces/core.EntityAccessRequestResult.md)\>
    
*   ##### <a id="revoke"></a>revoke: (grantId: string) \=> Promise<[EntityGrant](../interfaces/core.EntityGrant.md)\>
    
*   ##### <a id="subscribe"></a>subscribe: (  
        input: [EntityWatchInput](../interfaces/core.EntityWatchInput.md),  
        onChange: [EntitySubscriptionChange](../types/core.EntitySubscriptionChange.md),  
    ) \=> [EntitySubscription](../interfaces/core.EntitySubscription.md)
    
*   ##### <a id="subscribequery"></a>subscribeQuery: <T \= unknown\>(  
        type: string,  
        query: [EntityQuery](../interfaces/core.EntityQuery.md),  
        onChange: [EntityQuerySubscriptionChange](../types/core.EntityQuerySubscriptionChange.md)<T\>,  
        options?: { recoveryCursor?: string },  
    ) \=> [EntityQuerySubscription](../interfaces/core.EntityQuerySubscription.md)<T\>
    
*   ##### <a id="update"></a>update: <T \= unknown\>(  
        type: string,  
        id: string,  
        patch: [EntityPatch](../types/core.Supporting_types.EntityPatch.md)<NoInfer<T\>\>,  
        options?: [EntityUpdateOptions](../interfaces/core.EntityUpdateOptions.md),  
    ) \=> Promise<[EntityRecord](../interfaces/core.EntityRecord.md)<T\>\>
    
*   ##### <a id="watch"></a>watch: (input?: [EntityWatchInput](../interfaces/core.EntityWatchInput.md)) \=> Promise<[EntityWatchResult](../interfaces/core.EntityWatchResult.md)\>
