@segmentstream/ontology 0.170.0 → 0.170.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/CHANGELOG.md +9 -0
- package/dist/connection.d.ts +2 -2
- package/dist/service/connections.js +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.170.1
|
|
4
|
+
|
|
5
|
+
A connection call that names no `api` reaches the connection's `default_api` or, when the
|
|
6
|
+
connection declares exactly one API and no default, that API, as the connections SDK's HTTP
|
|
7
|
+
client already chooses. Calls such as `nowpayments.get("/payment/123")` through a preset with one
|
|
8
|
+
API, such as `NowPaymentsConnection` or `CoinGateConnection`, no longer fail for want of a default.
|
|
9
|
+
Cloud applies the same rule to deployed ontologies without an upgrade; this release brings it to
|
|
10
|
+
local runs.
|
|
11
|
+
|
|
3
12
|
## 0.170.0
|
|
4
13
|
|
|
5
14
|
An `hmac` webhook signature can sign the body as `{ body: "sorted-json" }`: the body parsed as a
|
package/dist/connection.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare class ConnectionError extends ConnectionError_base {
|
|
|
47
47
|
}
|
|
48
48
|
/** One HTTP request through the connection proxy, before it is bound to a connection key. */
|
|
49
49
|
export interface ConnectionCall {
|
|
50
|
-
/** One of the connection's declared APIs;
|
|
50
|
+
/** One of the connection's declared APIs; when omitted, its `default_api`, or its only API. */
|
|
51
51
|
readonly api?: string;
|
|
52
52
|
readonly method: ConnectionMethod;
|
|
53
53
|
/** The path and query, relative to the API's base URL, such as `/people/match?reveal=true`. */
|
|
@@ -121,7 +121,7 @@ export type ConnectionHeaders = Readonly<Record<string, string>> | ReadonlyArray
|
|
|
121
121
|
export type QueryValue = string | number | boolean | ReadonlyArray<string | number | boolean>;
|
|
122
122
|
/** The options of `request` and the method helpers. */
|
|
123
123
|
export interface ConnectionRequestOptions {
|
|
124
|
-
/** One of the connection's declared APIs;
|
|
124
|
+
/** One of the connection's declared APIs; when omitted, its `default_api`, or its only API. */
|
|
125
125
|
readonly api?: string;
|
|
126
126
|
/** Appended to the path as a query string. `undefined` values are skipped. */
|
|
127
127
|
readonly query?: Readonly<Record<string, QueryValue | undefined>>;
|
|
@@ -223,10 +223,12 @@ export function localConnections(context, fetchImpl = fetch) {
|
|
|
223
223
|
if (granted === undefined) {
|
|
224
224
|
return Effect.fail(failure(call.connection, "not_granted", `Run the service with segmentstream exec --connection ${call.connection}.`));
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
// The connection's default API, or its only one, as the connections SDK's client chooses.
|
|
227
|
+
const declared = Object.keys(granted.apis);
|
|
228
|
+
const api = call.api ?? granted.defaultApi ?? (declared.length === 1 ? declared[0] : undefined);
|
|
227
229
|
if (api === undefined || !(api in granted.apis)) {
|
|
228
230
|
return Effect.fail(failure(call.connection, "invalid_request", api === undefined
|
|
229
|
-
? `The connection ${call.connection}
|
|
231
|
+
? `The connection ${call.connection} declares several APIs and no default; set api.`
|
|
230
232
|
: `The connection ${call.connection} declares no API named ${api}.`));
|
|
231
233
|
}
|
|
232
234
|
return Effect.succeed({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.170.
|
|
3
|
+
"version": "0.170.1",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|