@terreno/api 57.21.0 → 58.0.0-beta.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 +43 -0
- package/README.md +1 -1
- package/biome.jsonc +2 -2
- package/dist/api.d.ts +0 -13
- package/dist/api.js +0 -9
- package/dist/auth.d.ts +3 -2
- package/dist/auth.js +95 -5
- package/dist/authRecovery.d.ts +2 -1
- package/dist/authRecovery.js +35 -17
- package/dist/collectionRegistry.d.ts +3 -4
- package/dist/collectionRegistry.js +0 -1
- package/dist/consentApp.d.ts +1 -1
- package/dist/consentApp.js +58 -2
- package/dist/index.d.ts +4 -5
- package/dist/index.js +8 -20
- package/dist/mcp/adminTracking.js +1 -1
- package/dist/mcp/serviceTokens.d.ts +21 -1
- package/dist/mcp/serviceTokens.js +159 -183
- package/dist/migrations/builtin/mcpServiceTokenStringIds.d.ts +18 -0
- package/dist/migrations/builtin/mcpServiceTokenStringIds.js +67 -0
- package/dist/models/mcpRequestLog.js +1 -1
- package/dist/models/mcpServiceToken.js +36 -4
- package/dist/openApiBuilder.d.ts +4 -0
- package/dist/openApiBuilder.js +2 -0
- package/dist/rbac/realtimeAccess.d.ts +5 -4
- package/dist/rbac/realtimeAccess.js +17 -64
- package/dist/realtime/changeStreamWatcher.d.ts +8 -63
- package/dist/realtime/changeStreamWatcher.js +32 -391
- package/dist/realtime/realtimeApp.d.ts +14 -27
- package/dist/realtime/realtimeApp.js +14 -220
- package/dist/realtime/types.d.ts +0 -64
- package/dist/sync/executors.js +14 -2
- package/dist/sync/socketHandlers.d.ts +1 -1
- package/dist/sync/socketHandlers.js +1 -1
- package/dist/terrenoApp.d.ts +7 -5
- package/dist/terrenoApp.js +18 -14
- package/dist/tests/openApiResponseSchema.d.ts +39 -0
- package/dist/tests/openApiResponseSchema.js +56 -0
- package/dist/tests.d.ts +1 -0
- package/dist/tests.js +4 -1
- package/dist/types/mcpAdmin.d.ts +1 -1
- package/dist/types/mcpServiceToken.d.ts +7 -4
- package/dist/versionCheckPlugin.d.ts +1 -1
- package/dist/versionCheckPlugin.js +25 -2
- package/package.json +10 -6
- package/src/__snapshots__/openApi.test.ts.snap +4986 -2478
- package/src/__snapshots__/openApiBuilder.test.ts.snap +836 -0
- package/src/__tests__/openApiResponseSchema.test.ts +148 -0
- package/src/__tests__/versionCheckPlugin.test.ts +72 -0
- package/src/api.test.ts +9 -7
- package/src/api.ts +0 -24
- package/src/auth.ts +116 -5
- package/src/authOpenApi.test.ts +316 -0
- package/src/authRecovery.ts +47 -19
- package/src/betterAuthOAuthHandoff.test.ts +13 -5
- package/src/collectionRegistry.ts +3 -5
- package/src/consentApp.test.ts +98 -0
- package/src/consentApp.ts +67 -2
- package/src/index.ts +6 -28
- package/src/mcp/actionTools.test.ts +2 -2
- package/src/mcp/adminTracking.ts +1 -1
- package/src/mcp/auth.test.ts +7 -3
- package/src/mcp/oauth.test.ts +12 -12
- package/src/mcp/serviceTokens.sync.test.ts +230 -0
- package/src/mcp/serviceTokens.test.ts +112 -61
- package/src/mcp/serviceTokens.ts +193 -212
- package/src/migrations/builtin/mcpServiceTokenStringIds.test.ts +194 -0
- package/src/migrations/builtin/mcpServiceTokenStringIds.ts +121 -0
- package/src/models/mcpRequestLog.ts +1 -1
- package/src/models/mcpServiceToken.test.ts +52 -5
- package/src/models/mcpServiceToken.ts +51 -14
- package/src/openApiBuilder.test.ts +34 -1
- package/src/openApiBuilder.ts +5 -0
- package/src/rateLimit/rateLimit.test.ts +25 -10
- package/src/rbac/realtimeAccess.test.ts +20 -172
- package/src/rbac/realtimeAccess.ts +17 -82
- package/src/realtime/changeStreamWatcher.ts +43 -506
- package/src/realtime/realtime.test.ts +205 -2545
- package/src/realtime/realtimeApp.ts +16 -295
- package/src/realtime/types.ts +0 -72
- package/src/sync/executors.test.ts +28 -0
- package/src/sync/executors.ts +23 -2
- package/src/sync/socketHandlers.ts +1 -1
- package/src/sync/syncSocket.test.ts +77 -113
- package/src/terrenoApp.mcpServiceTokens.test.ts +14 -6
- package/src/terrenoApp.ts +24 -18
- package/src/tests/openApiResponseSchema.ts +104 -0
- package/src/tests.ts +7 -0
- package/src/types/mcpAdmin.ts +1 -1
- package/src/types/mcpServiceToken.ts +7 -4
- package/src/versionCheckPlugin.ts +41 -2
- package/dist/realtime/deprecation.d.ts +0 -13
- package/dist/realtime/deprecation.js +0 -31
- package/dist/realtime/queryStore.d.ts +0 -37
- package/dist/realtime/queryStore.js +0 -103
- package/dist/realtime/registry.d.ts +0 -15
- package/dist/realtime/registry.js +0 -52
- package/src/realtime/deprecation.test.ts +0 -60
- package/src/realtime/deprecation.ts +0 -33
- package/src/realtime/queryStore.ts +0 -122
- package/src/realtime/registry.ts +0 -84
|
@@ -8,7 +8,7 @@ interface McpServiceTokenMethods {
|
|
|
8
8
|
deleteOne: (this: McpServiceTokenDocument) => Promise<McpServiceTokenDocument>;
|
|
9
9
|
}
|
|
10
10
|
export interface McpServiceTokenStatics extends FindExactlyOnePlugin<McpServiceTokenDocument>, FindOneOrNonePlugin<McpServiceTokenDocument> {
|
|
11
|
-
countActiveForUser: (this: McpServiceTokenModel, userId: mongoose.Types.ObjectId) => Promise<number>;
|
|
11
|
+
countActiveForUser: (this: McpServiceTokenModel, userId: mongoose.Types.ObjectId | string) => Promise<number>;
|
|
12
12
|
issueFor: (this: McpServiceTokenModel, user: {
|
|
13
13
|
_id: {
|
|
14
14
|
toString(): string;
|
|
@@ -30,14 +30,17 @@ export interface McpServiceTokenStatics extends FindExactlyOnePlugin<McpServiceT
|
|
|
30
30
|
_id: {
|
|
31
31
|
toString(): string;
|
|
32
32
|
};
|
|
33
|
-
}, tokenId:
|
|
33
|
+
}, tokenId: string) => Promise<McpServiceTokenDocument | null>;
|
|
34
34
|
verify: (this: McpServiceTokenModel, token: string) => Promise<McpServiceTokenDocument | null>;
|
|
35
35
|
}
|
|
36
36
|
export interface McpServiceTokenModel extends mongoose.Model<McpServiceTokenDocument, object, McpServiceTokenMethods>, McpServiceTokenStatics {
|
|
37
37
|
}
|
|
38
|
-
export interface McpServiceTokenDocument extends mongoose.Document {
|
|
39
|
-
|
|
38
|
+
export interface McpServiceTokenDocument extends mongoose.Document<string> {
|
|
39
|
+
/** UUID for new rows; ObjectId hex for rows migrated by mcp-service-token-string-ids. */
|
|
40
|
+
_id: string;
|
|
40
41
|
created: Date;
|
|
42
|
+
/** Always false: a delete revokes the token instead of tombstoning it. */
|
|
43
|
+
deleted: boolean;
|
|
41
44
|
expiresAt?: Date;
|
|
42
45
|
lastUsedAt?: Date;
|
|
43
46
|
name: string;
|
|
@@ -15,5 +15,5 @@ export interface VersionCheckResponse {
|
|
|
15
15
|
* Compares client build number against admin-configured thresholds per platform.
|
|
16
16
|
*/
|
|
17
17
|
export declare class VersionCheckPlugin implements TerrenoPlugin {
|
|
18
|
-
register(app: express.Application): void;
|
|
18
|
+
register(app: express.Application, openApi?: unknown): void;
|
|
19
19
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VersionCheckPlugin = void 0;
|
|
4
4
|
const api_1 = require("./api");
|
|
5
5
|
const versionConfig_1 = require("./models/versionConfig");
|
|
6
|
+
const openApiBuilder_1 = require("./openApiBuilder");
|
|
6
7
|
const DEFAULT_WARNING_MESSAGE = "A new version is available. Please update for the best experience.";
|
|
7
8
|
const DEFAULT_REQUIRED_MESSAGE = "This version is no longer supported. Please update to continue.";
|
|
8
9
|
const DEFAULT_POLLING_INTERVAL_MINUTES = 1440;
|
|
@@ -11,8 +12,30 @@ const DEFAULT_POLLING_INTERVAL_MINUTES = 1440;
|
|
|
11
12
|
* Compares client build number against admin-configured thresholds per platform.
|
|
12
13
|
*/
|
|
13
14
|
class VersionCheckPlugin {
|
|
14
|
-
register(app) {
|
|
15
|
-
|
|
15
|
+
register(app, openApi) {
|
|
16
|
+
// Documentation only: request validation stays off so unparseable versions still get "ok".
|
|
17
|
+
const versionCheckOpenApi = (0, openApiBuilder_1.createOpenApiBuilder)(openApi ? { openApi: openApi } : {})
|
|
18
|
+
.withTags(["version"])
|
|
19
|
+
.withSummary("Check whether the client build must or should update")
|
|
20
|
+
.withQueryParameter("platform", { enum: ["web", "mobile"], type: "string" }, { description: "Client platform. Any other value is treated as web." })
|
|
21
|
+
.withQueryParameter("version", { type: "integer" }, { description: "Client build number. When missing or not a number, the status is ok." })
|
|
22
|
+
.withResponse(200, {
|
|
23
|
+
message: {
|
|
24
|
+
description: "Message to show when status is warning or required",
|
|
25
|
+
type: "string",
|
|
26
|
+
},
|
|
27
|
+
pollingIntervalMs: {
|
|
28
|
+
description: "How often the client should poll for updates, in milliseconds",
|
|
29
|
+
type: "number",
|
|
30
|
+
},
|
|
31
|
+
requiredVersion: { description: "Minimum supported build number", type: "number" },
|
|
32
|
+
status: { enum: ["ok", "warning", "required"], type: "string" },
|
|
33
|
+
updateUrl: { description: "Where the user can get the update", type: "string" },
|
|
34
|
+
warningVersion: { description: "Builds below this number get a warning", type: "number" },
|
|
35
|
+
}, { required: ["status"] })
|
|
36
|
+
.withValidation({ enabled: false })
|
|
37
|
+
.build();
|
|
38
|
+
app.get("/version-check", versionCheckOpenApi, (0, api_1.asyncHandler)(async (req, res) => {
|
|
16
39
|
const versionParam = req.query.version;
|
|
17
40
|
const platform = req.query.platform;
|
|
18
41
|
let version;
|
package/package.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"url": "https://github.com/TerrenoLabs/terreno/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@asteasolutions/zod-to-openapi": "^
|
|
10
|
+
"@asteasolutions/zod-to-openapi": "^9.1.0",
|
|
11
11
|
"@better-auth/expo": "^1.6.25",
|
|
12
12
|
"@better-auth/passkey": "1.7.4",
|
|
13
13
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
14
14
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
15
|
-
"@sentry/bun": "^
|
|
16
|
-
"@terreno/test": "
|
|
15
|
+
"@sentry/bun": "^11.0.0",
|
|
16
|
+
"@terreno/test": "58.0.0-beta.1",
|
|
17
17
|
"@thream/socketio-jwt": "^3.1.4",
|
|
18
18
|
"@types/qs": "^6.14.0",
|
|
19
19
|
"ajv": "8.20.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"serve-static": "^2.2.1",
|
|
44
44
|
"socket.io": "^4.8.1",
|
|
45
45
|
"swagger-parser": "^10.0.3",
|
|
46
|
-
"swagger-ui-dist": "^5.
|
|
46
|
+
"swagger-ui-dist": "^5.33.0",
|
|
47
47
|
"winston": "^3.18.3",
|
|
48
48
|
"yaml": "^2.4.0"
|
|
49
49
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@biomejs/biome": "^2.3.6",
|
|
53
53
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
54
|
-
"@terreno/syncdb": "
|
|
54
|
+
"@terreno/syncdb": "58.0.0-beta.1",
|
|
55
55
|
"@types/bun": "^1.4.0",
|
|
56
56
|
"@types/cors": "^2.8.17",
|
|
57
57
|
"@types/express": "^5.0.6",
|
|
@@ -80,6 +80,10 @@
|
|
|
80
80
|
"./testing": {
|
|
81
81
|
"default": "./dist/tests.js",
|
|
82
82
|
"types": "./dist/tests.d.ts"
|
|
83
|
+
},
|
|
84
|
+
"./testing/openApi": {
|
|
85
|
+
"default": "./dist/tests/openApiResponseSchema.js",
|
|
86
|
+
"types": "./dist/tests/openApiResponseSchema.d.ts"
|
|
83
87
|
}
|
|
84
88
|
},
|
|
85
89
|
"homepage": "https://github.com/TerrenoLabs/terreno#readme",
|
|
@@ -137,5 +141,5 @@
|
|
|
137
141
|
"updateSnapshot": "bun test --update-snapshots"
|
|
138
142
|
},
|
|
139
143
|
"types": "dist/index.d.ts",
|
|
140
|
-
"version": "
|
|
144
|
+
"version": "58.0.0-beta.1"
|
|
141
145
|
}
|