Skip to content

collection

collection

Interfaces

CollectionApprovalOperations

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

Properties

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

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

Parameters
Parameter Type
approvalRequestId string
Returns

RemoteQuery<readonly CollectionApprovalRequest[]>

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

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

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

Promise<void>

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

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

Parameters
Parameter Type
approvalRequestId string
Returns

Promise<void>


CollectionApprovalRequest

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

Properties

norbital_id
readonly norbital_id: string;

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

status
readonly status: string;

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


CollectionClient

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

Type Parameters

Type Parameter
TCollections extends CollectionRegistry

Properties

approvals?
readonly optional approvals?: CollectionApprovalOperations;

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

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

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

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

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

history?
readonly optional history?: CollectionHistoryOperations;

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

records
readonly records: CollectionRecordOperations;

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


CollectionDefinition

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

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:101

name
readonly name: string;

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

recordLabel?
readonly optional recordLabel?: string | null;

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

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

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

system?
readonly optional system?: boolean;

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


CollectionField

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

Type Parameters

Type Parameter Default type
TName extends string string

Properties

array?
readonly optional array?: boolean;

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

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

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

kind
readonly kind: string;

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

label?
readonly optional label?: string;

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

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

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

name
readonly name: TName;

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

nullable
readonly nullable: boolean;

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

readOnly?
readonly optional readOnly?: boolean;

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

relation?
readonly optional relation?: object;

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

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:60

variant?
readonly optional variant?: NumericRendererVariant;

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


CollectionFilterOptions

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

Properties

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

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


CollectionGroupedQuery

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

Extends

Type Parameters

Type Parameter
TRow extends object

Properties

bypass_secret?
readonly optional bypass_secret?: string;

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

Inherited from

CollectionQuery.bypass_secret

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

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

Inherited from

CollectionQuery.columns

group
readonly group: object;

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

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:114

Inherited from

CollectionQuery.limit

offset?
readonly optional offset?: number;

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

Inherited from

CollectionQuery.offset

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

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

Inherited from

CollectionQuery.orderBy

readonly optional search?: string;

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

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

Inherited from

CollectionQuery.search

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

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

Inherited from

CollectionQuery.where

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

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

Inherited from

CollectionQuery.with


CollectionHistoryOperations

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

Methods

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

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

Parameters
Parameter Type
collectionName string
recordId string
limit? number
Returns

RemoteQuery<readonly CollectionRecordHistoryEntry[]>


CollectionOperations

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

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:142

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

RemoteQuery<number>

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

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

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:149

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:162

Parameters
Parameter Type
recordId string
Returns

Promise<void>

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

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

Parameters
Parameter Type
query CollectionGroupedQuery<CollectionRow<TCollection>>
Returns

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

findMany
readonly findMany: (query?, options?) => RemoteQuery<CollectionRow<TCollection>[]>;

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

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

RemoteQuery<CollectionRow<TCollection>[]>

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

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

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:156

Parameters
Parameter Type
updates readonly object[]
Returns

Promise<CollectionRow<TCollection>[]>


CollectionQuery

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

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:116

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

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

limit?
readonly optional limit?: number;

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

offset?
readonly optional offset?: number;

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

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

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

readonly optional search?: string;

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

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:109

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

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


CollectionRecord

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

Indexable

[field: string]: unknown

CollectionRecordHistoryEntry

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

Properties

validFrom
readonly validFrom: string;

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

validTo
readonly validTo: string | null;

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

values
readonly values: CollectionRecord;

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

version
readonly version: number;

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


CollectionRecordOperations

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

Methods

findMany()
findMany(collectionName, query?): RemoteQuery<CollectionRecord[]>;

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

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

RemoteQuery<CollectionRecord[]>


CollectionRelationship

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

Properties

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

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

name
readonly name: string;

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

target
readonly target: string;

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


CollectionTransport

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

Schema-erased collection transport used below typed collection clients.

Properties

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

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

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; columns?: Record<string, boolean>; filters?: object[]; limit?: number; offset?: 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.offset? 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:225

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:226

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:231

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>

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

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

Parameters
Parameter Type
input { bypass_secret?: string; collection: string; columns?: Record<string, boolean>; group: { by: string; lanes?: unknown[]; }; limit?: number; offset?: 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.group { by: string; lanes?: unknown[]; }
input.group.by string
input.group.lanes? unknown[]
input.limit? number
input.offset? 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:221

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<CollectionRecord[]>;

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

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

RemoteQuery<CollectionRecord[]>

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

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

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:228

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:26

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:32

row
readonly row: TRow;

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

update
readonly update: TUpdate;

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


RemoteQuery

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

Type Parameters

Type Parameter
T

Properties

current
readonly current: T | undefined;

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

error
readonly error: Error | undefined;

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

loading
readonly loading: boolean;

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

Methods

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

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

Returns

Promise<void>

Type Aliases

CollectionCreateInput

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

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

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:45

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:128


CollectionGroupedResult

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

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

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:36


CollectionRow

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

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

Type Parameters

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

CollectionUpdateInput

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

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

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:105

Type Parameters

Type Parameter
_TRow extends object

ErasedCollectionRegistry

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

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


NumericRendererVariant

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

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

Variables

COLLECTION_SEARCH_MAX_LENGTH

const COLLECTION_SEARCH_MAX_LENGTH: 200 = 200;

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

Functions

collectionSearchTrigramIndexName()

function collectionSearchTrigramIndexName(tableName, columnName): string;

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

Parameters

Parameter Type
tableName string
columnName string

Returns

string


isSearchableCollectionField()

function isSearchableCollectionField(field): boolean;

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

Parameters

Parameter Type
field CollectionField

Returns

boolean