@microsoft/rayfin-connector-fabric-graphql 1.34.0-alpha.1201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.js +2 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @microsoft/rayfin-connector-fabric-graphql
|
|
2
|
+
|
|
3
|
+
> **Experimental** — this package is experimental and may change substantially in the near future.
|
|
4
|
+
> Mount the typed connectors runtime via the experimental subpath of
|
|
5
|
+
> `@microsoft/rayfin-client` rather than the stable `RayfinClient` entry.
|
|
6
|
+
|
|
7
|
+
Base types for Rayfin's Category A (GraphQL-backed) connectors:
|
|
8
|
+
`fabric-sql`, `fabric-warehouse`, `fabric-sqlanalytics`, and `fabric-graphql`.
|
|
9
|
+
|
|
10
|
+
This package contributes nothing at runtime — it only exports the types
|
|
11
|
+
needed to make
|
|
12
|
+
`client.connectors.<name>.<Entity>.select([...]).where(...).execute()`
|
|
13
|
+
strongly typed when `<name>` points at a GraphQL-backed connector in
|
|
14
|
+
`rayfin.yml`. The runtime that backs the surface lives in
|
|
15
|
+
`@microsoft/rayfin-connectors`.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { METHODS_FOR_CRUD_OPERATION, type ConnectorMarker, type CrudOperation } from '@microsoft/rayfin-connectors';
|
|
2
|
+
import type { EntitySchema, GraphQLEntityClient } from '@microsoft/rayfin-data';
|
|
3
|
+
/**
|
|
4
|
+
* Re-exported from `@microsoft/rayfin-connectors` so the runtime
|
|
5
|
+
* allow-list (`ConnectorConfig.operations`), the CLI validators in
|
|
6
|
+
* `@microsoft/rayfin-tools-common`, and this type marker all reference
|
|
7
|
+
* the same union and cannot drift.
|
|
8
|
+
*/
|
|
9
|
+
export type { CrudOperation };
|
|
10
|
+
/**
|
|
11
|
+
* The subset of `GraphQLEntityClient` method names associated with each
|
|
12
|
+
* CRUD operation. Derived from the shared runtime constant
|
|
13
|
+
* `METHODS_FOR_CRUD_OPERATION` in `@microsoft/rayfin-connectors`, so the
|
|
14
|
+
* compile-time gate and runtime gate use the exact same mapping.
|
|
15
|
+
*/
|
|
16
|
+
type MethodsFor<TOp extends CrudOperation> = (typeof METHODS_FOR_CRUD_OPERATION)[TOp][number];
|
|
17
|
+
/**
|
|
18
|
+
* Narrows `GraphQLEntityClient<TSchema, TEntity>` to only the methods
|
|
19
|
+
* permitted by `TOps`. Disallowed methods become inaccessible at
|
|
20
|
+
* compile time — calling `connector.Entity.update(...)` on a `'read'`
|
|
21
|
+
* connector is a `Property 'update' does not exist` error.
|
|
22
|
+
*/
|
|
23
|
+
export type RestrictedEntityClient<TSchema extends EntitySchema, TEntity extends keyof TSchema & string, TOps extends CrudOperation> = Pick<GraphQLEntityClient<TSchema, TEntity>, MethodsFor<TOps> & keyof GraphQLEntityClient<TSchema, TEntity>>;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level entity API for a Category A connector: one
|
|
26
|
+
* `RestrictedEntityClient` per entity in the connector's schema, gated
|
|
27
|
+
* by `TOps`. Mirrors the shape of `TypedDataClients<TSchema>` from
|
|
28
|
+
* `@microsoft/rayfin-data` but with CRUD gating layered on.
|
|
29
|
+
*/
|
|
30
|
+
export type RestrictedDataApi<TSchema extends EntitySchema, TOps extends CrudOperation = CrudOperation> = {
|
|
31
|
+
[K in keyof TSchema & string]: RestrictedEntityClient<TSchema, K, TOps>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Phantom marker for a Category A (GraphQL-backed) connector instance.
|
|
35
|
+
*
|
|
36
|
+
* Builders never construct this directly. The CLI generates a
|
|
37
|
+
* `schema.ts` per connector that declares e.g.
|
|
38
|
+
* `type SalesDbSchema = GraphQLBackedConnector<{ Product: typeof Product }, 'read'>;`
|
|
39
|
+
* and the typed `client.connectors.salesDb` proxy resolves to a
|
|
40
|
+
* `RestrictedDataApi<...>` whose entity clients only expose the
|
|
41
|
+
* permitted CRUD methods.
|
|
42
|
+
*
|
|
43
|
+
* Both type parameters are phantom — the fields exist only at the
|
|
44
|
+
* type level so the mapped type in `@microsoft/rayfin-connectors`
|
|
45
|
+
* can infer them via `infer S`, `infer O`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* type LakehouseSchema = GraphQLBackedConnector<{ Product: typeof Product }, 'read'>;
|
|
50
|
+
* type SalesDbSchema = GraphQLBackedConnector<
|
|
51
|
+
* { Product: typeof Product; Customer: typeof Customer }
|
|
52
|
+
* >;
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export interface GraphQLBackedConnector<TSchema extends EntitySchema = EntitySchema, TOps extends CrudOperation = CrudOperation> extends ConnectorMarker<RestrictedDataApi<TSchema, TOps>> {
|
|
56
|
+
readonly __schema?: TSchema;
|
|
57
|
+
readonly __ops?: TOps;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@microsoft/rayfin-connector-fabric-graphql",
|
|
3
|
+
"version": "1.34.0-alpha.1201",
|
|
4
|
+
"description": "Experimental Cat A GraphQL-backed connector types for the Rayfin SDK. Provides the entity-oriented marker (GraphQLBackedConnector) and CRUD operation gating used by the typed client.connectors.<name>.<Entity>.select(...).execute() surface.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*.js",
|
|
9
|
+
"dist/**/*.d.ts",
|
|
10
|
+
"!dist/**/__tests__/**",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"eslint": "^9.28.0",
|
|
15
|
+
"prettier": "^3.5.3",
|
|
16
|
+
"typescript": "^5.8.3",
|
|
17
|
+
"vitest": "^3.2.3",
|
|
18
|
+
"@vitest/coverage-v8": "~3.2.4",
|
|
19
|
+
"rimraf": "~6.0.1"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@microsoft/rayfin-connectors": "1.34.0-alpha.1201",
|
|
23
|
+
"@microsoft/rayfin-data": "1.34.0-alpha.1201"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"registry": "https://npm.pkg.github.com",
|
|
27
|
+
"access": "restricted"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/microsoft/project-rayfin.git",
|
|
32
|
+
"directory": "packages/typescript-sdk/connector-fabric-graphql"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"rayfin",
|
|
36
|
+
"connector",
|
|
37
|
+
"graphql",
|
|
38
|
+
"sql"
|
|
39
|
+
],
|
|
40
|
+
"author": "",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"type": "module",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc && node ../scripts/fix-esm-extensions.mjs ./dist",
|
|
45
|
+
"build:watch": "tsc --watch",
|
|
46
|
+
"clean": "rimraf dist && rimraf .tsbuildinfo",
|
|
47
|
+
"test": "vitest run --passWithNoTests"
|
|
48
|
+
}
|
|
49
|
+
}
|