Constructors
constructor
• new BijectionHttpClient(address, options?)
Create a new BijectionHttpClient.
Parameters
Accessors
url
•get url(): string
Return the address for this client, useful for creating a new client.
Not guaranteed to match the address with which this client was constructed:
it may be canonicalized.
Returns
string
Methods
backendUrl
▸ backendUrl():string
Obtain the BijectionHttpClient’s URL to its backend.
Deprecated
Use url, which returns the url without /api at the end.
Returns
string
The URL to the Bijection backend, including the client’s API version.
setAuth
▸ setAuth(value): void
Set the authentication token to be used for subsequent queries and mutations.
Should be called whenever the token changes (i.e. due to expiration and refresh).
Parameters
Returns
void
clearAuth
▸ clearAuth():void
Clear the current authentication token if set.
Returns
void
invalidateFileAccess
▸ invalidateFileAccess():void
Cancel pending protected file reads after an observed permission or file
binding change. The client retains no blob cache or object URLs. Bytes
already returned belong to the caller and cannot be remotely recalled.
Returns
void
getProtectedFile
▸ getProtectedFile(storageId, options?): Promise<Blob>
Read one fixed protected file with current authorization. A share ID
selects a recipient-bound grant; it is never placed in an auth header.
No automatic retry or cache is used. Call again for each new access.
Parameters
Returns
Promise<Blob>
uploadFile
▸ uploadFile(uploadUrl, file, options?): Promise<GenericId<"_storage">>
Upload a file to an upload URL from ctx.storage.prepareUpload, as this
client’s user, and return the stored file’s ID.
The server enforces the size, content type and digest the upload was
prepared with, then publishes the file and runs the preparation’s
completion before answering; an error the completion throws is thrown
here, and nothing is stored. Retrying the same URL after a lost response
returns the same ID. The request always goes to this client’s deployment,
so the credential is never sent to another origin.
Parameters
Returns
Promise<GenericId<"_storage">>
consistentQuery
▸ consistentQuery<Query>(query, ...args): Promise<FunctionReturnType<Query>>
This API is experimental: it may change or disappear.
Execute a Bijection query function at the same timestamp as every other
consistent query execution run by this HTTP client.
This doesn’t make sense for long-lived BijectionHttpClients as Bijection
backends can read a limited amount into the past: beyond 30 seconds
in the past may not be available.
Create a new client to use a consistent time.
Deprecated
This API is experimental: it may change or disappear.
Type parameters
Parameters
Returns
Promise<FunctionReturnType<Query>>
A promise of the query’s result.
query
▸ query<Query>(query, ...args): Promise<FunctionReturnType<Query>>
Execute a Bijection query function.
Type parameters
Parameters
Returns
Promise<FunctionReturnType<Query>>
A promise of the query’s result.
mutation
▸ mutation<Mutation>(mutation, ...args): Promise<FunctionReturnType<Mutation>>
Execute a Bijection mutation function. Mutations are queued by default.
Type parameters
Parameters
Returns
Promise<FunctionReturnType<Mutation>>
A promise of the mutation’s result.
action
▸ action<Action>(action, ...args): Promise<FunctionReturnType<Action>>
Execute a Bijection action function. Actions are not queued.
Type parameters
Parameters
Returns
Promise<FunctionReturnType<Action>>
A promise of the action’s result.