Skip to content

collection

collection

Interfaces

CollectionApprovalOperations

Defined in: platform-utils/src/collection/types.ts:191

Properties

findMany
readonly findMany: (approvalRequestId) => RemoteQuery<readonly CollectionApprovalRequest[]>;

Defined in: platform-utils/src/collection/types.ts:192

Parameters
Parameter Type
approvalRequestId string
Returns

RemoteQuery<readonly CollectionApprovalRequest[]>

process
readonly process: (input) => Promise<void>;

Defined in: platform-utils/src/collection/types.ts:195

Parameters
Parameter Type
input { action: "APPROVED" | "REJECTED" | "REQUEST_FOR_CHANGE"; approvalRequestId: string; comments?: string; }
input.action "APPROVED" | "REJECTED" | "REQUEST_FOR_CHANGE"
input.approvalRequestId string
input.comments? string
Returns

Promise<void>

withdraw
readonly withdraw: (approvalRequestId) => Promise<void>;

Defined in: platform-utils/src/collection/types.ts:200

Parameters
Parameter Type
approvalRequestId string
Returns

Promise<void>


CollectionApprovalRequest

Defined in: platform-utils/src/collection/types.ts:186

Properties

norbital_id
readonly norbital_id: string;

Defined in: platform-utils/src/collection/types.ts:187

status
readonly status: string;

Defined in: platform-utils/src/collection/types.ts:188


CollectionBaseQuery

Defined in: platform-utils/src/collection/types.ts:119

Extended by

Type Parameters

Type Parameter
TRow extends object

Properties

bypass_secret?
readonly optional bypass_secret?: string;

Defined in: platform-utils/src/collection/types.ts:126

columns?
readonly optional columns?: Record<string, boolean>;

Defined in: platform-utils/src/collection/types.ts:124

orderBy?
readonly optional orderBy?: Partial<Record<Extract<keyof TRow, string>, "asc" | "desc">>;

Defined in: platform-utils/src/collection/types.ts:125

readonly optional search?: string;

Defined in: platform-utils/src/collection/types.ts:123

Typo-tolerant search across text/phone/enum fields and direct relationship text labels.

where?
readonly optional where?: Readonly<Record<string, unknown>>;

Defined in: platform-utils/src/collection/types.ts:121

with?
readonly optional with?: Record<string, unknown>;

Defined in: platform-utils/src/collection/types.ts:120


CollectionClient

Defined in: platform-utils/src/collection/types.ts:225

Type Parameters

Type Parameter
TCollections extends CollectionRegistry

Properties

approvals?
readonly optional approvals?: CollectionApprovalOperations;

Defined in: platform-utils/src/collection/types.ts:234

collections
readonly collections: { readonly [TName in string | number | symbol]: CollectionDefinition<TCollections[TName]> };

Defined in: platform-utils/src/collection/types.ts:229

db
readonly db: { readonly [TName in string | number | symbol]: CollectionOperations<TCollections[TName]> };

Defined in: platform-utils/src/collection/types.ts:226

history?
readonly optional history?: CollectionHistoryOperations;

Defined in: platform-utils/src/collection/types.ts:233

records
readonly records: CollectionRecordOperations;

Defined in: platform-utils/src/collection/types.ts:232


CollectionDbClient

Defined in: platform-utils/src/collection/types.ts:238

Tenant-authored collection surfaces receive only the typed database vocabulary.

Type Parameters

Type Parameter
TCollections extends CollectionRegistry

Properties

db
readonly db: { readonly [TName in string | number | symbol]: CollectionOperations<TCollections[TName]> };

Defined in: platform-utils/src/collection/types.ts:239


CollectionDefinition

Defined in: platform-utils/src/collection/types.ts:107

Type Parameters

Type Parameter Default type
TCollection extends CollectionType<object, object, object> CollectionType

Properties

fields
readonly fields: readonly CollectionField<Extract<keyof CollectionRow<TCollection>, string>>[];

Defined in: platform-utils/src/collection/types.ts:113

name
readonly name: string;

Defined in: platform-utils/src/collection/types.ts:110

recordLabel?
readonly optional recordLabel?: string | null;

Defined in: platform-utils/src/collection/types.ts:111

relationships?
readonly optional relationships?: readonly CollectionRelationship[];

Defined in: platform-utils/src/collection/types.ts:114

system?
readonly optional system?: boolean;

Defined in: platform-utils/src/collection/types.ts:112


CollectionField

Defined in: platform-utils/src/collection/types.ts:64

Type Parameters

Type Parameter Default type
TName extends string string

Properties

array?
readonly optional array?: boolean;

Defined in: platform-utils/src/collection/types.ts:69

currencies?
readonly optional currencies?: readonly string[];

Defined in: platform-utils/src/collection/types.ts:73

kind
readonly kind: string;

Defined in: platform-utils/src/collection/types.ts:66

label?
readonly optional label?: string;

Defined in: platform-utils/src/collection/types.ts:68

mimeTypes?
readonly optional mimeTypes?: readonly string[];

Defined in: platform-utils/src/collection/types.ts:74

name
readonly name: TName;

Defined in: platform-utils/src/collection/types.ts:65

nullable
readonly nullable: boolean;

Defined in: platform-utils/src/collection/types.ts:67

options?
readonly optional options?: Readonly<Record<string, unknown>>;

Defined in: platform-utils/src/collection/types.ts:72

readOnly?
readonly optional readOnly?: boolean;

Defined in: platform-utils/src/collection/types.ts:70

relation?
readonly optional relation?: object;

Defined in: platform-utils/src/collection/types.ts:76

name
readonly name: string;
recordLabel
readonly recordLabel: string | null;
target
readonly target: string;

values?
readonly optional values?: readonly string[];

Defined in: platform-utils/src/collection/types.ts:71

variant?
readonly optional variant?: NumericRendererVariant;

Defined in: platform-utils/src/collection/types.ts:75


CollectionFilterOptions

Defined in: platform-utils/src/collection/types.ts:147

Properties

filters?
readonly optional filters?: readonly object[];

Defined in: platform-utils/src/collection/types.ts:148


CollectionGroupedQuery

Defined in: platform-utils/src/collection/types.ts:135

Extends

Type Parameters

Type Parameter
TRow extends object

Properties

bypass_secret?
readonly optional bypass_secret?: string;

Defined in: platform-utils/src/collection/types.ts:126

Inherited from

CollectionBaseQuery.bypass_secret

columns?
readonly optional columns?: Record<string, boolean>;

Defined in: platform-utils/src/collection/types.ts:124

Inherited from

CollectionBaseQuery.columns

group
readonly group: object;

Defined in: platform-utils/src/collection/types.ts:137

by
readonly by: Extract<keyof TRow, string>;
lanes?
readonly optional lanes?: unknown[];

limit?
readonly optional limit?: number;

Defined in: platform-utils/src/collection/types.ts:136

orderBy?
readonly optional orderBy?: Partial<Record<Extract<keyof TRow, string>, "asc" | "desc">>;

Defined in: platform-utils/src/collection/types.ts:125

Inherited from

CollectionBaseQuery.orderBy

readonly optional search?: string;

Defined in: platform-utils/src/collection/types.ts:123

Typo-tolerant search across text/phone/enum fields and direct relationship text labels.

Inherited from

CollectionBaseQuery.search

where?
readonly optional where?: Readonly<Record<string, unknown>>;

Defined in: platform-utils/src/collection/types.ts:121

Inherited from

CollectionBaseQuery.where

with?
readonly optional with?: Record<string, unknown>;

Defined in: platform-utils/src/collection/types.ts:120

Inherited from

CollectionBaseQuery.with


CollectionHistoryOperations

Defined in: platform-utils/src/collection/types.ts:217

Methods

findMany()
findMany(
   collectionName, 
   recordId, 
limit?): RemoteQuery<readonly CollectionRecordHistoryEntry[]>;

Defined in: platform-utils/src/collection/types.ts:218

Parameters
Parameter Type
collectionName string
recordId string
limit? number
Returns

RemoteQuery<readonly CollectionRecordHistoryEntry[]>


CollectionOperations

Defined in: platform-utils/src/collection/types.ts:151

Type Parameters

Type Parameter
TCollection extends CollectionType<object, object, object>

Properties

count
readonly count: (query?, options?) => RemoteQuery<number>;

Defined in: platform-utils/src/collection/types.ts:163

Parameters
Parameter Type
query? CollectionBaseQuery<CollectionRow<TCollection>>
options? CollectionFilterOptions
Returns

RemoteQuery<number>

create?
readonly optional create?: (input) => Promise<CollectionRow<TCollection>>;

Defined in: platform-utils/src/collection/types.ts:167

Parameters
Parameter Type
input CollectionCreateInput<TCollection>
Returns

Promise<CollectionRow<TCollection>>

createMany?
readonly optional createMany?: (inputs) => Promise<CollectionRow<TCollection>[]>;

Defined in: platform-utils/src/collection/types.ts:170

Parameters
Parameter Type
inputs readonly CollectionCreateInput<TCollection>[]
Returns

Promise<CollectionRow<TCollection>[]>

delete?
readonly optional delete?: (recordId) => Promise<void>;

Defined in: platform-utils/src/collection/types.ts:183

Parameters
Parameter Type
recordId string
Returns

Promise<void>

findFirst
readonly findFirst: (query?) => RemoteQuery<
  | CollectionRow<TCollection>
| undefined>;

Defined in: platform-utils/src/collection/types.ts:156

Parameters
Parameter Type
query? CollectionBaseQuery<CollectionRow<TCollection>>
Returns

RemoteQuery< | CollectionRow<TCollection> | undefined>

findGrouped
readonly findGrouped: (query, options?) => RemoteQuery<Readonly<Record<string, CollectionRow<TCollection>[]>>>;

Defined in: platform-utils/src/collection/types.ts:159

Parameters
Parameter Type
query CollectionGroupedQuery<CollectionRow<TCollection>>
options? CollectionFilterOptions
Returns

RemoteQuery<Readonly<Record<string, CollectionRow<TCollection>[]>>>

findMany
readonly findMany: (query?, options?) => CollectionPageQuery<CollectionRow<TCollection>>;

Defined in: platform-utils/src/collection/types.ts:152

Parameters
Parameter Type
query? CollectionQuery<CollectionRow<TCollection>>
options? CollectionFilterOptions
Returns

CollectionPageQuery<CollectionRow<TCollection>>

update?
readonly optional update?: (recordId, input) => Promise<CollectionRow<TCollection>>;

Defined in: platform-utils/src/collection/types.ts:173

Parameters
Parameter Type
recordId string
input CollectionUpdateInput<TCollection>
Returns

Promise<CollectionRow<TCollection>>

updateMany?
readonly optional updateMany?: (updates) => Promise<CollectionRow<TCollection>[]>;

Defined in: platform-utils/src/collection/types.ts:177

Parameters
Parameter Type
updates readonly object[]
Returns

Promise<CollectionRow<TCollection>[]>


CollectionPage

Defined in: platform-utils/src/collection/types.ts:27

Type Parameters

Type Parameter Default type
TRow extends object CollectionRecord

Properties

nextCursor
readonly nextCursor: string | null;

Defined in: platform-utils/src/collection/types.ts:29

rows
readonly rows: TRow[];

Defined in: platform-utils/src/collection/types.ts:28


CollectionPageQuery

Defined in: platform-utils/src/collection/types.ts:33

A collection page keeps the familiar row result while exposing its opaque continuation.

Extends

Type Parameters

Type Parameter
TRow extends object

Properties

current
readonly current: TRow[] | undefined;

Defined in: platform-utils/src/collection/types.ts:21

Inherited from

RemoteQuery.current

error
readonly error: Error | undefined;

Defined in: platform-utils/src/collection/types.ts:23

Inherited from

RemoteQuery.error

loading
readonly loading: boolean;

Defined in: platform-utils/src/collection/types.ts:22

Inherited from

RemoteQuery.loading

nextCursor
readonly nextCursor: string | null | undefined;

Defined in: platform-utils/src/collection/types.ts:34

Methods

refresh()
refresh(): Promise<void>;

Defined in: platform-utils/src/collection/types.ts:24

Returns

Promise<void>

Inherited from

RemoteQuery.refresh


CollectionQuery

Defined in: platform-utils/src/collection/types.ts:129

Extends

Type Parameters

Type Parameter
TRow extends object

Properties

after?
readonly optional after?: string;

Defined in: platform-utils/src/collection/types.ts:132

Opaque continuation returned by the previous page.

bypass_secret?
readonly optional bypass_secret?: string;

Defined in: platform-utils/src/collection/types.ts:126

Inherited from

CollectionBaseQuery.bypass_secret

columns?
readonly optional columns?: Record<string, boolean>;

Defined in: platform-utils/src/collection/types.ts:124

Inherited from

CollectionBaseQuery.columns

limit?
readonly optional limit?: number;

Defined in: platform-utils/src/collection/types.ts:130

orderBy?
readonly optional orderBy?: Partial<Record<Extract<keyof TRow, string>, "asc" | "desc">>;

Defined in: platform-utils/src/collection/types.ts:125

Inherited from

CollectionBaseQuery.orderBy

readonly optional search?: string;

Defined in: platform-utils/src/collection/types.ts:123

Typo-tolerant search across text/phone/enum fields and direct relationship text labels.

Inherited from

CollectionBaseQuery.search

where?
readonly optional where?: Readonly<Record<string, unknown>>;

Defined in: platform-utils/src/collection/types.ts:121

Inherited from

CollectionBaseQuery.where

with?
readonly optional with?: Record<string, unknown>;

Defined in: platform-utils/src/collection/types.ts:120

Inherited from

CollectionBaseQuery.with


CollectionRecord

Defined in: platform-utils/src/collection/types.ts:16

Indexable

[field: string]: unknown

CollectionRecordHistoryEntry

Defined in: platform-utils/src/collection/types.ts:210

Properties

validFrom
readonly validFrom: string;

Defined in: platform-utils/src/collection/types.ts:212

validTo
readonly validTo: string | null;

Defined in: platform-utils/src/collection/types.ts:213

values
readonly values: CollectionRecord;

Defined in: platform-utils/src/collection/types.ts:211

version
readonly version: number;

Defined in: platform-utils/src/collection/types.ts:214


CollectionRecordOperations

Defined in: platform-utils/src/collection/types.ts:203

Methods

findMany()
findMany(collectionName, query?): CollectionPageQuery<CollectionRecord>;

Defined in: platform-utils/src/collection/types.ts:204

Parameters
Parameter Type
collectionName string
query? CollectionQuery<CollectionRecord>
Returns

CollectionPageQuery<CollectionRecord>


CollectionRelationship

Defined in: platform-utils/src/collection/types.ts:101

Properties

cardinality
readonly cardinality: "one" | "many";

Defined in: platform-utils/src/collection/types.ts:104

name
readonly name: string;

Defined in: platform-utils/src/collection/types.ts:102

target
readonly target: string;

Defined in: platform-utils/src/collection/types.ts:103


CollectionTransport

Defined in: platform-utils/src/collection/types.ts:243

Schema-erased collection transport used below typed collection clients.

Properties

count
readonly count: (input) => RemoteQuery<number>;

Defined in: platform-utils/src/collection/types.ts:256

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; columns?: Record<string, boolean>; filters?: object[]; limit?: number; orderBy?: Record<string, "asc" | "desc">; search?: string; where?: Record<string, unknown>; with?: Record<string, unknown>; }
input.bypass_secret? string
input.collection string
input.columns? Record<string, boolean>
input.filters? object[]
input.limit? number
input.orderBy? Record<string, "asc" | "desc">
input.search? string
input.where? Record<string, unknown>
input.with? Record<string, unknown>
Returns

RemoteQuery<number>

create
readonly create: (input) => Promise<CollectionRecord>;

Defined in: platform-utils/src/collection/types.ts:257

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; input: Record<string, unknown>; }
input.bypass_secret? string
input.collection string
input.input Record<string, unknown>
Returns

Promise<CollectionRecord>

createMany
readonly createMany: (input) => Promise<CollectionRecord[]>;

Defined in: platform-utils/src/collection/types.ts:258

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; inputs: Record<string, unknown>[]; }
input.bypass_secret? string
input.collection string
input.inputs Record<string, unknown>[]
Returns

Promise<CollectionRecord[]>

delete
readonly delete: (input) => Promise<void>;

Defined in: platform-utils/src/collection/types.ts:263

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; record_id: string; }
input.bypass_secret? string
input.collection string
input.record_id string
Returns

Promise<void>

findFirst
readonly findFirst: (input) => RemoteQuery<
  | CollectionRecord
| undefined>;

Defined in: platform-utils/src/collection/types.ts:247

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; columns?: Record<string, boolean>; orderBy?: Record<string, "asc" | "desc">; search?: string; where?: Record<string, unknown>; with?: Record<string, unknown>; }
input.bypass_secret? string
input.collection string
input.columns? Record<string, boolean>
input.orderBy? Record<string, "asc" | "desc">
input.search? string
input.where? Record<string, unknown>
input.with? Record<string, unknown>
Returns

RemoteQuery< | CollectionRecord | undefined>

findGrouped
readonly findGrouped: (input) => RemoteQuery<Readonly<Record<string, CollectionRecord[]>>>;

Defined in: platform-utils/src/collection/types.ts:250

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; columns?: Record<string, boolean>; filters?: object[]; group: { by: string; lanes?: unknown[]; }; limit: number; orderBy?: Record<string, "asc" | "desc">; search?: string; where?: Record<string, unknown>; with?: Record<string, unknown>; }
input.bypass_secret? string
input.collection string
input.columns? Record<string, boolean>
input.filters? object[]
input.group { by: string; lanes?: unknown[]; }
input.group.by string
input.group.lanes? unknown[]
input.limit number
input.orderBy? Record<string, "asc" | "desc">
input.search? string
input.where? Record<string, unknown>
input.with? Record<string, unknown>
Returns

RemoteQuery<Readonly<Record<string, CollectionRecord[]>>>

findHistory?
readonly optional findHistory?: (input) => RemoteQuery<readonly CollectionRecordHistoryEntry[]>;

Defined in: platform-utils/src/collection/types.ts:253

Parameters
Parameter Type
input { collection: string; limit: number; record_id: string; }
input.collection string
input.limit number
input.record_id string
Returns

RemoteQuery<readonly CollectionRecordHistoryEntry[]>

findMany
readonly findMany: (input) => RemoteQuery<CollectionPage<CollectionRecord>>;

Defined in: platform-utils/src/collection/types.ts:244

Parameters
Parameter Type
input { after?: string; bypass_secret?: string; collection: string; columns?: Record<string, boolean>; filters?: object[]; limit?: number; orderBy?: Record<string, "asc" | "desc">; search?: string; where?: Record<string, unknown>; with?: Record<string, unknown>; }
input.after? string
input.bypass_secret? string
input.collection string
input.columns? Record<string, boolean>
input.filters? object[]
input.limit? number
input.orderBy? Record<string, "asc" | "desc">
input.search? string
input.where? Record<string, unknown>
input.with? Record<string, unknown>
Returns

RemoteQuery<CollectionPage<CollectionRecord>>

update
readonly update: (input) => Promise<CollectionRecord>;

Defined in: platform-utils/src/collection/types.ts:259

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; input: Record<string, unknown>; record_id: string; }
input.bypass_secret? string
input.collection string
input.input Record<string, unknown>
input.record_id string
Returns

Promise<CollectionRecord>

updateMany?
readonly optional updateMany?: (input) => Promise<CollectionRecord[]>;

Defined in: platform-utils/src/collection/types.ts:260

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; updates: object[]; }
input.bypass_secret? string
input.collection string
input.updates object[]
Returns

Promise<CollectionRecord[]>


CollectionType

Defined in: platform-utils/src/collection/types.ts:37

Type Parameters

Type Parameter Default type
TRow extends object CollectionRecord
TCreate extends object CollectionRecord
TUpdate extends object CollectionRecord

Properties

create
readonly create: TCreate;

Defined in: platform-utils/src/collection/types.ts:43

row
readonly row: TRow;

Defined in: platform-utils/src/collection/types.ts:42

update
readonly update: TUpdate;

Defined in: platform-utils/src/collection/types.ts:44


RemoteQuery

Defined in: platform-utils/src/collection/types.ts:20

Extended by

Type Parameters

Type Parameter
T

Properties

current
readonly current: T | undefined;

Defined in: platform-utils/src/collection/types.ts:21

error
readonly error: Error | undefined;

Defined in: platform-utils/src/collection/types.ts:23

loading
readonly loading: boolean;

Defined in: platform-utils/src/collection/types.ts:22

Methods

refresh()
refresh(): Promise<void>;

Defined in: platform-utils/src/collection/types.ts:24

Returns

Promise<void>

Type Aliases

CollectionCreateInput

type CollectionCreateInput<TCollection> = TCollection["create"];

Defined in: platform-utils/src/collection/types.ts:52

Type Parameters

Type Parameter
TCollection extends CollectionType<object, object, object>

CollectionFieldName

type CollectionFieldName<TCollection> = Extract<keyof CollectionRow<TCollection>, string>;

Defined in: platform-utils/src/collection/types.ts:56

Type Parameters

Type Parameter
TCollection extends CollectionType<object, object, object>

CollectionFilter

type CollectionFilter = z.infer<typeof CollectionFilterSchema>;

Defined in: platform-utils/src/collection/types.ts:145


CollectionGroupedResult

type CollectionGroupedResult<TRow> = Readonly<Record<string, TRow[]>>;

Defined in: platform-utils/src/collection/types.ts:143

Type Parameters

Type Parameter
TRow extends object

CollectionRegistry

type CollectionRegistry = Readonly<Record<string, CollectionType<object, object, object>>>;

Defined in: platform-utils/src/collection/types.ts:47


CollectionRow

type CollectionRow<TCollection> = TCollection["row"];

Defined in: platform-utils/src/collection/types.ts:50

Type Parameters

Type Parameter
TCollection extends CollectionType<object, object, object>

CollectionUpdateInput

type CollectionUpdateInput<TCollection> = TCollection["update"];

Defined in: platform-utils/src/collection/types.ts:54

Type Parameters

Type Parameter
TCollection extends CollectionType<object, object, object>

CollectionWhere

type CollectionWhere<_TRow> = Readonly<Record<string, unknown>>;

Defined in: platform-utils/src/collection/types.ts:117

Type Parameters

Type Parameter
_TRow extends object

ErasedCollectionRegistry

type ErasedCollectionRegistry = Readonly<Record<string, CollectionType>>;

Defined in: platform-utils/src/collection/types.ts:48


NumericRendererVariant

type NumericRendererVariant = 
  | {
  type: "number";
}
  | {
  max: number;
  type: "star-rating";
}
  | {
  denominator: number;
  type: "progress";
};

Defined in: platform-utils/src/collection/types.ts:59

Variables

COLLECTION_SEARCH_MAX_LENGTH

const COLLECTION_SEARCH_MAX_LENGTH: 200 = 200;

Defined in: platform-utils/src/collection/types.ts:83

Functions

collectionSearchTrigramIndexName()

function collectionSearchTrigramIndexName(tableName, columnName): string;

Defined in: platform-utils/src/collection/types.ts:89

Parameters

Parameter Type
tableName string
columnName string

Returns

string


isSearchableCollectionField()

function isSearchableCollectionField(field): boolean;

Defined in: platform-utils/src/collection/types.ts:85

Parameters

Parameter Type
field CollectionField

Returns

boolean