target-supabase-sdk 0.2.12 → 0.2.13
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/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/enable-DqnfLPsQ.js +874 -0
- package/dist/chunks/enable-DqnfLPsQ.js.map +1 -0
- package/dist/chunks/list.api-BzbTJBsM.js.map +1 -1
- package/dist/chunks/{task-queue-H4mpSW8R.js → task-queue-6X3aglJh.js} +108 -3
- package/dist/chunks/task-queue-6X3aglJh.js.map +1 -0
- package/dist/node/preload/run-service-preload.d.ts.map +1 -1
- package/dist/node/preload/service-preload.interface.d.ts +3 -1
- package/dist/node/preload/service-preload.interface.d.ts.map +1 -1
- package/dist/node/process/managed-child-processes.d.ts.map +1 -1
- package/dist/node/service-guard/service-guard-node.d.ts.map +1 -1
- package/dist/node/service-host/index.d.ts +1 -0
- package/dist/node/service-host/index.d.ts.map +1 -1
- package/dist/node/service-host/service-host.d.ts +5 -1
- package/dist/node/service-host/service-host.d.ts.map +1 -1
- package/dist/node.d.ts +10 -5
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +492 -47
- package/dist/node.js.map +1 -1
- package/dist/preload.js +9 -6
- package/dist/preload.js.map +1 -1
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/registry.service.d.ts +19 -0
- package/dist/service/registry.service.d.ts.map +1 -1
- package/dist/shared/log/core/create-logger.d.ts.map +1 -0
- package/dist/shared/log/{log-batch.d.ts → core/log-batch.d.ts} +4 -4
- package/dist/shared/log/core/log-batch.d.ts.map +1 -0
- package/dist/shared/log/core/log-manager.d.ts.map +1 -0
- package/dist/shared/log/core/log-min-level.d.ts.map +1 -0
- package/dist/shared/log/core/log-scope.d.ts.map +1 -0
- package/dist/shared/log/index.d.ts +13 -13
- package/dist/shared/log/index.d.ts.map +1 -1
- package/dist/shared/log/spool/collector.d.ts +21 -0
- package/dist/shared/log/spool/collector.d.ts.map +1 -0
- package/dist/shared/log/spool/config.d.ts +7 -0
- package/dist/shared/log/spool/config.d.ts.map +1 -0
- package/dist/shared/log/spool/coordinator.d.ts +18 -0
- package/dist/shared/log/spool/coordinator.d.ts.map +1 -0
- package/dist/shared/log/spool/enable.d.ts +23 -0
- package/dist/shared/log/spool/enable.d.ts.map +1 -0
- package/dist/shared/log/spool/file.d.ts +21 -0
- package/dist/shared/log/spool/file.d.ts.map +1 -0
- package/dist/shared/log/spool/interface.d.ts +55 -0
- package/dist/shared/log/spool/interface.d.ts.map +1 -0
- package/dist/shared/log/spool/paths.d.ts +6 -0
- package/dist/shared/log/spool/paths.d.ts.map +1 -0
- package/dist/shared/log/spool/process-roles.d.ts +17 -0
- package/dist/shared/log/spool/process-roles.d.ts.map +1 -0
- package/dist/shared/log/spool/register-collect-log-runner.d.ts +15 -0
- package/dist/shared/log/spool/register-collect-log-runner.d.ts.map +1 -0
- package/dist/shared/log/spool/service-lifecycle.d.ts +13 -0
- package/dist/shared/log/spool/service-lifecycle.d.ts.map +1 -0
- package/dist/shared/log/spool/writer.d.ts +32 -0
- package/dist/shared/log/spool/writer.d.ts.map +1 -0
- package/dist/shared/log/{log-persist-batch-id.d.ts → upload/batch-id.d.ts} +3 -3
- package/dist/shared/log/upload/batch-id.d.ts.map +1 -0
- package/dist/shared/log/upload/env.d.ts +7 -0
- package/dist/shared/log/upload/env.d.ts.map +1 -0
- package/dist/shared/log/{log-persist-flush.d.ts → upload/flush.d.ts} +3 -3
- package/dist/shared/log/upload/flush.d.ts.map +1 -0
- package/dist/shared/log/{log-persist-hook.d.ts → upload/hook.d.ts} +2 -2
- package/dist/shared/log/upload/hook.d.ts.map +1 -0
- package/dist/shared/log/upload/interface.d.ts +33 -0
- package/dist/shared/log/upload/interface.d.ts.map +1 -0
- package/dist/shared/log/upload/logger.d.ts +22 -0
- package/dist/shared/log/upload/logger.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/browser.ts +1 -0
- package/src/node/preload/run-service-preload.ts +11 -6
- package/src/node/preload/service-preload.interface.ts +3 -1
- package/src/node/process/create-managed-child-processes.ts +1 -1
- package/src/node/process/managed-child-processes.ts +8 -1
- package/src/node/service-guard/service-guard-node.ts +5 -0
- package/src/node/service-host/index.ts +4 -0
- package/src/node/service-host/service-host.ts +22 -3
- package/src/node.ts +26 -19
- package/src/service/index.ts +3 -0
- package/src/service/registry.service.ts +142 -0
- package/src/shared/log/README.md +206 -0
- package/src/shared/log/{log-batch.ts → core/log-batch.ts} +4 -4
- package/src/shared/log/{log-manager.ts → core/log-manager.ts} +3 -3
- package/src/shared/log/{log-min-level.ts → core/log-min-level.ts} +1 -1
- package/src/shared/log/{log-scope.ts → core/log-scope.ts} +1 -1
- package/src/shared/log/index.ts +13 -18
- package/src/shared/log/spool/collector.ts +330 -0
- package/src/shared/log/spool/config.ts +56 -0
- package/src/shared/log/spool/coordinator.ts +55 -0
- package/src/shared/log/spool/enable.ts +136 -0
- package/src/shared/log/spool/file.ts +75 -0
- package/src/shared/log/spool/interface.ts +62 -0
- package/src/shared/log/spool/paths.ts +30 -0
- package/src/shared/log/spool/process-roles.ts +75 -0
- package/src/shared/log/spool/register-collect-log-runner.ts +63 -0
- package/src/shared/log/spool/service-lifecycle.ts +35 -0
- package/src/shared/log/spool/writer.ts +273 -0
- package/src/shared/log/{log-persist-batch-id.ts → upload/batch-id.ts} +2 -2
- package/src/shared/log/upload/env.ts +26 -0
- package/src/shared/log/{log-persist-flush.ts → upload/flush.ts} +8 -7
- package/src/shared/log/{log-persist-hook.ts → upload/hook.ts} +1 -1
- package/src/shared/log/upload/interface.ts +38 -0
- package/src/shared/log/upload/logger.ts +37 -0
- package/dist/chunks/enable-log-persist-Dl55_mv2.js +0 -1674
- package/dist/chunks/enable-log-persist-Dl55_mv2.js.map +0 -1
- package/dist/chunks/task-queue-H4mpSW8R.js.map +0 -1
- package/dist/shared/log/create-logger.d.ts.map +0 -1
- package/dist/shared/log/enable-log-persist.d.ts +0 -28
- package/dist/shared/log/enable-log-persist.d.ts.map +0 -1
- package/dist/shared/log/log-batch.d.ts.map +0 -1
- package/dist/shared/log/log-manager.d.ts.map +0 -1
- package/dist/shared/log/log-min-level.d.ts.map +0 -1
- package/dist/shared/log/log-persist-batch-id.d.ts.map +0 -1
- package/dist/shared/log/log-persist-coordinator.d.ts +0 -37
- package/dist/shared/log/log-persist-coordinator.d.ts.map +0 -1
- package/dist/shared/log/log-persist-errors.d.ts +0 -4
- package/dist/shared/log/log-persist-errors.d.ts.map +0 -1
- package/dist/shared/log/log-persist-flush.d.ts.map +0 -1
- package/dist/shared/log/log-persist-hook.d.ts.map +0 -1
- package/dist/shared/log/log-persist-logger.d.ts +0 -16
- package/dist/shared/log/log-persist-logger.d.ts.map +0 -1
- package/dist/shared/log/log-persist-registry.d.ts +0 -18
- package/dist/shared/log/log-persist-registry.d.ts.map +0 -1
- package/dist/shared/log/log-persist.config.d.ts +0 -9
- package/dist/shared/log/log-persist.config.d.ts.map +0 -1
- package/dist/shared/log/log-persist.d.ts +0 -62
- package/dist/shared/log/log-persist.d.ts.map +0 -1
- package/dist/shared/log/log-persist.interface.d.ts +0 -132
- package/dist/shared/log/log-persist.interface.d.ts.map +0 -1
- package/dist/shared/log/log-scope.d.ts.map +0 -1
- package/src/shared/log/enable-log-persist.ts +0 -225
- package/src/shared/log/log-persist-coordinator.ts +0 -107
- package/src/shared/log/log-persist-errors.ts +0 -16
- package/src/shared/log/log-persist-logger.ts +0 -61
- package/src/shared/log/log-persist-registry.ts +0 -252
- package/src/shared/log/log-persist.config.ts +0 -115
- package/src/shared/log/log-persist.interface.ts +0 -150
- package/src/shared/log/log-persist.ts +0 -822
- /package/dist/shared/log/{create-logger.d.ts → core/create-logger.d.ts} +0 -0
- /package/dist/shared/log/{log-manager.d.ts → core/log-manager.d.ts} +0 -0
- /package/dist/shared/log/{log-min-level.d.ts → core/log-min-level.d.ts} +0 -0
- /package/dist/shared/log/{log-scope.d.ts → core/log-scope.d.ts} +0 -0
- /package/src/shared/log/{create-logger.ts → core/create-logger.ts} +0 -0
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
/**
|
|
5
5
|
* Read side of the log-persist pipeline: decode persisted `LogBatch` Lists into
|
|
6
6
|
* structured batches and flat entries. Pure and defensive — malformed rows are
|
|
7
|
-
* skipped rather than thrown. Mirrors the write side in `
|
|
7
|
+
* skipped rather than thrown. Mirrors the write side in `upload/flush.ts`.
|
|
8
8
|
*/
|
|
9
9
|
const LANES = new Set(["fast", "medium", "slow"]);
|
|
10
10
|
function asRecord$1(value) {
|
|
@@ -1884,6 +1884,27 @@ function releaseActiveSlotsForServiceValues(slots, serviceValueSet) {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
return { nextSlots, released };
|
|
1886
1886
|
}
|
|
1887
|
+
function releaseActiveSlotsForServiceIds(slots, serviceIdSet) {
|
|
1888
|
+
const nextSlots = [...slots];
|
|
1889
|
+
const released = [];
|
|
1890
|
+
for (let slotIndex = 0; slotIndex < nextSlots.length; slotIndex += 1) {
|
|
1891
|
+
const slot = nextSlots[slotIndex];
|
|
1892
|
+
if (slot.serviceId == null || !serviceIdSet.has(slot.serviceId) || slot.status !== ServiceSlotStatus.ACTIVE) {
|
|
1893
|
+
continue;
|
|
1894
|
+
}
|
|
1895
|
+
released.push({
|
|
1896
|
+
serviceValue: slot.serviceValue,
|
|
1897
|
+
serviceId: slot.serviceId,
|
|
1898
|
+
slotIndex,
|
|
1899
|
+
});
|
|
1900
|
+
nextSlots[slotIndex] = {
|
|
1901
|
+
...slot,
|
|
1902
|
+
serviceId: null,
|
|
1903
|
+
status: ServiceSlotStatus.EMPTY,
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
return { nextSlots, released };
|
|
1907
|
+
}
|
|
1887
1908
|
/**
|
|
1888
1909
|
* Force-release ACTIVE registry slots for the given logical service keys (`ACTIVE → EMPTY`).
|
|
1889
1910
|
* Ops/dev recovery when a process crashed without {@link unregisterService}.
|
|
@@ -1974,6 +1995,90 @@ async function releaseSystemRegistrySlots(input) {
|
|
|
1974
1995
|
}
|
|
1975
1996
|
throw new ServiceRegistryError("[releaseSystemRegistrySlots] Optimistic lock retries exhausted", "REGISTRY_UPDATE_FAILED");
|
|
1976
1997
|
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Force-release ACTIVE registry slots for the given runtime Service row ids (`ACTIVE → EMPTY`).
|
|
2000
|
+
* Targets one slot per `serviceId` — use when multiple slots share the same `serviceValue`.
|
|
2001
|
+
* Ops/dev recovery when a process crashed without {@link unregisterService}.
|
|
2002
|
+
* Does not delete Service rows or mutate `details.runtime`.
|
|
2003
|
+
*/
|
|
2004
|
+
async function releaseSystemRegistrySlotsByServiceId(input) {
|
|
2005
|
+
const serviceIds = [...new Set(input.serviceIds.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
2006
|
+
if (serviceIds.length === 0) {
|
|
2007
|
+
throw new Error("[releaseSystemRegistrySlotsByServiceId] serviceIds must not be empty");
|
|
2008
|
+
}
|
|
2009
|
+
const serviceIdSet = new Set(serviceIds);
|
|
2010
|
+
const maxAttempts = input.maxAttempts ?? DEFAULT_REGISTER_RETRY_ATTEMPTS;
|
|
2011
|
+
const logger = createLogger({
|
|
2012
|
+
module: "releaseSystemRegistrySlotsByServiceId",
|
|
2013
|
+
traceId: input.traceId,
|
|
2014
|
+
labels: { serviceIds: serviceIds.join(",") },
|
|
2015
|
+
});
|
|
2016
|
+
logger.info("开始按 serviceId 强制释放 registry 槽位", {
|
|
2017
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2018
|
+
data: { serviceIds },
|
|
2019
|
+
});
|
|
2020
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
2021
|
+
try {
|
|
2022
|
+
const config = await loadSystemRegistryConfig();
|
|
2023
|
+
const revision = parseRegistryRevision(config.details.meta);
|
|
2024
|
+
const slots = parseServiceSlots(config);
|
|
2025
|
+
const { nextSlots, released } = releaseActiveSlotsForServiceIds(slots, serviceIdSet);
|
|
2026
|
+
const releasedIdSet = new Set(released.map((entry) => entry.serviceId));
|
|
2027
|
+
const unchangedServiceIds = serviceIds.filter((serviceId) => !releasedIdSet.has(serviceId));
|
|
2028
|
+
if (released.length === 0) {
|
|
2029
|
+
logger.info("无 ACTIVE 槽位需要释放", {
|
|
2030
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2031
|
+
data: { serviceIds, attempt },
|
|
2032
|
+
});
|
|
2033
|
+
return { config, released, unchangedServiceIds: serviceIds };
|
|
2034
|
+
}
|
|
2035
|
+
await persistSlotClaim({
|
|
2036
|
+
configId: config.id,
|
|
2037
|
+
revision,
|
|
2038
|
+
slots: nextSlots,
|
|
2039
|
+
});
|
|
2040
|
+
const updated = await loadSystemRegistryConfig();
|
|
2041
|
+
logger.info("槽位强制释放成功", {
|
|
2042
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2043
|
+
data: {
|
|
2044
|
+
released,
|
|
2045
|
+
unchangedServiceIds,
|
|
2046
|
+
attempt,
|
|
2047
|
+
revision: revision + 1,
|
|
2048
|
+
},
|
|
2049
|
+
});
|
|
2050
|
+
return {
|
|
2051
|
+
config: updated,
|
|
2052
|
+
released,
|
|
2053
|
+
unchangedServiceIds,
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
catch (error) {
|
|
2057
|
+
if (error instanceof ServiceRegistryError) {
|
|
2058
|
+
logger.error("槽位强制释放被拒绝", {
|
|
2059
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2060
|
+
data: { serviceIds, code: error.code, message: error.message },
|
|
2061
|
+
});
|
|
2062
|
+
throw error;
|
|
2063
|
+
}
|
|
2064
|
+
if (isOptimisticLockError(error) && attempt < maxAttempts) {
|
|
2065
|
+
logger.warn("registry 乐观锁冲突,重试", {
|
|
2066
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2067
|
+
data: { serviceIds, attempt, maxAttempts },
|
|
2068
|
+
});
|
|
2069
|
+
await sleep$1(50 * attempt);
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2073
|
+
logger.error("槽位强制释放失败", {
|
|
2074
|
+
topic: LOG_TOPIC_REGISTRY,
|
|
2075
|
+
data: { serviceIds, attempt, message },
|
|
2076
|
+
});
|
|
2077
|
+
throw new ServiceRegistryError(message, "REGISTRY_UPDATE_FAILED");
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
throw new ServiceRegistryError("[releaseSystemRegistrySlotsByServiceId] Optimistic lock retries exhausted", "REGISTRY_UPDATE_FAILED");
|
|
2081
|
+
}
|
|
1977
2082
|
/**
|
|
1978
2083
|
* Append EMPTY {@link ServiceSlot} rows for logical service keys not yet declared.
|
|
1979
2084
|
* Idempotent — skips keys that already appear in `details.objects`.
|
|
@@ -3179,5 +3284,5 @@ function summarizeTaskQueue(tasks, taskType, statuses) {
|
|
|
3179
3284
|
return tasks.filter((task) => task.value === taskType && statuses.includes(task.details.status)).length;
|
|
3180
3285
|
}
|
|
3181
3286
|
|
|
3182
|
-
export { getApiSchema as $, ApiMethod as A, createActiveServiceLifecycle as B, CategoryConfig as C, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS as D, EMPTY_REGISTRY_SLOT_RUNTIME_STATE as E, createClaimedRegistrySlotRuntimeState as F, createStorageProviderRegistry as G, createUploadTracker as H, decodeLogBatch as I, decodeLogBatchList as J, defaultL3ServiceDetails as K, LINK_MANIFEST_VERSION as L, deleteParcel as M, NodeStatus as N, deleteParcelSchema as O, POST_TASK_DEFAULT_MAX_ATTEMPTS as P, evaluateBusyNodeLiveness as Q, ResultCode as R, ServiceLifecycleStatus as S, TARGET_SYSTEM_REGISTRY_KEY as T, fetchBinaryWithRetry as U, fetchWithRetry as V, fieldDefinitionSchema as W, flattenLogBatch as X, flattenLogBatches as Y, formatNetworkError as Z, getApi as _, CategoryExtraction as a,
|
|
3183
|
-
//# sourceMappingURL=task-queue-
|
|
3287
|
+
export { getApiSchema as $, ApiMethod as A, createActiveServiceLifecycle as B, CategoryConfig as C, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS as D, EMPTY_REGISTRY_SLOT_RUNTIME_STATE as E, createClaimedRegistrySlotRuntimeState as F, createStorageProviderRegistry as G, createUploadTracker as H, decodeLogBatch as I, decodeLogBatchList as J, defaultL3ServiceDetails as K, LINK_MANIFEST_VERSION as L, deleteParcel as M, NodeStatus as N, deleteParcelSchema as O, POST_TASK_DEFAULT_MAX_ATTEMPTS as P, evaluateBusyNodeLiveness as Q, ResultCode as R, ServiceLifecycleStatus as S, TARGET_SYSTEM_REGISTRY_KEY as T, fetchBinaryWithRetry as U, fetchWithRetry as V, fieldDefinitionSchema as W, flattenLogBatch as X, flattenLogBatches as Y, formatNetworkError as Z, getApi as _, CategoryExtraction as a, releaseSystemRegistrySlotsByServiceId as a$, getConfig as a0, getConfigSchema as a1, getExtraction as a2, getExtractionSchema as a3, getParcel as a4, getParcelSchema as a5, getScanRemoteRepoValues as a6, getScanRemoteRepoValuesSchema as a7, getService as a8, getServiceSchema as a9, patchStopNode as aA, patchStopNodeSchema as aB, patchTaskProgress as aC, patchTaskProgressSchema as aD, postApi as aE, postApiSchema as aF, postExtraction as aG, postExtractionSchema as aH, postLinkCreate as aI, postParcel as aJ, postParcelSchema as aK, postRegisterNode as aL, postRegisterNodeSchema as aM, postService as aN, postServiceInstance as aO, postServiceSchema as aP, postSystemRegistryConfig as aQ, postSystemRegistryConfigSchema as aR, postTask as aS, postTaskSchema as aT, postTaskWithRetry as aU, publishParcel as aV, registerProviderChunkResolver as aW, registerService as aX, registerServiceAtStartup as aY, registrySlotRuntimePatchFromGuardResult as aZ, releaseSystemRegistrySlots as a_, getTargetSystemRegistry as aa, getValueAtPath as ab, installChunkFetchRegistry as ac, isHttpUrl as ad, isLocalFilesystemPath as ae, isLogBatchList as af, isLogEntry as ag, isOpaqueChunkUrl as ah, isRetryableHttpStatus as ai, linkTargetDraftBuildInputSchema as aj, parcelDetailsSchema as ak, parseLogBatchMeta as al, parseProviderPrefixedUrl as am, parseServiceSlot as an, parseServiceSlots as ao, patchChangeNodeStatus as ap, patchChangeNodeStatusSchema as aq, patchChangeTaskStatus as ar, patchChangeTaskStatusSchema as as, patchClaimTask as at, patchClaimTaskSchema as au, patchExtractionObjects as av, patchExtractionObjectsSchema as aw, patchNodeHeartBeat as ax, patchNodeHeartBeatSchema as ay, patchServiceRuntime as az, CategoryLink as b, requestHasBody as b0, resetSystemRegistryConfig as b1, resetSystemRegistryConfigSchema as b2, resolveActiveRegistryServiceId as b3, resolveFetchUrl as b4, restoreParcel as b5, restoreParcelById as b6, runRegistrySlotGuardCheck as b7, sanitizeFileName as b8, sanitizeParcelFileName as b9, scanExtractionList as ba, scanExtractionListSchema as bb, schemaDefinitionSchema as bc, serviceDetailsSchema as bd, serviceLifecycleSchema as be, serviceNodeSnapshotSchema as bf, serviceRuntimeSchema as bg, sha256Hex as bh, summarizeTaskQueue as bi, systemRegistrySeedSlotSchema as bj, unregisterService as bk, unregisterServiceAtShutdown as bl, getErrorMessage as bm, LOG_TOPIC_TASK as bn, CRITICAL_UNKNOWN_TASK_TRACE_ID as bo, toError as bp, createTaskRow as bq, CategoryNode as c, CategoryParcel as d, CategoryRepo as e, CategoryService as f, CategoryTask as g, LIST_MANIFEST_VERSION as h, ParcelManager as i, PostLinkValidator as j, ServiceRegistryError as k, ServiceSlotStatus as l, TASK_REPO_USAGE as m, TaskStatus as n, TaskStatusAction as o, apiDetailsSchema as p, appendSystemRegistrySlots as q, assertRegistrySlotAvailable as r, assertRegistrySlotOwner as s, buildEmptyServiceSlots as t, buildLinkTargetDraft as u, buildListTargetDraft as v, buildSystemRegistryConfigDetails as w, claimServiceRegistrySlot as x, classifyNetworkError as y, countTasksByType as z };
|
|
3288
|
+
//# sourceMappingURL=task-queue-6X3aglJh.js.map
|