@lunora/runtime 1.0.0-alpha.1 → 1.0.0-alpha.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/dist/index.mjs +4 -4
- package/dist/packem_shared/{composeWorker-BYHiNH_V.mjs → composeWorker-BmfKl1ei.mjs} +18 -6
- package/package.json +1 -1
- /package/dist/packem_shared/{createDynamicShardRegistry-BpCwo_mo.mjs → DEFAULT_REGISTRY_CACHE_TTL_MS-BpCwo_mo.mjs} +0 -0
- /package/dist/packem_shared/{consoleSink-DqEvrQs0.mjs → analyticsEngineSink-DqEvrQs0.mjs} +0 -0
- /package/dist/packem_shared/{emitRpcEvent-pEdtqAK8.mjs → emitLogEvent-pEdtqAK8.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { toAirbyteMessages, toFivetranResponse } from './packem_shared/toAirbyteMessages-DrHdplb4.mjs';
|
|
2
|
-
export { composeWorker, createWorker, defineRpcEnvelope, withFrameworkWorker } from './packem_shared/composeWorker-
|
|
2
|
+
export { composeWorker, createWorker, defineRpcEnvelope, withFrameworkWorker } from './packem_shared/composeWorker-BmfKl1ei.mjs';
|
|
3
3
|
export { createCrossShardRelationCapabilities } from './packem_shared/createCrossShardRelationCapabilities-C0KOf7er.mjs';
|
|
4
|
-
export { DEFAULT_REGISTRY_CACHE_TTL_MS, SHARD_REGISTRY_DO_NAME, createDynamicShardRegistry } from './packem_shared/
|
|
4
|
+
export { DEFAULT_REGISTRY_CACHE_TTL_MS, SHARD_REGISTRY_DO_NAME, createDynamicShardRegistry } from './packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-BpCwo_mo.mjs';
|
|
5
5
|
export { LunoraError, toErrorResponse } from './packem_shared/LunoraError-CL0aOtpo.mjs';
|
|
6
|
-
export { emitLogEvent, emitRpcEvent } from './packem_shared/
|
|
7
|
-
export { analyticsEngineSink, combineSinks, consoleSink, sentrySink, webhookSink } from './packem_shared/
|
|
6
|
+
export { emitLogEvent, emitRpcEvent } from './packem_shared/emitLogEvent-pEdtqAK8.mjs';
|
|
7
|
+
export { analyticsEngineSink, combineSinks, consoleSink, sentrySink, webhookSink } from './packem_shared/analyticsEngineSink-DqEvrQs0.mjs';
|
|
8
8
|
export { createQueryCoordinator, createStaticShardRegistry, mergeStrategyForAggregate } from './packem_shared/createQueryCoordinator-DbxC7iUz.mjs';
|
|
9
9
|
export { resolveShard } from './packem_shared/resolveShard-DDkzWtrU.mjs';
|
|
10
10
|
export { decorateResponse, enforceOrigin, handleCorsPreflight, resolveSecurity } from './packem_shared/decorateResponse-DbISh_Wi.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LunoraError, toErrorResponse, isStructuralLunoraError, isStructuralConflictError } from './LunoraError-CL0aOtpo.mjs';
|
|
2
|
-
import { emitRpcEvent } from './
|
|
2
|
+
import { emitRpcEvent } from './emitLogEvent-pEdtqAK8.mjs';
|
|
3
3
|
import { resolveShard } from './resolveShard-DDkzWtrU.mjs';
|
|
4
4
|
import { resolveSecurity, handleCorsPreflight, enforceOrigin, decorateResponse } from './decorateResponse-DbISh_Wi.mjs';
|
|
5
5
|
|
|
@@ -1740,6 +1740,17 @@ const checkAdminWsToken = (request, expected) => {
|
|
|
1740
1740
|
};
|
|
1741
1741
|
const createWorker = (options) => {
|
|
1742
1742
|
const defaultShard = options.defaultShardKey ?? "__root__";
|
|
1743
|
+
let envAdminToken;
|
|
1744
|
+
const effectiveAdminToken = () => options.adminToken ?? envAdminToken;
|
|
1745
|
+
const resolveAdminTokenFromEnv = (env) => {
|
|
1746
|
+
if (envAdminToken !== void 0 || options.adminToken !== void 0) {
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
const value = (env ?? {})["LUNORA_ADMIN_TOKEN"];
|
|
1750
|
+
if (typeof value === "string" && value.length > 0) {
|
|
1751
|
+
envAdminToken = value;
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1743
1754
|
const hasAnyShardAuth = Boolean(options.authorizeShard) || Boolean(options.authorizeFanOut);
|
|
1744
1755
|
let warnedUnauthenticatedShardAccess = false;
|
|
1745
1756
|
const warnUnauthenticatedShardAccessOnce = (kind) => {
|
|
@@ -1758,7 +1769,7 @@ const createWorker = (options) => {
|
|
|
1758
1769
|
const orchestrationAdminRoutes = buildOrchestrationAdminRoutes({
|
|
1759
1770
|
defaultShard,
|
|
1760
1771
|
forwardToShard,
|
|
1761
|
-
isAdmin: (request) => checkAdminAuth(request,
|
|
1772
|
+
isAdmin: (request) => checkAdminAuth(request, effectiveAdminToken()),
|
|
1762
1773
|
queryCoordinator: options.queryCoordinator,
|
|
1763
1774
|
resolveForwardContext: (request, env) => resolveForwardContext(request, env, options.resolveIdentity),
|
|
1764
1775
|
shardDO: options.shardDO
|
|
@@ -1824,7 +1835,7 @@ const createWorker = (options) => {
|
|
|
1824
1835
|
}
|
|
1825
1836
|
};
|
|
1826
1837
|
const handleRunCronJob = async (request, env) => {
|
|
1827
|
-
if (!checkAdminAuth(request,
|
|
1838
|
+
if (!checkAdminAuth(request, effectiveAdminToken())) {
|
|
1828
1839
|
throw new LunoraError("admin endpoint requires a valid admin bearer", { code: "ADMIN_FORBIDDEN", status: 403 });
|
|
1829
1840
|
}
|
|
1830
1841
|
if (request.method !== "POST") {
|
|
@@ -1898,7 +1909,7 @@ const createWorker = (options) => {
|
|
|
1898
1909
|
};
|
|
1899
1910
|
const dataMovementAdminRoutes = buildDataMovementAdminRoutes({
|
|
1900
1911
|
applyGlobals: options.applyGlobals,
|
|
1901
|
-
isAdmin: (request) => checkAdminAuth(request,
|
|
1912
|
+
isAdmin: (request) => checkAdminAuth(request, effectiveAdminToken()),
|
|
1902
1913
|
knownTables: () => collectKnownTables(),
|
|
1903
1914
|
queryCoordinator: options.queryCoordinator,
|
|
1904
1915
|
resolveForwardContext: (request, env) => resolveForwardContext(request, env, options.resolveIdentity),
|
|
@@ -1908,7 +1919,7 @@ const createWorker = (options) => {
|
|
|
1908
1919
|
syncGlobals: options.syncGlobals
|
|
1909
1920
|
});
|
|
1910
1921
|
const assertAdminAuthorized = (request) => {
|
|
1911
|
-
if (!checkAdminAuth(request,
|
|
1922
|
+
if (!checkAdminAuth(request, effectiveAdminToken())) {
|
|
1912
1923
|
throw new LunoraError("admin endpoint requires a valid admin bearer", { code: "ADMIN_FORBIDDEN", status: 403 });
|
|
1913
1924
|
}
|
|
1914
1925
|
};
|
|
@@ -1945,7 +1956,7 @@ const createWorker = (options) => {
|
|
|
1945
1956
|
return resolveShard(requireSchedulerNamespace(), options.schedulerInstanceName ?? "default");
|
|
1946
1957
|
};
|
|
1947
1958
|
const scheduledAdminRoutes = buildScheduledAdminRoutes({
|
|
1948
|
-
checkWsAdmin: (request) => checkAdminAuth(request,
|
|
1959
|
+
checkWsAdmin: (request) => checkAdminAuth(request, effectiveAdminToken()) || checkAdminWsToken(request, effectiveAdminToken()),
|
|
1949
1960
|
requireSchedulerNamespace,
|
|
1950
1961
|
resolveSchedulerStub,
|
|
1951
1962
|
schedulerInstanceName: options.schedulerInstanceName ?? "default"
|
|
@@ -2435,6 +2446,7 @@ const createWorker = (options) => {
|
|
|
2435
2446
|
context.passThroughOnException();
|
|
2436
2447
|
}
|
|
2437
2448
|
ensureSecurityResolved(env);
|
|
2449
|
+
resolveAdminTokenFromEnv(env);
|
|
2438
2450
|
const preflight = handleCorsPreflight(request, resolvedSecurity);
|
|
2439
2451
|
if (preflight) {
|
|
2440
2452
|
return preflight;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|