Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

accessProvider.replace()

Learn: Access providers

We recommend you use FSL to create and update access providers. See FSL access provider schema.

Replace an access provider.

Signature

replace(data: { *: Any }) => AccessProvider

Description

Replaces all fields in an AccessProvider document with fields from a provided data object. Fields not present in the data object, excluding the coll and ts metadata fields, are removed.

AccessProvider documents are FQL versions of a database’s FSL access provider schema. AccessProvider documents have the AccessProvider type. See Access providers.

Metadata fields

You can’t use this method to insert or edit the following metadata fields:

  • coll

  • ts

Staged schema

If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.

You can’t rename an access provider while a database has staged schema.

If the database has no staged schema, using this method is equivalent to making an unstaged schema change. Changes are applied immediately to the database’s active schema.

Avoid concurrent schema changes

Concurrent unstaged schema changes can cause contended transactions, even if the changes affect different resources. This includes unstaged changes made using:

A schema change triggers a transaction that validates the entire database schema. To avoid errors, do one of the following instead:

Parameters

Parameter Type Required Description

data

Object

Document fields for the AccessProvider document. Fields not present, excluding the coll and ts metadata fields, in the object are removed.

For supported document fields, see AccessProvider collection.

The object can’t include the following metadata fields:

  • coll

  • ts

Return value

Type Description

AccessProvider

The updated AccessProvider document.

Examples

AccessProvider.byName("someIssuer")?.replace({
  name: "someIssuer",
  issuer: "https://example.com/",
  roles: "customer",
  jwks_uri: "https://example.com/.well-known/jwks.json"
})
{
  name: "someIssuer",
  coll: AccessProvider,
  ts: Time("2099-06-25T15:00:07.450Z"),
  audience: "https://db.fauna.com/db/ysjowue14yyr1",
  issuer: "https://example.com/",
  roles: "customer",
  jwks_uri: "https://example.com/.well-known/jwks.json"
}

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!