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@1.36.2

This package is not a dependency of @microsoft/rayfin-client, so a fresh app is missing it until you install it explicitly. Pin the version to the Rayfin CLI release you are using.

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.

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

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 SalesWarehouseConnector = GraphQLBackedConnector<
  {
    Customer: typeof Customer;
    Order: typeof Order;
  },
  typeof connectorConfig
>;

TSchema maps entity names to their classes with typeof. connectorConfig.entities can register either string arrays of scalar field names or decorated entity classes. Prefer string arrays in browser-loaded code. Use class entries only when relationship selections need @one / @many cardinality, and verify the production bundle loads; see Decorated entity classes can break a browser bundle.

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.

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.

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, mounted by ConnectorsRayfinClient from @microsoft/rayfin-client. Link the generated connector schema into that client as described in Wiring connectors into your app.

Something wrong on this page?Report an issueEdit this page

On this page