target-supabase-sdk 0.2.16 → 0.2.18
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/README.md +20 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{task-queue-Gi4DSq74.js → task-queue-DufG7PlX.js} +162 -2
- package/dist/chunks/task-queue-DufG7PlX.js.map +1 -0
- package/dist/node/telegram/api-client.d.ts +12 -0
- package/dist/node/telegram/api-client.d.ts.map +1 -0
- package/dist/node/telegram/chunk-locator.d.ts +10 -0
- package/dist/node/telegram/chunk-locator.d.ts.map +1 -0
- package/dist/node/telegram/chunk.d.ts +4 -0
- package/dist/node/telegram/chunk.d.ts.map +1 -0
- package/dist/node/telegram/index.d.ts +8 -0
- package/dist/node/telegram/index.d.ts.map +1 -0
- package/dist/node/telegram/storage-provider.d.ts +32 -0
- package/dist/node/telegram/storage-provider.d.ts.map +1 -0
- package/dist/node/telegram/types.d.ts +53 -0
- package/dist/node/telegram/types.d.ts.map +1 -0
- package/dist/node.d.ts +4 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +503 -8
- package/dist/node.js.map +1 -1
- package/dist/shared/media/index.d.ts +14 -0
- package/dist/shared/media/index.d.ts.map +1 -0
- package/dist/shared/media/media.build.d.ts +20 -0
- package/dist/shared/media/media.build.d.ts.map +1 -0
- package/dist/shared/media/media.interface.d.ts +38 -0
- package/dist/shared/media/media.interface.d.ts.map +1 -0
- package/dist/shared/media/media.mime.d.ts +4 -0
- package/dist/shared/media/media.mime.d.ts.map +1 -0
- package/dist/shared/media/media.name.d.ts +6 -0
- package/dist/shared/media/media.name.d.ts.map +1 -0
- package/dist/shared/media/media.query.d.ts +8 -0
- package/dist/shared/media/media.query.d.ts.map +1 -0
- package/dist/shared/media/node/index.d.ts +9 -0
- package/dist/shared/media/node/index.d.ts.map +1 -0
- package/dist/shared/media/node/media.access.d.ts +40 -0
- package/dist/shared/media/node/media.access.d.ts.map +1 -0
- package/dist/shared/media/node/media.service.d.ts +30 -0
- package/dist/shared/media/node/media.service.d.ts.map +1 -0
- package/package.json +8 -1
- package/src/browser.ts +11 -0
- package/src/node/telegram/api-client.ts +146 -0
- package/src/node/telegram/chunk-locator.ts +23 -0
- package/src/node/telegram/chunk.ts +33 -0
- package/src/node/telegram/index.ts +20 -0
- package/src/node/telegram/storage-provider.ts +182 -0
- package/src/node/telegram/types.ts +82 -0
- package/src/node.ts +36 -0
- package/src/shared/media/README.md +109 -0
- package/src/shared/media/index.ts +19 -0
- package/src/shared/media/media.build.ts +69 -0
- package/src/shared/media/media.interface.ts +45 -0
- package/src/shared/media/media.mime.ts +64 -0
- package/src/shared/media/media.name.ts +33 -0
- package/src/shared/media/media.query.ts +13 -0
- package/src/shared/media/node/index.ts +13 -0
- package/src/shared/media/node/media.access.ts +148 -0
- package/src/shared/media/node/media.service.ts +129 -0
- package/dist/chunks/task-queue-Gi4DSq74.js.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { M as MAX_POLL_TARGET_LIST_SIZE, V as validateWithSchema, g as createLogger, z as pollTargetList, k as generateResponse, h as createTarget, K as supabase, w as logManager, X as createScope, d as LogLevel, Y as patchScope, J as scanTargetList, Z as withModule, l as getPossibleTarget, t as isOptimisticLockResponse, R as updateTargetDetails } from './chunks/list.api-BzbTJBsM.js';
|
|
3
|
-
export { B as BaseValidator, C as CREATE_TARGET_ALREADY_EXISTS_MESSAGE, a as CategoryList, L as LOG_BATCH_LOADER_KEY, b as LOG_MIN_LEVEL_ENV_KEY, c as LOG_PERSIST_LOADER_KEY, e as MAX_TARGET_LIST_PAGE_SIZE, O as OPTIMISTIC_LOCK_ERROR_CODE, f as OPTIMISTIC_LOCK_FAILED_MESSAGE, P as PostListValidator, S as StatusCode, U as UPDATE_TARGET_NOT_FOUND_MESSAGE, i as deleteTarget, j as formatZodError, m as getTarget, n as getTargetList, o as getTargetTotalCount, p as handleSupabaseError,
|
|
2
|
+
import { M as MAX_POLL_TARGET_LIST_SIZE, V as validateWithSchema, g as createLogger, z as pollTargetList, k as generateResponse, h as createTarget, K as supabase, w as logManager, X as createScope, d as LogLevel, Y as patchScope, J as scanTargetList, Z as withModule, l as getPossibleTarget, E as postTarget, q as isCreateTargetAlreadyExistsError, t as isOptimisticLockResponse, R as updateTargetDetails } from './chunks/list.api-BzbTJBsM.js';
|
|
3
|
+
export { B as BaseValidator, C as CREATE_TARGET_ALREADY_EXISTS_MESSAGE, a as CategoryList, L as LOG_BATCH_LOADER_KEY, b as LOG_MIN_LEVEL_ENV_KEY, c as LOG_PERSIST_LOADER_KEY, e as MAX_TARGET_LIST_PAGE_SIZE, O as OPTIMISTIC_LOCK_ERROR_CODE, f as OPTIMISTIC_LOCK_FAILED_MESSAGE, P as PostListValidator, S as StatusCode, U as UPDATE_TARGET_NOT_FOUND_MESSAGE, i as deleteTarget, j as formatZodError, m as getTarget, n as getTargetList, o as getTargetTotalCount, p as handleSupabaseError, r as isDevEnvironment, s as isOptimisticLockError, u as logDev, v as logDevGroup, x as logMinLevelFromEnv, y as patchTarget, A as postListCreate, D as postLogListCreate, F as postTargetPayloadSchema, G as queryFilterSchema, H as resolveLogMinLevel, I as safeParseWithSchema, N as targetDraftSchema, Q as updateTarget, T as validateWith } from './chunks/list.api-BzbTJBsM.js';
|
|
4
4
|
import { l as loadEnvFiles, b as readEnv, c as requireEnv, d as resolveLogSpoolSpawnEnvForLabel, e as resolveLogSpoolConfig, f as resolveLogSpoolRoot, g as resolveAllLogSpoolProcessRoles, h as logSpoolProcessDir, s as spoolLogger, i as parseLogSpoolBatchFilename, j as computeLogBatchIdempotencyKey, k as buildLogListDraft, n as postLogBatch, a as logSpoolEnabledFromEnv, o as logSpoolConfigFromEnv, L as LOG_SPOOL_SERVICE_ID_ENV, q as ensureLogSpoolFromEnv, t as shutdownLogSpoolFromEnv, u as getLogSpoolStats } from './chunks/enable-C7lFooTG.js';
|
|
5
5
|
export { C as CLI_PROD_FLAG, S as SERVICE_ENV_PROFILE_ENV_KEY, w as SERVICE_ENV_PROFILE_PROD, x as buildLogSpoolSpawnEnv, y as envBool, z as envInt, A as envMs, B as envNumber, D as envPort, E as envProfileFromProcess, F as resolveDefaultEnvFiles, r as resolveProjectRootByPackageName, G as resolveProjectRootFromModule, v as validateLogSpoolPreloadEnv } from './chunks/enable-C7lFooTG.js';
|
|
6
6
|
import { randomBytes, createHash } from 'node:crypto';
|
|
7
7
|
import { readFile, unlink, mkdir, writeFile, rename, access, stat, readdir, constants } from 'node:fs/promises';
|
|
8
8
|
import { dirname, resolve, join, isAbsolute } from 'node:path';
|
|
9
|
-
import {
|
|
10
|
-
export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, b as CategoryLink, d as CategoryParcel, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, P as POST_TASK_DEFAULT_MAX_ATTEMPTS,
|
|
9
|
+
import { bq as sha256Hex, bw as getErrorMessage, bx as LOG_TOPIC_NODE, aU as postRegisterNode, ay as patchChangeNodeStatus, N as NodeStatus, aJ as patchStopNode, aG as patchNodeHeartBeat, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, bg as runRegistrySlotGuardCheck, b6 as registrySlotRuntimePatchFromGuardResult, c as CategoryNode, Z as evaluateBusyNodeLiveness, aI as patchServiceRuntime, an as isLogEntry, F as claimServiceRegistrySlot, m as ServiceRegistryError, $ as fetchWithRetry, aq as isRetryableHttpStatus, _ as fetchBinaryWithRetry, ap as isOpaqueChunkUrl, e as CategoryRepo, ai as guessMediaMime, M as MEDIA_CONTENT_HASH_ALGORITHM, ao as isMediaValue, as as mediaLinkDedupFilters, y as buildMediaLinkDraft, R as ResultCode, by as LOG_TOPIC_TASK, o as TASK_REPO_USAGE, ac as getScanRemoteRepoValues, aC as patchClaimTask, bz as CRITICAL_UNKNOWN_TASK_TRACE_ID, aA as patchChangeTaskStatus, q as TaskStatusAction, bA as toError, b0 as postTaskSchema, bB as createTaskRow, p as TaskStatus } from './chunks/task-queue-DufG7PlX.js';
|
|
10
|
+
export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, b as CategoryLink, d as CategoryParcel, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, i as MEDIA_CONTENT_HASH_PREFIX_LENGTH, j as MEDIA_VALUES, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, k as ParcelManager, l as PostLinkValidator, S as ServiceLifecycleStatus, n as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, r as apiDetailsSchema, s as appendSystemRegistryEmptySlots, t as assertRegistrySlotAvailable, u as assertRegistrySlotOwner, v as buildEmptyServiceSlots, w as buildLinkTargetDraft, x as buildListTargetDraft, z as buildMediaNameFromLocator, B as buildSystemRegistryConfigDetails, G as classifyNetworkError, H as countTasksByType, I as createActiveServiceLifecycle, J as createClaimedRegistrySlotRuntimeState, K as createStorageProviderRegistry, O as createUploadTracker, Q as decodeLogBatch, U as decodeLogBatchList, V as defaultL3ServiceDetails, W as deleteParcel, X as deleteParcelSchema, Y as escapeIlikePattern, a0 as fieldDefinitionSchema, a1 as flattenLogBatch, a2 as flattenLogBatches, a3 as formatNetworkError, a4 as getApi, a5 as getApiSchema, a6 as getConfig, a7 as getConfigSchema, a8 as getExtraction, a9 as getExtractionSchema, aa as getParcel, ab as getParcelSchema, ad as getScanRemoteRepoValuesSchema, ae as getService, af as getServiceSchema, ag as getTargetSystemRegistry, ah as getValueAtPath, aj as installChunkFetchRegistry, ak as isHttpUrl, al as isLocalFilesystemPath, am as isLogBatchList, ar as linkTargetDraftBuildInputSchema, at as parcelDetailsSchema, au as parseLogBatchMeta, av as parseProviderPrefixedUrl, aw as parseServiceSlot, ax as parseServiceSlots, az as patchChangeNodeStatusSchema, aB as patchChangeTaskStatusSchema, aD as patchClaimTaskSchema, aE as patchExtractionObjects, aF as patchExtractionObjectsSchema, aH as patchNodeHeartBeatSchema, aK as patchStopNodeSchema, aL as patchTaskProgress, aM as patchTaskProgressSchema, aN as postApi, aO as postApiSchema, aP as postExtraction, aQ as postExtractionSchema, aR as postLinkCreate, aS as postParcel, aT as postParcelSchema, aV as postRegisterNodeSchema, aW as postService, aX as postServiceInstance, aY as postServiceSchema, aZ as postSystemRegistryConfig, a_ as postSystemRegistryConfigSchema, a$ as postTask, b1 as postTaskWithRetry, b2 as publishParcel, b3 as registerProviderChunkResolver, b4 as registerService, b5 as registerServiceAtStartup, b7 as releaseSystemRegistrySlots, b8 as releaseSystemRegistrySlotsByServiceId, b9 as requestHasBody, ba as resetSystemRegistryConfig, bb as resetSystemRegistryConfigSchema, bc as resolveActiveRegistryServiceId, bd as resolveFetchUrl, be as restoreParcel, bf as restoreParcelById, bh as sanitizeFileName, bi as sanitizeParcelFileName, bj as scanExtractionList, bk as scanExtractionListSchema, bl as schemaDefinitionSchema, bm as serviceDetailsSchema, bn as serviceLifecycleSchema, bo as serviceNodeSnapshotSchema, bp as serviceRuntimeSchema, br as summarizeTaskQueue, bs as systemRegistrySeedSlotSchema, bt as toPostgrestTextArrayLiteral, bu as unregisterService, bv as unregisterServiceAtShutdown } from './chunks/task-queue-DufG7PlX.js';
|
|
11
11
|
import { spawn } from 'node:child_process';
|
|
12
|
+
import { ProxyAgent } from 'undici';
|
|
12
13
|
import { tmpdir } from 'node:os';
|
|
13
14
|
import { pathToFileURL } from 'node:url';
|
|
15
|
+
import { createReadStream } from 'node:fs';
|
|
14
16
|
import 'lodash-es';
|
|
15
17
|
import '@supabase/supabase-js';
|
|
16
|
-
import 'node:fs';
|
|
17
18
|
|
|
18
19
|
var CategoryCommand;
|
|
19
20
|
(function (CategoryCommand) {
|
|
@@ -923,7 +924,7 @@ function createManagedChildProcesses(options) {
|
|
|
923
924
|
});
|
|
924
925
|
}
|
|
925
926
|
|
|
926
|
-
function sleep(ms) {
|
|
927
|
+
function sleep$1(ms) {
|
|
927
928
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
928
929
|
}
|
|
929
930
|
/**
|
|
@@ -937,7 +938,7 @@ async function pollUntil(options) {
|
|
|
937
938
|
if (await options.until()) {
|
|
938
939
|
return;
|
|
939
940
|
}
|
|
940
|
-
await sleep(intervalMs);
|
|
941
|
+
await sleep$1(intervalMs);
|
|
941
942
|
}
|
|
942
943
|
throw new Error(`pollUntil timeout after ${options.timeoutMs}ms`);
|
|
943
944
|
}
|
|
@@ -2611,6 +2612,295 @@ async function runSingleProcessService(options) {
|
|
|
2611
2612
|
}
|
|
2612
2613
|
}
|
|
2613
2614
|
|
|
2615
|
+
const logger$1 = createLogger({ module: "telegram" });
|
|
2616
|
+
let cachedDispatcher;
|
|
2617
|
+
let cachedProxyUrl;
|
|
2618
|
+
/** Per-request undici dispatcher when proxyUrl is set (Supabase stays direct). */
|
|
2619
|
+
function telegramFetchDispatcher(proxyUrl) {
|
|
2620
|
+
if (proxyUrl == null) {
|
|
2621
|
+
return undefined;
|
|
2622
|
+
}
|
|
2623
|
+
if (cachedDispatcher != null && cachedProxyUrl === proxyUrl) {
|
|
2624
|
+
return cachedDispatcher;
|
|
2625
|
+
}
|
|
2626
|
+
cachedDispatcher = new ProxyAgent(proxyUrl);
|
|
2627
|
+
cachedProxyUrl = proxyUrl;
|
|
2628
|
+
return cachedDispatcher;
|
|
2629
|
+
}
|
|
2630
|
+
function telegramNetworkHint(proxyUrl) {
|
|
2631
|
+
return proxyUrl
|
|
2632
|
+
? ` (proxy=${proxyUrl}, ensure Clash/V2Ray is running)`
|
|
2633
|
+
: " (set proxyUrl / TELEGRAM_PROXY if api.telegram.org is blocked)";
|
|
2634
|
+
}
|
|
2635
|
+
function botApiUrl(options, method) {
|
|
2636
|
+
return `${options.apiBaseUrl}/bot${options.botToken}/${method}`;
|
|
2637
|
+
}
|
|
2638
|
+
function telegramFileDownloadUrl(options, filePath) {
|
|
2639
|
+
const normalized = filePath.replace(/^\/+/, "");
|
|
2640
|
+
return `${options.apiBaseUrl}/file/bot${options.botToken}/${normalized}`;
|
|
2641
|
+
}
|
|
2642
|
+
function sleep(ms) {
|
|
2643
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2644
|
+
}
|
|
2645
|
+
function telegramBackoff(attempt, retryBaseMs) {
|
|
2646
|
+
return sleep(retryBaseMs * 2 ** (attempt - 1));
|
|
2647
|
+
}
|
|
2648
|
+
/** Bot API JSON call — transport retry via SDK fetch; outer loop retries Telegram `{ ok: false }`. */
|
|
2649
|
+
async function callTelegramApi(options, method, initOrFactory, callOptions = {}) {
|
|
2650
|
+
const timeoutMs = callOptions.timeoutMs ?? options.fetchTimeoutMs;
|
|
2651
|
+
const maxAttempts = callOptions.retryAttempts ?? 1;
|
|
2652
|
+
const retryBaseMs = callOptions.retryBaseMs ?? options.uploadRetryBaseMs;
|
|
2653
|
+
const url = botApiUrl(options, method);
|
|
2654
|
+
const label = `Telegram ${method}`;
|
|
2655
|
+
const dispatcher = telegramFetchDispatcher(options.proxyUrl);
|
|
2656
|
+
const hint = telegramNetworkHint(options.proxyUrl);
|
|
2657
|
+
let lastError = null;
|
|
2658
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
2659
|
+
const response = await fetchWithRetry(url, initOrFactory, {
|
|
2660
|
+
label,
|
|
2661
|
+
timeoutMs,
|
|
2662
|
+
maxAttempts: attempt === 1 ? maxAttempts : 1,
|
|
2663
|
+
retryBaseMs,
|
|
2664
|
+
dispatcher,
|
|
2665
|
+
hint,
|
|
2666
|
+
logger: logger$1,
|
|
2667
|
+
});
|
|
2668
|
+
let payload;
|
|
2669
|
+
try {
|
|
2670
|
+
payload = (await response.json());
|
|
2671
|
+
}
|
|
2672
|
+
catch {
|
|
2673
|
+
lastError = new Error(`${label}: invalid JSON response (HTTP ${response.status})`);
|
|
2674
|
+
if (attempt < maxAttempts && isRetryableHttpStatus(response.status)) {
|
|
2675
|
+
await telegramBackoff(attempt, retryBaseMs);
|
|
2676
|
+
continue;
|
|
2677
|
+
}
|
|
2678
|
+
throw lastError;
|
|
2679
|
+
}
|
|
2680
|
+
if (!payload.ok) {
|
|
2681
|
+
const description = payload.description ?? `HTTP ${response.status}`;
|
|
2682
|
+
lastError = new Error(`${label}: ${description}`);
|
|
2683
|
+
if (attempt < maxAttempts && isRetryableHttpStatus(response.status)) {
|
|
2684
|
+
logger$1.warn("retrying after API error", {
|
|
2685
|
+
topic: "telegram",
|
|
2686
|
+
data: { method, attempt, description },
|
|
2687
|
+
});
|
|
2688
|
+
await telegramBackoff(attempt, retryBaseMs);
|
|
2689
|
+
continue;
|
|
2690
|
+
}
|
|
2691
|
+
throw lastError;
|
|
2692
|
+
}
|
|
2693
|
+
if (payload.result == null) {
|
|
2694
|
+
throw new Error(`${label}: empty result in response`);
|
|
2695
|
+
}
|
|
2696
|
+
if (attempt > 1) {
|
|
2697
|
+
logger$1.info("request succeeded after retry", { topic: "telegram", data: { method, attempt } });
|
|
2698
|
+
}
|
|
2699
|
+
return payload.result;
|
|
2700
|
+
}
|
|
2701
|
+
throw lastError ?? new Error(`${label}: request failed`);
|
|
2702
|
+
}
|
|
2703
|
+
async function telegramDownloadBinary(options, url, label, callOptions = {}) {
|
|
2704
|
+
const dispatcher = telegramFetchDispatcher(options.proxyUrl);
|
|
2705
|
+
return fetchBinaryWithRetry(url, { method: "GET" }, {
|
|
2706
|
+
label: `Telegram ${label}`,
|
|
2707
|
+
timeoutMs: callOptions.timeoutMs ?? options.fetchTimeoutMs,
|
|
2708
|
+
maxAttempts: callOptions.retryAttempts ?? 1,
|
|
2709
|
+
retryBaseMs: callOptions.retryBaseMs ?? options.uploadRetryBaseMs,
|
|
2710
|
+
dispatcher,
|
|
2711
|
+
hint: telegramNetworkHint(options.proxyUrl),
|
|
2712
|
+
logger: logger$1,
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
/** Download chunk bytes by Telegram `file_id` stored in Chunk.url. */
|
|
2717
|
+
async function downloadTelegramChunk(options, fileId) {
|
|
2718
|
+
const file = await callTelegramApi(options, `getFile?file_id=${encodeURIComponent(fileId)}`, { method: "GET" }, {
|
|
2719
|
+
retryAttempts: options.uploadRetryAttempts,
|
|
2720
|
+
retryBaseMs: options.uploadRetryBaseMs,
|
|
2721
|
+
});
|
|
2722
|
+
if (file.file_path == null || file.file_path === "") {
|
|
2723
|
+
throw new Error(`Telegram getFile: missing file_path for file_id ${fileId}`);
|
|
2724
|
+
}
|
|
2725
|
+
return telegramDownloadBinary(options, telegramFileDownloadUrl(options, file.file_path), `download:${fileId.slice(0, 12)}…`, {
|
|
2726
|
+
timeoutMs: options.uploadTimeoutMs,
|
|
2727
|
+
retryAttempts: options.uploadRetryAttempts,
|
|
2728
|
+
retryBaseMs: options.uploadRetryBaseMs,
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
/**
|
|
2733
|
+
* Telegram chunk URL encoding: `${messageId}|${fileId}`.
|
|
2734
|
+
* Legacy parcels store bare `file_id` (no messageId → cannot deleteMessage).
|
|
2735
|
+
*/
|
|
2736
|
+
const SEPARATOR = "|";
|
|
2737
|
+
function encodeTelegramChunkUrl(messageId, fileId) {
|
|
2738
|
+
return `${messageId}${SEPARATOR}${fileId}`;
|
|
2739
|
+
}
|
|
2740
|
+
function parseTelegramChunkUrl(locator) {
|
|
2741
|
+
const idx = locator.indexOf(SEPARATOR);
|
|
2742
|
+
if (idx <= 0) {
|
|
2743
|
+
return { messageId: null, fileId: locator };
|
|
2744
|
+
}
|
|
2745
|
+
const mid = Number(locator.slice(0, idx));
|
|
2746
|
+
const fileId = locator.slice(idx + 1);
|
|
2747
|
+
if (!Number.isInteger(mid) || mid <= 0 || fileId === "") {
|
|
2748
|
+
return { messageId: null, fileId: locator };
|
|
2749
|
+
}
|
|
2750
|
+
return { messageId: mid, fileId };
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
function resolveTelegramStorageOptions(options) {
|
|
2754
|
+
const botToken = options.botToken.trim();
|
|
2755
|
+
const chatId = options.chatId.trim();
|
|
2756
|
+
if (botToken === "") {
|
|
2757
|
+
throw new Error("TelegramStorageProviderOptions.botToken is required");
|
|
2758
|
+
}
|
|
2759
|
+
if (chatId === "") {
|
|
2760
|
+
throw new Error("TelegramStorageProviderOptions.chatId is required");
|
|
2761
|
+
}
|
|
2762
|
+
const apiBaseUrl = (options.apiBaseUrl?.trim() || "https://api.telegram.org").replace(/\/$/, "");
|
|
2763
|
+
const proxyUrl = options.proxyUrl?.trim() || undefined;
|
|
2764
|
+
return {
|
|
2765
|
+
botToken,
|
|
2766
|
+
chatId,
|
|
2767
|
+
apiBaseUrl,
|
|
2768
|
+
proxyUrl: proxyUrl !== "" ? proxyUrl : undefined,
|
|
2769
|
+
fetchTimeoutMs: options.fetchTimeoutMs ?? 30_000,
|
|
2770
|
+
uploadTimeoutMs: options.uploadTimeoutMs ?? 120_000,
|
|
2771
|
+
uploadRetryAttempts: options.uploadRetryAttempts ?? 3,
|
|
2772
|
+
uploadRetryBaseMs: options.uploadRetryBaseMs ?? 2_000,
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
const PROVIDER_TELEGRAM = "telegram";
|
|
2777
|
+
async function uploadChunkToTelegram(options, data, filename) {
|
|
2778
|
+
const sizeMb = (data.byteLength / (1024 * 1024)).toFixed(2);
|
|
2779
|
+
const message = await callTelegramApi(options, "sendDocument", () => {
|
|
2780
|
+
const form = new FormData();
|
|
2781
|
+
form.append("chat_id", options.chatId);
|
|
2782
|
+
form.append("document", new Blob([data]), filename);
|
|
2783
|
+
return { method: "POST", body: form };
|
|
2784
|
+
}, {
|
|
2785
|
+
timeoutMs: options.uploadTimeoutMs,
|
|
2786
|
+
retryAttempts: options.uploadRetryAttempts,
|
|
2787
|
+
retryBaseMs: options.uploadRetryBaseMs,
|
|
2788
|
+
});
|
|
2789
|
+
const fileId = message.document?.file_id;
|
|
2790
|
+
if (fileId == null || fileId === "") {
|
|
2791
|
+
throw new Error(`Telegram sendDocument: missing file_id (chunk ${filename}, ${sizeMb} MB)`);
|
|
2792
|
+
}
|
|
2793
|
+
return { fileId, messageId: message.message_id };
|
|
2794
|
+
}
|
|
2795
|
+
async function deleteTelegramMessage(options, messageId) {
|
|
2796
|
+
await callTelegramApi(options, "deleteMessage", () => {
|
|
2797
|
+
const form = new FormData();
|
|
2798
|
+
form.append("chat_id", options.chatId);
|
|
2799
|
+
form.append("message_id", String(messageId));
|
|
2800
|
+
return { method: "POST", body: form };
|
|
2801
|
+
}, {
|
|
2802
|
+
retryAttempts: 3,
|
|
2803
|
+
retryBaseMs: 1_000,
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
async function rollbackTelegramUploads(options, handles) {
|
|
2807
|
+
for (const item of handles) {
|
|
2808
|
+
const upload = item;
|
|
2809
|
+
if (upload?.messageId == null) {
|
|
2810
|
+
continue;
|
|
2811
|
+
}
|
|
2812
|
+
try {
|
|
2813
|
+
await deleteTelegramMessage(options, upload.messageId);
|
|
2814
|
+
}
|
|
2815
|
+
catch {
|
|
2816
|
+
// Best-effort cleanup
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
function assertTelegramParcel(parcel) {
|
|
2821
|
+
const chunks = parcel.details.chunkList;
|
|
2822
|
+
if (chunks.length === 0) {
|
|
2823
|
+
throw new Error("Parcel has no chunks");
|
|
2824
|
+
}
|
|
2825
|
+
const nonTelegram = chunks.filter((chunk) => chunk.provider != null && chunk.provider !== PROVIDER_TELEGRAM);
|
|
2826
|
+
if (nonTelegram.length > 0) {
|
|
2827
|
+
const providers = [...new Set(nonTelegram.map((chunk) => chunk.provider))];
|
|
2828
|
+
throw new Error(`Parcel is not telegram-only (found providers: ${providers.join(", ")}). ` +
|
|
2829
|
+
"Multi-provider restore is not yet supported for this parcel.");
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
/**
|
|
2833
|
+
* Build a Telegram {@link StorageProviderModule}. Caller registers it — no side effects.
|
|
2834
|
+
*
|
|
2835
|
+
* @example
|
|
2836
|
+
* ```ts
|
|
2837
|
+
* import { createStorageProviderRegistry, createTelegramStorageProvider } from "target-supabase-sdk/node";
|
|
2838
|
+
* const registry = createStorageProviderRegistry();
|
|
2839
|
+
* registry.register(createTelegramStorageProvider({ botToken, chatId, proxyUrl }));
|
|
2840
|
+
* ```
|
|
2841
|
+
*/
|
|
2842
|
+
function createTelegramStorageProvider(input) {
|
|
2843
|
+
const options = resolveTelegramStorageOptions(input);
|
|
2844
|
+
return {
|
|
2845
|
+
provider: PROVIDER_TELEGRAM,
|
|
2846
|
+
uploadChunk: (data, filename) => uploadChunkToTelegram(options, data, filename),
|
|
2847
|
+
deleteMessage: (messageId) => deleteTelegramMessage(options, messageId),
|
|
2848
|
+
async deleteChunkBlobs(parcel) {
|
|
2849
|
+
let deleted = 0;
|
|
2850
|
+
let failed = 0;
|
|
2851
|
+
let skipped = 0;
|
|
2852
|
+
for (const chunk of parcel.details.chunkList) {
|
|
2853
|
+
if (chunk.provider != null && chunk.provider !== PROVIDER_TELEGRAM) {
|
|
2854
|
+
skipped += 1;
|
|
2855
|
+
continue;
|
|
2856
|
+
}
|
|
2857
|
+
const { messageId } = parseTelegramChunkUrl(chunk.url);
|
|
2858
|
+
if (messageId == null) {
|
|
2859
|
+
skipped += 1;
|
|
2860
|
+
continue;
|
|
2861
|
+
}
|
|
2862
|
+
try {
|
|
2863
|
+
await deleteTelegramMessage(options, messageId);
|
|
2864
|
+
deleted += 1;
|
|
2865
|
+
}
|
|
2866
|
+
catch {
|
|
2867
|
+
failed += 1;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
return { deleted, failed, skipped };
|
|
2871
|
+
},
|
|
2872
|
+
createUploadAdapter(adapterOptions) {
|
|
2873
|
+
const tracker = adapterOptions?.tracker;
|
|
2874
|
+
return {
|
|
2875
|
+
provider: PROVIDER_TELEGRAM,
|
|
2876
|
+
async upload(data, pathOrKey) {
|
|
2877
|
+
const result = await uploadChunkToTelegram(options, data, pathOrKey);
|
|
2878
|
+
tracker?.push(result);
|
|
2879
|
+
// Persist messageId so later deleteParcel can call deleteMessage.
|
|
2880
|
+
return { url: encodeTelegramChunkUrl(result.messageId, result.fileId) };
|
|
2881
|
+
},
|
|
2882
|
+
};
|
|
2883
|
+
},
|
|
2884
|
+
resolveChunk: (locator) => {
|
|
2885
|
+
const { fileId } = parseTelegramChunkUrl(locator);
|
|
2886
|
+
return downloadTelegramChunk(options, fileId);
|
|
2887
|
+
},
|
|
2888
|
+
matchesOpaqueUrl: isOpaqueChunkUrl,
|
|
2889
|
+
async probe() {
|
|
2890
|
+
try {
|
|
2891
|
+
const me = await callTelegramApi(options, "getMe", { method: "GET" });
|
|
2892
|
+
return { ok: true, detail: { username: me.username ?? "unknown" } };
|
|
2893
|
+
}
|
|
2894
|
+
catch (error) {
|
|
2895
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2896
|
+
return { ok: false, error: message };
|
|
2897
|
+
}
|
|
2898
|
+
},
|
|
2899
|
+
rollbackUpload: (handles) => rollbackTelegramUploads(options, handles),
|
|
2900
|
+
assertParcelRestorable: assertTelegramParcel,
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2614
2904
|
/** Supabase `target.category` for rows that store task script payloads */
|
|
2615
2905
|
const TASK_REPO_SCRIPT_CATEGORY = "script";
|
|
2616
2906
|
/** Host app config directory (relative to `cwd`) — recommended for library consumers */
|
|
@@ -3125,6 +3415,211 @@ async function shutdownLogSpool() {
|
|
|
3125
3415
|
await shutdownLogSpoolFromEnv();
|
|
3126
3416
|
}
|
|
3127
3417
|
|
|
3418
|
+
function sameStorageHost(storageProvider, localStorageProvider) {
|
|
3419
|
+
return storageProvider.trim() === localStorageProvider.trim();
|
|
3420
|
+
}
|
|
3421
|
+
async function sha256FileStreaming(absolutePath) {
|
|
3422
|
+
return await new Promise((resolveHash, reject) => {
|
|
3423
|
+
const hash = createHash(MEDIA_CONTENT_HASH_ALGORITHM);
|
|
3424
|
+
const stream = createReadStream(absolutePath);
|
|
3425
|
+
stream.on("data", (chunk) => {
|
|
3426
|
+
hash.update(chunk);
|
|
3427
|
+
});
|
|
3428
|
+
stream.on("error", reject);
|
|
3429
|
+
stream.on("end", () => {
|
|
3430
|
+
resolveHash(hash.digest("hex"));
|
|
3431
|
+
});
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
async function countFilesOneLevel(dirPath) {
|
|
3435
|
+
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
3436
|
+
let count = 0;
|
|
3437
|
+
for (const entry of entries) {
|
|
3438
|
+
if (entry.isFile()) {
|
|
3439
|
+
count += 1;
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
return count;
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* Fast local reachability check for a media locator.
|
|
3446
|
+
*
|
|
3447
|
+
* - Requires `storageProvider === localStorageProvider` (cross-host → not ok).
|
|
3448
|
+
* - `locator` must be an absolute path.
|
|
3449
|
+
* - `image-list`: directory exists; only immediate children are considered.
|
|
3450
|
+
* - other values: path exists and is a non-empty file.
|
|
3451
|
+
*
|
|
3452
|
+
* **Node-only** — under `shared/media/node/`; do not import from the browser entry.
|
|
3453
|
+
*/
|
|
3454
|
+
async function checkMediaAvailability(input) {
|
|
3455
|
+
const storageProvider = input.storageProvider.trim();
|
|
3456
|
+
const localStorageProvider = input.localStorageProvider.trim();
|
|
3457
|
+
const locator = input.locator.trim();
|
|
3458
|
+
if (storageProvider === "" || localStorageProvider === "") {
|
|
3459
|
+
return { ok: false, reason: "storageProvider and localStorageProvider are required" };
|
|
3460
|
+
}
|
|
3461
|
+
if (locator === "") {
|
|
3462
|
+
return { ok: false, reason: "locator is empty" };
|
|
3463
|
+
}
|
|
3464
|
+
if (!sameStorageHost(storageProvider, localStorageProvider)) {
|
|
3465
|
+
return {
|
|
3466
|
+
ok: false,
|
|
3467
|
+
reason: `storageProvider not on this host (${storageProvider} !== ${localStorageProvider})`,
|
|
3468
|
+
};
|
|
3469
|
+
}
|
|
3470
|
+
if (!isAbsolute(locator)) {
|
|
3471
|
+
return { ok: false, reason: `locator must be an absolute path: ${locator}` };
|
|
3472
|
+
}
|
|
3473
|
+
const absolutePath = resolve(locator);
|
|
3474
|
+
try {
|
|
3475
|
+
const info = await stat(absolutePath);
|
|
3476
|
+
if (input.value === "image-list") {
|
|
3477
|
+
if (!info.isDirectory()) {
|
|
3478
|
+
return { ok: false, reason: `image-list locator is not a directory: ${absolutePath}` };
|
|
3479
|
+
}
|
|
3480
|
+
return { ok: true, absolutePath };
|
|
3481
|
+
}
|
|
3482
|
+
if (!info.isFile()) {
|
|
3483
|
+
return { ok: false, reason: `locator is not a file: ${absolutePath}` };
|
|
3484
|
+
}
|
|
3485
|
+
if (info.size <= 0) {
|
|
3486
|
+
return { ok: false, reason: `file is empty: ${absolutePath}` };
|
|
3487
|
+
}
|
|
3488
|
+
return { ok: true, absolutePath };
|
|
3489
|
+
}
|
|
3490
|
+
catch (error) {
|
|
3491
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3492
|
+
return { ok: false, reason: `locator not reachable: ${absolutePath} (${message})` };
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* Derive `contentHash` / `size` / `mimeType` for {@link MediaOriginal} after availability succeeds.
|
|
3497
|
+
*
|
|
3498
|
+
* **Node-only** — under `shared/media/node/`; do not import from the browser entry.
|
|
3499
|
+
*/
|
|
3500
|
+
async function probeMediaOriginal(input) {
|
|
3501
|
+
const storageProvider = input.storageProvider.trim();
|
|
3502
|
+
const locator = input.locator.trim();
|
|
3503
|
+
if (input.value === "image-list") {
|
|
3504
|
+
const size = await countFilesOneLevel(input.absolutePath);
|
|
3505
|
+
return {
|
|
3506
|
+
storageProvider,
|
|
3507
|
+
locator,
|
|
3508
|
+
contentHash: "",
|
|
3509
|
+
size,
|
|
3510
|
+
mimeType: "",
|
|
3511
|
+
};
|
|
3512
|
+
}
|
|
3513
|
+
const info = await stat(input.absolutePath);
|
|
3514
|
+
const mimeType = guessMediaMime(input.absolutePath, input.value);
|
|
3515
|
+
if (mimeType == null) {
|
|
3516
|
+
throw new Error(`probeMediaOriginal: cannot guess mimeType for ${input.value}: ${input.absolutePath}`);
|
|
3517
|
+
}
|
|
3518
|
+
const contentHash = await sha256FileStreaming(input.absolutePath);
|
|
3519
|
+
return {
|
|
3520
|
+
storageProvider,
|
|
3521
|
+
locator,
|
|
3522
|
+
contentHash,
|
|
3523
|
+
size: info.size,
|
|
3524
|
+
mimeType,
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
const logger = createLogger({ module: "media" });
|
|
3529
|
+
/** Dedup lookup: same `category` + `value` + `name`. */
|
|
3530
|
+
async function findMediaLink(input) {
|
|
3531
|
+
if (!isMediaValue(input.value)) {
|
|
3532
|
+
throw new Error(`findMediaLink: unsupported media value: ${String(input.value)}`);
|
|
3533
|
+
}
|
|
3534
|
+
const name = input.name.trim();
|
|
3535
|
+
if (name === "") {
|
|
3536
|
+
throw new Error("findMediaLink: name is empty");
|
|
3537
|
+
}
|
|
3538
|
+
const { data } = await getPossibleTarget({
|
|
3539
|
+
filterList: mediaLinkDedupFilters({ value: input.value, name }),
|
|
3540
|
+
});
|
|
3541
|
+
return data != null ? data : null;
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Register a media Link: dedup → availability → probe → `postTarget`.
|
|
3545
|
+
* Idempotent when `category`+`value`+`name` already exist.
|
|
3546
|
+
*
|
|
3547
|
+
* **Node-only** — under `shared/media/node/`; do not import from the browser entry.
|
|
3548
|
+
*/
|
|
3549
|
+
async function registerMediaLink(input) {
|
|
3550
|
+
if (!isMediaValue(input.value)) {
|
|
3551
|
+
throw new Error(`registerMediaLink: unsupported media value: ${String(input.value)}`);
|
|
3552
|
+
}
|
|
3553
|
+
const name = input.name.trim();
|
|
3554
|
+
if (name === "") {
|
|
3555
|
+
throw new Error("registerMediaLink: name is empty");
|
|
3556
|
+
}
|
|
3557
|
+
const existing = await findMediaLink({ value: input.value, name });
|
|
3558
|
+
if (existing != null) {
|
|
3559
|
+
logger.info("media already registered", {
|
|
3560
|
+
topic: "dedup",
|
|
3561
|
+
data: { id: existing.id, value: input.value, name },
|
|
3562
|
+
});
|
|
3563
|
+
return { id: existing.id, created: false };
|
|
3564
|
+
}
|
|
3565
|
+
const availability = await checkMediaAvailability({
|
|
3566
|
+
value: input.value,
|
|
3567
|
+
storageProvider: input.storageProvider,
|
|
3568
|
+
locator: input.locator,
|
|
3569
|
+
localStorageProvider: input.localStorageProvider,
|
|
3570
|
+
});
|
|
3571
|
+
if (!availability.ok || availability.absolutePath == null) {
|
|
3572
|
+
throw new Error(`registerMediaLink: unavailable — ${availability.reason ?? "unknown"}`);
|
|
3573
|
+
}
|
|
3574
|
+
const probed = await probeMediaOriginal({
|
|
3575
|
+
value: input.value,
|
|
3576
|
+
storageProvider: input.storageProvider,
|
|
3577
|
+
locator: input.locator,
|
|
3578
|
+
absolutePath: availability.absolutePath,
|
|
3579
|
+
});
|
|
3580
|
+
const draft = buildMediaLinkDraft({
|
|
3581
|
+
value: input.value,
|
|
3582
|
+
name,
|
|
3583
|
+
storageProvider: probed.storageProvider,
|
|
3584
|
+
locator: probed.locator,
|
|
3585
|
+
contentHash: probed.contentHash,
|
|
3586
|
+
size: probed.size,
|
|
3587
|
+
mimeType: probed.mimeType,
|
|
3588
|
+
description: input.description,
|
|
3589
|
+
tagList: input.tagList,
|
|
3590
|
+
});
|
|
3591
|
+
try {
|
|
3592
|
+
const { data, error } = await postTarget({
|
|
3593
|
+
name: draft.name,
|
|
3594
|
+
value: draft.value,
|
|
3595
|
+
category: draft.category,
|
|
3596
|
+
tagList: draft.tagList,
|
|
3597
|
+
details: draft.details,
|
|
3598
|
+
});
|
|
3599
|
+
if (error != null || data == null) {
|
|
3600
|
+
throw new Error(error?.message ?? "registerMediaLink: postTarget failed");
|
|
3601
|
+
}
|
|
3602
|
+
logger.info("media registered", {
|
|
3603
|
+
topic: "register",
|
|
3604
|
+
data: { id: data.id, value: input.value, name, size: probed.size },
|
|
3605
|
+
});
|
|
3606
|
+
return { id: data.id, created: true };
|
|
3607
|
+
}
|
|
3608
|
+
catch (error) {
|
|
3609
|
+
if (isCreateTargetAlreadyExistsError(error)) {
|
|
3610
|
+
const raced = await findMediaLink({ value: input.value, name });
|
|
3611
|
+
if (raced != null) {
|
|
3612
|
+
logger.info("media register race — using existing", {
|
|
3613
|
+
topic: "dedup",
|
|
3614
|
+
data: { id: raced.id, value: input.value, name },
|
|
3615
|
+
});
|
|
3616
|
+
return { id: raced.id, created: false };
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
throw error;
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3128
3623
|
const EMPTY_RESULT = {
|
|
3129
3624
|
status: "not_configured",
|
|
3130
3625
|
registered: [],
|
|
@@ -4036,5 +4531,5 @@ const patchTriggerFired = validateWithSchema(patchTriggerFiredSchema, "patchTrig
|
|
|
4036
4531
|
}
|
|
4037
4532
|
});
|
|
4038
4533
|
|
|
4039
|
-
export { BaseNodeRuntime, COLLECT_LOG_RUNNER_KEY, CategoryCommand, CategoryNode, CategoryRepo, CategoryTrigger, CommandType, EMPTY_REGISTRY_SLOT_RUNTIME_STATE, LOG_SPOOL_SERVICE_ID_ENV, LOG_TOPIC_TRIGGER, LogLevel, MAX_POLL_TARGET_LIST_SIZE, ManagedChildProcesses, NodeStatus, RepoManager, ResultCode, SERVICE_GUARD_RUNNER_KEY, ServiceGuardNode, ServiceRegistryError, TASK_LOCAL_PACKAGE_CONFIG_FILENAME, TASK_REPO_SCRIPT_CATEGORY, TASK_REPO_USAGE, TASK_RUNNER_CONFIG_DIR, TASK_RUNNER_ROOT_CONFIG_FILENAME, TASK_RUNNER_ROOT_CONFIG_LEGACY_RELATIVE_PATH, TASK_RUNNER_ROOT_CONFIG_RELATIVE_PATH, TRIGGER_LOOP_INTERVAL_MS, TRIGGER_RUNNER_DEFAULT_RETRY_COUNT, TRIGGER_RUNNER_DEFAULT_RETRY_DELAY_MS, TaskManager, TaskNode, TaskRepoValidation, TaskStatus, TaskStatusAction, TriggerManager, TriggerNode, TriggerStatus, applyRegistrySlotGuardStep, buildNodeImportArgs, claimServiceRegistrySlot, createJsonFileStateStore, createL3ChildLauncher, createLogSpoolCoordinator, createLogger, createManagedChildProcesses, createPathsExistCheck, createRequiredEnvCheck, createServiceHost, createServiceRuntimeStateStore, createSupabaseReachableCheck, createTarget, enableLogSpoolFromEnvInChild, ensureLogSpoolFromEnv, evaluateBusyNodeLiveness, generateResponse, getConfigFileDir, getLogSpoolStats, getMainLogSpoolWriterStats, getPollCommandList, getPollCommandListSchema, getPossibleTarget, getScanRemoteRepoValues, guardRetryAfterSec, importJsConfigModule, initSupabaseFromStandardEnv, isChildProcessRunning, isGuardAvailable, isLogEntry, isLogSpoolEnabled, isOptimisticLockResponse, loadCachedJsConfigModule, loadEnvFiles, logManager, logSpoolEnabledFromEnv, markWorkerSpawned, nodeBufferToArrayBuffer, patchChangeNodeStatus, patchChangeTaskStatus, patchClaimTask, patchNodeHeartBeat, patchServiceRuntime, patchStopNode, patchTriggerFired, patchTriggerFiredSchema, pathExists, pollTargetList, pollUntil, postCommand, postCommandSchema, postRegisterNode, postTaskSchema, postTaskWithValidation, postTrigger, postTriggerSchema, publicBaseUrlFromEnv, readAndVerifySourceFile, readEnv, registerCollectLogRunner, registerServiceGuardRunner, registrySlotRuntimePatchFromGuardResult, requireEnv, resolveFirstExistingPath, resolveLogSpoolRoot, resolvePathFromBaseDir, resolvePathFromConfigFile, resolvePathFromCwd, runCollectLogTick, runReadinessChecks, runReadinessGate, runRegistrySlotGuardCheck, runServiceGuardTick, runSingleProcessService, scanEnabledTriggers, scanEnabledTriggersSchema, scanTargetList, sha256Hex, shutdownLogSpool, shutdownLogSpoolFromEnv, spawnTsxChild, supabase, toFileImportHref, updateTargetDetails, validateTaskRepoAndParams, validateWithSchema, waitForServiceReady };
|
|
4534
|
+
export { BaseNodeRuntime, COLLECT_LOG_RUNNER_KEY, CategoryCommand, CategoryNode, CategoryRepo, CategoryTrigger, CommandType, EMPTY_REGISTRY_SLOT_RUNTIME_STATE, LOG_SPOOL_SERVICE_ID_ENV, LOG_TOPIC_TRIGGER, LogLevel, MAX_POLL_TARGET_LIST_SIZE, MEDIA_CONTENT_HASH_ALGORITHM, ManagedChildProcesses, NodeStatus, PROVIDER_TELEGRAM, RepoManager, ResultCode, SERVICE_GUARD_RUNNER_KEY, ServiceGuardNode, ServiceRegistryError, TASK_LOCAL_PACKAGE_CONFIG_FILENAME, TASK_REPO_SCRIPT_CATEGORY, TASK_REPO_USAGE, TASK_RUNNER_CONFIG_DIR, TASK_RUNNER_ROOT_CONFIG_FILENAME, TASK_RUNNER_ROOT_CONFIG_LEGACY_RELATIVE_PATH, TASK_RUNNER_ROOT_CONFIG_RELATIVE_PATH, TRIGGER_LOOP_INTERVAL_MS, TRIGGER_RUNNER_DEFAULT_RETRY_COUNT, TRIGGER_RUNNER_DEFAULT_RETRY_DELAY_MS, TaskManager, TaskNode, TaskRepoValidation, TaskStatus, TaskStatusAction, TriggerManager, TriggerNode, TriggerStatus, applyRegistrySlotGuardStep, buildMediaLinkDraft, buildNodeImportArgs, callTelegramApi, checkMediaAvailability, claimServiceRegistrySlot, createJsonFileStateStore, createL3ChildLauncher, createLogSpoolCoordinator, createLogger, createManagedChildProcesses, createPathsExistCheck, createRequiredEnvCheck, createServiceHost, createServiceRuntimeStateStore, createSupabaseReachableCheck, createTarget, createTelegramStorageProvider, downloadTelegramChunk, enableLogSpoolFromEnvInChild, encodeTelegramChunkUrl, ensureLogSpoolFromEnv, evaluateBusyNodeLiveness, fetchBinaryWithRetry, fetchWithRetry, findMediaLink, generateResponse, getConfigFileDir, getLogSpoolStats, getMainLogSpoolWriterStats, getPollCommandList, getPollCommandListSchema, getPossibleTarget, getScanRemoteRepoValues, guardRetryAfterSec, guessMediaMime, importJsConfigModule, initSupabaseFromStandardEnv, isChildProcessRunning, isCreateTargetAlreadyExistsError, isGuardAvailable, isLogEntry, isLogSpoolEnabled, isMediaValue, isOpaqueChunkUrl, isOptimisticLockResponse, isRetryableHttpStatus, loadCachedJsConfigModule, loadEnvFiles, logManager, logSpoolEnabledFromEnv, markWorkerSpawned, mediaLinkDedupFilters, nodeBufferToArrayBuffer, parseTelegramChunkUrl, patchChangeNodeStatus, patchChangeTaskStatus, patchClaimTask, patchNodeHeartBeat, patchServiceRuntime, patchStopNode, patchTriggerFired, patchTriggerFiredSchema, pathExists, pollTargetList, pollUntil, postCommand, postCommandSchema, postRegisterNode, postTarget, postTaskSchema, postTaskWithValidation, postTrigger, postTriggerSchema, probeMediaOriginal, publicBaseUrlFromEnv, readAndVerifySourceFile, readEnv, registerCollectLogRunner, registerMediaLink, registerServiceGuardRunner, registrySlotRuntimePatchFromGuardResult, requireEnv, resolveFirstExistingPath, resolveLogSpoolRoot, resolvePathFromBaseDir, resolvePathFromConfigFile, resolvePathFromCwd, resolveTelegramStorageOptions, runCollectLogTick, runReadinessChecks, runReadinessGate, runRegistrySlotGuardCheck, runServiceGuardTick, runSingleProcessService, scanEnabledTriggers, scanEnabledTriggersSchema, scanTargetList, sha256Hex, shutdownLogSpool, shutdownLogSpoolFromEnv, spawnTsxChild, supabase, telegramDownloadBinary, telegramFileDownloadUrl, toFileImportHref, updateTargetDetails, validateTaskRepoAndParams, validateWithSchema, waitForServiceReady };
|
|
4040
4535
|
//# sourceMappingURL=node.js.map
|