@syncular/server 0.1.0 → 0.1.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/dist/auth-leases.js +1 -1
- package/dist/blobs/access.js +1 -1
- package/dist/blobs/index.js +5 -5
- package/dist/cloudflare/index.js +4 -4
- package/dist/commit-integrity.js +1 -1
- package/dist/dialect/base.js +2 -2
- package/dist/dialect/index.js +3 -3
- package/dist/encrypted-crdt.js +2 -2
- package/dist/handlers/create-handler.js +2 -2
- package/dist/handlers/index.js +3 -3
- package/dist/helpers/index.js +6 -6
- package/dist/hono/api-key-auth.js +2 -2
- package/dist/hono/blobs.js +2 -2
- package/dist/hono/console/gateway.js +5 -5
- package/dist/hono/console/routes/api-keys.js +4 -4
- package/dist/hono/console/routes/clients.js +4 -4
- package/dist/hono/console/routes/commits.js +5 -5
- package/dist/hono/console/routes/context.js +4 -4
- package/dist/hono/console/routes/events.js +6 -6
- package/dist/hono/console/routes/maintenance.js +4 -4
- package/dist/hono/console/routes/shared.js +2 -2
- package/dist/hono/console/routes/stats.js +4 -4
- package/dist/hono/console/routes/storage.js +4 -4
- package/dist/hono/console/routes.js +9 -9
- package/dist/hono/create-server.js +3 -3
- package/dist/hono/index.js +13 -13
- package/dist/hono/proxy/index.js +2 -2
- package/dist/hono/proxy/routes.js +2 -2
- package/dist/hono/routes/audit.js +4 -4
- package/dist/hono/routes/auth-leases.js +2 -2
- package/dist/hono/routes/combined.js +3 -3
- package/dist/hono/routes/context.js +7 -7
- package/dist/hono/routes/realtime.js +4 -4
- package/dist/hono/routes/shared.js +2 -2
- package/dist/hono/routes/snapshots.js +3 -3
- package/dist/hono/routes.js +9 -9
- package/dist/index.js +24 -24
- package/dist/notify.js +3 -3
- package/dist/plugins/index.js +1 -1
- package/dist/proxy/handler.js +2 -2
- package/dist/proxy/index.js +3 -3
- package/dist/proxy/oplog.js +3 -3
- package/dist/prune.js +1 -1
- package/dist/pull.js +8 -8
- package/dist/push.js +4 -4
- package/dist/realtime/index.js +2 -2
- package/dist/relay/client-role/index.js +3 -3
- package/dist/relay/evaluation/relay-paths.js +7 -7
- package/dist/relay/index.js +7 -7
- package/dist/relay/relay.js +7 -7
- package/dist/relay/server-role/index.js +2 -2
- package/dist/snapshot-artifacts.js +1 -1
- package/dist/snapshot-chunks/index.js +2 -2
- package/dist/stats.js +1 -1
- package/dist/subscriptions/index.js +2 -2
- package/dist/subscriptions/resolve.js +1 -1
- package/dist/sync.js +1 -1
- package/package.json +4 -4
package/dist/auth-leases.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectScopeVars, SYNC_AUTH_LEASE_ALG_ES256, SYNC_AUTH_LEASE_CODE_EXPIRED, SYNC_AUTH_LEASE_CODE_INVALID, SYNC_AUTH_LEASE_CODE_SCHEMA_MISMATCH, SYNC_AUTH_LEASE_CODE_SCOPE_MISMATCH, SYNC_AUTH_LEASE_CODE_SCOPE_REVOKED, SYNC_AUTH_LEASE_PROTOCOL_VERSION, SYNC_AUTH_LEASE_TYP, SYNC_AUTH_LEASE_VERSION, SyncAuthLeasePayloadSchema, } from '@syncular/core';
|
|
2
2
|
import { sql } from 'kysely';
|
|
3
|
-
import { resolveEffectiveScopesForSubscriptions } from './subscriptions';
|
|
3
|
+
import { resolveEffectiveScopesForSubscriptions } from './subscriptions/index.js';
|
|
4
4
|
const textEncoder = new TextEncoder();
|
|
5
5
|
const textDecoder = new TextDecoder();
|
|
6
6
|
export async function issueAuthLease(options) {
|
package/dist/blobs/access.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectScopeVars } from '@syncular/core';
|
|
2
2
|
import { sql } from 'kysely';
|
|
3
|
-
import { rowScopesAllowed } from '../helpers/scope-authorization';
|
|
3
|
+
import { rowScopesAllowed } from '../helpers/scope-authorization.js';
|
|
4
4
|
export function createScopedBlobAccessChecker(options) {
|
|
5
5
|
const handlersByTable = new Map(options.handlers.map((handler) => [handler.table, handler]));
|
|
6
6
|
const candidateLimit = options.candidateLimit ?? 100;
|
package/dist/blobs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @syncular/server - Blob storage exports
|
|
3
3
|
*/
|
|
4
|
-
export * from './access';
|
|
5
|
-
export * from './adapters/database';
|
|
6
|
-
export * from './manager';
|
|
7
|
-
export * from './migrate';
|
|
8
|
-
export * from './types';
|
|
4
|
+
export * from './access.js';
|
|
5
|
+
export * from './adapters/database.js';
|
|
6
|
+
export * from './manager.js';
|
|
7
|
+
export * from './migrate.js';
|
|
8
|
+
export * from './types.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/cloudflare/index.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* - D1 + SQLite: `@syncular/server/d1` + `@syncular/server/sqlite`
|
|
16
16
|
* - Neon + Postgres: `@syncular/server/neon` + `createNeonServerDialect()` from `@syncular/server/postgres`
|
|
17
17
|
*/
|
|
18
|
-
export * from './durable-object';
|
|
19
|
-
export * from './r2';
|
|
20
|
-
export * from './scope-cache';
|
|
21
|
-
export * from './worker';
|
|
18
|
+
export * from './durable-object.js';
|
|
19
|
+
export * from './r2.js';
|
|
20
|
+
export * from './scope-cache.js';
|
|
21
|
+
export * from './worker.js';
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/dist/commit-integrity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sha256Hex, } from '@syncular/core';
|
|
2
2
|
import { sql } from 'kysely';
|
|
3
|
-
import { coerceIsoString, coerceNumber, parseJsonValue, } from './dialect/helpers';
|
|
3
|
+
import { coerceIsoString, coerceNumber, parseJsonValue, } from './dialect/helpers.js';
|
|
4
4
|
export const SYNCULAR_COMMIT_DIGEST_VERSION = 'syncular-commit-digest-v1';
|
|
5
5
|
export const SYNCULAR_COMMIT_CHAIN_ROOT_VERSION = 'syncular-commit-chain-root-v1';
|
|
6
6
|
export const SYNCULAR_WIRE_COMMIT_DIGEST_VERSION = 'syncular-wire-commit-digest-v1';
|
package/dist/dialect/base.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* database-specific sync dialect implementations.
|
|
6
6
|
*/
|
|
7
7
|
import { sql } from 'kysely';
|
|
8
|
-
import { scopeKeysFromScopeValues } from '../helpers/scope-commit-index';
|
|
9
|
-
import { coerceIsoString, coerceNumber, parseScopes } from './helpers';
|
|
8
|
+
import { scopeKeysFromScopeValues } from '../helpers/scope-commit-index.js';
|
|
9
|
+
import { coerceIsoString, coerceNumber, parseScopes } from './helpers.js';
|
|
10
10
|
/**
|
|
11
11
|
* Abstract base class for server sync dialects.
|
|
12
12
|
*
|
package/dist/dialect/index.js
CHANGED
package/dist/encrypted-crdt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BinarySnapshotTableWriter, collectScopeVars } from '@syncular/core';
|
|
2
2
|
import { sql } from 'kysely';
|
|
3
|
-
import { parseScopes } from './dialect/helpers';
|
|
4
|
-
import { rowScopesAllowed } from './helpers/scope-authorization';
|
|
3
|
+
import { parseScopes } from './dialect/helpers.js';
|
|
4
|
+
import { rowScopesAllowed } from './helpers/scope-authorization.js';
|
|
5
5
|
export const SYNC_CRDT_UPDATES_TABLE = 'sync_crdt_updates';
|
|
6
6
|
export const SYNC_CRDT_CHECKPOINTS_TABLE = 'sync_crdt_checkpoints';
|
|
7
7
|
const CRDT_UPDATE_BINARY_COLUMNS = [
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { applyCodecsFromDbRow, applyCodecsToDbRow, createSingleVariableScopeMetadata, createTableColumnCodecsResolver, toTableColumnCodecs, } from '@syncular/core';
|
|
5
5
|
import { sql } from 'kysely';
|
|
6
|
-
import { coerceNumber } from '../dialect/helpers';
|
|
7
|
-
import { rowScopesAllowed } from '../helpers/scope-authorization';
|
|
6
|
+
import { coerceNumber } from '../dialect/helpers.js';
|
|
7
|
+
import { rowScopesAllowed } from '../helpers/scope-authorization.js';
|
|
8
8
|
function classifyConstraintViolationCode(_message) {
|
|
9
9
|
return 'sync.constraint_violation';
|
|
10
10
|
}
|
package/dist/handlers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './collection';
|
|
2
|
-
export * from './create-handler';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './collection.js';
|
|
2
|
+
export * from './create-handler.js';
|
|
3
|
+
export * from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/helpers/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Convenience helpers for implementing server table handlers.
|
|
5
5
|
*/
|
|
6
|
-
export * from './conflict';
|
|
7
|
-
export * from './emitted-change';
|
|
8
|
-
export * from './paginate';
|
|
9
|
-
export * from './scope-authorization';
|
|
10
|
-
export * from './scope-commit-index';
|
|
11
|
-
export * from './scope-strings';
|
|
6
|
+
export * from './conflict.js';
|
|
7
|
+
export * from './emitted-change.js';
|
|
8
|
+
export * from './paginate.js';
|
|
9
|
+
export * from './scope-authorization.js';
|
|
10
|
+
export * from './scope-commit-index.js';
|
|
11
|
+
export * from './scope-strings.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { sha256Hex } from '@syncular/core';
|
|
7
7
|
import { sql } from 'kysely';
|
|
8
|
-
import { ApiKeyTypeSchema } from './console/schemas';
|
|
9
|
-
import { syncError } from './errors';
|
|
8
|
+
import { ApiKeyTypeSchema } from './console/schemas.js';
|
|
9
|
+
import { syncError } from './errors.js';
|
|
10
10
|
/**
|
|
11
11
|
* Validates an API key from Authorization header.
|
|
12
12
|
* Updates last_used_at on successful validation.
|
package/dist/hono/blobs.js
CHANGED
|
@@ -13,8 +13,8 @@ import { readBlobFromDatabase, storeBlobInDatabase, } from '@syncular/server';
|
|
|
13
13
|
import { Hono } from 'hono';
|
|
14
14
|
import { describeRoute, resolver } from 'hono-openapi';
|
|
15
15
|
import { z } from 'zod';
|
|
16
|
-
import { syncError } from './errors';
|
|
17
|
-
import { blobValidator as zValidator } from './validation';
|
|
16
|
+
import { syncError } from './errors.js';
|
|
17
|
+
import { blobValidator as zValidator } from './validation.js';
|
|
18
18
|
const hashParamsSchema = z.object({
|
|
19
19
|
hash: z.string().min(1),
|
|
20
20
|
});
|
|
@@ -3,11 +3,11 @@ import { Hono } from 'hono';
|
|
|
3
3
|
import { cors } from 'hono/cors';
|
|
4
4
|
import { resolver } from 'hono-openapi';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { consoleValidator as zValidator } from '../validation';
|
|
7
|
-
import { isWebSocketOriginAllowed } from '../websocket-origin';
|
|
8
|
-
import { closeUnauthenticatedSocket, parseBearerToken, parseWebSocketAuthToken, } from './live-auth';
|
|
9
|
-
import { describeConsoleGatewayRoute } from './route-descriptor';
|
|
10
|
-
import { ApiKeyTypeSchema, ConsoleApiKeyBulkRevokeRequestSchema, ConsoleApiKeyBulkRevokeResponseSchema, ConsoleApiKeyCreateRequestSchema, ConsoleApiKeyCreateResponseSchema, ConsoleApiKeyRevokeResponseSchema, ConsoleApiKeySchema, ConsoleClearEventsResultSchema, ConsoleClientSchema, ConsoleCommitDetailSchema, ConsoleCommitListItemSchema, ConsoleCompactResultSchema, ConsoleEvictResultSchema, ConsoleHandlerSchema, ConsoleOperationEventSchema, ConsoleOperationsQuerySchema, ConsolePaginatedResponseSchema, ConsolePaginationQuerySchema, ConsolePartitionedPaginationQuerySchema, ConsolePartitionQuerySchema, ConsolePruneEventsResultSchema, ConsolePrunePreviewSchema, ConsolePruneResultSchema, ConsoleRequestEventSchema, ConsoleRequestPayloadSchema, ConsoleTimelineItemSchema, ConsoleTimelineQuerySchema, LatencyQuerySchema, LatencyStatsResponseSchema, SyncStatsSchema, TimeseriesQuerySchema, TimeseriesStatsResponseSchema, } from './schemas';
|
|
6
|
+
import { consoleValidator as zValidator } from '../validation.js';
|
|
7
|
+
import { isWebSocketOriginAllowed } from '../websocket-origin.js';
|
|
8
|
+
import { closeUnauthenticatedSocket, parseBearerToken, parseWebSocketAuthToken, } from './live-auth.js';
|
|
9
|
+
import { describeConsoleGatewayRoute } from './route-descriptor.js';
|
|
10
|
+
import { ApiKeyTypeSchema, ConsoleApiKeyBulkRevokeRequestSchema, ConsoleApiKeyBulkRevokeResponseSchema, ConsoleApiKeyCreateRequestSchema, ConsoleApiKeyCreateResponseSchema, ConsoleApiKeyRevokeResponseSchema, ConsoleApiKeySchema, ConsoleClearEventsResultSchema, ConsoleClientSchema, ConsoleCommitDetailSchema, ConsoleCommitListItemSchema, ConsoleCompactResultSchema, ConsoleEvictResultSchema, ConsoleHandlerSchema, ConsoleOperationEventSchema, ConsoleOperationsQuerySchema, ConsolePaginatedResponseSchema, ConsolePaginationQuerySchema, ConsolePartitionedPaginationQuerySchema, ConsolePartitionQuerySchema, ConsolePruneEventsResultSchema, ConsolePrunePreviewSchema, ConsolePruneResultSchema, ConsoleRequestEventSchema, ConsoleRequestPayloadSchema, ConsoleTimelineItemSchema, ConsoleTimelineQuerySchema, LatencyQuerySchema, LatencyStatsResponseSchema, SyncStatsSchema, TimeseriesQuerySchema, TimeseriesStatsResponseSchema, } from './schemas.js';
|
|
11
11
|
function consoleGatewayError(c, status, code, options = {}) {
|
|
12
12
|
return c.json(createSyncularErrorResponse(code, options), status);
|
|
13
13
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { ErrorResponseSchema, logSyncEvent } from '@syncular/core';
|
|
7
7
|
import { coerceNumber } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
10
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
11
|
-
import { ConsoleApiKeyBulkRevokeRequestSchema, ConsoleApiKeyBulkRevokeResponseSchema, ConsoleApiKeyCreateRequestSchema, ConsoleApiKeyCreateResponseSchema, ConsoleApiKeyRevokeResponseSchema, ConsoleApiKeySchema, ConsolePaginatedResponseSchema, } from '../schemas';
|
|
12
|
-
import { apiKeyIdParamSchema, apiKeysQuerySchema, consoleNotFound, consoleRouteError, generateKeyId, generateSecretKey, hashApiKey, } from './shared';
|
|
9
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
10
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
11
|
+
import { ConsoleApiKeyBulkRevokeRequestSchema, ConsoleApiKeyBulkRevokeResponseSchema, ConsoleApiKeyCreateRequestSchema, ConsoleApiKeyCreateResponseSchema, ConsoleApiKeyRevokeResponseSchema, ConsoleApiKeySchema, ConsolePaginatedResponseSchema, } from '../schemas.js';
|
|
12
|
+
import { apiKeyIdParamSchema, apiKeysQuerySchema, consoleNotFound, consoleRouteError, generateKeyId, generateSecretKey, hashApiKey, } from './shared.js';
|
|
13
13
|
export function registerApiKeyRoutes(ctx) {
|
|
14
14
|
const { routes, options, db } = ctx;
|
|
15
15
|
// -------------------------------------------------------------------------
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { ErrorResponseSchema } from '@syncular/core';
|
|
7
7
|
import { coerceNumber } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
10
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
11
|
-
import { ConsoleClientDiagnosticIngestSchema, ConsoleClientDiagnosticRecordSchema, ConsoleClientSchema, ConsolePaginatedResponseSchema, ConsolePartitionedPaginationQuerySchema, } from '../schemas';
|
|
12
|
-
import { buildClientDiagnosticRecord, clientDiagnosticDetailQuerySchema, clientDiagnosticHistoryQuerySchema, clientDiagnosticsQuerySchema, clientIdParamSchema, consoleNotFound, consoleRouteError, DEFAULT_CLIENT_DIAGNOSTICS_MAX_JSON_BYTES, findSensitiveDiagnosticField, getClientActivityState, jsonByteLength, normalizeRequestEventType, } from './shared';
|
|
9
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
10
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
11
|
+
import { ConsoleClientDiagnosticIngestSchema, ConsoleClientDiagnosticRecordSchema, ConsoleClientSchema, ConsolePaginatedResponseSchema, ConsolePartitionedPaginationQuerySchema, } from '../schemas.js';
|
|
12
|
+
import { buildClientDiagnosticRecord, clientDiagnosticDetailQuerySchema, clientDiagnosticHistoryQuerySchema, clientDiagnosticsQuerySchema, clientIdParamSchema, consoleNotFound, consoleRouteError, DEFAULT_CLIENT_DIAGNOSTICS_MAX_JSON_BYTES, findSensitiveDiagnosticField, getClientActivityState, jsonByteLength, normalizeRequestEventType, } from './shared.js';
|
|
13
13
|
export function registerClientRoutes(ctx) {
|
|
14
14
|
const { routes, options, db, readClientDiagnosticRecords, writeClientDiagnosticRecord, pruneClientDiagnosticRecordsByCount, } = ctx;
|
|
15
15
|
// -------------------------------------------------------------------------
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import { ErrorResponseSchema } from '@syncular/core';
|
|
7
7
|
import { coerceNumber } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
|
-
import { summarizeAuditChange } from '../../audit-redaction';
|
|
10
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
11
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
12
|
-
import { ConsoleCommitDetailSchema, ConsoleCommitListItemSchema, ConsoleDebugExportResponseSchema, ConsolePaginatedResponseSchema, ConsolePartitionedPaginationQuerySchema, ConsoleRowHistoryResponseSchema, ConsoleRowInvestigationResponseSchema, ConsoleTimelineItemSchema, ConsoleTimelineQuerySchema, } from '../schemas';
|
|
13
|
-
import { assessScopeEligibility, commitDetailQuerySchema, commitSeqParamSchema, consoleNotFound, debugExportQuerySchema, includesSearchTerm, parseDate, parseJsonStringArray, rowHistoryParamSchema, rowHistoryQuerySchema, rowInvestigationQuerySchema, summarizeRealtimeEvidence, summarizeRequestEvidence, summarizeSnapshotEvidence, summarizeSubscriptionEvidence, } from './shared';
|
|
9
|
+
import { summarizeAuditChange } from '../../audit-redaction.js';
|
|
10
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
11
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
12
|
+
import { ConsoleCommitDetailSchema, ConsoleCommitListItemSchema, ConsoleDebugExportResponseSchema, ConsolePaginatedResponseSchema, ConsolePartitionedPaginationQuerySchema, ConsoleRowHistoryResponseSchema, ConsoleRowInvestigationResponseSchema, ConsoleTimelineItemSchema, ConsoleTimelineQuerySchema, } from '../schemas.js';
|
|
13
|
+
import { assessScopeEligibility, commitDetailQuerySchema, commitSeqParamSchema, consoleNotFound, debugExportQuerySchema, includesSearchTerm, parseDate, parseJsonStringArray, rowHistoryParamSchema, rowHistoryQuerySchema, rowInvestigationQuerySchema, summarizeRealtimeEvidence, summarizeRequestEvidence, summarizeSnapshotEvidence, summarizeSubscriptionEvidence, } from './shared.js';
|
|
14
14
|
export function registerCommitRoutes(ctx) {
|
|
15
15
|
const { routes, options, db, timelineScanMaxRows, requestEventSelectColumns, mapRequestEvent, mapDebugExportEvent, readRedactedCommitChanges, } = ctx;
|
|
16
16
|
// -------------------------------------------------------------------------
|
|
@@ -11,10 +11,10 @@ import { createSyncularErrorResponse, logSyncEvent } from '@syncular/core';
|
|
|
11
11
|
import { coerceNumber, parseJsonValue, toDialectJsonValue, } from '@syncular/server';
|
|
12
12
|
import { Hono } from 'hono';
|
|
13
13
|
import { cors } from 'hono/cors';
|
|
14
|
-
import { summarizeAuditChange } from '../../audit-redaction';
|
|
15
|
-
import { isBenignConsoleSchemaError } from '../schema-errors';
|
|
16
|
-
import { ConsoleClientDiagnosticRecordSchema, } from '../schemas';
|
|
17
|
-
import { clientDiagnosticStoreKey, consoleRouteError, DEFAULT_AUTO_EVENTS_PRUNE_INTERVAL_MS, DEFAULT_CLIENT_DIAGNOSTICS_MAX_RECORDS, DEFAULT_OPERATION_EVENTS_MAX_AGE_MS, DEFAULT_OPERATION_EVENTS_MAX_ROWS, DEFAULT_REQUEST_EVENTS_MAX_AGE_MS, DEFAULT_REQUEST_EVENTS_MAX_ROWS, DEFAULT_TIMELINE_SCAN_MAX_ROWS, normalizeRequestEventType, parseResponseSummary, parseScopesSummary, readNonNegativeInteger, readStringProperty, } from './shared';
|
|
14
|
+
import { summarizeAuditChange } from '../../audit-redaction.js';
|
|
15
|
+
import { isBenignConsoleSchemaError } from '../schema-errors.js';
|
|
16
|
+
import { ConsoleClientDiagnosticRecordSchema, } from '../schemas.js';
|
|
17
|
+
import { clientDiagnosticStoreKey, consoleRouteError, DEFAULT_AUTO_EVENTS_PRUNE_INTERVAL_MS, DEFAULT_CLIENT_DIAGNOSTICS_MAX_RECORDS, DEFAULT_OPERATION_EVENTS_MAX_AGE_MS, DEFAULT_OPERATION_EVENTS_MAX_ROWS, DEFAULT_REQUEST_EVENTS_MAX_AGE_MS, DEFAULT_REQUEST_EVENTS_MAX_ROWS, DEFAULT_TIMELINE_SCAN_MAX_ROWS, normalizeRequestEventType, parseResponseSummary, parseScopesSummary, readNonNegativeInteger, readStringProperty, } from './shared.js';
|
|
18
18
|
export function createConsoleRoutesContext(options) {
|
|
19
19
|
const routes = new Hono();
|
|
20
20
|
routes.onError((error, context) => {
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
import { createSyncularErrorResponse, ErrorResponseSchema, logSyncEvent, } from '@syncular/core';
|
|
7
7
|
import { coerceNumber, parseJsonValue } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
10
|
-
import { isWebSocketOriginAllowed } from '../../websocket-origin';
|
|
11
|
-
import { closeUnauthenticatedSocket, parseWebSocketAuthToken, } from '../live-auth';
|
|
12
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
13
|
-
import { ConsoleClearEventsResultSchema, ConsolePaginatedResponseSchema, ConsolePruneEventsResultSchema, ConsoleRequestEventSchema, ConsoleRequestPayloadSchema, } from '../schemas';
|
|
14
|
-
import { consoleNotFound, eventDetailQuerySchema, eventIdParamSchema, eventsQuerySchema, measureWebSocketMessageBytes, } from './shared';
|
|
9
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
10
|
+
import { isWebSocketOriginAllowed } from '../../websocket-origin.js';
|
|
11
|
+
import { closeUnauthenticatedSocket, parseWebSocketAuthToken, } from '../live-auth.js';
|
|
12
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
13
|
+
import { ConsoleClearEventsResultSchema, ConsolePaginatedResponseSchema, ConsolePruneEventsResultSchema, ConsoleRequestEventSchema, ConsoleRequestPayloadSchema, } from '../schemas.js';
|
|
14
|
+
import { consoleNotFound, eventDetailQuerySchema, eventIdParamSchema, eventsQuerySchema, measureWebSocketMessageBytes, } from './shared.js';
|
|
15
15
|
export function registerEventRoutes(ctx) {
|
|
16
16
|
const { routes, options, db, requestEventSelectColumns, mapRequestEvent, deleteUnreferencedPayloadSnapshots, runEventsPrune, } = ctx;
|
|
17
17
|
// -------------------------------------------------------------------------
|
|
@@ -7,10 +7,10 @@ import { ErrorResponseSchema, logSyncEvent } from '@syncular/core';
|
|
|
7
7
|
import { coerceNumber, compactChanges, notifyExternalDataChange, previewPruneSync, pruneSync, } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
11
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
12
|
-
import { ConsoleCompactResultSchema, ConsoleEvictResultSchema, ConsoleOperationEventSchema, ConsoleOperationsQuerySchema, ConsolePaginatedResponseSchema, ConsolePrunePreviewSchema, ConsolePruneResultSchema, } from '../schemas';
|
|
13
|
-
import { clientIdParamSchema, evictClientQuerySchema, handlersResponseSchema, } from './shared';
|
|
10
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
11
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
12
|
+
import { ConsoleCompactResultSchema, ConsoleEvictResultSchema, ConsoleOperationEventSchema, ConsoleOperationsQuerySchema, ConsolePaginatedResponseSchema, ConsolePrunePreviewSchema, ConsolePruneResultSchema, } from '../schemas.js';
|
|
13
|
+
import { clientIdParamSchema, evictClientQuerySchema, handlersResponseSchema, } from './shared.js';
|
|
14
14
|
export function registerMaintenanceRoutes(ctx) {
|
|
15
15
|
const { routes, options, db, operationEventSelectColumns, mapOperationEvent, recordOperationEvent, } = ctx;
|
|
16
16
|
// -------------------------------------------------------------------------
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { createSyncularErrorResponse, sha256Hex, } from '@syncular/core';
|
|
7
7
|
import { coerceNumber, parseJsonValue } from '@syncular/server';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { ApiKeyTypeSchema, ConsoleHandlerSchema, ConsolePaginationQuerySchema, ConsolePartitionedPaginationQuerySchema, ConsolePartitionQuerySchema, } from '../schemas';
|
|
9
|
+
import { ApiKeyTypeSchema, ConsoleHandlerSchema, ConsolePaginationQuerySchema, ConsolePartitionedPaginationQuerySchema, ConsolePartitionQuerySchema, } from '../schemas.js';
|
|
10
10
|
export function parseDate(value) {
|
|
11
11
|
if (!value)
|
|
12
12
|
return null;
|
|
@@ -26,7 +26,7 @@ export function parseJsonStringArray(value) {
|
|
|
26
26
|
return [];
|
|
27
27
|
return parsed.filter((entry) => typeof entry === 'string');
|
|
28
28
|
}
|
|
29
|
-
export { parseScopesSummary } from '../../routes/shared';
|
|
29
|
+
export { parseScopesSummary } from '../../routes/shared.js';
|
|
30
30
|
export function parseResponseSummary(value) {
|
|
31
31
|
const parsed = parseJsonValue(value);
|
|
32
32
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
@@ -7,10 +7,10 @@ import { ErrorResponseSchema, logSyncEvent } from '@syncular/core';
|
|
|
7
7
|
import { coerceNumber, readSyncStats } from '@syncular/server';
|
|
8
8
|
import { resolver } from 'hono-openapi';
|
|
9
9
|
import { sql } from 'kysely';
|
|
10
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
11
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
12
|
-
import { ConsolePartitionQuerySchema, LatencyQuerySchema, LatencyStatsResponseSchema, SyncStatsSchema, TimeseriesQuerySchema, TimeseriesStatsResponseSchema, } from '../schemas';
|
|
13
|
-
import { calculatePercentiles, createEmptyTimeseriesAccumulator, createTimeseriesBucketMap, finalizeTimeseriesBuckets, intervalToMs, intervalToSqliteBucketFormat, normalizeBucketTimestamp, normalizeRequestEventType, parseDate, rangeToMs, } from './shared';
|
|
10
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
11
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
12
|
+
import { ConsolePartitionQuerySchema, LatencyQuerySchema, LatencyStatsResponseSchema, SyncStatsSchema, TimeseriesQuerySchema, TimeseriesStatsResponseSchema, } from '../schemas.js';
|
|
13
|
+
import { calculatePercentiles, createEmptyTimeseriesAccumulator, createTimeseriesBucketMap, finalizeTimeseriesBuckets, intervalToMs, intervalToSqliteBucketFormat, normalizeBucketTimestamp, normalizeRequestEventType, parseDate, rangeToMs, } from './shared.js';
|
|
14
14
|
export function registerStatsRoutes(ctx) {
|
|
15
15
|
const { routes, options, db, shouldUseRawMetrics } = ctx;
|
|
16
16
|
// -------------------------------------------------------------------------
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ErrorResponseSchema } from '@syncular/core';
|
|
7
7
|
import { resolver } from 'hono-openapi';
|
|
8
|
-
import { consoleValidator as zValidator } from '../../validation';
|
|
9
|
-
import { describeConsoleRoute } from '../route-descriptor';
|
|
10
|
-
import { ConsoleBlobDeleteResponseSchema, ConsoleBlobListQuerySchema, ConsoleBlobListResponseSchema, } from '../schemas';
|
|
11
|
-
import { blobStorageNotConfigured, consoleRouteError } from './shared';
|
|
8
|
+
import { consoleValidator as zValidator } from '../../validation.js';
|
|
9
|
+
import { describeConsoleRoute } from '../route-descriptor.js';
|
|
10
|
+
import { ConsoleBlobDeleteResponseSchema, ConsoleBlobListQuerySchema, ConsoleBlobListResponseSchema, } from '../schemas.js';
|
|
11
|
+
import { blobStorageNotConfigured, consoleRouteError } from './shared.js';
|
|
12
12
|
export function registerStorageRoutes(ctx) {
|
|
13
13
|
const { routes, options } = ctx;
|
|
14
14
|
// Storage endpoints
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
* - POST /compact - Trigger compaction
|
|
15
15
|
* - DELETE /clients/:id - Evict client
|
|
16
16
|
*/
|
|
17
|
-
import { parseBearerToken } from './live-auth';
|
|
18
|
-
import { registerApiKeyRoutes } from './routes/api-keys';
|
|
19
|
-
import { registerClientRoutes } from './routes/clients';
|
|
20
|
-
import { registerCommitRoutes } from './routes/commits';
|
|
21
|
-
import { createConsoleRoutesContext } from './routes/context';
|
|
22
|
-
import { registerEventRoutes } from './routes/events';
|
|
23
|
-
import { registerMaintenanceRoutes } from './routes/maintenance';
|
|
24
|
-
import { registerStatsRoutes } from './routes/stats';
|
|
25
|
-
import { registerStorageRoutes } from './routes/storage';
|
|
17
|
+
import { parseBearerToken } from './live-auth.js';
|
|
18
|
+
import { registerApiKeyRoutes } from './routes/api-keys.js';
|
|
19
|
+
import { registerClientRoutes } from './routes/clients.js';
|
|
20
|
+
import { registerCommitRoutes } from './routes/commits.js';
|
|
21
|
+
import { createConsoleRoutesContext } from './routes/context.js';
|
|
22
|
+
import { registerEventRoutes } from './routes/events.js';
|
|
23
|
+
import { registerMaintenanceRoutes } from './routes/maintenance.js';
|
|
24
|
+
import { registerStatsRoutes } from './routes/stats.js';
|
|
25
|
+
import { registerStorageRoutes } from './routes/storage.js';
|
|
26
26
|
/**
|
|
27
27
|
* Create a simple console event emitter for broadcasting live events.
|
|
28
28
|
*/
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* - sync contract instead of top-level handlers/authenticate
|
|
6
6
|
* - Combined sync + console routes in one call
|
|
7
7
|
*/
|
|
8
|
-
import { createConsoleEventEmitter, createConsoleRoutes, createTokenAuthenticator, } from './console/routes';
|
|
9
|
-
import { isBenignConsoleSchemaError } from './console/schema-errors';
|
|
10
|
-
import { createSyncRoutes, getSyncWebSocketConnectionManager, normalizeSyncCorsConfig, } from './routes';
|
|
8
|
+
import { createConsoleEventEmitter, createConsoleRoutes, createTokenAuthenticator, } from './console/routes.js';
|
|
9
|
+
import { isBenignConsoleSchemaError } from './console/schema-errors.js';
|
|
10
|
+
import { createSyncRoutes, getSyncWebSocketConnectionManager, normalizeSyncCorsConfig, } from './routes.js';
|
|
11
11
|
export function resolveDefaultWebSocketAllowedOrigins(routes) {
|
|
12
12
|
return (routes?.websocket?.allowedOrigins ??
|
|
13
13
|
normalizeSyncCorsConfig(routes?.cors)?.staticAllowedOrigins);
|
package/dist/hono/index.js
CHANGED
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
* imports live behind this opt-in subpath.
|
|
6
6
|
*/
|
|
7
7
|
// API Key Auth
|
|
8
|
-
export * from './api-key-auth';
|
|
8
|
+
export * from './api-key-auth.js';
|
|
9
9
|
// Blob routes
|
|
10
|
-
export { createBlobRoutes } from './blobs';
|
|
10
|
+
export { createBlobRoutes } from './blobs.js';
|
|
11
11
|
// Console API and live gateway. Console UI mounting lives in ./console/ui and
|
|
12
12
|
// intentionally is not re-exported here because it requires @syncular/console.
|
|
13
|
-
export * from './console/gateway';
|
|
14
|
-
export * from './console/routes';
|
|
15
|
-
export * from './console/schemas';
|
|
16
|
-
export * from './console/types';
|
|
13
|
+
export * from './console/gateway.js';
|
|
14
|
+
export * from './console/routes.js';
|
|
15
|
+
export * from './console/schemas.js';
|
|
16
|
+
export * from './console/types.js';
|
|
17
17
|
// Simplified server factory
|
|
18
|
-
export { createSyncServer, } from './create-server';
|
|
18
|
+
export { createSyncServer, } from './create-server.js';
|
|
19
19
|
// OpenAPI utilities
|
|
20
|
-
export * from './openapi';
|
|
20
|
+
export * from './openapi.js';
|
|
21
21
|
// Proxy
|
|
22
|
-
export * from './proxy';
|
|
22
|
+
export * from './proxy/index.js';
|
|
23
23
|
// Rate limiting
|
|
24
|
-
export * from './rate-limit';
|
|
24
|
+
export * from './rate-limit.js';
|
|
25
25
|
// Realtime binary sync-pack helpers
|
|
26
|
-
export * from './realtime-sync-packs';
|
|
26
|
+
export * from './realtime-sync-packs.js';
|
|
27
27
|
// Route types and factory
|
|
28
|
-
export { createSyncRoutes, getSyncRealtimeUnsubscribe, getSyncWebSocketConnectionManager, normalizeSyncCorsConfig, } from './routes';
|
|
28
|
+
export { createSyncRoutes, getSyncRealtimeUnsubscribe, getSyncWebSocketConnectionManager, normalizeSyncCorsConfig, } from './routes.js';
|
|
29
29
|
// WebSocket helpers for realtime sync
|
|
30
|
-
export * from './ws';
|
|
30
|
+
export * from './ws.js';
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
package/dist/hono/proxy/index.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { createSyncularErrorResponse, logSyncEvent } from '@syncular/core';
|
|
7
7
|
import { Hono } from 'hono';
|
|
8
|
-
import { isWebSocketOriginAllowed } from '../websocket-origin';
|
|
9
|
-
import { ProxyConnectionManager } from './connection-manager';
|
|
8
|
+
import { isWebSocketOriginAllowed } from '../websocket-origin.js';
|
|
9
|
+
import { ProxyConnectionManager } from './connection-manager.js';
|
|
10
10
|
const proxyConnectionManagerMap = new WeakMap();
|
|
11
11
|
/**
|
|
12
12
|
* Create Hono routes for the proxy WebSocket endpoint.
|
|
@@ -9,10 +9,10 @@ import { ErrorResponseSchema } from '@syncular/core';
|
|
|
9
9
|
import { coerceNumber } from '@syncular/server';
|
|
10
10
|
import { describeRoute, resolver } from 'hono-openapi';
|
|
11
11
|
import { sql } from 'kysely';
|
|
12
|
-
import { summarizeAuditChange } from '../audit-redaction';
|
|
13
|
-
import { syncError } from '../errors';
|
|
14
|
-
import { syncValidator as zValidator } from '../validation';
|
|
15
|
-
import { auditCommitDetailResponseSchema, auditCommitListQuerySchema, auditCommitListResponseSchema, auditCommitParamsSchema, auditDebugExportQuerySchema, auditDebugExportResponseSchema, auditRowHistoryParamsSchema, auditRowHistoryQuerySchema, auditRowHistoryResponseSchema, selectRequiredAuditScopes, } from './shared';
|
|
12
|
+
import { summarizeAuditChange } from '../audit-redaction.js';
|
|
13
|
+
import { syncError } from '../errors.js';
|
|
14
|
+
import { syncValidator as zValidator } from '../validation.js';
|
|
15
|
+
import { auditCommitDetailResponseSchema, auditCommitListQuerySchema, auditCommitListResponseSchema, auditCommitParamsSchema, auditDebugExportQuerySchema, auditDebugExportResponseSchema, auditRowHistoryParamsSchema, auditRowHistoryQuerySchema, auditRowHistoryResponseSchema, selectRequiredAuditScopes, } from './shared.js';
|
|
16
16
|
export function registerAuditRoutes(ctx) {
|
|
17
17
|
const { routes, getAuth, options, handlerRegistry, readVisibleAuditChanges, readAuditDebugRequestEvents, } = ctx;
|
|
18
18
|
// -------------------------------------------------------------------------
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { ErrorResponseSchema, SyncAuthLeaseIssueRequestSchema, SyncAuthLeaseIssueResponseSchema, } from '@syncular/core';
|
|
5
5
|
import { InvalidSubscriptionScopeError, issueAuthLease, } from '@syncular/server';
|
|
6
6
|
import { describeRoute, resolver } from 'hono-openapi';
|
|
7
|
-
import { syncError } from '../errors';
|
|
8
|
-
import { syncValidator as zValidator } from '../validation';
|
|
7
|
+
import { syncError } from '../errors.js';
|
|
8
|
+
import { syncValidator as zValidator } from '../validation.js';
|
|
9
9
|
export function registerAuthLeaseRoutes(ctx) {
|
|
10
10
|
const { routes, authLeaseRoutesConfig, getAuth, options, handlerRegistry } = ctx;
|
|
11
11
|
// -------------------------------------------------------------------------
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { createSyncTimer, ErrorResponseSchema, encodeBinarySyncPack, logSyncEvent, SYNC_PACK_CONTENT_TYPE, SyncCombinedRequestSchema, SyncCombinedResponseSchema, } from '@syncular/core';
|
|
5
5
|
import { InvalidSubscriptionScopeError, pull, recordClientCursor, resolveEffectiveScopesForSubscriptions, SyncClientSchemaUnsupportedError, } from '@syncular/server';
|
|
6
6
|
import { describeRoute, resolver } from 'hono-openapi';
|
|
7
|
-
import { syncError } from '../errors';
|
|
8
|
-
import { createWebSocketConnectionOwnerKey } from '../ws';
|
|
9
|
-
import { clampInt, countPullRows, emitConsoleLiveEvent, normalizeResponseStatus, readClientState, readRequestId, readTraceContext, readTransportPath, responseBodyOverLimit, summarizePullResponse, summarizePullResponseForRequestEvent, summarizeScopeValues, syncValidationError, } from './shared';
|
|
7
|
+
import { syncError } from '../errors.js';
|
|
8
|
+
import { createWebSocketConnectionOwnerKey } from '../ws.js';
|
|
9
|
+
import { clampInt, countPullRows, emitConsoleLiveEvent, normalizeResponseStatus, readClientState, readRequestId, readTraceContext, readTransportPath, responseBodyOverLimit, summarizePullResponse, summarizePullResponseForRequestEvent, summarizeScopeValues, syncValidationError, } from './shared.js';
|
|
10
10
|
export function registerCombinedSyncRoutes(ctx) {
|
|
11
11
|
const { routes, getAuth, options, handlerRegistry, readLimitedSyncJsonBody, recordHttpCombinedReadFailure, recordHttpCombinedFailure, recordRequestEventInBackground, executePushCommitBatchWithSideEffects, executePushCommitWithSideEffects, buildRealtimeSubscriptionsForPull, serializeRealtimeSubscriptions, consoleLiveEmitter, shouldRecordRequestEvents, shouldEmitConsoleLiveEvents, shouldCaptureRequestPayloadSnapshots, logAsyncFailureOnce, wsConnectionManager, triggerAutoMaintenance, binarySyncPackChangeRowEncoders, maxOperationsPerPush, maxSubscriptionsPerPull, maxPullLimitCommits, maxPullLimitSnapshotRows, maxPullMaxSnapshotPages, maxSyncBinaryPackBytes, requiredSchemaVersion, latestSchemaVersion, } = ctx;
|
|
12
12
|
// -------------------------------------------------------------------------
|
|
@@ -12,13 +12,13 @@ import { captureSyncException, collectScopeVars, countSyncMetric, createSyncTime
|
|
|
12
12
|
import { coerceNumber, createServerHandlerCollection, createSyncRealtimeShardKey, maybeCompactChanges, maybePruneSync, pushCommit, pushCommitBatch, rowScopesAllowed, validateAuthLeaseOperation, verifyAuthLeaseToken, } from '@syncular/server';
|
|
13
13
|
import { Hono } from 'hono';
|
|
14
14
|
import { sql } from 'kysely';
|
|
15
|
-
import { summarizeAuditChange } from '../audit-redaction';
|
|
16
|
-
import { isBenignConsoleSchemaError } from '../console/schema-errors';
|
|
17
|
-
import { syncError, syncLimitExceeded } from '../errors';
|
|
18
|
-
import { createRateLimiter, DEFAULT_SYNC_RATE_LIMITS, } from '../rate-limit';
|
|
19
|
-
import { notifyWebSocketConnectionsWithSyncPacks } from '../realtime-sync-packs';
|
|
20
|
-
import { WebSocketConnectionManager, } from '../ws';
|
|
21
|
-
import { applyPartitionToScopeKeys, applySyncCorsHeaders, createOpaqueId, createSyncCorsOriginDeniedResponse, DEFAULT_MAX_SNAPSHOT_ARTIFACT_RESPONSE_BYTES, DEFAULT_MAX_SNAPSHOT_CHUNK_RESPONSE_BYTES, DEFAULT_MAX_SYNC_BINARY_PACK_BYTES, DEFAULT_MAX_SYNC_REQUEST_JSON_BYTES, DEFAULT_REQUEST_PAYLOAD_SNAPSHOT_MAX_BYTES, emitConsoleLiveEvent, encodePayloadSnapshot, firstPushErrorCode, isAuthLeaseRefreshRetriable, isMissingRequestEventsTableError, isSyncJsonBodyLimitError, normalizeRequestEventType, normalizeResponseStatus, normalizeSyncCorsConfig, parseScopesSummary, parseStoredAuditScopes, readClientIdHint, readCommitScopeKeys, readOptionalPositiveInteger, readOriginHeader, readPositiveInteger, readRequestBodyBytesWithLimit, readRequestContentLength, readRequestId, readTraceContext, readTransportPath, realtimeUnsubscribeMap, scopeValuesToScopeKeys, selectRequiredAuditScopes, syncValidationError, wsConnectionManagerMap, } from './shared';
|
|
15
|
+
import { summarizeAuditChange } from '../audit-redaction.js';
|
|
16
|
+
import { isBenignConsoleSchemaError } from '../console/schema-errors.js';
|
|
17
|
+
import { syncError, syncLimitExceeded } from '../errors.js';
|
|
18
|
+
import { createRateLimiter, DEFAULT_SYNC_RATE_LIMITS, } from '../rate-limit.js';
|
|
19
|
+
import { notifyWebSocketConnectionsWithSyncPacks } from '../realtime-sync-packs.js';
|
|
20
|
+
import { WebSocketConnectionManager, } from '../ws.js';
|
|
21
|
+
import { applyPartitionToScopeKeys, applySyncCorsHeaders, createOpaqueId, createSyncCorsOriginDeniedResponse, DEFAULT_MAX_SNAPSHOT_ARTIFACT_RESPONSE_BYTES, DEFAULT_MAX_SNAPSHOT_CHUNK_RESPONSE_BYTES, DEFAULT_MAX_SYNC_BINARY_PACK_BYTES, DEFAULT_MAX_SYNC_REQUEST_JSON_BYTES, DEFAULT_REQUEST_PAYLOAD_SNAPSHOT_MAX_BYTES, emitConsoleLiveEvent, encodePayloadSnapshot, firstPushErrorCode, isAuthLeaseRefreshRetriable, isMissingRequestEventsTableError, isSyncJsonBodyLimitError, normalizeRequestEventType, normalizeResponseStatus, normalizeSyncCorsConfig, parseScopesSummary, parseStoredAuditScopes, readClientIdHint, readCommitScopeKeys, readOptionalPositiveInteger, readOriginHeader, readPositiveInteger, readRequestBodyBytesWithLimit, readRequestContentLength, readRequestId, readTraceContext, readTransportPath, realtimeUnsubscribeMap, scopeValuesToScopeKeys, selectRequiredAuditScopes, syncValidationError, wsConnectionManagerMap, } from './shared.js';
|
|
22
22
|
export function createSyncRoutesContext(options) {
|
|
23
23
|
const routes = new Hono();
|
|
24
24
|
const config = options.sync ?? {};
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { captureSyncException, countSyncMetric, createSyncTimer, distributionSyncMetric, logSyncEvent, SYNC_PACK_ENCODING_BINARY_V1, SyncPushRequestSchema, } from '@syncular/core';
|
|
6
6
|
import { createSyncRealtimeShardKey } from '@syncular/server';
|
|
7
|
-
import { syncError } from '../errors';
|
|
8
|
-
import { isWebSocketOriginAllowed } from '../websocket-origin';
|
|
9
|
-
import { createRealtimeSessionId, createWebSocketConnection, createWebSocketConnectionOwnerKey, } from '../ws';
|
|
10
|
-
import { applyPartitionToScopeKeys, createSyncCorsOriginDeniedResponse, emitConsoleLiveEvent, measureWebSocketMessageBytes, normalizeResponseStatus, normalizeScopeKeyForPartition, parsePersistedRealtimeSubscriptions, readClientState, readOriginHeader, readTraceContextFromMessage, readTransportPath, recordRealtimeAck, scopeValuesToScopeKeys, uniqueScopeKeys, } from './shared';
|
|
7
|
+
import { syncError } from '../errors.js';
|
|
8
|
+
import { isWebSocketOriginAllowed } from '../websocket-origin.js';
|
|
9
|
+
import { createRealtimeSessionId, createWebSocketConnection, createWebSocketConnectionOwnerKey, } from '../ws.js';
|
|
10
|
+
import { applyPartitionToScopeKeys, createSyncCorsOriginDeniedResponse, emitConsoleLiveEvent, measureWebSocketMessageBytes, normalizeResponseStatus, normalizeScopeKeyForPartition, parsePersistedRealtimeSubscriptions, readClientState, readOriginHeader, readTraceContextFromMessage, readTransportPath, recordRealtimeAck, scopeValuesToScopeKeys, uniqueScopeKeys, } from './shared.js';
|
|
11
11
|
export function registerRealtimeRoutes(ctx) {
|
|
12
12
|
const { routes, getAuth, options, websocketConfig, corsConfig, wsConnectionManager, consoleLiveEmitter, recordRealtimeEventInBackground, recordRequestEventInBackground, serializeRealtimeSubscriptions, logAsyncFailureOnce, maxOperationsPerPush, executePushCommitWithSideEffects, triggerAutoMaintenance, shouldCaptureRequestPayloadSnapshots, } = ctx;
|
|
13
13
|
// -------------------------------------------------------------------------
|
|
@@ -6,8 +6,8 @@ import { collectScopeVars, createSyncularErrorResponse, ScopeValuesSchema, SYNC_
|
|
|
6
6
|
import { coerceNumber, parseJsonValue, } from '@syncular/server';
|
|
7
7
|
import { sql } from 'kysely';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { syncErrorResponse, syncLimitExceeded } from '../errors';
|
|
10
|
-
import { resolveAllowedOriginFromPatterns } from '../websocket-origin';
|
|
9
|
+
import { syncErrorResponse, syncLimitExceeded } from '../errors.js';
|
|
10
|
+
import { resolveAllowedOriginFromPatterns } from '../websocket-origin.js';
|
|
11
11
|
/**
|
|
12
12
|
* WeakMaps for storing Hono-instance-specific data without augmenting the type.
|
|
13
13
|
*/
|
|
@@ -7,9 +7,9 @@ import { ErrorResponseSchema } from '@syncular/core';
|
|
|
7
7
|
import { InvalidSubscriptionScopeError, readScopedSnapshotArtifact, readSnapshotChunk, resolveEffectiveScopesForSubscriptions, scopesToSnapshotChunkScopeKey, } from '@syncular/server';
|
|
8
8
|
import { describeRoute, resolver } from 'hono-openapi';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
import { syncError } from '../errors';
|
|
11
|
-
import { syncValidator as zValidator } from '../validation';
|
|
12
|
-
import { readSnapshotScopeValues, responseBodyOverLimit, snapshotArtifactParamsSchema, snapshotChunkParamsSchema, snapshotChunkQuerySchema, } from './shared';
|
|
10
|
+
import { syncError } from '../errors.js';
|
|
11
|
+
import { syncValidator as zValidator } from '../validation.js';
|
|
12
|
+
import { readSnapshotScopeValues, responseBodyOverLimit, snapshotArtifactParamsSchema, snapshotChunkParamsSchema, snapshotChunkQuerySchema, } from './shared.js';
|
|
13
13
|
export function registerSnapshotRoutes(ctx) {
|
|
14
14
|
const { routes, getAuth, options, handlerRegistry, maxSnapshotChunkResponseBytes, maxSnapshotArtifactResponseBytes, } = ctx;
|
|
15
15
|
// -------------------------------------------------------------------------
|
package/dist/hono/routes.js
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
* - GET /snapshot-artifacts/:artifactId (download scoped snapshot artifacts)
|
|
8
8
|
* - GET /realtime (optional WebSocket "wake up" notifications)
|
|
9
9
|
*/
|
|
10
|
-
import { registerAuditRoutes } from './routes/audit';
|
|
11
|
-
import { registerAuthLeaseRoutes } from './routes/auth-leases';
|
|
12
|
-
import { registerCombinedSyncRoutes } from './routes/combined';
|
|
13
|
-
import { createSyncRoutesContext } from './routes/context';
|
|
14
|
-
import { registerHealthRoutes } from './routes/health';
|
|
15
|
-
import { registerRealtimeRoutes } from './routes/realtime';
|
|
16
|
-
import { realtimeUnsubscribeMap, wsConnectionManagerMap, } from './routes/shared';
|
|
17
|
-
import { registerSnapshotRoutes } from './routes/snapshots';
|
|
18
|
-
export { normalizeSyncCorsConfig } from './routes/shared';
|
|
10
|
+
import { registerAuditRoutes } from './routes/audit.js';
|
|
11
|
+
import { registerAuthLeaseRoutes } from './routes/auth-leases.js';
|
|
12
|
+
import { registerCombinedSyncRoutes } from './routes/combined.js';
|
|
13
|
+
import { createSyncRoutesContext } from './routes/context.js';
|
|
14
|
+
import { registerHealthRoutes } from './routes/health.js';
|
|
15
|
+
import { registerRealtimeRoutes } from './routes/realtime.js';
|
|
16
|
+
import { realtimeUnsubscribeMap, wsConnectionManagerMap, } from './routes/shared.js';
|
|
17
|
+
import { registerSnapshotRoutes } from './routes/snapshots.js';
|
|
18
|
+
export { normalizeSyncCorsConfig } from './routes/shared.js';
|
|
19
19
|
export function createSyncRoutes(options) {
|
|
20
20
|
const ctx = createSyncRoutesContext(options);
|
|
21
21
|
// Route registration order matters in Hono; keep it identical to the
|
package/dist/index.js
CHANGED
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
* - blob/media storage
|
|
9
9
|
*/
|
|
10
10
|
export * from '@syncular/core';
|
|
11
|
-
export * from './auth-leases';
|
|
12
|
-
export * from './blobs';
|
|
13
|
-
export * from './clients';
|
|
14
|
-
export * from './commit-integrity';
|
|
15
|
-
export * from './compaction';
|
|
16
|
-
export * from './dialect';
|
|
17
|
-
export * from './encrypted-crdt';
|
|
18
|
-
export * from './errors';
|
|
19
|
-
export * from './handlers';
|
|
20
|
-
export * from './helpers';
|
|
21
|
-
export * from './migrate';
|
|
22
|
-
export * from './notify';
|
|
23
|
-
export * from './plugins';
|
|
24
|
-
export * from './proxy';
|
|
25
|
-
export * from './prune';
|
|
26
|
-
export * from './pull';
|
|
27
|
-
export * from './push';
|
|
28
|
-
export * from './realtime';
|
|
29
|
-
export * from './schema';
|
|
30
|
-
export * from './snapshot-artifacts';
|
|
31
|
-
export * from './snapshot-chunks';
|
|
32
|
-
export * from './stats';
|
|
33
|
-
export * from './subscriptions';
|
|
34
|
-
export * from './sync';
|
|
11
|
+
export * from './auth-leases.js';
|
|
12
|
+
export * from './blobs/index.js';
|
|
13
|
+
export * from './clients.js';
|
|
14
|
+
export * from './commit-integrity.js';
|
|
15
|
+
export * from './compaction.js';
|
|
16
|
+
export * from './dialect/index.js';
|
|
17
|
+
export * from './encrypted-crdt.js';
|
|
18
|
+
export * from './errors.js';
|
|
19
|
+
export * from './handlers/index.js';
|
|
20
|
+
export * from './helpers/index.js';
|
|
21
|
+
export * from './migrate.js';
|
|
22
|
+
export * from './notify.js';
|
|
23
|
+
export * from './plugins/index.js';
|
|
24
|
+
export * from './proxy/index.js';
|
|
25
|
+
export * from './prune.js';
|
|
26
|
+
export * from './pull.js';
|
|
27
|
+
export * from './push.js';
|
|
28
|
+
export * from './realtime/index.js';
|
|
29
|
+
export * from './schema.js';
|
|
30
|
+
export * from './snapshot-artifacts.js';
|
|
31
|
+
export * from './snapshot-chunks.js';
|
|
32
|
+
export * from './stats.js';
|
|
33
|
+
export * from './subscriptions/index.js';
|
|
34
|
+
export * from './sync.js';
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
package/dist/notify.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* ensuring clients receive the updated data.
|
|
9
9
|
*/
|
|
10
10
|
import { randomId } from '@syncular/core';
|
|
11
|
-
import { finalizeCommitIntegrity } from './commit-integrity';
|
|
12
|
-
import { coerceNumber, toDialectJsonValue } from './dialect/helpers';
|
|
13
|
-
import { createScopeCommitIndexEntries } from './helpers/scope-commit-index';
|
|
11
|
+
import { finalizeCommitIntegrity } from './commit-integrity.js';
|
|
12
|
+
import { coerceNumber, toDialectJsonValue } from './dialect/helpers.js';
|
|
13
|
+
import { createScopeCommitIndexEntries } from './helpers/scope-commit-index.js';
|
|
14
14
|
/**
|
|
15
15
|
* Well-known client_id for external/synthetic commits.
|
|
16
16
|
* Used by the pull handler to detect external data changes.
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './types';
|
|
1
|
+
export * from './types.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/proxy/handler.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Executes proxied queries with automatic oplog generation for mutations.
|
|
5
5
|
*/
|
|
6
6
|
import { sql } from 'kysely';
|
|
7
|
-
import { appendReturning, detectMutation, hasReturningClause, hasReturningWildcard, } from './mutation-detector';
|
|
8
|
-
import { createOplogEntries } from './oplog';
|
|
7
|
+
import { appendReturning, detectMutation, hasReturningClause, hasReturningWildcard, } from './mutation-detector.js';
|
|
8
|
+
import { createOplogEntries } from './oplog.js';
|
|
9
9
|
/**
|
|
10
10
|
* Build a raw SQL query with parameters using Kysely's sql helper.
|
|
11
11
|
*
|
package/dist/proxy/index.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Oplog creation
|
|
7
7
|
// Collections
|
|
8
|
-
export { createProxyHandlerCollection, } from './collection';
|
|
8
|
+
export { createProxyHandlerCollection, } from './collection.js';
|
|
9
9
|
// Query execution
|
|
10
|
-
export { executeProxyQuery, } from './handler';
|
|
10
|
+
export { executeProxyQuery, } from './handler.js';
|
|
11
11
|
// Mutation detection
|
|
12
|
-
export { detectMutation } from './mutation-detector';
|
|
12
|
+
export { detectMutation } from './mutation-detector.js';
|
|
13
13
|
// Types
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/proxy/oplog.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { randomId } from '@syncular/core';
|
|
7
7
|
import { sql } from 'kysely';
|
|
8
|
-
import { finalizeCommitIntegrity } from '../commit-integrity';
|
|
9
|
-
import { toDialectJsonValue } from '../dialect/helpers';
|
|
10
|
-
import { createScopeCommitIndexEntries } from '../helpers/scope-commit-index';
|
|
8
|
+
import { finalizeCommitIntegrity } from '../commit-integrity.js';
|
|
9
|
+
import { toDialectJsonValue } from '../dialect/helpers.js';
|
|
10
|
+
import { createScopeCommitIndexEntries } from '../helpers/scope-commit-index.js';
|
|
11
11
|
/**
|
|
12
12
|
* Create oplog entries for affected rows.
|
|
13
13
|
*
|
package/dist/prune.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Clients behind pruned history will be forced to bootstrap.
|
|
11
11
|
*/
|
|
12
12
|
import { sql } from 'kysely';
|
|
13
|
-
import { coerceNumber } from './dialect/helpers';
|
|
13
|
+
import { coerceNumber } from './dialect/helpers.js';
|
|
14
14
|
async function readPrunePartitionIds(db) {
|
|
15
15
|
const res = await sql `
|
|
16
16
|
SELECT DISTINCT partition_id
|
package/dist/pull.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { bytesToReadableStream, captureSyncException, concatByteChunks, countSyncMetric, createSnapshotManifest, distributionSyncMetric, encodeBinarySnapshotTable, gzipBytes, randomId, SYNC_SCOPED_SNAPSHOT_ARTIFACT_KIND_SQLITE_V1, SYNC_SNAPSHOT_CHUNK_COMPRESSION, SYNC_SNAPSHOT_CHUNK_ENCODING, sha256Hex, snapshotScopeDigestFromCacheKey, startSyncSpan, } from '@syncular/core';
|
|
2
|
-
import { createWireSubscriptionIntegrity, SYNCULAR_COMMIT_GENESIS_ROOT, } from './commit-integrity';
|
|
3
|
-
import { getServerBootstrapOrderFor, } from './handlers/collection';
|
|
4
|
-
import { EXTERNAL_CLIENT_ID } from './notify';
|
|
5
|
-
import { sortServerPullPlugins, } from './plugins/types';
|
|
6
|
-
import { createScopedSnapshotArtifactScopeCacheKey, readBestScopedSnapshotArtifactRefForPageCapacity, } from './snapshot-artifacts';
|
|
7
|
-
import { createSnapshotChunkScopeCacheKey, insertSnapshotChunk, readSnapshotChunkRefByPageKey, } from './snapshot-chunks';
|
|
8
|
-
import { createMemoryScopeCache, } from './subscriptions/cache';
|
|
9
|
-
import { resolveEffectiveScopesForSubscriptions } from './subscriptions/resolve';
|
|
2
|
+
import { createWireSubscriptionIntegrity, SYNCULAR_COMMIT_GENESIS_ROOT, } from './commit-integrity.js';
|
|
3
|
+
import { getServerBootstrapOrderFor, } from './handlers/collection.js';
|
|
4
|
+
import { EXTERNAL_CLIENT_ID } from './notify.js';
|
|
5
|
+
import { sortServerPullPlugins, } from './plugins/types.js';
|
|
6
|
+
import { createScopedSnapshotArtifactScopeCacheKey, readBestScopedSnapshotArtifactRefForPageCapacity, } from './snapshot-artifacts.js';
|
|
7
|
+
import { createSnapshotChunkScopeCacheKey, insertSnapshotChunk, readSnapshotChunkRefByPageKey, } from './snapshot-chunks.js';
|
|
8
|
+
import { createMemoryScopeCache, } from './subscriptions/cache.js';
|
|
9
|
+
import { resolveEffectiveScopesForSubscriptions } from './subscriptions/resolve.js';
|
|
10
10
|
const defaultScopeCache = createMemoryScopeCache();
|
|
11
11
|
const DEFAULT_MAX_BINARY_SNAPSHOT_BUNDLE_ROWS = 50_000;
|
|
12
12
|
const DEFAULT_SNAPSHOT_CHUNK_GZIP_LEVEL = 1;
|
package/dist/push.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { captureSyncException, countSyncMetric, distributionSyncMetric, startSyncSpan, } from '@syncular/core';
|
|
2
2
|
import { sql } from 'kysely';
|
|
3
|
-
import { finalizeCommitIntegrity } from './commit-integrity';
|
|
4
|
-
import { coerceNumber, parseJsonValue, toDialectJsonValue, } from './dialect/helpers';
|
|
5
|
-
import { createScopeCommitIndexEntries, scopeKeysFromScopeValues, } from './helpers/scope-commit-index';
|
|
6
|
-
import { sortServerPushPlugins, } from './plugins/types';
|
|
3
|
+
import { finalizeCommitIntegrity } from './commit-integrity.js';
|
|
4
|
+
import { coerceNumber, parseJsonValue, toDialectJsonValue, } from './dialect/helpers.js';
|
|
5
|
+
import { createScopeCommitIndexEntries, scopeKeysFromScopeValues, } from './helpers/scope-commit-index.js';
|
|
6
|
+
import { sortServerPushPlugins, } from './plugins/types.js';
|
|
7
7
|
class RejectCommitError extends Error {
|
|
8
8
|
response;
|
|
9
9
|
constructor(response) {
|
package/dist/realtime/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { InMemorySyncRealtimeBroadcaster } from './in-memory';
|
|
2
|
-
export { createSyncRealtimeShardKey } from './types';
|
|
1
|
+
export { InMemorySyncRealtimeBroadcaster } from './in-memory.js';
|
|
2
|
+
export { createSyncRealtimeShardKey } from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Components for the relay's role as a client to the main server.
|
|
5
5
|
*/
|
|
6
|
-
export * from './forward-engine';
|
|
7
|
-
export * from './pull-engine';
|
|
8
|
-
export * from './sequence-mapper';
|
|
6
|
+
export * from './forward-engine.js';
|
|
7
|
+
export * from './pull-engine.js';
|
|
8
|
+
export * from './sequence-mapper.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,13 +2,13 @@ import Database from 'bun:sqlite';
|
|
|
2
2
|
import { createServerHandlerCollection } from '@syncular/server';
|
|
3
3
|
import { createSqliteServerDialect } from '@syncular/server/sqlite';
|
|
4
4
|
import { Kysely, SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler, } from 'kysely';
|
|
5
|
-
import { ForwardEngine } from '../client-role/forward-engine';
|
|
6
|
-
import { PullEngine } from '../client-role/pull-engine';
|
|
7
|
-
import { SequenceMapper } from '../client-role/sequence-mapper';
|
|
8
|
-
import { ensureRelaySchema } from '../migrate';
|
|
9
|
-
import { createRelayWebSocketConnection, RelayRealtime } from '../realtime';
|
|
10
|
-
import { relayPull } from '../server-role/pull';
|
|
11
|
-
import { relayPushCommit } from '../server-role/push';
|
|
5
|
+
import { ForwardEngine } from '../client-role/forward-engine.js';
|
|
6
|
+
import { PullEngine } from '../client-role/pull-engine.js';
|
|
7
|
+
import { SequenceMapper } from '../client-role/sequence-mapper.js';
|
|
8
|
+
import { ensureRelaySchema } from '../migrate.js';
|
|
9
|
+
import { createRelayWebSocketConnection, RelayRealtime } from '../realtime.js';
|
|
10
|
+
import { relayPull } from '../server-role/pull.js';
|
|
11
|
+
import { relayPushCommit } from '../server-role/push.js';
|
|
12
12
|
const DEFAULT_ITERATIONS = 100;
|
|
13
13
|
const DEFAULT_WARMUP_ITERATIONS = 10;
|
|
14
14
|
const DEFAULT_REALTIME_CONNECTIONS = 100;
|
package/dist/relay/index.js
CHANGED
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
// Client role (syncing with main server)
|
|
31
|
-
export * from './client-role';
|
|
31
|
+
export * from './client-role/index.js';
|
|
32
32
|
// Migration
|
|
33
|
-
export * from './migrate';
|
|
33
|
+
export * from './migrate.js';
|
|
34
34
|
// Mode manager
|
|
35
|
-
export * from './mode-manager';
|
|
35
|
+
export * from './mode-manager.js';
|
|
36
36
|
// Realtime WebSocket manager
|
|
37
|
-
export * from './realtime';
|
|
37
|
+
export * from './realtime.js';
|
|
38
38
|
// Main exports
|
|
39
|
-
export * from './relay';
|
|
39
|
+
export * from './relay.js';
|
|
40
40
|
// Schema types
|
|
41
|
-
export * from './schema';
|
|
41
|
+
export * from './schema.js';
|
|
42
42
|
// Server role (serving local clients)
|
|
43
|
-
export * from './server-role';
|
|
43
|
+
export * from './server-role/index.js';
|
|
44
44
|
//# sourceMappingURL=index.js.map
|
package/dist/relay/relay.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
* continue syncing when internet is lost.
|
|
9
9
|
*/
|
|
10
10
|
import { sql } from 'kysely';
|
|
11
|
-
import { ForwardEngine } from './client-role/forward-engine';
|
|
12
|
-
import { PullEngine } from './client-role/pull-engine';
|
|
13
|
-
import { SequenceMapper } from './client-role/sequence-mapper';
|
|
14
|
-
import { ensureRelaySchema } from './migrate';
|
|
15
|
-
import { ModeManager } from './mode-manager';
|
|
16
|
-
import { RelayRealtime } from './realtime';
|
|
11
|
+
import { ForwardEngine } from './client-role/forward-engine.js';
|
|
12
|
+
import { PullEngine } from './client-role/pull-engine.js';
|
|
13
|
+
import { SequenceMapper } from './client-role/sequence-mapper.js';
|
|
14
|
+
import { ensureRelaySchema } from './migrate.js';
|
|
15
|
+
import { ModeManager } from './mode-manager.js';
|
|
16
|
+
import { RelayRealtime } from './realtime.js';
|
|
17
17
|
/**
|
|
18
18
|
* Relay server that acts as an edge relay between local clients and a main server.
|
|
19
19
|
*
|
|
@@ -280,7 +280,7 @@ export class RelayServer {
|
|
|
280
280
|
if (this.routesPromise)
|
|
281
281
|
return this.routesPromise;
|
|
282
282
|
this.routesPromise = (async () => {
|
|
283
|
-
const { createRelayRoutes } = await import('./server-role');
|
|
283
|
+
const { createRelayRoutes } = await import('./server-role/index.js');
|
|
284
284
|
const routes = createRelayRoutes({
|
|
285
285
|
db: this.db,
|
|
286
286
|
dialect: this.dialect,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { createSyncTimer, createSyncularErrorResponse, isRecord, logSyncEvent, ScopeValuesSchema, SyncBootstrapStateSchema, SyncPullRequestSchema, SyncPushRequestSchema, } from '@syncular/core';
|
|
7
7
|
import { recordClientCursor } from '@syncular/server';
|
|
8
8
|
import { Hono } from 'hono';
|
|
9
|
-
import { relayPull } from './pull';
|
|
10
|
-
import { relayPushCommit } from './push';
|
|
9
|
+
import { relayPull } from './pull.js';
|
|
10
|
+
import { relayPushCommit } from './push.js';
|
|
11
11
|
function clampInt(value, min, max) {
|
|
12
12
|
return Math.max(min, Math.min(max, value));
|
|
13
13
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { createScopedSnapshotArtifactManifest, randomId, SYNC_SCOPED_SNAPSHOT_ARTIFACT_KIND_SQLITE_V1, SYNC_SCOPED_SNAPSHOT_ARTIFACT_MANIFEST_VERSION, SYNC_SNAPSHOT_ARTIFACT_COMPRESSION_NONE, SYNC_SNAPSHOT_CHUNK_COMPRESSION, sha256Hex, snapshotScopeDigestFromCacheKey, } from '@syncular/core';
|
|
10
10
|
import { sql } from 'kysely';
|
|
11
|
-
import { scopesToSnapshotChunkScopeKey } from './snapshot-chunks';
|
|
11
|
+
import { scopesToSnapshotChunkScopeKey } from './snapshot-chunks.js';
|
|
12
12
|
function coerceOptionalString(value) {
|
|
13
13
|
if (value == null || value === '')
|
|
14
14
|
return null;
|
package/dist/stats.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @syncular/server - Observability helpers
|
|
3
3
|
*/
|
|
4
4
|
import { sql } from 'kysely';
|
|
5
|
-
import { coerceNumber } from './dialect/helpers';
|
|
5
|
+
import { coerceNumber } from './dialect/helpers.js';
|
|
6
6
|
function mapCachePressure(row) {
|
|
7
7
|
return {
|
|
8
8
|
count: coerceNumber(row?.total_count) ?? 0,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './resolve';
|
|
1
|
+
export * from './cache.js';
|
|
2
|
+
export * from './resolve.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectScopeVars, } from '@syncular/core';
|
|
2
|
-
import { createDefaultScopeCacheKey } from './cache';
|
|
2
|
+
import { createDefaultScopeCacheKey } from './cache.js';
|
|
3
3
|
export class InvalidSubscriptionScopeError extends Error {
|
|
4
4
|
constructor(message) {
|
|
5
5
|
super(message);
|
package/dist/sync.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Server-side Syncular engine with opt-in Hono, database, storage, Cloudflare, relay, and CRDT subpaths",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
"evaluate:rust-boundary": "bun scripts/evaluate-relay-rust-boundary.ts"
|
|
236
236
|
},
|
|
237
237
|
"dependencies": {
|
|
238
|
-
"@syncular/core": "
|
|
238
|
+
"@syncular/core": "0.1.1"
|
|
239
239
|
},
|
|
240
240
|
"peerDependencies": {
|
|
241
241
|
"@cloudflare/workers-types": "*",
|
|
@@ -271,8 +271,8 @@
|
|
|
271
271
|
"@scalar/hono-api-reference": "^0.10.6",
|
|
272
272
|
"@standard-community/standard-json": "^0.3.5",
|
|
273
273
|
"@standard-community/standard-openapi": "^0.2.9",
|
|
274
|
-
"@syncular/config": "
|
|
275
|
-
"@syncular/console": "
|
|
274
|
+
"@syncular/config": "0.0.0",
|
|
275
|
+
"@syncular/console": "0.1.1",
|
|
276
276
|
"@types/better-sqlite3": "^7.6.13",
|
|
277
277
|
"@types/json-schema": "^7.0.15",
|
|
278
278
|
"better-sqlite3": "^12.8.0",
|