@thomasfosterau/effect-sparql-node 0.0.0 → 0.1.0
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/LICENSE +21 -0
- package/README.md +219 -1
- package/bin/effect-sparql-server.mjs +26 -0
- package/dist/Cli-DE0eXMJr.d.mts +143 -0
- package/dist/Cli-DFvng1N8.mjs +259 -0
- package/dist/Cli-DFvng1N8.mjs.map +1 -0
- package/dist/Cli.d.mts +2 -0
- package/dist/Cli.mjs +1 -0
- package/dist/NodeSparqlServer-1vSrPk3J.d.mts +41 -0
- package/dist/NodeSparqlServer-CYAd_6BG.mjs +50 -0
- package/dist/NodeSparqlServer-CYAd_6BG.mjs.map +1 -0
- package/dist/NodeSparqlServer.d.mts +2 -0
- package/dist/NodeSparqlServer.mjs +1 -0
- package/dist/SparqlApi-BKE9nIf4.d.mts +488 -0
- package/dist/SparqlApi-BuycDkWu.mjs +371 -0
- package/dist/SparqlApi-BuycDkWu.mjs.map +1 -0
- package/dist/SparqlApi.d.mts +2 -0
- package/dist/SparqlApi.mjs +1 -0
- package/dist/SparqlApiBuilder-BAMpMy-Z.d.mts +83 -0
- package/dist/SparqlApiBuilder-GT7EopBq.mjs +136 -0
- package/dist/SparqlApiBuilder-GT7EopBq.mjs.map +1 -0
- package/dist/SparqlApiBuilder.d.mts +2 -0
- package/dist/SparqlApiBuilder.mjs +1 -0
- package/dist/SparqlApiClient-C82RGMEF.d.mts +386 -0
- package/dist/SparqlApiClient-CJcoFy5b.mjs +203 -0
- package/dist/SparqlApiClient-CJcoFy5b.mjs.map +1 -0
- package/dist/SparqlApiClient.d.mts +2 -0
- package/dist/SparqlApiClient.mjs +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/rolldown-runtime-D8jQpDG7.mjs +12 -0
- package/package.json +59 -3
- package/src/Cli.ts +373 -0
- package/src/NodeSparqlServer.ts +71 -0
- package/src/SparqlApi.ts +506 -0
- package/src/SparqlApiBuilder.ts +196 -0
- package/src/SparqlApiClient.ts +383 -0
- package/src/index.ts +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparqlApiBuilder-GT7EopBq.mjs","names":["SparqlApi.make","SparqlApi.SchemaFallback"],"sources":["../src/SparqlApiBuilder.ts"],"sourcesContent":["/**\n * Serves the `SparqlApi` definition with `HttpApiBuilder`.\n *\n * Every endpoint is implemented with a raw handler (`handleRaw`) that runs\n * the same code as `SparqlServer`: the request body, `Accept` and\n * `Content-Type` are read by the protocol internals, so responses, statuses\n * and error messages are those of `SparqlServer.handler`. Routes the API does\n * not declare (other methods on the endpoints, which get `405` with\n * `Allow`; `OPTIONS` preflights when CORS is on; graphs identified directly\n * by a URL below the graph store) are registered as plain `HttpRouter`\n * fallback routes to `SparqlServer.handler`.\n *\n * `effect/http-api` is `@stability unstable` in Effect 4.\n *\n * @since 0.1.0\n */\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Scope from 'effect/Scope';\nimport type * as HttpClient from 'effect/http/HttpClient';\nimport * as HttpRouter from 'effect/http/HttpRouter';\nimport * as HttpServer from 'effect/http/HttpServer';\nimport * as HttpServerError from 'effect/http/HttpServerError';\nimport * as HttpApiBuilder from 'effect/http-api/HttpApiBuilder';\nimport * as HttpApiMiddleware from 'effect/http-api/HttpApiMiddleware';\nimport type * as Options from '@thomasfosterau/effect-rdf/sparql/Options';\nimport * as SparqlApi from './SparqlApi.ts';\nimport * as SparqlServer from '@thomasfosterau/effect-rdf/sparql/SparqlServer';\nimport * as Testing from '@thomasfosterau/effect-rdf/sparql/Testing';\n\n/**\n * Options of the API server: the server options, with the endpoint paths of\n * the API (the update endpoint is the query endpoint) and where to serve the\n * OpenAPI document.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface ApiOptions\n extends Omit<Options.Options, 'path' | 'updatePath' | 'graphStorePath'>, SparqlApi.Paths {\n /** Serves the OpenAPI document (`SparqlApi.openApi`) as JSON at this path. */\n readonly openapiPath?: `/${string}` | undefined;\n}\n\ninterface ServerPaths {\n readonly path: `/${string}`;\n readonly graphStorePath: `/${string}`;\n}\n\nconst serverOptions = (options?: ApiOptions): Options.Options & ServerPaths => {\n const path = options?.path ?? '/sparql';\n return {\n ...options,\n path,\n updatePath: path,\n graphStorePath: options?.graphStorePath ?? '/rdf-graph-store',\n };\n};\n\nconst handlersFor = (api: SparqlApi.Api, options: Options.Options) => {\n const sparql = SparqlServer.sparqlHandler(options);\n const graphStore = SparqlServer.graphStoreHandler(options);\n return Layer.mergeAll(\n HttpApiBuilder.group(api, 'sparql', (handlers) =>\n handlers.handleRaw('query', () => sparql).handleRaw('post', () => sparql),\n ),\n HttpApiBuilder.group(api, 'graphStore', (handlers) =>\n handlers\n .handleRaw('get', () => graphStore)\n .handleRaw('head', () => graphStore)\n .handleRaw('put', () => graphStore)\n .handleRaw('post', () => graphStore)\n .handleRaw('delete', () => graphStore),\n ),\n );\n};\n\n/**\n * The handlers of both API groups (`sparql` and `graphStore`) for the API at\n * the options' paths, using the server's services from the context.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerHandlers = (options?: ApiOptions) => {\n const resolved = serverOptions(options);\n return handlersFor(SparqlApi.make(resolved), resolved);\n};\n\n/**\n * The `SparqlApi.SchemaFallback` middleware: a request whose parameters or\n * headers fail the API's schemas is answered by `SparqlServer.handler`, so\n * it gets the protocol's own status and message (e.g. `400` \"Exactly one\n * 'query' parameter is allowed\"). Response encoding failures stay `500`.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerSchemaFallback = (\n options?: ApiOptions,\n): Layer.Layer<SparqlApi.SchemaFallback> => {\n const app = SparqlServer.handler(serverOptions(options));\n return HttpApiMiddleware.layerSchemaErrorTransform(SparqlApi.SchemaFallback, (error) =>\n error.kind === 'Body' || error.kind === 'ResponseHeaders' ? Effect.fail(error) : app,\n );\n};\n\n/**\n * The fallback routes: every method on `<path>*` and `<graphStorePath>*`\n * that the API does not declare, answered by `SparqlServer.handler` (`405`\n * with `Allow`, CORS preflights, direct graph identification, `404` for\n * other paths).\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerFallback = (\n options?: ApiOptions,\n): Layer.Layer<\n never,\n never,\n HttpRouter.HttpRouter | HttpRouter.Request.From<'Requires', SparqlServer.Requirements>\n> => {\n const resolved = serverOptions(options);\n const app = SparqlServer.handler(resolved);\n return HttpRouter.use((router) =>\n Effect.gen(function* () {\n // A wildcard right after the path matches the path itself (for methods the API does not\n // declare) and everything below it, without clashing with the API's own routes.\n yield* router.add('*', `${resolved.path}*`, app);\n yield* router.add('*', `${resolved.graphStorePath}*`, app);\n }),\n );\n};\n\n/**\n * Registers the API on the `HttpRouter`: the `HttpApiBuilder` routes with\n * their handlers and the `SchemaFallback` middleware, the fallback routes and, with `openapiPath`, the OpenAPI\n * document.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerRoutes = (options?: ApiOptions) => {\n const resolved = serverOptions(options);\n const api = SparqlApi.make(resolved);\n const schemaFallback = layerSchemaFallback(options);\n return Layer.mergeAll(\n HttpApiBuilder.layer(api, { openapiPath: options?.openapiPath }).pipe(\n Layer.provide(handlersFor(api, resolved).pipe(Layer.provide(schemaFallback))),\n ),\n layerFallback(options),\n );\n};\n\n/**\n * Serves the API routes with `HttpRouter.serve` on an `HttpServer` from the\n * context (logging requests unless `logging: false`); the server layer (such\n * as `NodeHttpServer.layer`) also provides the platform services\n * `HttpApiBuilder` needs.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerServe = (options?: ApiOptions) =>\n HttpRouter.serve(layerRoutes({ ...options, logging: false }), {\n disableLogger: options?.logging === false,\n });\n\n/**\n * In-process testing: builds a client for the `SparqlApi` routes\n * (`layerRoutes(options)`) using the server's services from\n * the context. The routes live as long as the surrounding scope.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const makeTestClient = (\n options?: ApiOptions,\n): Effect.Effect<HttpClient.HttpClient, never, SparqlServer.Requirements | Scope.Scope> =>\n Effect.gen(function* () {\n const scope = yield* Scope.Scope;\n const context = yield* Effect.context<SparqlServer.Requirements>();\n const app = yield* HttpRouter.toHttpEffect(\n layerRoutes(options).pipe(Layer.provide(HttpServer.layerServices)),\n );\n return Testing.fromApp(\n app.pipe(\n Effect.catchCause((cause) =>\n Effect.map(HttpServerError.causeResponse(cause), ([response]) => response),\n ),\n Effect.provideService(Scope.Scope, scope),\n Effect.provideContext(context),\n ),\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAM,iBAAiB,YAAwD;CAC7E,MAAM,OAAO,SAAS,QAAQ;CAC9B,OAAO;EACL,GAAG;EACH;EACA,YAAY;EACZ,gBAAgB,SAAS,kBAAkB;CAC7C;AACF;AAEA,MAAM,eAAe,KAAoB,YAA6B;CACpE,MAAM,SAAS,aAAa,cAAc,OAAO;CACjD,MAAM,aAAa,aAAa,kBAAkB,OAAO;CACzD,OAAO,MAAM,SACX,eAAe,MAAM,KAAK,WAAW,aACnC,SAAS,UAAU,eAAe,MAAM,CAAC,CAAC,UAAU,cAAc,MAAM,CAC1E,GACA,eAAe,MAAM,KAAK,eAAe,aACvC,SACG,UAAU,aAAa,UAAU,CAAC,CAClC,UAAU,cAAc,UAAU,CAAC,CACnC,UAAU,aAAa,UAAU,CAAC,CAClC,UAAU,cAAc,UAAU,CAAC,CACnC,UAAU,gBAAgB,UAAU,CACzC,CACF;AACF;;;;;;;;AASA,MAAa,iBAAiB,YAAyB;CACrD,MAAM,WAAW,cAAc,OAAO;CACtC,OAAO,YAAYA,KAAe,QAAQ,GAAG,QAAQ;AACvD;;;;;;;;;;AAWA,MAAa,uBACX,YAC0C;CAC1C,MAAM,MAAM,aAAa,QAAQ,cAAc,OAAO,CAAC;CACvD,OAAO,kBAAkB,0BAA0BC,iBAA2B,UAC5E,MAAM,SAAS,UAAU,MAAM,SAAS,oBAAoB,OAAO,KAAK,KAAK,IAAI,GACnF;AACF;;;;;;;;;;AAWA,MAAa,iBACX,YAKG;CACH,MAAM,WAAW,cAAc,OAAO;CACtC,MAAM,MAAM,aAAa,QAAQ,QAAQ;CACzC,OAAO,WAAW,KAAK,WACrB,OAAO,IAAI,aAAa;EAGtB,OAAO,OAAO,IAAI,KAAK,GAAG,SAAS,KAAK,IAAI,GAAG;EAC/C,OAAO,OAAO,IAAI,KAAK,GAAG,SAAS,eAAe,IAAI,GAAG;CAC3D,CAAC,CACH;AACF;;;;;;;;;AAUA,MAAa,eAAe,YAAyB;CACnD,MAAM,WAAW,cAAc,OAAO;CACtC,MAAM,MAAMD,KAAe,QAAQ;CACnC,MAAM,iBAAiB,oBAAoB,OAAO;CAClD,OAAO,MAAM,SACX,eAAe,MAAM,KAAK,EAAE,aAAa,SAAS,YAAY,CAAC,CAAC,CAAC,KAC/D,MAAM,QAAQ,YAAY,KAAK,QAAQ,CAAC,CAAC,KAAK,MAAM,QAAQ,cAAc,CAAC,CAAC,CAC9E,GACA,cAAc,OAAO,CACvB;AACF;;;;;;;;;;AAWA,MAAa,cAAc,YACzB,WAAW,MAAM,YAAY;CAAE,GAAG;CAAS,SAAS;AAAM,CAAC,GAAG,EAC5D,eAAe,SAAS,YAAY,MACtC,CAAC;;;;;;;;;AAUH,MAAa,kBACX,YAEA,OAAO,IAAI,aAAa;CACtB,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,UAAU,OAAO,OAAO,QAAmC;CACjE,MAAM,MAAM,OAAO,WAAW,aAC5B,YAAY,OAAO,CAAC,CAAC,KAAK,MAAM,QAAQ,WAAW,aAAa,CAAC,CACnE;CACA,OAAO,QAAQ,QACb,IAAI,KACF,OAAO,YAAY,UACjB,OAAO,IAAI,gBAAgB,cAAc,KAAK,IAAI,CAAC,cAAc,QAAQ,CAC3E,GACA,OAAO,eAAe,MAAM,OAAO,KAAK,GACxC,OAAO,eAAe,OAAO,CAC/B,CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as layerRoutes, c as makeTestClient, i as layerHandlers, o as layerSchemaFallback, r as layerFallback, s as layerServe, t as ApiOptions } from "./SparqlApiBuilder-BAMpMy-Z.mjs";
|
|
2
|
+
export { ApiOptions, layerFallback, layerHandlers, layerRoutes, layerSchemaFallback, layerServe, makeTestClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as layerFallback, r as layerHandlers, i as layerRoutes, a as layerSchemaFallback, o as layerServe, s as makeTestClient } from "./SparqlApiBuilder-GT7EopBq.mjs";
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { c as Paths, m as SchemaFallback, n as Api } from "./SparqlApi-BKE9nIf4.mjs";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as Dataset from "@thomasfosterau/effect-rdf/Dataset";
|
|
6
|
+
import * as ProtocolErrors from "@thomasfosterau/effect-rdf/sparql/ProtocolErrors";
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
import * as HttpApiClient from "effect/http-api/HttpApiClient";
|
|
10
|
+
import * as ClientErrors from "@thomasfosterau/effect-rdf/sparql/ClientErrors";
|
|
11
|
+
import * as ResultsStream from "@thomasfosterau/effect-rdf/sparql/ResultsStream";
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
13
|
+
import * as HttpClientError from "effect/http/HttpClientError";
|
|
14
|
+
declare namespace SparqlApiClient_d_exports {
|
|
15
|
+
export { ApiError, Body, Client, GraphTarget, Options, QueryOptions, SparqlApiClient, UpdateOptions, construct, layer, make, query, readGraph, results, update, writeGraph };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The generated client of the `SparqlApi`.
|
|
19
|
+
*
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
* @category models
|
|
22
|
+
*/
|
|
23
|
+
type Client = HttpApiClient.ForApi<Api>;
|
|
24
|
+
/**
|
|
25
|
+
* Options of the derived client.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
* @category models
|
|
29
|
+
*/
|
|
30
|
+
interface Options {
|
|
31
|
+
/** The server's base URL (e.g. `https://example.org`); paths are appended to it. */
|
|
32
|
+
readonly baseUrl?: string | URL | undefined;
|
|
33
|
+
/** The endpoint paths, when the server does not use the defaults. */
|
|
34
|
+
readonly paths?: Paths | undefined;
|
|
35
|
+
/** Transforms the `HttpClient` (retries, authentication, …). */
|
|
36
|
+
readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Derives the client from the API definition, using the `HttpClient` from
|
|
40
|
+
* the context.
|
|
41
|
+
*
|
|
42
|
+
* @since 0.1.0
|
|
43
|
+
* @category constructors
|
|
44
|
+
*/
|
|
45
|
+
declare const make: (options?: Options) => Effect.Effect<Client, never, HttpClient.HttpClient>;
|
|
46
|
+
declare const SparqlApiClient_base: Context.ServiceClass<SparqlApiClient, "@thomasfosterau/effect-sparql-node/SparqlApiClient", {
|
|
47
|
+
readonly sparql: {
|
|
48
|
+
readonly query: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"query", "GET", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
49
|
+
readonly query: Schema.optionalKey<Schema.String>;
|
|
50
|
+
readonly 'default-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
51
|
+
readonly 'named-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
52
|
+
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
53
|
+
readonly accept: Schema.optionalKey<Schema.String>;
|
|
54
|
+
}>>, import("effect/http-api/HttpApiSchema").StreamUint8Array, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
55
|
+
readonly status: number;
|
|
56
|
+
readonly message: string;
|
|
57
|
+
readonly _tag: "ProtocolError";
|
|
58
|
+
readonly headers?: {
|
|
59
|
+
readonly [x: string]: string;
|
|
60
|
+
} | undefined;
|
|
61
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
62
|
+
readonly status: Schema.Number;
|
|
63
|
+
readonly message: Schema.String;
|
|
64
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
65
|
+
}>], {
|
|
66
|
+
readonly status: number;
|
|
67
|
+
readonly message: string;
|
|
68
|
+
readonly _tag: "ProtocolError";
|
|
69
|
+
readonly headers?: {
|
|
70
|
+
readonly [x: string]: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
73
|
+
readonly status: Schema.Number;
|
|
74
|
+
readonly message: Schema.String;
|
|
75
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
76
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
77
|
+
readonly post: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"post", "POST", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
78
|
+
readonly 'default-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
79
|
+
readonly 'named-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
80
|
+
readonly 'using-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
81
|
+
readonly 'using-named-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
82
|
+
}>>, Schema.toCodecJson<Schema.decodeTo<Schema.TaggedStruct<"DirectQuery", {
|
|
83
|
+
readonly query: Schema.String;
|
|
84
|
+
}>, Schema.String, never, never> | Schema.decodeTo<Schema.TaggedStruct<"DirectUpdate", {
|
|
85
|
+
readonly update: Schema.String;
|
|
86
|
+
}>, Schema.String, never, never> | Schema.Struct<{
|
|
87
|
+
readonly query: Schema.optionalKey<Schema.String>;
|
|
88
|
+
readonly update: Schema.optionalKey<Schema.String>;
|
|
89
|
+
readonly 'default-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
90
|
+
readonly 'named-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
91
|
+
readonly 'using-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
92
|
+
readonly 'using-named-graph-uri': Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
93
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
94
|
+
readonly accept: Schema.optionalKey<Schema.String>;
|
|
95
|
+
}>>, import("effect/http-api/HttpApiSchema").StreamUint8Array | Schema.toCodecJson<import("effect/http-api/HttpApiSchema").NoContent>, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
96
|
+
readonly status: number;
|
|
97
|
+
readonly message: string;
|
|
98
|
+
readonly _tag: "ProtocolError";
|
|
99
|
+
readonly headers?: {
|
|
100
|
+
readonly [x: string]: string;
|
|
101
|
+
} | undefined;
|
|
102
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
103
|
+
readonly status: Schema.Number;
|
|
104
|
+
readonly message: Schema.String;
|
|
105
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
106
|
+
}>], {
|
|
107
|
+
readonly status: number;
|
|
108
|
+
readonly message: string;
|
|
109
|
+
readonly _tag: "ProtocolError";
|
|
110
|
+
readonly headers?: {
|
|
111
|
+
readonly [x: string]: string;
|
|
112
|
+
} | undefined;
|
|
113
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
114
|
+
readonly status: Schema.Number;
|
|
115
|
+
readonly message: Schema.String;
|
|
116
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
117
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
118
|
+
};
|
|
119
|
+
readonly graphStore: {
|
|
120
|
+
readonly get: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"get", "GET", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
121
|
+
readonly graph: Schema.optionalKey<Schema.String>;
|
|
122
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
123
|
+
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
124
|
+
readonly accept: Schema.optionalKey<Schema.String>;
|
|
125
|
+
}>>, import("effect/http-api/HttpApiSchema").StreamUint8Array, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
126
|
+
readonly status: number;
|
|
127
|
+
readonly message: string;
|
|
128
|
+
readonly _tag: "ProtocolError";
|
|
129
|
+
readonly headers?: {
|
|
130
|
+
readonly [x: string]: string;
|
|
131
|
+
} | undefined;
|
|
132
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
133
|
+
readonly status: Schema.Number;
|
|
134
|
+
readonly message: Schema.String;
|
|
135
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
136
|
+
}>], {
|
|
137
|
+
readonly status: number;
|
|
138
|
+
readonly message: string;
|
|
139
|
+
readonly _tag: "ProtocolError";
|
|
140
|
+
readonly headers?: {
|
|
141
|
+
readonly [x: string]: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
144
|
+
readonly status: Schema.Number;
|
|
145
|
+
readonly message: Schema.String;
|
|
146
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
147
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
148
|
+
readonly head: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"head", "HEAD", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
149
|
+
readonly graph: Schema.optionalKey<Schema.String>;
|
|
150
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
151
|
+
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
152
|
+
readonly accept: Schema.optionalKey<Schema.String>;
|
|
153
|
+
}>>, Schema.toCodecJson<Schema.Void>, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
154
|
+
readonly status: number;
|
|
155
|
+
readonly message: string;
|
|
156
|
+
readonly _tag: "ProtocolError";
|
|
157
|
+
readonly headers?: {
|
|
158
|
+
readonly [x: string]: string;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
161
|
+
readonly status: Schema.Number;
|
|
162
|
+
readonly message: Schema.String;
|
|
163
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
164
|
+
}>], {
|
|
165
|
+
readonly status: number;
|
|
166
|
+
readonly message: string;
|
|
167
|
+
readonly _tag: "ProtocolError";
|
|
168
|
+
readonly headers?: {
|
|
169
|
+
readonly [x: string]: string;
|
|
170
|
+
} | undefined;
|
|
171
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
172
|
+
readonly status: Schema.Number;
|
|
173
|
+
readonly message: Schema.String;
|
|
174
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
175
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
176
|
+
readonly put: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"put", "PUT", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
177
|
+
readonly graph: Schema.optionalKey<Schema.String>;
|
|
178
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
179
|
+
}>>, Schema.toCodecJson<Schema.decodeTo<Schema.Struct<{
|
|
180
|
+
readonly mediaType: Schema.Literal<string>;
|
|
181
|
+
readonly document: Schema.String;
|
|
182
|
+
}>, Schema.String, never, never>>, never, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").NoContent | import("effect/http-api/HttpApiSchema").Created>, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
183
|
+
readonly status: number;
|
|
184
|
+
readonly message: string;
|
|
185
|
+
readonly _tag: "ProtocolError";
|
|
186
|
+
readonly headers?: {
|
|
187
|
+
readonly [x: string]: string;
|
|
188
|
+
} | undefined;
|
|
189
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
190
|
+
readonly status: Schema.Number;
|
|
191
|
+
readonly message: Schema.String;
|
|
192
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
193
|
+
}>], {
|
|
194
|
+
readonly status: number;
|
|
195
|
+
readonly message: string;
|
|
196
|
+
readonly _tag: "ProtocolError";
|
|
197
|
+
readonly headers?: {
|
|
198
|
+
readonly [x: string]: string;
|
|
199
|
+
} | undefined;
|
|
200
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
201
|
+
readonly status: Schema.Number;
|
|
202
|
+
readonly message: Schema.String;
|
|
203
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
204
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
205
|
+
readonly post: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"post", "POST", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
206
|
+
readonly graph: Schema.optionalKey<Schema.String>;
|
|
207
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
208
|
+
}>>, Schema.toCodecJson<Schema.decodeTo<Schema.Struct<{
|
|
209
|
+
readonly mediaType: Schema.Literal<string>;
|
|
210
|
+
readonly document: Schema.String;
|
|
211
|
+
}>, Schema.String, never, never>>, never, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").NoContent | import("effect/http-api/HttpApiSchema").Created>, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
212
|
+
readonly status: number;
|
|
213
|
+
readonly message: string;
|
|
214
|
+
readonly _tag: "ProtocolError";
|
|
215
|
+
readonly headers?: {
|
|
216
|
+
readonly [x: string]: string;
|
|
217
|
+
} | undefined;
|
|
218
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
219
|
+
readonly status: Schema.Number;
|
|
220
|
+
readonly message: Schema.String;
|
|
221
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
222
|
+
}>], {
|
|
223
|
+
readonly status: number;
|
|
224
|
+
readonly message: string;
|
|
225
|
+
readonly _tag: "ProtocolError";
|
|
226
|
+
readonly headers?: {
|
|
227
|
+
readonly [x: string]: string;
|
|
228
|
+
} | undefined;
|
|
229
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
230
|
+
readonly status: Schema.Number;
|
|
231
|
+
readonly message: Schema.String;
|
|
232
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
233
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
234
|
+
readonly delete: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"delete", "DELETE", `/${string}`, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
235
|
+
readonly graph: Schema.optionalKey<Schema.String>;
|
|
236
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
237
|
+
}>>, never, never, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").NoContent>, Schema.toCodecJson<Schema.decodeTo<Schema.decodeTo<Schema.declareConstructor<ProtocolErrors.ProtocolError, {
|
|
238
|
+
readonly status: number;
|
|
239
|
+
readonly message: string;
|
|
240
|
+
readonly _tag: "ProtocolError";
|
|
241
|
+
readonly headers?: {
|
|
242
|
+
readonly [x: string]: string;
|
|
243
|
+
} | undefined;
|
|
244
|
+
}, readonly [Schema.TaggedStruct<"ProtocolError", {
|
|
245
|
+
readonly status: Schema.Number;
|
|
246
|
+
readonly message: Schema.String;
|
|
247
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
248
|
+
}>], {
|
|
249
|
+
readonly status: number;
|
|
250
|
+
readonly message: string;
|
|
251
|
+
readonly _tag: "ProtocolError";
|
|
252
|
+
readonly headers?: {
|
|
253
|
+
readonly [x: string]: string;
|
|
254
|
+
} | undefined;
|
|
255
|
+
}>, Schema.TaggedStruct<"ProtocolError", {
|
|
256
|
+
readonly status: Schema.Number;
|
|
257
|
+
readonly message: Schema.String;
|
|
258
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
259
|
+
}>, never, never>, Schema.String, never, never>>, SchemaFallback, import("effect/http-api/HttpApiMiddleware").ApplyServices<SchemaFallback, never>>, never, never>;
|
|
260
|
+
};
|
|
261
|
+
}>;
|
|
262
|
+
/**
|
|
263
|
+
* The derived client as a service.
|
|
264
|
+
*
|
|
265
|
+
* @since 0.1.0
|
|
266
|
+
* @category services
|
|
267
|
+
*/
|
|
268
|
+
declare class SparqlApiClient extends SparqlApiClient_base {}
|
|
269
|
+
/**
|
|
270
|
+
* A layer providing the derived client.
|
|
271
|
+
*
|
|
272
|
+
* @since 0.1.0
|
|
273
|
+
* @category layers
|
|
274
|
+
*/
|
|
275
|
+
declare const layer: (options?: Options) => Layer.Layer<SparqlApiClient, never, HttpClient.HttpClient>;
|
|
276
|
+
/**
|
|
277
|
+
* Any failure of a derived client call: a protocol error status, a transport
|
|
278
|
+
* or decoding failure of the generated client, or an unreadable body.
|
|
279
|
+
*
|
|
280
|
+
* @since 0.1.0
|
|
281
|
+
* @category errors
|
|
282
|
+
*/
|
|
283
|
+
type ApiError = ProtocolErrors.ProtocolError | HttpClientError.HttpClientError | Schema.SchemaError | ClientErrors.MalformedResponseError | ClientErrors.UnsupportedMediaTypeError;
|
|
284
|
+
/**
|
|
285
|
+
* A response body and its media type.
|
|
286
|
+
*
|
|
287
|
+
* @since 0.1.0
|
|
288
|
+
* @category models
|
|
289
|
+
*/
|
|
290
|
+
interface Body {
|
|
291
|
+
/** The media type of the body, without parameters. */
|
|
292
|
+
readonly mediaType: string;
|
|
293
|
+
readonly bytes: Stream.Stream<Uint8Array, ApiError>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* The protocol dataset of a query (`default-graph-uri` / `named-graph-uri`).
|
|
297
|
+
*
|
|
298
|
+
* @since 0.1.0
|
|
299
|
+
* @category models
|
|
300
|
+
*/
|
|
301
|
+
interface QueryOptions {
|
|
302
|
+
readonly defaultGraphs?: ReadonlyArray<string> | undefined;
|
|
303
|
+
readonly namedGraphs?: ReadonlyArray<string> | undefined;
|
|
304
|
+
/** The `Accept` header (default: every results and RDF format). */
|
|
305
|
+
readonly accept?: string | undefined;
|
|
306
|
+
/** `get` (default) sends `?query=`, `post` an `application/sparql-query` body. */
|
|
307
|
+
readonly method?: 'get' | 'post' | undefined;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The protocol dataset of an update (`using-graph-uri` /
|
|
311
|
+
* `using-named-graph-uri`).
|
|
312
|
+
*
|
|
313
|
+
* @since 0.1.0
|
|
314
|
+
* @category models
|
|
315
|
+
*/
|
|
316
|
+
interface UpdateOptions {
|
|
317
|
+
readonly usingGraphs?: ReadonlyArray<string> | undefined;
|
|
318
|
+
readonly usingNamedGraphs?: ReadonlyArray<string> | undefined;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The graph of a Graph Store request: the default graph or a graph IRI.
|
|
322
|
+
*
|
|
323
|
+
* @since 0.1.0
|
|
324
|
+
* @category models
|
|
325
|
+
*/
|
|
326
|
+
type GraphTarget = 'default' | {
|
|
327
|
+
readonly graph: string;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Sends a query and returns the response body with its media type, without
|
|
331
|
+
* parsing it.
|
|
332
|
+
*
|
|
333
|
+
* @since 0.1.0
|
|
334
|
+
* @category queries
|
|
335
|
+
*/
|
|
336
|
+
declare const query: (client: Client, sparql: string, options?: QueryOptions) => Effect.Effect<Body, ApiError>;
|
|
337
|
+
/**
|
|
338
|
+
* Sends a `SELECT` or `ASK` query and parses the results incrementally with
|
|
339
|
+
* `ResultsStream`.
|
|
340
|
+
*
|
|
341
|
+
* @since 0.1.0
|
|
342
|
+
* @category queries
|
|
343
|
+
*/
|
|
344
|
+
declare const results: (client: Client, sparql: string, options?: QueryOptions) => Stream.Stream<ResultsStream.ResultEvent, ApiError>;
|
|
345
|
+
/**
|
|
346
|
+
* Sends a `CONSTRUCT` or `DESCRIBE` query and parses the graph with the
|
|
347
|
+
* default `Formats` (relative IRIs resolve against `baseIri`).
|
|
348
|
+
*
|
|
349
|
+
* @since 0.1.0
|
|
350
|
+
* @category queries
|
|
351
|
+
*/
|
|
352
|
+
declare const construct: (client: Client, sparql: string, options?: QueryOptions & {
|
|
353
|
+
readonly baseIri?: string | undefined;
|
|
354
|
+
}) => Effect.Effect<Dataset.Dataset, ApiError>;
|
|
355
|
+
/**
|
|
356
|
+
* Sends an update as an `application/sparql-update` body.
|
|
357
|
+
*
|
|
358
|
+
* @since 0.1.0
|
|
359
|
+
* @category updates
|
|
360
|
+
*/
|
|
361
|
+
declare const update: (client: Client, sparql: string, options?: UpdateOptions) => Effect.Effect<void, ApiError>;
|
|
362
|
+
/**
|
|
363
|
+
* Reads a graph from the graph store and parses it with the default
|
|
364
|
+
* `Formats`.
|
|
365
|
+
*
|
|
366
|
+
* @since 0.1.0
|
|
367
|
+
* @category graph store
|
|
368
|
+
*/
|
|
369
|
+
declare const readGraph: (client: Client, target: GraphTarget, options?: {
|
|
370
|
+
readonly accept?: string | undefined;
|
|
371
|
+
readonly baseIri?: string | undefined;
|
|
372
|
+
}) => Effect.Effect<Dataset.Dataset, ApiError>;
|
|
373
|
+
/**
|
|
374
|
+
* Writes an RDF document to a graph: `put` (default) replaces the graph,
|
|
375
|
+
* `post` adds to it. The document's media type must be one of
|
|
376
|
+
* `SparqlApi.rdfMediaTypes` (default `text/turtle`).
|
|
377
|
+
*
|
|
378
|
+
* @since 0.1.0
|
|
379
|
+
* @category graph store
|
|
380
|
+
*/
|
|
381
|
+
declare const writeGraph: (client: Client, target: GraphTarget, document: string, options?: {
|
|
382
|
+
readonly mediaType?: string | undefined;
|
|
383
|
+
readonly method?: "put" | "post" | undefined;
|
|
384
|
+
}) => Effect.Effect<void, ApiError>;
|
|
385
|
+
export { writeGraph as _, Options as a, SparqlApiClient_d_exports as c, layer as d, make as f, update as g, results as h, GraphTarget as i, UpdateOptions as l, readGraph as m, Body as n, QueryOptions as o, query as p, Client as r, SparqlApiClient as s, ApiError as t, construct as u };
|
|
386
|
+
//# sourceMappingURL=SparqlApiClient-C82RGMEF.d.mts.map
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
|
|
2
|
+
import { _ as queryMediaTypes, h as make$1, v as rdfMediaTypes, y as resultsMediaTypes } from "./SparqlApi-BuycDkWu.mjs";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Serialization from "@thomasfosterau/effect-rdf/Serialization";
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
import * as HttpApiClient from "effect/http-api/HttpApiClient";
|
|
10
|
+
import * as ClientErrors from "@thomasfosterau/effect-rdf/sparql/ClientErrors";
|
|
11
|
+
import * as ClientFormats from "@thomasfosterau/effect-rdf/sparql/ClientFormats";
|
|
12
|
+
import * as ResultsStream from "@thomasfosterau/effect-rdf/sparql/ResultsStream";
|
|
13
|
+
import * as SparqlClient from "@thomasfosterau/effect-rdf/sparql/SparqlClient";
|
|
14
|
+
// src/SparqlApiClient.ts
|
|
15
|
+
/**
|
|
16
|
+
* A client derived with `HttpApiClient` from the `SparqlApi` definition,
|
|
17
|
+
* alongside the hand-written `SparqlClient`.
|
|
18
|
+
*
|
|
19
|
+
* `make` returns the generated client: one method per endpoint
|
|
20
|
+
* (`client.sparql.query`, `client.sparql.post`, `client.graphStore.get`, …)
|
|
21
|
+
* taking the endpoint's typed `query`, `headers` and `payload` and returning
|
|
22
|
+
* response bodies as byte streams. Error statuses decode into the server's
|
|
23
|
+
* `ProtocolErrors.ProtocolError`. The helpers below (`query`, `results`,
|
|
24
|
+
* `construct`, `update`, `readGraph`, `writeGraph`) send the common
|
|
25
|
+
* requests and parse the bodies with the results parsers (`ResultsStream`)
|
|
26
|
+
* and the default `Formats`.
|
|
27
|
+
*
|
|
28
|
+
* `effect/http-api` is `@stability unstable` in Effect 4, and so is this
|
|
29
|
+
* client.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
*/
|
|
33
|
+
var SparqlApiClient_exports = /* @__PURE__ */ __exportAll({
|
|
34
|
+
SparqlApiClient: () => SparqlApiClient,
|
|
35
|
+
construct: () => construct,
|
|
36
|
+
layer: () => layer,
|
|
37
|
+
make: () => make,
|
|
38
|
+
query: () => query,
|
|
39
|
+
readGraph: () => readGraph,
|
|
40
|
+
results: () => results,
|
|
41
|
+
update: () => update,
|
|
42
|
+
writeGraph: () => writeGraph
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Derives the client from the API definition, using the `HttpClient` from
|
|
46
|
+
* the context.
|
|
47
|
+
*
|
|
48
|
+
* @since 0.1.0
|
|
49
|
+
* @category constructors
|
|
50
|
+
*/
|
|
51
|
+
const make = (options) => HttpApiClient.make(make$1(options?.paths), {
|
|
52
|
+
baseUrl: options?.baseUrl,
|
|
53
|
+
transformClient: options?.transformClient
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* The derived client as a service.
|
|
57
|
+
*
|
|
58
|
+
* @since 0.1.0
|
|
59
|
+
* @category services
|
|
60
|
+
*/
|
|
61
|
+
var SparqlApiClient = class extends Context.Service()("@thomasfosterau/effect-sparql-node/SparqlApiClient") {};
|
|
62
|
+
/**
|
|
63
|
+
* A layer providing the derived client.
|
|
64
|
+
*
|
|
65
|
+
* @since 0.1.0
|
|
66
|
+
* @category layers
|
|
67
|
+
*/
|
|
68
|
+
const layer = (options) => Layer.effect(SparqlApiClient, make(options));
|
|
69
|
+
const mediaTypeOf = (response) => (response.headers["content-type"] ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
|
|
70
|
+
const graphParams = (target) => target === "default" ? { default: "" } : { graph: target.graph };
|
|
71
|
+
const queryDataset = (options) => ({
|
|
72
|
+
"default-graph-uri": options?.defaultGraphs ?? [],
|
|
73
|
+
"named-graph-uri": options?.namedGraphs ?? []
|
|
74
|
+
});
|
|
75
|
+
const updateDataset = (options) => ({
|
|
76
|
+
"using-graph-uri": options?.usingGraphs ?? [],
|
|
77
|
+
"using-named-graph-uri": options?.usingNamedGraphs ?? []
|
|
78
|
+
});
|
|
79
|
+
const queryHeaders = (accept) => ({ accept: accept ?? queryMediaTypes.join(", ") });
|
|
80
|
+
/**
|
|
81
|
+
* Sends a query and returns the response body with its media type, without
|
|
82
|
+
* parsing it.
|
|
83
|
+
*
|
|
84
|
+
* @since 0.1.0
|
|
85
|
+
* @category queries
|
|
86
|
+
*/
|
|
87
|
+
const query = (client, sparql, options) => {
|
|
88
|
+
const dataset = queryDataset(options);
|
|
89
|
+
const headers = queryHeaders(options?.accept);
|
|
90
|
+
const sent = options?.method === "post" ? client.sparql.post({
|
|
91
|
+
query: dataset,
|
|
92
|
+
headers,
|
|
93
|
+
payload: {
|
|
94
|
+
_tag: "DirectQuery",
|
|
95
|
+
query: sparql
|
|
96
|
+
},
|
|
97
|
+
responseMode: "decoded-and-response"
|
|
98
|
+
}) : client.sparql.query({
|
|
99
|
+
query: {
|
|
100
|
+
query: sparql,
|
|
101
|
+
...dataset
|
|
102
|
+
},
|
|
103
|
+
headers,
|
|
104
|
+
responseMode: "decoded-and-response"
|
|
105
|
+
});
|
|
106
|
+
return Effect.flatMap(sent, ([bytes, response]) => bytes === void 0 ? Effect.fail(new ClientErrors.MalformedResponseError({ message: `Expected a query result, got status ${response.status}` })) : Effect.succeed({
|
|
107
|
+
mediaType: mediaTypeOf(response),
|
|
108
|
+
bytes
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Sends a `SELECT` or `ASK` query and parses the results incrementally with
|
|
113
|
+
* `ResultsStream`.
|
|
114
|
+
*
|
|
115
|
+
* @since 0.1.0
|
|
116
|
+
* @category queries
|
|
117
|
+
*/
|
|
118
|
+
const results = (client, sparql, options) => Stream.unwrap(Effect.flatMap(query(client, sparql, {
|
|
119
|
+
...options,
|
|
120
|
+
accept: options?.accept ?? SparqlClient.DEFAULT_RESULTS_ACCEPT
|
|
121
|
+
}), (body) => Option.match(ResultsStream.parse(body.mediaType, Stream.decodeText(body.bytes)), {
|
|
122
|
+
onNone: () => Effect.fail(new ClientErrors.UnsupportedMediaTypeError({
|
|
123
|
+
contentType: body.mediaType,
|
|
124
|
+
expected: resultsMediaTypes
|
|
125
|
+
})),
|
|
126
|
+
onSome: (events) => Effect.succeed(Stream.mapError(events, (e) => ClientErrors.isSparqlClientError(e) ? e : new ClientErrors.MalformedResponseError({
|
|
127
|
+
message: e.message,
|
|
128
|
+
contentType: body.mediaType,
|
|
129
|
+
cause: e
|
|
130
|
+
})))
|
|
131
|
+
})));
|
|
132
|
+
const parseRdf = (body, baseIri) => Option.match(Serialization.parserFor(ClientFormats.defaults, body.mediaType), {
|
|
133
|
+
onNone: () => Effect.fail(new ClientErrors.UnsupportedMediaTypeError({
|
|
134
|
+
contentType: body.mediaType,
|
|
135
|
+
expected: rdfMediaTypes
|
|
136
|
+
})),
|
|
137
|
+
onSome: (parser) => Stream.mkString(Stream.decodeText(body.bytes)).pipe(Effect.flatMap((text) => parser.parse(text, { baseIri }).pipe(Effect.mapError((e) => new ClientErrors.MalformedResponseError({
|
|
138
|
+
message: Serialization.formatError(e),
|
|
139
|
+
contentType: body.mediaType,
|
|
140
|
+
cause: e
|
|
141
|
+
})))), Effect.map((parsed) => parsed.dataset))
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Sends a `CONSTRUCT` or `DESCRIBE` query and parses the graph with the
|
|
145
|
+
* default `Formats` (relative IRIs resolve against `baseIri`).
|
|
146
|
+
*
|
|
147
|
+
* @since 0.1.0
|
|
148
|
+
* @category queries
|
|
149
|
+
*/
|
|
150
|
+
const construct = (client, sparql, options) => Effect.flatMap(query(client, sparql, {
|
|
151
|
+
...options,
|
|
152
|
+
accept: options?.accept ?? ClientFormats.acceptHeader(ClientFormats.defaults)
|
|
153
|
+
}), (body) => parseRdf(body, options?.baseIri ?? "urn:x-base:"));
|
|
154
|
+
/**
|
|
155
|
+
* Sends an update as an `application/sparql-update` body.
|
|
156
|
+
*
|
|
157
|
+
* @since 0.1.0
|
|
158
|
+
* @category updates
|
|
159
|
+
*/
|
|
160
|
+
const update = (client, sparql, options) => Effect.asVoid(client.sparql.post({
|
|
161
|
+
query: updateDataset(options),
|
|
162
|
+
headers: {},
|
|
163
|
+
payload: {
|
|
164
|
+
_tag: "DirectUpdate",
|
|
165
|
+
update: sparql
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
/**
|
|
169
|
+
* Reads a graph from the graph store and parses it with the default
|
|
170
|
+
* `Formats`.
|
|
171
|
+
*
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
* @category graph store
|
|
174
|
+
*/
|
|
175
|
+
const readGraph = (client, target, options) => client.graphStore.get({
|
|
176
|
+
query: graphParams(target),
|
|
177
|
+
headers: { accept: options?.accept ?? ClientFormats.acceptHeader(ClientFormats.defaults) },
|
|
178
|
+
responseMode: "decoded-and-response"
|
|
179
|
+
}).pipe(Effect.flatMap(([bytes, response]) => parseRdf({
|
|
180
|
+
mediaType: mediaTypeOf(response),
|
|
181
|
+
bytes
|
|
182
|
+
}, options?.baseIri ?? (target === "default" ? "urn:x-base:" : target.graph))));
|
|
183
|
+
/**
|
|
184
|
+
* Writes an RDF document to a graph: `put` (default) replaces the graph,
|
|
185
|
+
* `post` adds to it. The document's media type must be one of
|
|
186
|
+
* `SparqlApi.rdfMediaTypes` (default `text/turtle`).
|
|
187
|
+
*
|
|
188
|
+
* @since 0.1.0
|
|
189
|
+
* @category graph store
|
|
190
|
+
*/
|
|
191
|
+
const writeGraph = (client, target, document, options) => {
|
|
192
|
+
const request = {
|
|
193
|
+
query: graphParams(target),
|
|
194
|
+
payload: {
|
|
195
|
+
mediaType: options?.mediaType ?? "text/turtle",
|
|
196
|
+
document
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
return Effect.asVoid(options?.method === "post" ? client.graphStore.post(request) : client.graphStore.put(request));
|
|
200
|
+
};
|
|
201
|
+
export { make as a, results as c, layer as i, update as l, SparqlApiClient_exports as n, query as o, construct as r, readGraph as s, SparqlApiClient as t, writeGraph as u };
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=SparqlApiClient-CJcoFy5b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparqlApiClient-CJcoFy5b.mjs","names":["SparqlApi.make","SparqlApi.resultsMediaTypes","SparqlApi.rdfMediaTypes"],"sources":["../src/SparqlApiClient.ts"],"sourcesContent":["/**\n * A client derived with `HttpApiClient` from the `SparqlApi` definition,\n * alongside the hand-written `SparqlClient`.\n *\n * `make` returns the generated client: one method per endpoint\n * (`client.sparql.query`, `client.sparql.post`, `client.graphStore.get`, …)\n * taking the endpoint's typed `query`, `headers` and `payload` and returning\n * response bodies as byte streams. Error statuses decode into the server's\n * `ProtocolErrors.ProtocolError`. The helpers below (`query`, `results`,\n * `construct`, `update`, `readGraph`, `writeGraph`) send the common\n * requests and parse the bodies with the results parsers (`ResultsStream`)\n * and the default `Formats`.\n *\n * `effect/http-api` is `@stability unstable` in Effect 4, and so is this\n * client.\n *\n * @since 0.1.0\n */\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Stream from 'effect/Stream';\nimport type * as Schema from 'effect/Schema';\nimport type * as HttpClient from 'effect/http/HttpClient';\nimport type * as HttpClientError from 'effect/http/HttpClientError';\nimport type * as HttpClientResponse from 'effect/http/HttpClientResponse';\nimport * as HttpApiClient from 'effect/http-api/HttpApiClient';\nimport type * as Dataset from '@thomasfosterau/effect-rdf/Dataset';\nimport * as Serialization from '@thomasfosterau/effect-rdf/Serialization';\nimport type * as ProtocolErrors from '@thomasfosterau/effect-rdf/sparql/ProtocolErrors';\nimport * as SparqlApi from './SparqlApi.ts';\nimport * as ClientErrors from '@thomasfosterau/effect-rdf/sparql/ClientErrors';\nimport * as ClientFormats from '@thomasfosterau/effect-rdf/sparql/ClientFormats';\nimport * as ResultsStream from '@thomasfosterau/effect-rdf/sparql/ResultsStream';\nimport * as SparqlClient from '@thomasfosterau/effect-rdf/sparql/SparqlClient';\n\n// -----------------------------------------------------------------------------\n// The client\n// -----------------------------------------------------------------------------\n\n/**\n * The generated client of the `SparqlApi`.\n *\n * @since 0.1.0\n * @category models\n */\nexport type Client = HttpApiClient.ForApi<SparqlApi.Api>;\n\n/**\n * Options of the derived client.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface Options {\n /** The server's base URL (e.g. `https://example.org`); paths are appended to it. */\n readonly baseUrl?: string | URL | undefined;\n /** The endpoint paths, when the server does not use the defaults. */\n readonly paths?: SparqlApi.Paths | undefined;\n /** Transforms the `HttpClient` (retries, authentication, …). */\n readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined;\n}\n\n/**\n * Derives the client from the API definition, using the `HttpClient` from\n * the context.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const make = (options?: Options): Effect.Effect<Client, never, HttpClient.HttpClient> =>\n HttpApiClient.make(SparqlApi.make(options?.paths), {\n baseUrl: options?.baseUrl,\n transformClient: options?.transformClient,\n });\n\n/**\n * The derived client as a service.\n *\n * @since 0.1.0\n * @category services\n */\nexport class SparqlApiClient extends Context.Service<SparqlApiClient, Client>()(\n '@thomasfosterau/effect-sparql-node/SparqlApiClient',\n) {}\n\n/**\n * A layer providing the derived client.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layer = (\n options?: Options,\n): Layer.Layer<SparqlApiClient, never, HttpClient.HttpClient> =>\n Layer.effect(SparqlApiClient, make(options));\n\n// -----------------------------------------------------------------------------\n// Helpers\n// -----------------------------------------------------------------------------\n\n/**\n * Any failure of a derived client call: a protocol error status, a transport\n * or decoding failure of the generated client, or an unreadable body.\n *\n * @since 0.1.0\n * @category errors\n */\nexport type ApiError =\n | ProtocolErrors.ProtocolError\n | HttpClientError.HttpClientError\n | Schema.SchemaError\n | ClientErrors.MalformedResponseError\n | ClientErrors.UnsupportedMediaTypeError;\n\n/**\n * A response body and its media type.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface Body {\n /** The media type of the body, without parameters. */\n readonly mediaType: string;\n readonly bytes: Stream.Stream<Uint8Array, ApiError>;\n}\n\n/**\n * The protocol dataset of a query (`default-graph-uri` / `named-graph-uri`).\n *\n * @since 0.1.0\n * @category models\n */\nexport interface QueryOptions {\n readonly defaultGraphs?: ReadonlyArray<string> | undefined;\n readonly namedGraphs?: ReadonlyArray<string> | undefined;\n /** The `Accept` header (default: every results and RDF format). */\n readonly accept?: string | undefined;\n /** `get` (default) sends `?query=`, `post` an `application/sparql-query` body. */\n readonly method?: 'get' | 'post' | undefined;\n}\n\n/**\n * The protocol dataset of an update (`using-graph-uri` /\n * `using-named-graph-uri`).\n *\n * @since 0.1.0\n * @category models\n */\nexport interface UpdateOptions {\n readonly usingGraphs?: ReadonlyArray<string> | undefined;\n readonly usingNamedGraphs?: ReadonlyArray<string> | undefined;\n}\n\n/**\n * The graph of a Graph Store request: the default graph or a graph IRI.\n *\n * @since 0.1.0\n * @category models\n */\nexport type GraphTarget = 'default' | { readonly graph: string };\n\nconst mediaTypeOf = (response: HttpClientResponse.HttpClientResponse): string =>\n (response.headers['content-type'] ?? '').split(';')[0]?.trim().toLowerCase() ?? '';\n\nconst graphParams = (target: GraphTarget) =>\n target === 'default' ? { default: '' } : { graph: target.graph };\n\n// An empty list sends no parameter.\nconst queryDataset = (options?: QueryOptions) => ({\n 'default-graph-uri': options?.defaultGraphs ?? [],\n 'named-graph-uri': options?.namedGraphs ?? [],\n});\n\nconst updateDataset = (options?: UpdateOptions) => ({\n 'using-graph-uri': options?.usingGraphs ?? [],\n 'using-named-graph-uri': options?.usingNamedGraphs ?? [],\n});\n\nconst queryHeaders = (accept?: string) => ({\n accept: accept ?? SparqlApi.queryMediaTypes.join(', '),\n});\n\n/**\n * Sends a query and returns the response body with its media type, without\n * parsing it.\n *\n * @since 0.1.0\n * @category queries\n */\nexport const query = (\n client: Client,\n sparql: string,\n options?: QueryOptions,\n): Effect.Effect<Body, ApiError> => {\n const dataset = queryDataset(options);\n const headers = queryHeaders(options?.accept);\n const sent =\n options?.method === 'post'\n ? client.sparql.post({\n query: dataset,\n headers,\n payload: { _tag: 'DirectQuery', query: sparql },\n responseMode: 'decoded-and-response',\n })\n : client.sparql.query({\n query: { query: sparql, ...dataset },\n headers,\n responseMode: 'decoded-and-response',\n });\n return Effect.flatMap(sent, ([bytes, response]) =>\n bytes === undefined\n ? Effect.fail(\n new ClientErrors.MalformedResponseError({\n message: `Expected a query result, got status ${response.status}`,\n }),\n )\n : Effect.succeed({ mediaType: mediaTypeOf(response), bytes }),\n );\n};\n\n/**\n * Sends a `SELECT` or `ASK` query and parses the results incrementally with\n * `ResultsStream`.\n *\n * @since 0.1.0\n * @category queries\n */\nexport const results = (\n client: Client,\n sparql: string,\n options?: QueryOptions,\n): Stream.Stream<ResultsStream.ResultEvent, ApiError> =>\n Stream.unwrap(\n Effect.flatMap(\n query(client, sparql, {\n ...options,\n accept: options?.accept ?? SparqlClient.DEFAULT_RESULTS_ACCEPT,\n }),\n (body) =>\n Option.match(ResultsStream.parse(body.mediaType, Stream.decodeText(body.bytes)), {\n onNone: () =>\n Effect.fail(\n new ClientErrors.UnsupportedMediaTypeError({\n contentType: body.mediaType,\n expected: SparqlApi.resultsMediaTypes,\n }),\n ),\n onSome: (events) =>\n Effect.succeed(\n Stream.mapError(events, (e) =>\n ClientErrors.isSparqlClientError(e)\n ? e\n : new ClientErrors.MalformedResponseError({\n message: e.message,\n contentType: body.mediaType,\n cause: e,\n }),\n ),\n ),\n }),\n ),\n );\n\nconst parseRdf = (body: Body, baseIri: string): Effect.Effect<Dataset.Dataset, ApiError> =>\n Option.match(Serialization.parserFor(ClientFormats.defaults, body.mediaType), {\n onNone: () =>\n Effect.fail(\n new ClientErrors.UnsupportedMediaTypeError({\n contentType: body.mediaType,\n expected: SparqlApi.rdfMediaTypes,\n }),\n ),\n onSome: (parser) =>\n Stream.mkString(Stream.decodeText(body.bytes)).pipe(\n Effect.flatMap((text) =>\n parser.parse(text, { baseIri }).pipe(\n Effect.mapError(\n (e) =>\n new ClientErrors.MalformedResponseError({\n message: Serialization.formatError(e),\n contentType: body.mediaType,\n cause: e,\n }),\n ),\n ),\n ),\n Effect.map((parsed) => parsed.dataset),\n ),\n });\n\n/**\n * Sends a `CONSTRUCT` or `DESCRIBE` query and parses the graph with the\n * default `Formats` (relative IRIs resolve against `baseIri`).\n *\n * @since 0.1.0\n * @category queries\n */\nexport const construct = (\n client: Client,\n sparql: string,\n options?: QueryOptions & { readonly baseIri?: string | undefined },\n): Effect.Effect<Dataset.Dataset, ApiError> =>\n Effect.flatMap(\n query(client, sparql, {\n ...options,\n accept: options?.accept ?? ClientFormats.acceptHeader(ClientFormats.defaults),\n }),\n (body) => parseRdf(body, options?.baseIri ?? 'urn:x-base:'),\n );\n\n/**\n * Sends an update as an `application/sparql-update` body.\n *\n * @since 0.1.0\n * @category updates\n */\nexport const update = (\n client: Client,\n sparql: string,\n options?: UpdateOptions,\n): Effect.Effect<void, ApiError> =>\n Effect.asVoid(\n client.sparql.post({\n query: updateDataset(options),\n headers: {},\n payload: { _tag: 'DirectUpdate', update: sparql },\n }),\n );\n\n/**\n * Reads a graph from the graph store and parses it with the default\n * `Formats`.\n *\n * @since 0.1.0\n * @category graph store\n */\nexport const readGraph = (\n client: Client,\n target: GraphTarget,\n options?: { readonly accept?: string | undefined; readonly baseIri?: string | undefined },\n): Effect.Effect<Dataset.Dataset, ApiError> =>\n client.graphStore\n .get({\n query: graphParams(target),\n headers: { accept: options?.accept ?? ClientFormats.acceptHeader(ClientFormats.defaults) },\n responseMode: 'decoded-and-response',\n })\n .pipe(\n Effect.flatMap(([bytes, response]) =>\n parseRdf(\n { mediaType: mediaTypeOf(response), bytes },\n options?.baseIri ?? (target === 'default' ? 'urn:x-base:' : target.graph),\n ),\n ),\n );\n\n/**\n * Writes an RDF document to a graph: `put` (default) replaces the graph,\n * `post` adds to it. The document's media type must be one of\n * `SparqlApi.rdfMediaTypes` (default `text/turtle`).\n *\n * @since 0.1.0\n * @category graph store\n */\nexport const writeGraph = (\n client: Client,\n target: GraphTarget,\n document: string,\n options?: {\n readonly mediaType?: string | undefined;\n readonly method?: 'put' | 'post' | undefined;\n },\n): Effect.Effect<void, ApiError> => {\n const request = {\n query: graphParams(target),\n payload: { mediaType: options?.mediaType ?? 'text/turtle', document },\n };\n return Effect.asVoid(\n options?.method === 'post' ? client.graphStore.post(request) : client.graphStore.put(request),\n );\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as writeGraph, a as Options, d as layer, f as make, g as update, h as results, i as GraphTarget, l as UpdateOptions, m as readGraph, n as Body, o as QueryOptions, p as query, r as Client, s as SparqlApiClient, t as ApiError, u as construct } from "./SparqlApiClient-C82RGMEF.mjs";
|
|
2
|
+
export { ApiError, Body, Client, GraphTarget, Options, QueryOptions, SparqlApiClient, UpdateOptions, construct, layer, make, query, readGraph, results, update, writeGraph };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as SparqlApiClient, r as construct, i as layer, a as make, o as query, s as readGraph, c as results, l as update, u as writeGraph } from "./SparqlApiClient-CJcoFy5b.mjs";
|