@powerhousedao/switchboard 6.2.3-dev.35 → 6.2.3-dev.37
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/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts +2 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts.map +1 -0
- package/.tsbuild/tsconfig.tsbuildinfo +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/index.mjs +1 -1
- package/dist/{server-CXAp5TOI.mjs → server-D3CYuEka.mjs} +26 -21
- package/dist/server-D3CYuEka.mjs.map +1 -0
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +3 -3
- package/package.json +16 -16
- package/test/attachments/byte-grants.test.ts +4 -1
- package/test/attachments/download-target.test.ts +7 -1
- package/test/attachments/reserve-metadata-parity.test.ts +96 -0
- package/test/attachments/routes-integration.test.ts +1 -0
- package/test/attachments/routes.test.ts +1 -0
- package/dist/server-CXAp5TOI.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 6.2.3-dev.37 (2026-10-01)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 6.2.3-dev.36 (2026-10-01)
|
|
6
|
+
|
|
7
|
+
### 🚀 Features
|
|
8
|
+
|
|
9
|
+
- **switchboard:** pass the attachment provider to host-built subgraphs ([9264687cf6](https://github.com/powerhouse-inc/powerhouse/commit/9264687cf6))
|
|
10
|
+
- **reactor-api:** declare caller-bound attachment types ([d6748866bc](https://github.com/powerhouse-inc/powerhouse/commit/d6748866bc))
|
|
11
|
+
|
|
12
|
+
### 🩹 Fixes
|
|
13
|
+
|
|
14
|
+
- **reactor-attachments:** reject mimeTypes a Content-Type header cannot carry ([2301dbe466](https://github.com/powerhouse-inc/powerhouse/commit/2301dbe466))
|
|
15
|
+
|
|
16
|
+
### ❤️ Thank You
|
|
17
|
+
|
|
18
|
+
- Benjamin Jordan
|
|
19
|
+
- Claude Opus 5.5
|
|
20
|
+
|
|
1
21
|
## 6.2.3-dev.35 (2026-10-01)
|
|
2
22
|
|
|
3
23
|
### 🚀 Features
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="691165f8-a729-5658-bf22-e7b2440e6156")}catch(e){}}();
|
|
4
|
-
import { i as StoredDocumentsRefusedError, r as startSwitchboard, s as parseForcePgVersion } from "./server-
|
|
4
|
+
import { i as StoredDocumentsRefusedError, r as startSwitchboard, s as parseForcePgVersion } from "./server-D3CYuEka.mjs";
|
|
5
5
|
import { metrics } from "@opentelemetry/api";
|
|
6
6
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
7
7
|
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="98e9dab8-b145-5eb1-8457-7a9d38dda98e")}catch(e){}}();
|
|
3
3
|
import { n as addDefaultReactorDrive, r as isPostgresUrl, t as addDefaultDrive } from "./utils-uaBlzyjS.mjs";
|
|
4
4
|
import { createRequire, register } from "node:module";
|
|
5
5
|
import { ReactorInstrumentation } from "@powerhousedao/opentelemetry-instrumentation-reactor";
|
|
@@ -13,7 +13,7 @@ import { AtomicNodeFs } from "@powerhousedao/pglite-fs";
|
|
|
13
13
|
import { ChannelScheme, DriveCollectionId, EventBus, REACTOR_SCHEMA, ReactorBuilder, ReactorClientBuilder, UnsupportedStoredProtocolError, createHybridProjectionCoordinatorFactory, instrumentPgPool, parseDriveUrl, supportsLiveReadModelRegistration } from "@powerhousedao/reactor";
|
|
14
14
|
import { AuthorizationPolicy, BaseSubgraph, ForbiddenError, HttpPackageLoader, ImportPackageLoader, PGLITE_UTC_PARSERS, PackageManagementService, PackagesSubgraph, PrivacyPermissionAdapter, callerSubject, createCanonicalDocumentIdResolver, getUniqueDocumentModels, initializeAndStartAPI, resolveRenownConfig } from "@powerhousedao/reactor-api";
|
|
15
15
|
import { httpsHooksPath } from "@powerhousedao/reactor-api/https-hooks";
|
|
16
|
-
import { AttachmentAlreadyExists, AttachmentNotFound, AttachmentPending, AttachmentReferenceReadModel, AttachmentSchemaCompiler, HashMismatch, InvalidAttachmentRef, ReservationNotFound, SizeMismatch, UploadTooLarge, createRef, createRemoteAttachmentService, parseAttachmentDownloadTarget, parseRef } from "@powerhousedao/reactor-attachments";
|
|
16
|
+
import { AttachmentAlreadyExists, AttachmentNotFound, AttachmentPending, AttachmentReferenceReadModel, AttachmentSchemaCompiler, HashMismatch, InvalidAttachmentMetadata, InvalidAttachmentRef, ReservationNotFound, SizeMismatch, UploadTooLarge, createRef, createRemoteAttachmentService, parseAttachmentDownloadTarget, parseRef, validateReserveMetadata } from "@powerhousedao/reactor-attachments";
|
|
17
17
|
import { createAttachmentClient } from "@powerhousedao/reactor-attachments/client";
|
|
18
18
|
import { DriveNodeView, NodeProcessor, ReactorDriveClient, createReactorDriveResolvers, reactorDriveDocumentModelModule, reactorDriveSubgraphTypeDefs } from "@powerhousedao/reactor-drive";
|
|
19
19
|
import { DEFAULT_KEYPAIR_PATH, DEFAULT_RENOWN_URL, NodeKeyStorage, RENOWN_READ_MODEL_SUBGRAPH, RenownBuilder, RenownCryptoBuilder, createLocalCredentialVerifier, createRenownTrustPolicy, resolveSwitchboardEndpoint } from "@renown/sdk/node";
|
|
@@ -152,10 +152,6 @@ function mountAuthenticatedNodeRoute(api, method, path, handler, options) {
|
|
|
152
152
|
const logger$2 = childLogger(["switchboard", "attachments"]);
|
|
153
153
|
const RETRY_AFTER_SECONDS = 5;
|
|
154
154
|
const HASH_PATTERN = /^[a-f0-9]{64}$/i;
|
|
155
|
-
const CONTROL_CHARS = /[\x00-\x1f\x7f]/;
|
|
156
|
-
const MIME_TYPE_PATTERN = /^[!#$%&'*+\-.^_`|~\w]+\/[!#$%&'*+\-.^_`|~\w]+(?:\s*;\s*[!#$%&'*+\-.^_`|~\w]+=(?:[!#$%&'*+\-.^_`|~\w]+|"(?:[^"\\\r\n]|\\[^\r\n])*"))*$/;
|
|
157
|
-
const MAX_FILENAME_LEN = 255;
|
|
158
|
-
const MAX_MIMETYPE_LEN = 255;
|
|
159
155
|
function sendJson(res, status, body) {
|
|
160
156
|
res.statusCode = status;
|
|
161
157
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -192,27 +188,34 @@ async function readJsonBody(req, body) {
|
|
|
192
188
|
function parseReserveOptions(input) {
|
|
193
189
|
if (input === null || typeof input !== "object") return null;
|
|
194
190
|
const obj = input;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
const { mimeType, fileName } = obj;
|
|
192
|
+
const extension = obj.extension ?? null;
|
|
193
|
+
try {
|
|
194
|
+
validateReserveMetadata({
|
|
195
|
+
mimeType,
|
|
196
|
+
fileName,
|
|
197
|
+
extension
|
|
198
|
+
});
|
|
199
|
+
} catch (err) {
|
|
200
|
+
if (err instanceof InvalidAttachmentMetadata) return null;
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
203
|
+
if (typeof mimeType !== "string" || typeof fileName !== "string") return null;
|
|
204
|
+
if (extension !== null && typeof extension !== "string") return null;
|
|
202
205
|
if (obj.clientHash !== void 0) {
|
|
203
206
|
if (typeof obj.clientHash !== "string" || !HASH_PATTERN.test(obj.clientHash)) return null;
|
|
204
207
|
if (typeof obj.sizeBytes !== "number" || !Number.isInteger(obj.sizeBytes) || obj.sizeBytes <= 0 || !Number.isSafeInteger(obj.sizeBytes)) return null;
|
|
205
208
|
return {
|
|
206
|
-
mimeType
|
|
207
|
-
fileName
|
|
209
|
+
mimeType,
|
|
210
|
+
fileName,
|
|
208
211
|
extension,
|
|
209
212
|
clientHash: obj.clientHash.toLowerCase(),
|
|
210
213
|
sizeBytes: obj.sizeBytes
|
|
211
214
|
};
|
|
212
215
|
}
|
|
213
216
|
return {
|
|
214
|
-
mimeType
|
|
215
|
-
fileName
|
|
217
|
+
mimeType,
|
|
218
|
+
fileName,
|
|
216
219
|
extension
|
|
217
220
|
};
|
|
218
221
|
}
|
|
@@ -2836,7 +2839,8 @@ async function initServer(serverPort, options, renown, renownConfig) {
|
|
|
2836
2839
|
graphqlManager,
|
|
2837
2840
|
syncManager: api.syncManager,
|
|
2838
2841
|
authorizationService: graphqlManager.getAuthorizationService(),
|
|
2839
|
-
path: graphqlManager.getBasePath()
|
|
2842
|
+
path: graphqlManager.getBasePath(),
|
|
2843
|
+
attachments: api.attachmentClientProvider
|
|
2840
2844
|
});
|
|
2841
2845
|
lateSubgraphs.push(graphqlManager.registerSubgraphInstance(workflowSubgraph, "graphql", false).catch((error) => {
|
|
2842
2846
|
logger.error("Failed to register workflow-runtime subgraph: @error", error);
|
|
@@ -2891,7 +2895,8 @@ async function initServer(serverPort, options, renown, renownConfig) {
|
|
|
2891
2895
|
path: graphqlManager.getBasePath(),
|
|
2892
2896
|
authorizationService: graphqlManager.getAuthorizationService(),
|
|
2893
2897
|
packageManagementService,
|
|
2894
|
-
http: graphqlManager.scopeForPackage("@powerhousedao/switchboard")
|
|
2898
|
+
http: graphqlManager.scopeForPackage("@powerhousedao/switchboard"),
|
|
2899
|
+
attachments: api.attachmentClientProvider
|
|
2895
2900
|
});
|
|
2896
2901
|
lateSubgraphs.push(graphqlManager.registerSubgraphInstance(packagesSubgraph, "graphql", false).catch((error) => {
|
|
2897
2902
|
logger.error("Failed to register packages subgraph: @error", error);
|
|
@@ -3032,5 +3037,5 @@ if (import.meta.main) await startSwitchboard({ fatalErrorShutdown: true });
|
|
|
3032
3037
|
//#endregion
|
|
3033
3038
|
export { resolveUnsupportedStoredDocuments as a, StoredDocumentsRefusedError as i, isPortAvailable as n, applySwitchboardReactorDefaults as o, startSwitchboard as r, parseForcePgVersion as s, deriveAttachmentServiceConfig as t };
|
|
3034
3039
|
|
|
3035
|
-
//# sourceMappingURL=server-
|
|
3036
|
-
//# debugId=
|
|
3040
|
+
//# sourceMappingURL=server-D3CYuEka.mjs.map
|
|
3041
|
+
//# debugId=98e9dab8-b145-5eb1-8457-7a9d38dda98e
|