@pqe-pro/source-grpc 0.0.0-stage → 0.4.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/NOTICE.md +5 -0
- package/README.md +294 -2
- package/dependency-notices.json +11 -0
- package/dist/execution/infrastructure/grpc/source.d.ts +37 -0
- package/dist/execution/infrastructure/grpc/source.js +168 -0
- package/dist/execution/infrastructure/grpc/unary.d.ts +14 -0
- package/dist/execution/infrastructure/grpc/unary.js +172 -0
- package/dist/exports/grpc.d.ts +2 -0
- package/dist/exports/grpc.js +1 -0
- package/npm-shrinkwrap.json +28 -0
- package/package.json +52 -4
- package/sbom.cdx.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vacho Aivazov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
The Progressive Query Engine packages are released under the MIT License; see `LICENSE`.
|
|
4
|
+
|
|
5
|
+
Third-party runtime dependency licenses and notices are preserved in `dependency-notices.json`, and the runtime dependency inventory is in `sbom.cdx.json`. React is an optional host-provided peer of `@pqe-pro/react`. A dependency's license does not change the license of these packages.
|
package/README.md
CHANGED
|
@@ -1,3 +1,295 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Progressive Query Engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Progressive Query Engine (PQE) runs registered queries under strict deadlines and streams their results progressively as newline-delimited JSON (NDJSON) to a browser or React client. It never loses track of the physical work it starts: a timeout or a cancellation does not count as proof that a database statement or an HTTP call stopped.
|
|
4
|
+
|
|
5
|
+
A page often needs one required result quickly and several optional, slower ones, for example a product list from PostgreSQL and delivery terms from a slow HTTP provider. PQE answers with one `initial` event carrying the required page, at most one `patch` per optional group, then one `complete`. A stream that ends without `complete` is an interruption, never a short success.
|
|
6
|
+
|
|
7
|
+
Requirements: Node 22.12 or later, ESM only. Every package ships TypeScript declarations.
|
|
8
|
+
|
|
9
|
+
## Packages
|
|
10
|
+
|
|
11
|
+
Install only what a host needs. Sibling packages depend on each other with exact versions, so keep all `@pqe-pro/*` packages of one application on the same version.
|
|
12
|
+
|
|
13
|
+
| Package | Use it for |
|
|
14
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| [`@pqe-pro/core`](https://www.npmjs.com/package/@pqe-pro/core) | The engine, query and contract definitions, the ports a host implements; `@pqe-pro/core/protocol`; `@pqe-pro/core/telemetry`. |
|
|
16
|
+
| [`@pqe-pro/node`](https://www.npmjs.com/package/@pqe-pro/node) | The Node HTTPS query server (NDJSON, JSON and enrichment routes), the NDJSON encoder and the monotonic clock. |
|
|
17
|
+
| [`@pqe-pro/oidc`](https://www.npmjs.com/package/@pqe-pro/oidc) | OIDC/JWT identity verification behind the engine's identity port. |
|
|
18
|
+
| [`@pqe-pro/source-postgres`](https://www.npmjs.com/package/@pqe-pro/source-postgres) | The PostgreSQL source adapter (PostgreSQL 17 or 18, `pg` driver). |
|
|
19
|
+
| [`@pqe-pro/source-http`](https://www.npmjs.com/package/@pqe-pro/source-http) | The bounded HTTP source adapter. |
|
|
20
|
+
| `@pqe-pro/source-grpc` | Bounded unary gRPC calls to Protobuf services over verified TLS. |
|
|
21
|
+
| `@pqe-pro/source-mysql` | MySQL 8.4 source with tenant-specific readers, bounded results and active cancellation. |
|
|
22
|
+
| [`@pqe-pro/coordination`](https://www.npmjs.com/package/@pqe-pro/coordination) | Coordination of capacity and authority between processes, with a PostgreSQL store, its ledger DDL and settlement probes. |
|
|
23
|
+
| [`@pqe-pro/browser`](https://www.npmjs.com/package/@pqe-pro/browser) | The browser query store and its fetch transport. No Node or server code. |
|
|
24
|
+
| [`@pqe-pro/react`](https://www.npmjs.com/package/@pqe-pro/react) | React hooks over the browser store. React 18.3 or 19 is a peer dependency. |
|
|
25
|
+
| `@pqe-pro/vue` | Vue 3 composables over the browser store. Vue 3.5.47 or later in the Vue 3 line is a peer dependency. |
|
|
26
|
+
| `@pqe-pro/angular` | Angular 22 signals and dependency injection over the browser query store. |
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
# A Node query server
|
|
30
|
+
npm install @pqe-pro/core @pqe-pro/node @pqe-pro/source-postgres zod
|
|
31
|
+
# A React client
|
|
32
|
+
npm install @pqe-pro/core @pqe-pro/browser @pqe-pro/react zod
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## A query
|
|
36
|
+
|
|
37
|
+
A query has a public contract, shared by server and client, and a server-side definition that owns authorization and data loading. Schemas are [Zod](https://zod.dev) schemas; every external value is validated before it is published.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
// contract.ts: shared by server and client
|
|
41
|
+
import { z } from "zod";
|
|
42
|
+
import { defineContract } from "@pqe-pro/core/protocol";
|
|
43
|
+
|
|
44
|
+
export const boardContract = defineContract({
|
|
45
|
+
id: "boards.items.v1",
|
|
46
|
+
input: z.strictObject({ board: z.string().min(1).max(64), size: z.number().int().min(1).max(50) }),
|
|
47
|
+
base: z.strictObject({ id: z.string(), title: z.string() }),
|
|
48
|
+
groups: { activity: z.strictObject({ count: z.number().int().nonnegative() }) },
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// server.ts
|
|
54
|
+
import { randomUUID } from "node:crypto";
|
|
55
|
+
import { readFileSync } from "node:fs";
|
|
56
|
+
import { z } from "zod";
|
|
57
|
+
import { defineQuery, QueryRegistry, GenericQueryEngine, referencePolicy } from "@pqe-pro/core";
|
|
58
|
+
import { ndjsonEncoder, systemClock, QueryServer } from "@pqe-pro/node";
|
|
59
|
+
import { HttpSource } from "@pqe-pro/source-http";
|
|
60
|
+
import { boardContract } from "./contract.ts";
|
|
61
|
+
|
|
62
|
+
// What the upstream service answers; every external value is validated.
|
|
63
|
+
const items = z.strictObject({ items: z.array(z.strictObject({ id: z.string(), title: z.string() })) });
|
|
64
|
+
const counts = z.strictObject({ counts: z.record(z.string(), z.number().int().nonnegative()) });
|
|
65
|
+
|
|
66
|
+
const query = defineQuery({
|
|
67
|
+
contract: boardContract,
|
|
68
|
+
policy: referencePolicy,
|
|
69
|
+
// What the trusted identity carries, and what authorization hands to the loaders.
|
|
70
|
+
identityContext: z.strictObject({ role: z.enum(["viewer", "editor"]) }),
|
|
71
|
+
authorizationOutput: z.strictObject({ board: z.string() }),
|
|
72
|
+
authorizationSources: [],
|
|
73
|
+
authorizationMaxBusinessCalls: 0,
|
|
74
|
+
async authorize(request, context) {
|
|
75
|
+
return { board: context.identity.context.role === "editor" ? request.input.board : "public" };
|
|
76
|
+
},
|
|
77
|
+
pageSize: (input) => input.size,
|
|
78
|
+
// The required part: answered in the `initial` event or not at all. Loaders reach data only
|
|
79
|
+
// through `context.call` on a registered source, which owns the physical request.
|
|
80
|
+
root: {
|
|
81
|
+
source: "catalog",
|
|
82
|
+
timeoutMs: 700,
|
|
83
|
+
maxBusinessCalls: 1,
|
|
84
|
+
async load(input, context) {
|
|
85
|
+
const page = await context.call("catalog", { kind: "items", board: context.authorized.board, size: input.size }, items);
|
|
86
|
+
return { items: page.items, pageInfo: { endCursor: null, hasNextPage: false } };
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// An optional group: one `patch` per group, with a ready, unavailable or failed state per row.
|
|
90
|
+
groups: {
|
|
91
|
+
activity: {
|
|
92
|
+
source: "catalog",
|
|
93
|
+
timeoutMs: 900,
|
|
94
|
+
maxBatchSize: 50,
|
|
95
|
+
maxBusinessCalls: 1,
|
|
96
|
+
async load(args, context) {
|
|
97
|
+
const answer = await context.call("catalog", { kind: "activity", board: context.authorized.board, ids: args.ids }, counts);
|
|
98
|
+
return args.ids.map((id) => {
|
|
99
|
+
const count = answer.counts[id];
|
|
100
|
+
return count === undefined
|
|
101
|
+
? { id, result: { status: "unavailable" as const, reason: "not_found" as const } }
|
|
102
|
+
: { id, result: { status: "ready" as const, value: { count } } };
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// An upstream HTTPS JSON service; PostgresSource from @pqe-pro/source-postgres is the other adapter.
|
|
110
|
+
const catalog = new HttpSource(
|
|
111
|
+
{
|
|
112
|
+
id: "catalog",
|
|
113
|
+
generation: randomUUID(),
|
|
114
|
+
endpoint: "https://catalog.internal.example/catalog",
|
|
115
|
+
ca: readFileSync("catalog-ca.pem", "utf8"),
|
|
116
|
+
token: process.env.CATALOG_TOKEN ?? "",
|
|
117
|
+
capacityScope: "local_io",
|
|
118
|
+
capacity: 8,
|
|
119
|
+
rootReserve: 2,
|
|
120
|
+
maxQueuedTasks: 32,
|
|
121
|
+
maxDurationMs: 1000,
|
|
122
|
+
maxBodyBytes: 16384,
|
|
123
|
+
},
|
|
124
|
+
systemClock,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const engine = new GenericQueryEngine({
|
|
128
|
+
registry: new QueryRegistry([query]),
|
|
129
|
+
clock: systemClock,
|
|
130
|
+
encoder: ndjsonEncoder(),
|
|
131
|
+
sources: [catalog],
|
|
132
|
+
// Trusted identity comes only from server-side authentication, for example OidcIdentityPort.
|
|
133
|
+
identity: {
|
|
134
|
+
sources: [],
|
|
135
|
+
maxBusinessCalls: 0,
|
|
136
|
+
async resolve() {
|
|
137
|
+
return { tenantId: "tenant", principalId: "user", authScopeVersion: "1", context: { role: "editor" } };
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
// Admission of physical operations; @pqe-pro/coordination provides one shared between processes.
|
|
141
|
+
authority: {
|
|
142
|
+
healthy: () => true,
|
|
143
|
+
async begin(context, sourceId) {
|
|
144
|
+
return { operationId: context.operationId, sourceId, generation: "local" };
|
|
145
|
+
},
|
|
146
|
+
async acquired() {},
|
|
147
|
+
async settle() {},
|
|
148
|
+
},
|
|
149
|
+
telemetry: { emit() {} },
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
await catalog.verify();
|
|
153
|
+
const server = new QueryServer(engine, {
|
|
154
|
+
tls: { cert: readFileSync("server.pem", "utf8"), key: readFileSync("server-key.pem", "utf8") },
|
|
155
|
+
drainMs: 2000,
|
|
156
|
+
hardCutoffMs: 5000,
|
|
157
|
+
});
|
|
158
|
+
await server.listen("127.0.0.1", 8443);
|
|
159
|
+
// POST /v1/query/ndjson streams events; POST /v1/query/json answers once; GET /health/ready.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
A complete runnable version, with a small upstream service, a Node client and server-side rendering, is [examples/board](https://github.com/watscho/pqe-pro/tree/main/examples/board) in the repository.
|
|
163
|
+
|
|
164
|
+
## Metrics with OpenTelemetry
|
|
165
|
+
|
|
166
|
+
`BoundedTelemetry` from `@pqe-pro/core/telemetry` validates the engine's observations and keeps bounded aggregates for a Prometheus text endpoint. With an exporter it mirrors the same aggregates into your OpenTelemetry meter. The packages do not depend on OpenTelemetry: pass your own meter from `@opentelemetry/api` 1.7 or later.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
// telemetry.ts
|
|
170
|
+
import { metrics } from "@opentelemetry/api";
|
|
171
|
+
import { BoundedTelemetry, openTelemetryMetrics } from "@pqe-pro/core/telemetry";
|
|
172
|
+
|
|
173
|
+
// Your OpenTelemetry SDK setup registers the global meter provider and its exporter.
|
|
174
|
+
export const telemetry = new BoundedTelemetry(["boards.items.v1"], {
|
|
175
|
+
exporter: openTelemetryMetrics(metrics.getMeter("pqe")),
|
|
176
|
+
});
|
|
177
|
+
// Pass `telemetry` as the engine's `telemetry` option, and
|
|
178
|
+
// `onTerminal: (record) => telemetry.terminal(record)` in the QueryServer options.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Instruments are named like the Prometheus families without the suffix (`pqe_requests`, `pqe_phase` in seconds, `pqe_output` in bytes), and carry the same bounded attributes. Request, operation, tenant and principal identifiers never become attributes. An exporter that throws is counted by `telemetry.exportFailures()` and never affects a query.
|
|
182
|
+
|
|
183
|
+
## A React client
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
// board.tsx
|
|
187
|
+
import { createPqeClient, type PqeClient } from "@pqe-pro/browser";
|
|
188
|
+
import { PqeProvider, useOwnedQuery, usePqeClient } from "@pqe-pro/react";
|
|
189
|
+
import { boardContract } from "./contract.ts";
|
|
190
|
+
|
|
191
|
+
export function createBoardClient() {
|
|
192
|
+
return createPqeClient({ endpoint: "/v1/query/ndjson", format: "ndjson" });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function BoardApp({ client }: { client: PqeClient }) {
|
|
196
|
+
return <PqeProvider client={client}><Board /></PqeProvider>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function Board() {
|
|
200
|
+
const client = usePqeClient();
|
|
201
|
+
const { store, snapshot } = useOwnedQuery(() =>
|
|
202
|
+
client.createStore({
|
|
203
|
+
contract: boardContract,
|
|
204
|
+
groups: ["activity"],
|
|
205
|
+
clientBudgetMs: 3000,
|
|
206
|
+
}),
|
|
207
|
+
);
|
|
208
|
+
return (
|
|
209
|
+
<section>
|
|
210
|
+
<button onClick={() => store.run({ board: "main", size: 20 })}>Load</button>
|
|
211
|
+
<p role="status">{snapshot.status}</p>
|
|
212
|
+
<ul>
|
|
213
|
+
{snapshot.execution.initial?.page.items.map((item) => (
|
|
214
|
+
<li key={item.id}>{item.title}</li>
|
|
215
|
+
))}
|
|
216
|
+
</ul>
|
|
217
|
+
</section>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Create one client for each mounted application or SSR request. The nearest `PqeProvider` supplies its transport configuration, and `client.createStore` creates a separate store for each query owner. `useOwnedQuery` releases the store's reads on unmount. Pass a server-rendered snapshot from `executeSsr` as `initialSnapshot` when creating the store in both renders to hydrate without a repeat request.
|
|
223
|
+
|
|
224
|
+
## A Vue client
|
|
225
|
+
|
|
226
|
+
Call `useOwnedQuery` in `setup()` to tie the store to the component. Its `snapshot` is a read-only shallow ref. For a store owned elsewhere, call `useQueryStore(store)` to subscribe without taking ownership.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
// board-vue.ts
|
|
230
|
+
import type { PqeClient } from "@pqe-pro/browser";
|
|
231
|
+
import { PqeProvider, useOwnedQuery, usePqeClient } from "@pqe-pro/vue";
|
|
232
|
+
import { createSSRApp, defineComponent, h } from "vue";
|
|
233
|
+
import { boardContract } from "./contract.ts";
|
|
234
|
+
|
|
235
|
+
export const Board = defineComponent({
|
|
236
|
+
setup() {
|
|
237
|
+
const client = usePqeClient();
|
|
238
|
+
const { store, snapshot } = useOwnedQuery(() =>
|
|
239
|
+
client.createStore({
|
|
240
|
+
contract: boardContract,
|
|
241
|
+
groups: ["activity"],
|
|
242
|
+
clientBudgetMs: 3000,
|
|
243
|
+
}),
|
|
244
|
+
);
|
|
245
|
+
return () =>
|
|
246
|
+
h("button", {
|
|
247
|
+
onClick: () => {
|
|
248
|
+
void store.run({ board: "main", size: 20 }).settled;
|
|
249
|
+
},
|
|
250
|
+
}, snapshot.value.status);
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export function createBoardApp(client: PqeClient) {
|
|
255
|
+
return createSSRApp({
|
|
256
|
+
render: () => h(PqeProvider, { client }, { default: () => h(Board) }),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
For SSR, seed `client.createStore` with the same `initialSnapshot` in both renders and hydrate with Vue's `createSSRApp`. A request starts when the caller invokes `run`. Mount a fresh provider subtree when changing account or endpoint scope to dispose the previous stores.
|
|
262
|
+
|
|
263
|
+
## An Angular client
|
|
264
|
+
|
|
265
|
+
Use Angular 22.3.2 or later in the Angular 22 line and its supported Node and TypeScript versions. Call `providePqeClient` at app or component scope. In a component field initializer, use `injectOwnedQuery` to create a store or `injectQuerySignal` to subscribe to an existing one.
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
// board-angular.ts
|
|
269
|
+
import type { ApplicationConfig } from "@angular/core";
|
|
270
|
+
import { createPqeClient } from "@pqe-pro/browser";
|
|
271
|
+
import { injectOwnedQuery, injectPqeClient, providePqeClient } from "@pqe-pro/angular";
|
|
272
|
+
import { boardContract } from "./contract.ts";
|
|
273
|
+
|
|
274
|
+
export function createBoardConfig(): ApplicationConfig {
|
|
275
|
+
const client = createPqeClient({ endpoint: "/v1/query/ndjson", format: "ndjson" });
|
|
276
|
+
return { providers: [providePqeClient(client)] };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function injectBoard(initialSnapshot?: unknown) {
|
|
280
|
+
const client = injectPqeClient();
|
|
281
|
+
return injectOwnedQuery(() =>
|
|
282
|
+
client.createStore({ contract: boardContract, groups: ["activity"], clientBudgetMs: 3000, initialSnapshot }),
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Read `snapshot()` from the component template. Pass the same `initialSnapshot` when rendering and hydrating. The first browser render reads it immediately. Subscriptions and store ownership begin after the first browser render, and destruction releases both.
|
|
288
|
+
|
|
289
|
+
## Stability
|
|
290
|
+
|
|
291
|
+
Version 0.x: the public API may change between minor versions until 1.0. Every release lists what changed in [CHANGELOG.md](https://github.com/watscho/pqe-pro/blob/main/CHANGELOG.md). The `./internal/*` subpaths exist only so that sibling `@pqe-pro` packages can share modules; they are not a public interface and may change in any release.
|
|
292
|
+
|
|
293
|
+
## More
|
|
294
|
+
|
|
295
|
+
Source, the behaviour specification, the domain documentation and the test suites are in the [GitHub repository](https://github.com/watscho/pqe-pro). Licence: MIT. Third-party notices: `NOTICE.md`, `dependency-notices.json` and `sbom.cdx.json` in each package.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scope": "Runtime dependencies only",
|
|
3
|
+
"dependencies": [
|
|
4
|
+
{
|
|
5
|
+
"name": "zod",
|
|
6
|
+
"version": "4.6.7",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"notice": "MIT License\n\nCopyright (c) 2025 Colin McDonnell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { SourceAdapter, SourceContext, SourceOperation } from "@pqe-pro/core/internal/execution/application/generic-contracts";
|
|
3
|
+
import { type Schema } from "@pqe-pro/core/internal/execution/domain/query-model";
|
|
4
|
+
export declare const grpcSourceConfigSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
endpoint: z.ZodURL;
|
|
7
|
+
ca: z.ZodString;
|
|
8
|
+
authorization: z.ZodOptional<z.ZodString>;
|
|
9
|
+
capacity: z.ZodNumber;
|
|
10
|
+
rootReserve: z.ZodNumber;
|
|
11
|
+
maxQueuedTasks: z.ZodNumber;
|
|
12
|
+
maxDurationMs: z.ZodNumber;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type GrpcSourceConfig = z.infer<typeof grpcSourceConfigSchema>;
|
|
15
|
+
export interface GrpcMethod {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly request: Schema<unknown>;
|
|
19
|
+
readonly response: Schema<unknown>;
|
|
20
|
+
encode(input: unknown): Uint8Array;
|
|
21
|
+
decode(message: Uint8Array): unknown;
|
|
22
|
+
}
|
|
23
|
+
export declare class GrpcSource implements SourceAdapter {
|
|
24
|
+
#private;
|
|
25
|
+
readonly kind = "grpc";
|
|
26
|
+
readonly capacityScope = "local_io";
|
|
27
|
+
readonly cancellation = "local_abort";
|
|
28
|
+
readonly maxBatchSize = 50;
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly capacity: number;
|
|
31
|
+
readonly rootReserve: number;
|
|
32
|
+
readonly maxQueuedTasks: number;
|
|
33
|
+
readonly maxDurationMs: number;
|
|
34
|
+
constructor(config: GrpcSourceConfig, methods: readonly GrpcMethod[]);
|
|
35
|
+
healthy(): boolean;
|
|
36
|
+
start(raw: unknown, context: SourceContext): SourceOperation;
|
|
37
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AdmissionError } from "@pqe-pro/core/internal/execution/application/admission";
|
|
3
|
+
import { SourceFailure } from "@pqe-pro/core/internal/execution/application/source-failure";
|
|
4
|
+
import { boundary, deferred, errorOf, TaskFailure, untilAborted, } from "@pqe-pro/core/internal/execution/application/task-boundary";
|
|
5
|
+
import { identifier, snapshot } from "@pqe-pro/core/internal/execution/domain/query-model";
|
|
6
|
+
import { grpcRequestBytes, grpcResponseBytes, unary } from "./unary.js";
|
|
7
|
+
export const grpcSourceConfigSchema = z
|
|
8
|
+
.strictObject({
|
|
9
|
+
id: identifier,
|
|
10
|
+
endpoint: z
|
|
11
|
+
.url({ protocol: /^https$/u })
|
|
12
|
+
.max(512)
|
|
13
|
+
.refine((value) => {
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(value);
|
|
16
|
+
return !url.username && !url.password && url.pathname === "/" && !url.search && !url.hash;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
ca: z.string().min(64).max(32768),
|
|
23
|
+
authorization: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(4096)
|
|
27
|
+
.regex(/^[\x20-\x7E]+$/u)
|
|
28
|
+
.optional(),
|
|
29
|
+
capacity: z.number().int().min(1).max(6),
|
|
30
|
+
rootReserve: z.number().int().min(0).max(5),
|
|
31
|
+
maxQueuedTasks: z.number().int().nonnegative().max(128),
|
|
32
|
+
maxDurationMs: z.number().int().min(1).max(1500),
|
|
33
|
+
})
|
|
34
|
+
.refine(({ rootReserve, capacity }) => rootReserve < capacity);
|
|
35
|
+
const invocation = z.strictObject({ method: identifier, input: z.unknown() });
|
|
36
|
+
const methodPath = /^\/(?:[A-Za-z_][A-Za-z0-9_]*\.)*[A-Za-z_][A-Za-z0-9_]*\/[A-Za-z_][A-Za-z0-9_]*$/u;
|
|
37
|
+
export class GrpcSource {
|
|
38
|
+
kind = "grpc";
|
|
39
|
+
capacityScope = "local_io";
|
|
40
|
+
cancellation = "local_abort";
|
|
41
|
+
maxBatchSize = 50;
|
|
42
|
+
id;
|
|
43
|
+
capacity;
|
|
44
|
+
rootReserve;
|
|
45
|
+
maxQueuedTasks;
|
|
46
|
+
maxDurationMs;
|
|
47
|
+
#config;
|
|
48
|
+
#methods = new Map();
|
|
49
|
+
#active = 0;
|
|
50
|
+
#debt = 0;
|
|
51
|
+
constructor(config, methods) {
|
|
52
|
+
this.#config = grpcSourceConfigSchema.parse(config);
|
|
53
|
+
this.id = this.#config.id;
|
|
54
|
+
this.capacity = this.#config.capacity;
|
|
55
|
+
this.rootReserve = this.#config.rootReserve;
|
|
56
|
+
this.maxQueuedTasks = this.#config.maxQueuedTasks;
|
|
57
|
+
this.maxDurationMs = this.#config.maxDurationMs;
|
|
58
|
+
for (const method of methods) {
|
|
59
|
+
identifier.parse(method.id);
|
|
60
|
+
if (this.#methods.has(method.id) ||
|
|
61
|
+
method.path.length > 256 ||
|
|
62
|
+
!methodPath.test(method.path)) {
|
|
63
|
+
throw new Error("INVALID_GRPC_METHOD");
|
|
64
|
+
}
|
|
65
|
+
this.#methods.set(method.id, Object.freeze({ ...method }));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
healthy() {
|
|
69
|
+
return this.#debt === 0;
|
|
70
|
+
}
|
|
71
|
+
start(raw, context) {
|
|
72
|
+
context.throwIfExpired();
|
|
73
|
+
const deadline = Math.min(context.deadlineAtMs, context.clock.now() + this.maxDurationMs);
|
|
74
|
+
if (!this.healthy()) {
|
|
75
|
+
throw new TaskFailure("SOURCE_DEBT");
|
|
76
|
+
}
|
|
77
|
+
if (this.#active >= this.capacity) {
|
|
78
|
+
throw new AdmissionError("OVERLOADED");
|
|
79
|
+
}
|
|
80
|
+
const parsed = invocation.safeParse(raw);
|
|
81
|
+
const method = parsed.success ? this.#methods.get(parsed.data.method) : undefined;
|
|
82
|
+
if (!parsed.success || !method) {
|
|
83
|
+
throw new SourceFailure("invalid_response", "INVALID_RESULT");
|
|
84
|
+
}
|
|
85
|
+
let request;
|
|
86
|
+
try {
|
|
87
|
+
request = method.encode(snapshot(method.request, parsed.data.input, grpcRequestBytes));
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
throw new SourceFailure("invalid_response", "INVALID_RESULT");
|
|
91
|
+
}
|
|
92
|
+
if (!(request instanceof Uint8Array) || request.length > grpcRequestBytes) {
|
|
93
|
+
throw new SourceFailure("invalid_response", "RESPONSE_LIMIT");
|
|
94
|
+
}
|
|
95
|
+
const ownedRequest = Buffer.from(request);
|
|
96
|
+
const task = boundary(context.clock, deadline, context.signal, "UPSTREAM_TIMEOUT");
|
|
97
|
+
const settlement = deferred();
|
|
98
|
+
this.#active++;
|
|
99
|
+
const result = Promise.resolve().then(async () => {
|
|
100
|
+
let exchange;
|
|
101
|
+
let terminalStatus = false;
|
|
102
|
+
let provenClosed = true;
|
|
103
|
+
let value;
|
|
104
|
+
try {
|
|
105
|
+
task.signal.throwIfAborted();
|
|
106
|
+
context.throwIfExpired();
|
|
107
|
+
if (context.clock.now() >= deadline) {
|
|
108
|
+
throw new TaskFailure("UPSTREAM_TIMEOUT");
|
|
109
|
+
}
|
|
110
|
+
exchange = unary(this.#config.endpoint, this.#config.ca, method.path, ownedRequest, () => deadline - context.clock.now(), this.#config.authorization);
|
|
111
|
+
const response = await untilAborted(exchange.response, task.signal);
|
|
112
|
+
terminalStatus = true;
|
|
113
|
+
if (response.status === 4) {
|
|
114
|
+
throw new SourceFailure("server", "UPSTREAM_TIMEOUT");
|
|
115
|
+
}
|
|
116
|
+
if (response.status !== 0 || !response.payload) {
|
|
117
|
+
throw new SourceFailure("server", "UPSTREAM_ERROR");
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
value = snapshot(method.response, method.decode(response.payload), grpcResponseBytes);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
throw new SourceFailure("invalid_response", "INVALID_RESULT");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
if (exchange) {
|
|
128
|
+
if (!terminalStatus) {
|
|
129
|
+
exchange.cancel(errorOf(task.signal));
|
|
130
|
+
}
|
|
131
|
+
const cleanup = boundary(context.clock, context.clock.now() + 1000, new AbortController().signal, "UPSTREAM_TIMEOUT");
|
|
132
|
+
try {
|
|
133
|
+
await untilAborted(exchange.closed, cleanup.signal);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
provenClosed = false;
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
cleanup.dispose();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
task.dispose();
|
|
143
|
+
if (provenClosed) {
|
|
144
|
+
this.#active--;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.#debt++;
|
|
148
|
+
}
|
|
149
|
+
settlement.resolve({
|
|
150
|
+
state: provenClosed ? "settled" : "debt",
|
|
151
|
+
unknownRemoteOutcomes: exchange?.dispatched() && !terminalStatus ? 1 : 0,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (!provenClosed) {
|
|
155
|
+
throw new TaskFailure("SOURCE_DEBT");
|
|
156
|
+
}
|
|
157
|
+
if (context.clock.now() >= deadline) {
|
|
158
|
+
throw new TaskFailure("UPSTREAM_TIMEOUT");
|
|
159
|
+
}
|
|
160
|
+
return value;
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
result: untilAborted(result, task.signal),
|
|
164
|
+
settled: settlement.promise,
|
|
165
|
+
cancel: (reason) => task.cancel(reason),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const grpcRequestBytes = 16384;
|
|
2
|
+
export declare const grpcResponseBytes = 65536;
|
|
3
|
+
interface Response {
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly payload: Buffer | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface UnaryExchange {
|
|
8
|
+
readonly response: Promise<Response>;
|
|
9
|
+
readonly closed: Promise<undefined>;
|
|
10
|
+
readonly dispatched: () => boolean;
|
|
11
|
+
cancel(error: Error): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function unary(endpoint: string, ca: string, path: string, request: Uint8Array, timeoutMs: () => number, authorization?: string): UnaryExchange;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { connect, constants, sensitiveHeaders, } from "node:http2";
|
|
2
|
+
import { SourceFailure } from "@pqe-pro/core/internal/execution/application/source-failure";
|
|
3
|
+
import { deferred } from "@pqe-pro/core/internal/execution/application/task-boundary";
|
|
4
|
+
export const grpcRequestBytes = 16384;
|
|
5
|
+
export const grpcResponseBytes = 65536;
|
|
6
|
+
const prefixBytes = 5;
|
|
7
|
+
export function unary(endpoint, ca, path, request, timeoutMs, authorization) {
|
|
8
|
+
const packet = Buffer.allocUnsafe(prefixBytes + request.length);
|
|
9
|
+
packet[0] = 0;
|
|
10
|
+
packet.writeUInt32BE(request.length, 1);
|
|
11
|
+
packet.set(request, prefixBytes);
|
|
12
|
+
const session = connect(endpoint, {
|
|
13
|
+
ca,
|
|
14
|
+
rejectUnauthorized: true,
|
|
15
|
+
minVersion: "TLSv1.2",
|
|
16
|
+
maxHeaderListPairs: 64,
|
|
17
|
+
maxSessionMemory: 1,
|
|
18
|
+
settings: { enablePush: false, maxHeaderListSize: 16384 },
|
|
19
|
+
});
|
|
20
|
+
const closed = deferred();
|
|
21
|
+
let stream;
|
|
22
|
+
let sent = false;
|
|
23
|
+
let stopped = false;
|
|
24
|
+
let status;
|
|
25
|
+
let validHeaders = false;
|
|
26
|
+
let payload;
|
|
27
|
+
let bytes = 0;
|
|
28
|
+
const prefix = Buffer.alloc(prefixBytes);
|
|
29
|
+
let prefixUsed = 0;
|
|
30
|
+
const invalid = () => new SourceFailure("invalid_response", "INVALID_RESULT");
|
|
31
|
+
const unavailable = () => new SourceFailure("transport", "UPSTREAM_ERROR");
|
|
32
|
+
let cancel = () => undefined;
|
|
33
|
+
const response = new Promise((resolve, reject) => {
|
|
34
|
+
cancel = (reason) => {
|
|
35
|
+
if (stopped) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
stopped = true;
|
|
39
|
+
reject(reason);
|
|
40
|
+
if (stream && !stream.closed) {
|
|
41
|
+
stream.close(constants.NGHTTP2_CANCEL);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
session.destroy();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function terminal(headers) {
|
|
48
|
+
const value = headers["grpc-status"];
|
|
49
|
+
if (status !== undefined || typeof value !== "string" || !/^(?:[0-9]|1[0-6])$/u.test(value)) {
|
|
50
|
+
cancel(invalid());
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
status = Number(value);
|
|
54
|
+
}
|
|
55
|
+
function receive(chunk) {
|
|
56
|
+
if (stopped) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!validHeaders || status !== undefined) {
|
|
60
|
+
cancel(invalid());
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let offset = 0;
|
|
64
|
+
if (!payload) {
|
|
65
|
+
offset = Math.min(prefixBytes - prefixUsed, chunk.length);
|
|
66
|
+
chunk.copy(prefix, prefixUsed, 0, offset);
|
|
67
|
+
prefixUsed += offset;
|
|
68
|
+
if (prefixUsed < prefixBytes) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (prefix[0] !== 0) {
|
|
72
|
+
cancel(invalid());
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const size = prefix.readUInt32BE(1);
|
|
76
|
+
if (size > grpcResponseBytes) {
|
|
77
|
+
cancel(new SourceFailure("invalid_response", "RESPONSE_LIMIT"));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
payload = Buffer.allocUnsafe(size);
|
|
81
|
+
}
|
|
82
|
+
const incoming = chunk.length - offset;
|
|
83
|
+
if (incoming > payload.length - bytes) {
|
|
84
|
+
cancel(invalid());
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
chunk.copy(payload, bytes, offset);
|
|
88
|
+
bytes += incoming;
|
|
89
|
+
}
|
|
90
|
+
session.on("error", () => cancel(unavailable()));
|
|
91
|
+
session.once("close", () => {
|
|
92
|
+
cancel(unavailable());
|
|
93
|
+
closed.resolve(undefined);
|
|
94
|
+
});
|
|
95
|
+
session.once("connect", () => {
|
|
96
|
+
if (stopped) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (session.alpnProtocol !== "h2") {
|
|
100
|
+
cancel(unavailable());
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const remaining = Math.floor(timeoutMs());
|
|
104
|
+
if (remaining <= 0) {
|
|
105
|
+
cancel(new SourceFailure("transport", "UPSTREAM_TIMEOUT"));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const headers = {
|
|
110
|
+
":method": "POST",
|
|
111
|
+
":path": path,
|
|
112
|
+
"content-type": "application/grpc+proto",
|
|
113
|
+
te: "trailers",
|
|
114
|
+
"grpc-timeout": `${remaining}m`,
|
|
115
|
+
"grpc-accept-encoding": "identity",
|
|
116
|
+
...(authorization
|
|
117
|
+
? { authorization, [sensitiveHeaders]: [constants.HTTP2_HEADER_AUTHORIZATION] }
|
|
118
|
+
: {}),
|
|
119
|
+
};
|
|
120
|
+
stream = session.request(headers);
|
|
121
|
+
sent = true;
|
|
122
|
+
stream.on("error", () => cancel(unavailable()));
|
|
123
|
+
stream.on("response", (reply, flags) => {
|
|
124
|
+
if (reply[":status"] !== 200) {
|
|
125
|
+
cancel(new SourceFailure("server", "UPSTREAM_ERROR"));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const type = reply["content-type"];
|
|
129
|
+
if (typeof type !== "string" ||
|
|
130
|
+
!/^application\/grpc(?:\+proto)?(?:\s*;|$)/u.test(type) ||
|
|
131
|
+
(reply["grpc-encoding"] !== undefined && reply["grpc-encoding"] !== "identity")) {
|
|
132
|
+
cancel(invalid());
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
validHeaders = true;
|
|
136
|
+
if (reply["grpc-status"] !== undefined) {
|
|
137
|
+
if (!(flags & constants.NGHTTP2_FLAG_END_STREAM)) {
|
|
138
|
+
cancel(invalid());
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
terminal(reply);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
stream.on("data", receive);
|
|
145
|
+
stream.on("trailers", terminal);
|
|
146
|
+
stream.once("end", () => {
|
|
147
|
+
if (stopped) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (!validHeaders ||
|
|
151
|
+
status === undefined ||
|
|
152
|
+
(status === 0 && !payload) ||
|
|
153
|
+
(prefixUsed !== 0 && bytes !== payload?.length)) {
|
|
154
|
+
cancel(invalid());
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
stopped = true;
|
|
158
|
+
resolve({ status, payload });
|
|
159
|
+
});
|
|
160
|
+
stream.once("close", () => {
|
|
161
|
+
cancel(unavailable());
|
|
162
|
+
session.destroy();
|
|
163
|
+
});
|
|
164
|
+
stream.end(packet);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
cancel(unavailable());
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
return { response, closed: closed.promise, cancel, dispatched: () => sent };
|
|
172
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GrpcSource, grpcSourceConfigSchema } from "../execution/infrastructure/grpc/source.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pqe-pro/source-grpc",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "@pqe-pro/source-grpc",
|
|
9
|
+
"version": "0.4.0",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.12.0"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@pqe-pro/core": "0.4.0",
|
|
15
|
+
"zod": "4.6.7"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"node_modules/zod": {
|
|
19
|
+
"version": "4.6.7",
|
|
20
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
|
|
21
|
+
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"funding": {
|
|
24
|
+
"url": "https://github.com/sponsors/colinhacks"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pqe-pro/source-grpc",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Bounded unary gRPC source for the Progressive Query Engine.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"progressive",
|
|
8
|
+
"query",
|
|
9
|
+
"streaming",
|
|
10
|
+
"ndjson",
|
|
11
|
+
"deadline",
|
|
12
|
+
"typescript",
|
|
13
|
+
"grpc",
|
|
14
|
+
"protobuf"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/watscho/pqe-pro#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/watscho/pqe-pro.git",
|
|
20
|
+
"directory": "packages/source-grpc"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/watscho/pqe-pro/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.12.0"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/exports/grpc.d.ts",
|
|
33
|
+
"import": "./dist/exports/grpc.js",
|
|
34
|
+
"default": "./dist/exports/grpc.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"README.md",
|
|
41
|
+
"NOTICE.md",
|
|
42
|
+
"dependency-notices.json",
|
|
43
|
+
"sbom.cdx.json",
|
|
44
|
+
"npm-shrinkwrap.json"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@pqe-pro/core": "0.4.0",
|
|
48
|
+
"zod": "4.6.7"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/sbom.cdx.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bomFormat": "CycloneDX",
|
|
3
|
+
"specVersion": "1.6",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"metadata": {
|
|
6
|
+
"component": {
|
|
7
|
+
"type": "library",
|
|
8
|
+
"name": "@pqe-pro/source-grpc",
|
|
9
|
+
"version": "0.4.0",
|
|
10
|
+
"properties": [
|
|
11
|
+
{
|
|
12
|
+
"name": "pqe:distribution",
|
|
13
|
+
"value": "MIT; public npm registry"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"components": [
|
|
19
|
+
{
|
|
20
|
+
"type": "library",
|
|
21
|
+
"name": "zod",
|
|
22
|
+
"version": "4.6.7",
|
|
23
|
+
"bom-ref": "pkg:npm/zod@4.6.7",
|
|
24
|
+
"purl": "pkg:npm/zod@4.6.7",
|
|
25
|
+
"licenses": [
|
|
26
|
+
{
|
|
27
|
+
"license": {
|
|
28
|
+
"id": "MIT"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|