ProofKit

API Reference

Quick reference for all available methods and operators in @proofkit/fmodata.

Query Methods

MethodDescriptionExample
list()Retrieve multiple recordsdb.from(users).list().execute()
get(id)Get a single record by IDdb.from(users).get("user-123").execute()
getSingleField(column)Get a single field valuedb.from(users).get("user-123").getSingleField(users.email).execute()
single()Ensure exactly one recorddb.from(users).list().where(eq(...)).single().execute()
maybeSingle()Get at most one record (returns null if none)db.from(users).list().where(eq(...)).maybeSingle().execute()

CRUD Methods

MethodDescriptionExample
insert(data)Insert a new recorddb.from(users).insert({ username: "john" }).execute()
update(data)Update recordsdb.from(users).update({ active: true }).byId("user-123").execute()
delete()Delete recordsdb.from(users).delete().byId("user-123").execute()

Query Modifiers

MethodDescriptionExample
where(filter)Filter recordsdb.from(users).list().where(eq(users.active, true)).execute()
select(fields)Select specific fieldsdb.from(users).list().select({ username: users.username }).execute()
orderBy(...columns)Sort resultsdb.from(users).list().orderBy(asc(users.name)).execute()
top(n)Limit resultsdb.from(users).list().top(10).execute()
skip(n)Skip records (pagination)db.from(users).list().top(10).skip(20).execute()
count()Get total countdb.from(users).list().count().execute()
expand(table, builder?)Expand related recordsdb.from(contacts).list().expand(users).execute()
navigate(table)Navigate to related tabledb.from(contacts).get("id").navigate(users).execute()

Filter Operators

Comparison Operators

OperatorDescriptionExample
eq(column, value)Equal toeq(users.active, true)
ne(column, value)Not equal tone(users.role, "admin")
gt(column, value)Greater thangt(users.age, 18)
gte(column, value)Greater than or equalgte(users.score, 100)
lt(column, value)Less thanlt(users.age, 65)
lte(column, value)Less than or equallte(users.score, 0)

String Operators

OperatorDescriptionExample
contains(column, value)Contains substringcontains(users.name, "John")
startsWith(column, value)Starts withstartsWith(users.email, "admin")
endsWith(column, value)Ends withendsWith(users.email, ".com")

Array Operators

OperatorDescriptionExample
inArray(column, values)Value in arrayinArray(users.role, ["admin", "moderator"])
notInArray(column, values)Value not in arraynotInArray(users.status, ["banned", "deleted"])

Null Operators

OperatorDescriptionExample
isNull(column)Is nullisNull(users.deletedAt)
isNotNull(column)Is not nullisNotNull(users.email)

Logical Operators

OperatorDescriptionExample
and(...filters)Logical ANDand(eq(users.active, true), gt(users.age, 18))
or(...filters)Logical ORor(eq(users.role, "admin"), eq(users.role, "moderator"))
not(filter)Logical NOTnot(eq(users.active, false))

Sort Helpers

HelperDescriptionExample
asc(column)Ascending orderorderBy(asc(users.name))
desc(column)Descending orderorderBy(desc(users.age))

Webhook Methods

MethodDescriptionExample
webhook.add(config)Add a webhookdb.webhook.add({ webhook: "https://...", tableName: users })
webhook.list()List all webhooksdb.webhook.list()
webhook.get(id)Get a webhook by IDdb.webhook.get(1)
webhook.remove(id)Remove a webhookdb.webhook.remove(1)
webhook.invoke(id, options?)Manually invoke a webhookdb.webhook.invoke(1, { rowIDs: [1, 2, 3] })

Schema Methods

MethodDescriptionExample
schema.createTable(name, fields)Create a new tabledb.schema.createTable("users", fields)
schema.addFields(table, fields)Add fields to a tabledb.schema.addFields("users", newFields)
schema.deleteTable(name)Delete a tabledb.schema.deleteTable("old_table")
schema.deleteField(table, field)Delete a fielddb.schema.deleteField("users", "old_field")
schema.createIndex(table, field)Create an indexdb.schema.createIndex("users", "email")
schema.deleteIndex(table, field)Delete an indexdb.schema.deleteIndex("users", "email")

Script Methods

MethodDescriptionExample
runScript(name, options?)Execute a FileMaker scriptdb.runScript("MyScript", { scriptParam: "value" })

Batch Methods

MethodDescriptionExample
batch(operations)Execute multiple operationsdb.batch([query1, query2]).execute()

Field Builders

BuilderFileMaker TypeChainable Methods
textField()Text.primaryKey(), .notNull(), .readOnly(), .entityId(), .readValidator(), .writeValidator()
numberField()NumberSame as above
dateField()DateSame as above
timeField()TimeSame as above
timestampField()TimestampSame as above
containerField()ContainerSame as above
calcField()CalculationSame as above

Error Types

Error TypeDescriptionType Guard
HTTPErrorHTTP status errors (4xx, 5xx)isHTTPError()
ODataErrorOData protocol errorsisODataError()
ValidationErrorSchema validation failuresisValidationError()
TimeoutErrorRequest timeoutinstanceof TimeoutError
NetworkErrorNetwork connectivity issuesinstanceof NetworkError
RetryLimitErrorRequest failed after retriesinstanceof RetryLimitError
CircuitOpenErrorCircuit breaker is openinstanceof CircuitOpenError
BatchTruncatedErrorBatch operation truncatedisBatchTruncatedError()

On this page