@streamotter/contracts 0.1.0-rc.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orca Solutions
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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @streamotter/contracts
2
+
3
+ The public types, protocol constants, error vocabulary, and runtime validation shared by the StreamOtter gateway and browser SDK. Both are built on this package.
4
+
5
+ **Most applications don't install it directly.** [`@streamotter/client`](https://www.npmjs.com/package/@streamotter/client) and [`@streamotter/gateway`](https://www.npmjs.com/package/@streamotter/gateway) re-export the types you need. Install this package when you build tooling around StreamOtter: editors, linters, or deployment checks for `streamotter.json`, or anything that must agree exactly with the gateway's rules.
6
+
7
+ > **Release candidate.** `0.1.0-rc.1` is published under the `next` tag. Package versions follow SemVer independently of the V1 protocol (`PROTOCOL_VERSION = 1`) and `configVersion: 1`.
8
+
9
+ ```bash
10
+ npm install @streamotter/contracts@next
11
+ ```
12
+
13
+ ESM only, with TypeScript declarations included. It has no dependencies and runs in browsers and Node.js.
14
+
15
+ ## Validate a configuration
16
+
17
+ ```ts
18
+ import { readFile } from "node:fs/promises";
19
+ import { canonicalJson, validateProjectConfig } from "@streamotter/contracts";
20
+
21
+ const config: unknown = JSON.parse(await readFile("streamotter.json", "utf8"));
22
+ const { valid, issues } = validateProjectConfig(config);
23
+ for (const issue of issues) console.error(`${issue.path || "/"} ${issue.code}: ${issue.message}`);
24
+
25
+ // The fingerprint `streamotter validate` and the workbench print:
26
+ const bytes = new TextEncoder().encode(canonicalJson(config));
27
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
28
+ const fingerprint = Array.from(new Uint8Array(digest), b => b.toString(16).padStart(2, "0")).join("");
29
+ ```
30
+
31
+ This is the same validator `defineProject()`, the CLI, and the workbench use. Validation is structural: identifiers, references between sources, schemas, and channels, the bounded schema dialect, limits, and deferred V2/V3 fields (which fail with a clear message). It never connects to Kafka or resolves secrets. `assertValidProjectConfig()` throws a `StreamOtterError` with code `CONFIG_INVALID` instead of returning issues.
32
+
33
+ ## What else is exported
34
+
35
+ | Area | Exports |
36
+ | --- | --- |
37
+ | Types | `ProjectConfig`, `Schema`, `HandlerRegistry`, `Principal`, `StreamEvent`, `StreamError`, `SubscriptionState`, `ConnectionState`, the Socket.IO wire frames, `ManagementOperations`, and more |
38
+ | Values and schemas | `validateValue(schema, value)`, `validateSchemaDefinition`, `canonicalizeParams`, `canonicalJson`, `canonicalJsonPretty` (the workbench's export format) |
39
+ | Revisions and identifiers | `isRevision`, `compareRevisions` (numeric, no `number` conversion), `isIdentifier`, `REVISION_PATTERN`, `IDENTIFIER_PATTERN` |
40
+ | Errors | `ERROR_CODES`, `StreamOtterError`, `isStreamError`, `PUBLIC_MESSAGES` |
41
+ | Protocol and limits | `PROTOCOL_VERSION`, `CAPABILITIES`, `EVENTS` (`so:subscribe`, `so:data`, …), `DEFAULT_LIMITS`, default ports and paths, and timeouts |
42
+
43
+ The types are the public contract that the [V1 API specification](https://github.com/jfricano/StreamOtter/blob/main/docs/V1_API.md) describes. Where the specification and the types differ, this package is authoritative for types (see its §13).
44
+
45
+ ## More
46
+
47
+ - [V1 API specification](https://github.com/jfricano/StreamOtter/blob/main/docs/V1_API.md): configuration and schemas (§2), protocol (§8), errors (§9), management (§10)
48
+ - [Repository](https://github.com/jfricano/StreamOtter) · [Issues](https://github.com/jfricano/StreamOtter/issues)
49
+
50
+ MIT License © 2026 Orca Solutions
@@ -0,0 +1,13 @@
1
+ import type { ConfigIssue, ProjectConfig } from "./types.ts";
2
+ export interface ConfigValidation {
3
+ valid: boolean;
4
+ issues: ConfigIssue[];
5
+ }
6
+ /**
7
+ * Structural, schema, and reference validation of a portable configuration.
8
+ * Never resolves secrets, runs handlers, or connects to brokers.
9
+ */
10
+ export declare function validateProjectConfig(input: unknown): ConfigValidation;
11
+ /** Throws CONFIG_INVALID with the issues attached when the configuration is invalid. */
12
+ export declare function assertValidProjectConfig(input: unknown): asserts input is ProjectConfig;
13
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAU,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAAG,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE;AAkF3E;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA+MtE;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAQvF"}
package/dist/config.js ADDED
@@ -0,0 +1,329 @@
1
+ import { StreamOtterError } from "./errors.js";
2
+ import { validateLimits } from "./limits.js";
3
+ import { IDENTIFIER_PATTERN, isPlainObject } from "./primitives.js";
4
+ import { pointer, validateParamsSchema, validateSchemaDefinition } from "./schema.js";
5
+ /** Keys that belong to deferred V2/V3 features; reported with a clear message. */
6
+ const DEFERRED_FEATURES = {
7
+ history: "Retained history is a V2 feature and is not supported in V1.",
8
+ recovery: "Client recovery cursors are a V2 feature and are not supported in V1.",
9
+ retention: "Retention windows are a V2 feature and are not supported in V1.",
10
+ acknowledgement: "Application acknowledgements are a V2 feature and are not supported in V1.",
11
+ resume: "Resume policies are a V2 feature and are not supported in V1.",
12
+ replay: "Replay is a V2 feature and is not supported in V1.",
13
+ commands: "Commands are a V3 feature and are not supported in V1.",
14
+ command: "Commands are a V3 feature and are not supported in V1.",
15
+ gateways: "Multiple gateways are a V2 feature and are not supported in V1.",
16
+ cluster: "Multiple gateways are a V2 feature and are not supported in V1.",
17
+ schemaRegistry: "Schema Registry integration is a V2 feature and is not supported in V1.",
18
+ workspaces: "Team workspaces are a V3 feature and are not supported in V1.",
19
+ environments: "Environments are a V3 feature and are not supported in V1.",
20
+ transports: "Only the Socket.IO transport is supported in V1.",
21
+ transport: "Only the Socket.IO transport is supported in V1."
22
+ };
23
+ const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
24
+ const KAFKA_NAME_PATTERN = /^[A-Za-z0-9._-]{1,249}$/;
25
+ const BROKER_PATTERN = /^[A-Za-z0-9.-]+:[0-9]{1,5}$|^\[[0-9A-Fa-f:.]+\]:[0-9]{1,5}$/;
26
+ class Checker {
27
+ issues = [];
28
+ add(path, code, message) {
29
+ this.issues.push({ path, code, message });
30
+ }
31
+ /** Reports unknown keys (with deferred-feature messages) and missing required keys. */
32
+ keys(value, path, required, optional = []) {
33
+ for (const key of Object.keys(value)) {
34
+ if (required.includes(key) || optional.includes(key))
35
+ continue;
36
+ const deferred = DEFERRED_FEATURES[key];
37
+ if (deferred !== undefined)
38
+ this.add(pointer(path, key), "UNSUPPORTED_FEATURE", deferred);
39
+ else
40
+ this.add(pointer(path, key), "UNKNOWN_KEY", `Unknown key "${key}".`);
41
+ }
42
+ for (const key of required) {
43
+ if (!Object.hasOwn(value, key) || value[key] === undefined)
44
+ this.add(pointer(path, key), "REQUIRED", `"${key}" is required.`);
45
+ }
46
+ }
47
+ object(value, path, label) {
48
+ if (isPlainObject(value))
49
+ return true;
50
+ this.add(path, "INVALID_TYPE", `${label} must be an object.`);
51
+ return false;
52
+ }
53
+ identifier(value, path, label) {
54
+ if (typeof value === "string" && IDENTIFIER_PATTERN.test(value))
55
+ return true;
56
+ this.add(path, "INVALID_IDENTIFIER", `${label} must match [A-Za-z][A-Za-z0-9_-]{0,63}.`);
57
+ return false;
58
+ }
59
+ nonEmptyString(value, path, label, max = 1024) {
60
+ if (typeof value === "string" && value.length > 0 && value.length <= max)
61
+ return true;
62
+ this.add(path, "INVALID_VALUE", `${label} must be a non-empty string of at most ${max} characters.`);
63
+ return false;
64
+ }
65
+ secretRef(value, path) {
66
+ if (!this.object(value, path, "A secret reference"))
67
+ return;
68
+ this.keys(value, path, ["env"]);
69
+ if (value["env"] !== undefined && !(typeof value["env"] === "string" && ENV_NAME_PATTERN.test(value["env"]))) {
70
+ this.add(pointer(path, "env"), "INVALID_VALUE", "env must name an environment variable.");
71
+ }
72
+ }
73
+ }
74
+ function isOrigin(value) {
75
+ if (typeof value !== "string")
76
+ return false;
77
+ try {
78
+ const url = new URL(value);
79
+ return (url.protocol === "http:" || url.protocol === "https:") && url.origin === value;
80
+ }
81
+ catch {
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Structural, schema, and reference validation of a portable configuration.
87
+ * Never resolves secrets, runs handlers, or connects to brokers.
88
+ */
89
+ export function validateProjectConfig(input) {
90
+ const c = new Checker();
91
+ if (!c.object(input, "", "The configuration"))
92
+ return { valid: false, issues: c.issues };
93
+ c.keys(input, "", ["configVersion", "projectId", "gateway", "connections", "sources", "schemas", "channels"], ["limits"]);
94
+ if (input["configVersion"] !== undefined && input["configVersion"] !== 1) {
95
+ c.add("/configVersion", "UNSUPPORTED_FEATURE", "Only configVersion 1 is supported.");
96
+ }
97
+ if (input["projectId"] !== undefined)
98
+ c.identifier(input["projectId"], "/projectId", "projectId");
99
+ const gateway = input["gateway"];
100
+ if (gateway !== undefined && c.object(gateway, "/gateway", "gateway")) {
101
+ c.keys(gateway, "/gateway", ["host", "port", "path", "allowedOrigins"]);
102
+ if (gateway["host"] !== undefined)
103
+ c.nonEmptyString(gateway["host"], "/gateway/host", "host", 253);
104
+ const port = gateway["port"];
105
+ if (port !== undefined && !(typeof port === "number" && Number.isInteger(port) && port >= 0 && port <= 65_535)) {
106
+ c.add("/gateway/port", "INVALID_VALUE", "port must be an integer from 0 to 65535.");
107
+ }
108
+ const path = gateway["path"];
109
+ if (path !== undefined && !(typeof path === "string" && /^\/[A-Za-z0-9._~\/-]*$/.test(path) && path.length <= 256)) {
110
+ c.add("/gateway/path", "INVALID_VALUE", "path must be an absolute URL path without a query or fragment.");
111
+ }
112
+ const origins = gateway["allowedOrigins"];
113
+ if (origins !== undefined) {
114
+ if (!Array.isArray(origins)) {
115
+ c.add("/gateway/allowedOrigins", "INVALID_TYPE", "allowedOrigins must be an array of exact origins.");
116
+ }
117
+ else {
118
+ origins.forEach((origin, index) => {
119
+ if (!isOrigin(origin)) {
120
+ c.add(pointer("/gateway/allowedOrigins", index), "INVALID_VALUE", "Each allowed origin must be an exact http(s) origin such as https://app.example.com; wildcards are not allowed.");
121
+ }
122
+ });
123
+ if (new Set(origins).size !== origins.length)
124
+ c.add("/gateway/allowedOrigins", "DUPLICATE", "allowedOrigins must be unique.");
125
+ }
126
+ }
127
+ }
128
+ const connectionIds = new Set();
129
+ const connections = input["connections"];
130
+ if (connections !== undefined && c.object(connections, "/connections", "connections")) {
131
+ for (const [id, profile] of Object.entries(connections)) {
132
+ const path = pointer("/connections", id);
133
+ if (!c.identifier(id, path, "Connection profile IDs"))
134
+ continue;
135
+ connectionIds.add(id);
136
+ if (!c.object(profile, path, "A connection profile"))
137
+ continue;
138
+ c.keys(profile, path, ["brokers", "tls"], ["sasl"]);
139
+ const brokers = profile["brokers"];
140
+ if (brokers !== undefined) {
141
+ if (!Array.isArray(brokers) || brokers.length === 0) {
142
+ c.add(pointer(path, "brokers"), "INVALID_VALUE", "brokers must be a non-empty array of host:port strings.");
143
+ }
144
+ else {
145
+ brokers.forEach((broker, index) => {
146
+ if (typeof broker !== "string" || !BROKER_PATTERN.test(broker)) {
147
+ c.add(pointer(pointer(path, "brokers"), index), "INVALID_VALUE", "Each broker must be host:port.");
148
+ }
149
+ });
150
+ }
151
+ }
152
+ const tls = profile["tls"];
153
+ if (tls !== undefined && tls !== false) {
154
+ if (c.object(tls, pointer(path, "tls"), "tls (false or an object)")) {
155
+ c.keys(tls, pointer(path, "tls"), [], ["caFile"]);
156
+ if (tls["caFile"] !== undefined)
157
+ c.nonEmptyString(tls["caFile"], pointer(pointer(path, "tls"), "caFile"), "caFile", 4096);
158
+ }
159
+ }
160
+ const sasl = profile["sasl"];
161
+ if (sasl !== undefined && c.object(sasl, pointer(path, "sasl"), "sasl")) {
162
+ const saslPath = pointer(path, "sasl");
163
+ c.keys(sasl, saslPath, ["mechanism", "username", "password"]);
164
+ const mechanism = sasl["mechanism"];
165
+ if (mechanism !== undefined && mechanism !== "plain" && mechanism !== "scram-sha-256" && mechanism !== "scram-sha-512") {
166
+ c.add(pointer(saslPath, "mechanism"), "UNSUPPORTED_FEATURE", "SASL mechanism must be plain, scram-sha-256, or scram-sha-512 (OAuth is not supported in V1).");
167
+ }
168
+ if (sasl["username"] !== undefined)
169
+ c.secretRef(sasl["username"], pointer(saslPath, "username"));
170
+ if (sasl["password"] !== undefined)
171
+ c.secretRef(sasl["password"], pointer(saslPath, "password"));
172
+ }
173
+ }
174
+ }
175
+ const sourceIds = new Set();
176
+ const kafkaProfiles = new Set();
177
+ const consumerGroups = new Map();
178
+ const sources = input["sources"];
179
+ if (sources !== undefined && c.object(sources, "/sources", "sources")) {
180
+ for (const [id, source] of Object.entries(sources)) {
181
+ const path = pointer("/sources", id);
182
+ if (!c.identifier(id, path, "Source IDs"))
183
+ continue;
184
+ sourceIds.add(id);
185
+ if (!c.object(source, path, "A source"))
186
+ continue;
187
+ const kind = source["kind"];
188
+ if (kind === "kafka") {
189
+ c.keys(source, path, ["kind", "generation", "connectionRef", "topics", "consumerGroup", "codec", "startFrom"]);
190
+ if (source["generation"] !== undefined)
191
+ c.identifier(source["generation"], pointer(path, "generation"), "generation");
192
+ const ref = source["connectionRef"];
193
+ if (ref !== undefined) {
194
+ if (typeof ref !== "string" || !connectionIds.has(ref)) {
195
+ c.add(pointer(path, "connectionRef"), "UNKNOWN_REFERENCE", "connectionRef must name a configured connection profile.");
196
+ }
197
+ else {
198
+ kafkaProfiles.add(ref);
199
+ }
200
+ }
201
+ const topics = source["topics"];
202
+ if (topics !== undefined) {
203
+ if (!Array.isArray(topics) || topics.length === 0) {
204
+ c.add(pointer(path, "topics"), "INVALID_VALUE", "topics must be a non-empty array.");
205
+ }
206
+ else {
207
+ topics.forEach((topic, index) => {
208
+ if (typeof topic !== "string" || !KAFKA_NAME_PATTERN.test(topic)) {
209
+ c.add(pointer(pointer(path, "topics"), index), "INVALID_VALUE", "Topic names may contain letters, digits, '.', '_', and '-'.");
210
+ }
211
+ });
212
+ if (new Set(topics).size !== topics.length)
213
+ c.add(pointer(path, "topics"), "DUPLICATE", "topics must be unique.");
214
+ }
215
+ }
216
+ const group = source["consumerGroup"];
217
+ if (group !== undefined) {
218
+ if (typeof group !== "string" || !KAFKA_NAME_PATTERN.test(group)) {
219
+ c.add(pointer(path, "consumerGroup"), "INVALID_VALUE", "consumerGroup may contain letters, digits, '.', '_', and '-'.");
220
+ }
221
+ else {
222
+ const owner = consumerGroups.get(group);
223
+ if (owner !== undefined) {
224
+ c.add(pointer(path, "consumerGroup"), "CONSUMER_GROUP_CONFLICT", `Consumer group "${group}" is already used by source "${owner}"; each source needs a dedicated group.`);
225
+ }
226
+ else {
227
+ consumerGroups.set(group, id);
228
+ }
229
+ }
230
+ }
231
+ if (source["codec"] !== undefined && source["codec"] !== "json") {
232
+ c.add(pointer(path, "codec"), "UNSUPPORTED_FEATURE", "Only the json codec is supported in V1.");
233
+ }
234
+ const startFrom = source["startFrom"];
235
+ if (startFrom !== undefined && startFrom !== "latest" && startFrom !== "earliest") {
236
+ c.add(pointer(path, "startFrom"), "INVALID_VALUE", "startFrom must be latest or earliest.");
237
+ }
238
+ }
239
+ else if (kind === "fixture") {
240
+ c.keys(source, path, ["kind", "generation", "fixtureRef"]);
241
+ if (source["generation"] !== undefined)
242
+ c.identifier(source["generation"], pointer(path, "generation"), "generation");
243
+ if (source["fixtureRef"] !== undefined)
244
+ c.identifier(source["fixtureRef"], pointer(path, "fixtureRef"), "fixtureRef");
245
+ }
246
+ else {
247
+ c.add(pointer(path, "kind"), "UNSUPPORTED_FEATURE", "Source kind must be kafka or fixture in V1.");
248
+ }
249
+ }
250
+ }
251
+ if (kafkaProfiles.size > 1) {
252
+ c.add("/sources", "MULTIPLE_CONNECTIONS", "V1 supports one Kafka connection profile per project; list multiple brokers of one cluster in that profile instead.");
253
+ }
254
+ const schemaDefinitions = new Map();
255
+ const schemas = input["schemas"];
256
+ if (schemas !== undefined && c.object(schemas, "/schemas", "schemas")) {
257
+ for (const [id, schema] of Object.entries(schemas)) {
258
+ const path = pointer("/schemas", id);
259
+ if (!c.identifier(id, path, "Schema IDs"))
260
+ continue;
261
+ if (validateSchemaDefinition(schema, path, c.issues))
262
+ schemaDefinitions.set(id, schema);
263
+ }
264
+ }
265
+ const channels = input["channels"];
266
+ if (channels !== undefined && c.object(channels, "/channels", "channels")) {
267
+ for (const [name, channel] of Object.entries(channels)) {
268
+ const path = pointer("/channels", name);
269
+ if (!c.identifier(name, path, "Channel names"))
270
+ continue;
271
+ if (!c.object(channel, path, "A channel"))
272
+ continue;
273
+ c.keys(channel, path, ["version", "source", "paramsSchema", "payloadSchema", "handlersRef", "delivery"]);
274
+ const version = channel["version"];
275
+ if (version !== undefined && !(typeof version === "number" && Number.isSafeInteger(version) && version > 0)) {
276
+ c.add(pointer(path, "version"), "INVALID_VALUE", "version must be a positive integer.");
277
+ }
278
+ const source = channel["source"];
279
+ if (source !== undefined && (typeof source !== "string" || !sourceIds.has(source))) {
280
+ c.add(pointer(path, "source"), "UNKNOWN_REFERENCE", "source must name a configured source.");
281
+ }
282
+ for (const key of ["paramsSchema", "payloadSchema"]) {
283
+ const ref = channel[key];
284
+ if (ref === undefined)
285
+ continue;
286
+ if (typeof ref !== "string" || !(schemas !== undefined && isPlainObject(schemas) && Object.hasOwn(schemas, ref))) {
287
+ c.add(pointer(path, key), "UNKNOWN_REFERENCE", `${key} must name a configured schema.`);
288
+ }
289
+ }
290
+ const paramsRef = channel["paramsSchema"];
291
+ if (typeof paramsRef === "string") {
292
+ const schema = schemaDefinitions.get(paramsRef);
293
+ if (schema !== undefined)
294
+ validateParamsSchema(schema, pointer("/schemas", paramsRef), c.issues);
295
+ }
296
+ const handlersRef = channel["handlersRef"];
297
+ if (handlersRef !== undefined && handlersRef !== name) {
298
+ c.add(pointer(path, "handlersRef"), "HANDLERS_REF_MISMATCH", "handlersRef must equal the channel name in V1.");
299
+ }
300
+ const delivery = channel["delivery"];
301
+ if (delivery !== undefined && c.object(delivery, pointer(path, "delivery"), "delivery")) {
302
+ const deliveryPath = pointer(path, "delivery");
303
+ c.keys(delivery, deliveryPath, ["kind", "overflow"]);
304
+ if (delivery["kind"] !== undefined && delivery["kind"] !== "state") {
305
+ c.add(pointer(deliveryPath, "kind"), "UNSUPPORTED_FEATURE", delivery["kind"] === "events"
306
+ ? "Retained event channels (delivery.kind \"events\") are a V2 feature; V1 supports only \"state\"."
307
+ : "delivery.kind must be \"state\" in V1.");
308
+ }
309
+ if (delivery["overflow"] !== undefined && delivery["overflow"] !== "resync") {
310
+ c.add(pointer(deliveryPath, "overflow"), "UNSUPPORTED_FEATURE", "delivery.overflow must be \"resync\" in V1.");
311
+ }
312
+ }
313
+ }
314
+ }
315
+ validateLimits(input["limits"], "/limits", c.issues);
316
+ return { valid: c.issues.length === 0, issues: c.issues };
317
+ }
318
+ /** Throws CONFIG_INVALID with the issues attached when the configuration is invalid. */
319
+ export function assertValidProjectConfig(input) {
320
+ const { valid, issues } = validateProjectConfig(input);
321
+ if (valid)
322
+ return;
323
+ const summary = issues.slice(0, 3).map(issue => `${issue.path || "/"}: ${issue.message}`).join("; ");
324
+ throw new StreamOtterError("CONFIG_INVALID", {
325
+ message: `The configuration is invalid (${issues.length} issue${issues.length === 1 ? "" : "s"}): ${summary}`,
326
+ details: { issues: issues.map(issue => ({ path: issue.path, code: issue.code, message: issue.message })) }
327
+ });
328
+ }
329
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAKtF,kFAAkF;AAClF,MAAM,iBAAiB,GAAqC;IAC1D,OAAO,EAAE,8DAA8D;IACvE,QAAQ,EAAE,uEAAuE;IACjF,SAAS,EAAE,iEAAiE;IAC5E,eAAe,EAAE,4EAA4E;IAC7F,MAAM,EAAE,+DAA+D;IACvE,MAAM,EAAE,oDAAoD;IAC5D,QAAQ,EAAE,wDAAwD;IAClE,OAAO,EAAE,wDAAwD;IACjE,QAAQ,EAAE,iEAAiE;IAC3E,OAAO,EAAE,iEAAiE;IAC1E,cAAc,EAAE,yEAAyE;IACzF,UAAU,EAAE,+DAA+D;IAC3E,YAAY,EAAE,4DAA4D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AE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI,KAAK;QAAE,OAAO;IAClB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrG,MAAM,IAAI,gBAAgB,CAAC,gBAAgB,EAAE;QAC3C,OAAO,EAAE,iCAAiC,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,OAAO,EAAE;QAC7G,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;KAC3G,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ErrorCode, Json, StreamError } from "./types.ts";
2
+ /** Public, action-oriented messages. Never include topics, secrets, or payloads. */
3
+ export declare const PUBLIC_MESSAGES: Readonly<Record<ErrorCode, string>>;
4
+ export declare const ERROR_CODES: readonly ErrorCode[];
5
+ export declare function isErrorCode(value: unknown): value is ErrorCode;
6
+ export interface StreamErrorOptions {
7
+ message?: string;
8
+ retryable?: boolean;
9
+ requestId?: string;
10
+ details?: Readonly<Record<string, Json>>;
11
+ }
12
+ /**
13
+ * An Error that also satisfies the StreamError shape. SDK promises reject with
14
+ * it; its enumerable fields serialize to exactly the public StreamError object.
15
+ */
16
+ export declare class StreamOtterError extends Error implements StreamError {
17
+ code: ErrorCode;
18
+ retryable: boolean;
19
+ requestId: string;
20
+ details?: Readonly<Record<string, Json>>;
21
+ constructor(code: ErrorCode, options?: StreamErrorOptions);
22
+ toJSON(): StreamError;
23
+ }
24
+ export declare function streamError(code: ErrorCode, options?: StreamErrorOptions): StreamError;
25
+ /** Copies only the public StreamError fields. */
26
+ export declare function toStreamError(error: StreamError): StreamError;
27
+ export declare function isStreamError(value: unknown): value is StreamError;
28
+ export declare function asStreamOtterError(error: StreamError): StreamOtterError;
29
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE/D,oFAAoF;AACpF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAoB/D,CAAC;AAwBF,eAAO,MAAM,WAAW,EAAqC,SAAS,SAAS,EAAE,CAAC;AAElF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAM,YAAW,WAAW;IAChE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE7B,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,kBAAuB;IAU7D,MAAM,IAAI,WAAW;CAGtB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAS1F;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAI7D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAOlE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,CAKvE"}
package/dist/errors.js ADDED
@@ -0,0 +1,106 @@
1
+ /** Public, action-oriented messages. Never include topics, secrets, or payloads. */
2
+ export const PUBLIC_MESSAGES = {
3
+ UNAUTHENTICATED: "Authentication is required or has expired.",
4
+ FORBIDDEN: "This subscription is not permitted.",
5
+ INVALID_PARAMS: "The channel parameters are invalid.",
6
+ CHANNEL_NOT_FOUND: "The channel is not configured.",
7
+ CHANNEL_VERSION_UNSUPPORTED: "The requested channel version is not deployed.",
8
+ SOURCE_UNAVAILABLE: "The source is unavailable; this view may be stale.",
9
+ INVALID_PAYLOAD: "The data did not match its declared contract.",
10
+ OVERLOADED: "The gateway is over its configured limits; try again later.",
11
+ RESYNC_REQUIRED: "Automatic synchronization stopped; call resync() to try again.",
12
+ UNSUPPORTED_CAPABILITY: "The requested capability is not supported by this gateway.",
13
+ INVALID_REQUEST: "The request is malformed.",
14
+ CONFIG_INVALID: "The configuration is invalid.",
15
+ TIMEOUT: "The operation did not complete before its deadline.",
16
+ CANCELLED: "The operation was cancelled.",
17
+ CLIENT_CLOSED: "The client is closed; create a new client.",
18
+ HANDLER_FAILED: "An application handler failed.",
19
+ REVISION_CONFLICT: "Conflicting data was received for the same revision.",
20
+ TRACE_CURSOR_EXPIRED: "The trace cursor has expired; start from the latest traces.",
21
+ INTERNAL: "An unexpected error occurred."
22
+ };
23
+ const DEFAULT_RETRYABLE = {
24
+ UNAUTHENTICATED: true,
25
+ FORBIDDEN: false,
26
+ INVALID_PARAMS: false,
27
+ CHANNEL_NOT_FOUND: false,
28
+ CHANNEL_VERSION_UNSUPPORTED: false,
29
+ SOURCE_UNAVAILABLE: true,
30
+ INVALID_PAYLOAD: false,
31
+ OVERLOADED: true,
32
+ RESYNC_REQUIRED: true,
33
+ UNSUPPORTED_CAPABILITY: false,
34
+ INVALID_REQUEST: false,
35
+ CONFIG_INVALID: false,
36
+ TIMEOUT: true,
37
+ CANCELLED: false,
38
+ CLIENT_CLOSED: false,
39
+ HANDLER_FAILED: true,
40
+ REVISION_CONFLICT: false,
41
+ TRACE_CURSOR_EXPIRED: false,
42
+ INTERNAL: true
43
+ };
44
+ export const ERROR_CODES = Object.keys(DEFAULT_RETRYABLE);
45
+ export function isErrorCode(value) {
46
+ return typeof value === "string" && Object.hasOwn(DEFAULT_RETRYABLE, value);
47
+ }
48
+ /**
49
+ * An Error that also satisfies the StreamError shape. SDK promises reject with
50
+ * it; its enumerable fields serialize to exactly the public StreamError object.
51
+ */
52
+ export class StreamOtterError extends Error {
53
+ code;
54
+ retryable;
55
+ requestId;
56
+ details;
57
+ constructor(code, options = {}) {
58
+ super(options.message ?? PUBLIC_MESSAGES[code]);
59
+ Object.defineProperty(this, "message", { enumerable: true, writable: true, configurable: true, value: this.message });
60
+ Object.defineProperty(this, "name", { enumerable: false, value: "StreamOtterError" });
61
+ this.code = code;
62
+ this.retryable = options.retryable ?? DEFAULT_RETRYABLE[code];
63
+ this.requestId = options.requestId ?? "";
64
+ if (options.details !== undefined)
65
+ this.details = options.details;
66
+ }
67
+ toJSON() {
68
+ return toStreamError(this);
69
+ }
70
+ }
71
+ export function streamError(code, options = {}) {
72
+ const error = {
73
+ code,
74
+ message: options.message ?? PUBLIC_MESSAGES[code],
75
+ retryable: options.retryable ?? DEFAULT_RETRYABLE[code],
76
+ requestId: options.requestId ?? ""
77
+ };
78
+ if (options.details !== undefined)
79
+ error.details = options.details;
80
+ return error;
81
+ }
82
+ /** Copies only the public StreamError fields. */
83
+ export function toStreamError(error) {
84
+ const copy = { code: error.code, message: error.message, retryable: error.retryable, requestId: error.requestId };
85
+ if (error.details !== undefined)
86
+ copy.details = error.details;
87
+ return copy;
88
+ }
89
+ export function isStreamError(value) {
90
+ if (typeof value !== "object" || value === null)
91
+ return false;
92
+ const candidate = value;
93
+ return isErrorCode(candidate["code"])
94
+ && typeof candidate["message"] === "string"
95
+ && typeof candidate["retryable"] === "boolean"
96
+ && typeof candidate["requestId"] === "string";
97
+ }
98
+ export function asStreamOtterError(error) {
99
+ if (error instanceof StreamOtterError)
100
+ return error;
101
+ const options = { message: error.message, retryable: error.retryable, requestId: error.requestId };
102
+ if (error.details !== undefined)
103
+ options.details = error.details;
104
+ return new StreamOtterError(error.code, options);
105
+ }
106
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAwC;IAClE,eAAe,EAAE,4CAA4C;IAC7D,SAAS,EAAE,qCAAqC;IAChD,cAAc,EAAE,qCAAqC;IACrD,iBAAiB,EAAE,gCAAgC;IACnD,2BAA2B,EAAE,gDAAgD;IAC7E,kBAAkB,EAAE,oDAAoD;IACxE,eAAe,EAAE,+CAA+C;IAChE,UAAU,EAAE,6DAA6D;IACzE,eAAe,EAAE,gEAAgE;IACjF,sBAAsB,EAAE,4DAA4D;IACpF,eAAe,EAAE,2BAA2B;IAC5C,cAAc,EAAE,+BAA+B;IAC/C,OAAO,EAAE,qDAAqD;IAC9D,SAAS,EAAE,8BAA8B;IACzC,aAAa,EAAE,4CAA4C;IAC3D,cAAc,EAAE,gCAAgC;IAChD,iBAAiB,EAAE,sDAA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,KAAK,CAAC,OAAO,CAAC;IAC9D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,KAAgC,CAAC;IACnD,OAAO,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;WAChC,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,QAAQ;WACxC,OAAO,SAAS,CAAC,WAAW,CAAC,KAAK,SAAS;WAC3C,OAAO,SAAS,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAkB;IACnD,IAAI,KAAK,YAAY,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,OAAO,GAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACvH,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACjE,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type * from "./types.ts";
2
+ export * from "./errors.ts";
3
+ export * from "./primitives.ts";
4
+ export * from "./schema.ts";
5
+ export * from "./limits.ts";
6
+ export * from "./protocol.ts";
7
+ export * from "./config.ts";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./errors.js";
2
+ export * from "./primitives.js";
3
+ export * from "./schema.js";
4
+ export * from "./limits.js";
5
+ export * from "./protocol.js";
6
+ export * from "./config.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ConfigIssue, Limits } from "./types.ts";
2
+ /** Starting bounds from the specification; not published capacity claims. */
3
+ export declare const DEFAULT_LIMITS: Readonly<Limits>;
4
+ export declare const LIMIT_KEYS: readonly (keyof Limits)[];
5
+ export declare function resolveLimits(overrides: Partial<Limits> | undefined): Limits;
6
+ /** Validates override values and cross-field consistency of the resolved limits. */
7
+ export declare function validateLimits(input: unknown, path: string, issues: ConfigIssue[]): void;
8
+ //# sourceMappingURL=limits.d.ts.map