@segmentstream/ontology 0.170.1 → 0.170.2
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
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.170.2
|
|
4
|
+
|
|
5
|
+
Workspace apps and ontology services call the production API at segmentstream.com. Existing signed token issuers, OAuth registrations and custom API origins continue to work.
|
|
6
|
+
|
|
3
7
|
## 0.170.1
|
|
4
8
|
|
|
5
9
|
A connection call that names no `api` reaches the connection's `default_api` or, when the
|
|
@@ -6,7 +6,7 @@ import { type DeploymentObservation } from "../deployment.js";
|
|
|
6
6
|
import { type BrowserRevision } from "./federation-status.js";
|
|
7
7
|
import type { WorkloadExecution } from "../runtime/workload.js";
|
|
8
8
|
import type { ChatProvenance, Principal } from "../runtime.js";
|
|
9
|
-
import type
|
|
9
|
+
import { type NeonAuthEnvironment } from "./config.js";
|
|
10
10
|
import { RequestId } from "./errors.js";
|
|
11
11
|
import { CurrentCaller, type VerifiedCaller } from "./caller-context.js";
|
|
12
12
|
import { OntologyBackend, type SignInIdentity } from "./runtime-contract.js";
|
|
@@ -8,6 +8,7 @@ import { previewRunsAgent, requireDeploymentCapability, } from "../deployment.js
|
|
|
8
8
|
import { API_KEY_PREFIX } from "../runtime/principals.js";
|
|
9
9
|
import { FEDERATION_TOKEN_PREFIX, federationDigest } from "../runtime/federation.js";
|
|
10
10
|
import { browserRevisionAdmitted, browserRevisionObservation, browserSessionAdmission, federationStatus, } from "./federation-status.js";
|
|
11
|
+
import { platformTokenIssuer } from "./config.js";
|
|
11
12
|
import { RequestId, crossOriginSession, forbidden, internalError, notInvited, toServerResponse, unauthorized, unavailable, } from "./errors.js";
|
|
12
13
|
import { ACCESS_TOKEN_PREFIX, appSessionResource, publicOrigin, callerOfAccessToken, READ_SCOPE, rejectedAccessToken, scopedPrincipal, } from "./oauth/protocol.js";
|
|
13
14
|
import { CurrentCaller } from "./caller-context.js";
|
|
@@ -71,7 +72,7 @@ function identityFromClaims(config, payload) {
|
|
|
71
72
|
if (!mapping ||
|
|
72
73
|
typeof mapping !== "object" ||
|
|
73
74
|
mapping.issuer !==
|
|
74
|
-
(config.oidc?.issuer ?? `${
|
|
75
|
+
(config.oidc?.issuer ?? `${platformTokenIssuer(config.segmentstreamUrl)}/oidc`) ||
|
|
75
76
|
typeof mapping.subject !== "string" ||
|
|
76
77
|
!mapping.subject) {
|
|
77
78
|
return undefined;
|
|
@@ -91,7 +92,7 @@ function identityFromClaims(config, payload) {
|
|
|
91
92
|
* `SEGMENTSTREAM_URL` for this application (`aud: app:<application id>`), organization and workspace.
|
|
92
93
|
*/
|
|
93
94
|
export function makeTokenVerifier(config, keySet) {
|
|
94
|
-
const issuer =
|
|
95
|
+
const issuer = platformTokenIssuer(config.segmentstreamUrl);
|
|
95
96
|
const audience = `app:${config.applicationId}`;
|
|
96
97
|
return async function verifyToken(token) {
|
|
97
98
|
let payload;
|
|
@@ -151,7 +152,7 @@ export function makeWorkloadTokenVerifier(config, keySet) {
|
|
|
151
152
|
const verified = await jwtVerify(token, keySet, {
|
|
152
153
|
algorithms: ["ES256"],
|
|
153
154
|
typ: WORKLOAD_TOKEN_TYPE,
|
|
154
|
-
issuer:
|
|
155
|
+
issuer: platformTokenIssuer(config.segmentstreamUrl),
|
|
155
156
|
audience: `ontology:${config.applicationId}`,
|
|
156
157
|
clockTolerance: CLOCK_TOLERANCE_SECONDS,
|
|
157
158
|
requiredClaims: [
|
|
@@ -333,7 +334,7 @@ export function tokenVerifier(config) {
|
|
|
333
334
|
}
|
|
334
335
|
};
|
|
335
336
|
const verifiers = new Map([
|
|
336
|
-
[
|
|
337
|
+
[platformTokenIssuer(config.segmentstreamUrl), platform],
|
|
337
338
|
]);
|
|
338
339
|
if (config.neonAuth !== undefined &&
|
|
339
340
|
(!config.browserMethods || config.browserMethods.includes("email"))) {
|
package/dist/service/config.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { PageCatalogV1 } from "../navigation-catalog.js";
|
|
|
9
9
|
import { type ConnectionTransportFactory, type LocalConnectionContext } from "./connections.js";
|
|
10
10
|
import type { OntologyServiceRuntime } from "./runtime-contract.js";
|
|
11
11
|
import type { RuntimeIdentityConfig } from "./runtime-identity.js";
|
|
12
|
+
/** A signed issuer stays stable when the platform API moves. */
|
|
13
|
+
export declare function platformTokenIssuer(apiUrl: string): string;
|
|
12
14
|
/** The environment of the workspace deployment's ontology service. */
|
|
13
15
|
export declare const ENVIRONMENT_VARIABLES: {
|
|
14
16
|
readonly databaseUrl: "SEGMENTSTREAM_ONTOLOGY_DATABASE_URL";
|
package/dist/service/config.js
CHANGED
|
@@ -3,6 +3,14 @@ import { Redacted, Schema } from "effect";
|
|
|
3
3
|
import { BlobStorageBinding } from "../storage/provider.js";
|
|
4
4
|
import { deploymentFromEnv, previewRunsAgent } from "../deployment.js";
|
|
5
5
|
import { LocalConnectionContextError, readLocalConnectionContext, RUNTIME_CONTEXT_FD, } from "./connections.js";
|
|
6
|
+
// @legacy website.cloud-domain-serving
|
|
7
|
+
const productionIssuer = "https://cloud.segmentstream.com";
|
|
8
|
+
const productionApi = "https://segmentstream.com";
|
|
9
|
+
/** A signed issuer stays stable when the platform API moves. */
|
|
10
|
+
export function platformTokenIssuer(apiUrl) {
|
|
11
|
+
const origin = new URL(apiUrl).origin;
|
|
12
|
+
return origin === productionApi ? productionIssuer : origin;
|
|
13
|
+
}
|
|
6
14
|
/** The environment of the workspace deployment's ontology service. */
|
|
7
15
|
export const ENVIRONMENT_VARIABLES = {
|
|
8
16
|
databaseUrl: "SEGMENTSTREAM_ONTOLOGY_DATABASE_URL",
|
|
@@ -190,11 +198,12 @@ export function configFromEnv(environment = process.env) {
|
|
|
190
198
|
}
|
|
191
199
|
}
|
|
192
200
|
const previews = telegramPreviewEnvironment(environment);
|
|
201
|
+
const apiOrigin = normalizeUrl(ENVIRONMENT_VARIABLES.segmentstreamUrl, read(ENVIRONMENT_VARIABLES.segmentstreamUrl));
|
|
193
202
|
return {
|
|
194
203
|
...previews,
|
|
195
204
|
deployment,
|
|
196
205
|
databaseUrl: checkDatabaseUrl(ENVIRONMENT_VARIABLES.databaseUrl, read(ENVIRONMENT_VARIABLES.databaseUrl)),
|
|
197
|
-
segmentstreamUrl:
|
|
206
|
+
segmentstreamUrl: apiOrigin === productionIssuer ? productionApi : apiOrigin,
|
|
198
207
|
applicationId: read(ENVIRONMENT_VARIABLES.applicationId),
|
|
199
208
|
workspaceId: read(ENVIRONMENT_VARIABLES.workspaceId),
|
|
200
209
|
organizationId: read(ENVIRONMENT_VARIABLES.organizationId),
|
package/dist/service/service.js
CHANGED
|
@@ -34,7 +34,7 @@ import { platformWarehouseQueries, WarehouseQueries } from "./warehouse-platform
|
|
|
34
34
|
import { BASE_PATH, ErrorResponsesLive, buildApi } from "./api.js";
|
|
35
35
|
import { CurrentPrincipal, authenticationLayer, neonAuthSessionExchange, tokenVerifier, withPrincipal, } from "./authentication.js";
|
|
36
36
|
import { currentCaller } from "./caller-context.js";
|
|
37
|
-
import { OntologyServiceConfigError, } from "./config.js";
|
|
37
|
+
import { platformTokenIssuer, OntologyServiceConfigError, } from "./config.js";
|
|
38
38
|
import { RequestId, failureResponse, internalError, errorBodyForWire, routeNotFound, toServerResponse, } from "./errors.js";
|
|
39
39
|
import { deployedConnections, localConnections } from "./connections.js";
|
|
40
40
|
import { DocsRoute } from "./docs.js";
|
|
@@ -321,7 +321,7 @@ export function createOntologyService(ontology, config) {
|
|
|
321
321
|
? {
|
|
322
322
|
issuer: config.browserRevisionIssuer ??
|
|
323
323
|
config.oidc?.issuer ??
|
|
324
|
-
`${
|
|
324
|
+
`${platformTokenIssuer(config.segmentstreamUrl)}/oidc`,
|
|
325
325
|
clientId: config.browserRevisionClientId,
|
|
326
326
|
manifestDigest: ontology.manifest.hash,
|
|
327
327
|
...(config.browserEnvironment !== "local" ? { deploymentId: deployment.deploymentId } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.170.
|
|
3
|
+
"version": "0.170.2",
|
|
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",
|