Rayfin

@microsoft/rayfin-connector-fabric-graphql

Marker APIs for Category A Fabric SQL connectors that expose typed entity CRUD through client.connectors.

@microsoft/rayfin-connector-fabric-graphql supplies marker types for Category A connectors. It has no runtime behavior. The entity proxy comes from @microsoft/rayfin-connectors. See Generating entity files for the guide workflow.

Installation

npm install @microsoft/rayfin-connector-fabric-graphql@2.0.0 @microsoft/rayfin-connectors@2.0.0

Neither package is a dependency of @microsoft/rayfin-client, so a fresh app is missing them until you install them explicitly. Pin the version to the Rayfin CLI release you are using; rayfin connector add prints the exact command.

GraphQLBackedConnector

GraphQLBackedConnector<TSchema, TConfig> is the published marker for all Category A connector types: fabric-sqlanalytics, fabric-warehouse, and fabric-sqldatabase. Per-type marker names such as FabricWarehouse do not exist.

rayfin/connectors/sales/schema.ts
import type { ConnectorConfig } from '@microsoft/rayfin-connectors';
import type { GraphQLBackedConnector } from '@microsoft/rayfin-connector-fabric-graphql';
import type { Customer } from './Customer.js';
import type { Order } from './Order.js';

export type { Customer } from './Customer.js';
export type { Order } from './Order.js';

export const connectorConfig = {
  connector: 'fabric-warehouse',
  operations: ['read', 'create', 'update', 'delete'],
  entities: {
    Customer: ['customerId', 'name'],
    Order: ['orderId', 'customerId', 'amount'],
  },
} as const satisfies ConnectorConfig;

export type SalesSchema = GraphQLBackedConnector<
  {
    Customer: typeof Customer;
    Order: typeof Order;
  },
  typeof connectorConfig
>;

TSchema maps entity names to their classes with typeof. The constructor type carries the primary-key phantom from the entity source metadata; a bare instance type is treated as keyless. TConfig should be typeof connectorConfig, with the value declared as const satisfies ConnectorConfig so the connector and operations literals are not widened.

Changed in 2.0

The marker also declares TConfig as the configuration it accepts, so connectorsService requires the generated connectorConfig itself for this connector. A config rebuilt by hand or annotated as ConnectorConfig no longer satisfies ConnectorConfigs<AppConnectorsSchema>.

connectorConfig.entities registers either string arrays of scalar property names or decorated entity classes. Prefer string arrays in browser-loaded code. Use class entries only when relationship selections need @one / @many cardinality, and make sure the frontend bundler compiles TC39 decorators; see Let the bundler compile entity decorators.

Restricted CRUD surface

The marker resolves to a RestrictedDataApi, one RestrictedEntityClient per entity:

type RestrictedDataApi<
  TSchema extends EntitySchema,
  TOps extends CrudOperation = CrudOperation,
  TDialect extends ConnectorType = ConnectorType,
> = {
  [K in keyof TSchema & string]: RestrictedEntityClient<TSchema, K, TOps, TDialect>;
};

type RestrictedEntityClient<
  TSchema extends EntitySchema,
  TEntity extends keyof TSchema & string,
  TOps extends CrudOperation,
  TDialect extends ConnectorType = ConnectorType,
> = Pick<ConnectorEntityClient<TSchema, TEntity, TDialect>, AllowedMethods>;

CrudOperation is re-exported from @microsoft/rayfin-connectors. The marker reads connectorConfig.operations and keeps only the methods mapped to those CRUD verbs. It also drops findByKey, update, and delete for entities that do not declare a usable primary key. The dialect, connectorConfig.connector, decides the mutation result: Fabric Warehouse returns DbOperationResult, and other writable dialects return the row's registered scalar columns.

Changed in 2.0

Read result types follow the selection: explicit field lists return exactly those fields, and reads without a selection return every scalar field as optional, without relationships. See Read result types follow the selection.

Runtime dependency

The marker gates methods at compile time only. Runtime routing, GraphQL execution, read-after-write behavior, and OPERATION_NOT_ALLOWED checks live in @microsoft/rayfin-connectors, registered on the client with connectorsService.

Changed in 2.0

Register the generated connectorConfig under the connector's rayfin.yml name in connectorsService({ configs }); Category A connectors take no runtime entry. See Wiring connectors into your app.

Something wrong on this page?Report an issueEdit this page

On this page