chainlesschain 0.66.0 → 0.132.0
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/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
package/src/lib/dbevo.js
CHANGED
|
@@ -667,3 +667,341 @@ export function _resetState() {
|
|
|
667
667
|
_suggestions.clear();
|
|
668
668
|
_slowQueryThresholdMs = 100;
|
|
669
669
|
}
|
|
670
|
+
|
|
671
|
+
/* ═════════════════════════════════════════════════════════ *
|
|
672
|
+
* Phase 80 V2 — Schema Baseline + Migration-Run Lifecycle
|
|
673
|
+
* ═════════════════════════════════════════════════════════ */
|
|
674
|
+
|
|
675
|
+
export const SCHEMA_BASELINE_V2 = Object.freeze({
|
|
676
|
+
DRAFT: "draft",
|
|
677
|
+
VALIDATED: "validated",
|
|
678
|
+
ACTIVE: "active",
|
|
679
|
+
DEPRECATED: "deprecated",
|
|
680
|
+
RETIRED: "retired",
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
export const MIGRATION_RUN_V2 = Object.freeze({
|
|
684
|
+
QUEUED: "queued",
|
|
685
|
+
RUNNING: "running",
|
|
686
|
+
APPLIED: "applied",
|
|
687
|
+
FAILED: "failed",
|
|
688
|
+
ROLLED_BACK: "rolled_back",
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
const BASELINE_TRANSITIONS_V2 = new Map([
|
|
692
|
+
["draft", new Set(["validated", "retired"])],
|
|
693
|
+
["validated", new Set(["active", "retired"])],
|
|
694
|
+
["active", new Set(["deprecated", "retired"])],
|
|
695
|
+
["deprecated", new Set(["active", "retired"])],
|
|
696
|
+
]);
|
|
697
|
+
const BASELINE_TERMINALS_V2 = new Set(["retired"]);
|
|
698
|
+
|
|
699
|
+
const RUN_TRANSITIONS_V2 = new Map([
|
|
700
|
+
["queued", new Set(["running", "failed"])],
|
|
701
|
+
["running", new Set(["applied", "failed", "rolled_back"])],
|
|
702
|
+
["applied", new Set(["rolled_back"])],
|
|
703
|
+
]);
|
|
704
|
+
const RUN_TERMINALS_V2 = new Set(["failed", "rolled_back"]);
|
|
705
|
+
|
|
706
|
+
export const DBEVO_DEFAULT_MAX_ACTIVE_BASELINES_PER_DB = 1;
|
|
707
|
+
export const DBEVO_DEFAULT_MAX_RUNNING_MIGRATIONS_PER_DB = 1;
|
|
708
|
+
export const DBEVO_DEFAULT_BASELINE_IDLE_MS = 180 * 86400000; // 180 days
|
|
709
|
+
export const DBEVO_DEFAULT_MIGRATION_STUCK_MS = 30 * 60000; // 30 minutes
|
|
710
|
+
|
|
711
|
+
let _maxActiveBaselinesPerDbV2 = DBEVO_DEFAULT_MAX_ACTIVE_BASELINES_PER_DB;
|
|
712
|
+
let _maxRunningMigrationsPerDbV2 = DBEVO_DEFAULT_MAX_RUNNING_MIGRATIONS_PER_DB;
|
|
713
|
+
let _baselineIdleMsV2 = DBEVO_DEFAULT_BASELINE_IDLE_MS;
|
|
714
|
+
let _migrationStuckMsV2 = DBEVO_DEFAULT_MIGRATION_STUCK_MS;
|
|
715
|
+
|
|
716
|
+
function _positiveIntV2(n, label) {
|
|
717
|
+
const v = Math.floor(Number(n));
|
|
718
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
719
|
+
throw new Error(`${label} must be a positive integer`);
|
|
720
|
+
return v;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export function getDefaultMaxActiveBaselinesPerDbV2() {
|
|
724
|
+
return DBEVO_DEFAULT_MAX_ACTIVE_BASELINES_PER_DB;
|
|
725
|
+
}
|
|
726
|
+
export function getMaxActiveBaselinesPerDbV2() {
|
|
727
|
+
return _maxActiveBaselinesPerDbV2;
|
|
728
|
+
}
|
|
729
|
+
export function setMaxActiveBaselinesPerDbV2(n) {
|
|
730
|
+
return (_maxActiveBaselinesPerDbV2 = _positiveIntV2(
|
|
731
|
+
n,
|
|
732
|
+
"maxActiveBaselinesPerDb",
|
|
733
|
+
));
|
|
734
|
+
}
|
|
735
|
+
export function getDefaultMaxRunningMigrationsPerDbV2() {
|
|
736
|
+
return DBEVO_DEFAULT_MAX_RUNNING_MIGRATIONS_PER_DB;
|
|
737
|
+
}
|
|
738
|
+
export function getMaxRunningMigrationsPerDbV2() {
|
|
739
|
+
return _maxRunningMigrationsPerDbV2;
|
|
740
|
+
}
|
|
741
|
+
export function setMaxRunningMigrationsPerDbV2(n) {
|
|
742
|
+
return (_maxRunningMigrationsPerDbV2 = _positiveIntV2(
|
|
743
|
+
n,
|
|
744
|
+
"maxRunningMigrationsPerDb",
|
|
745
|
+
));
|
|
746
|
+
}
|
|
747
|
+
export function getDefaultBaselineIdleMsV2() {
|
|
748
|
+
return DBEVO_DEFAULT_BASELINE_IDLE_MS;
|
|
749
|
+
}
|
|
750
|
+
export function getBaselineIdleMsV2() {
|
|
751
|
+
return _baselineIdleMsV2;
|
|
752
|
+
}
|
|
753
|
+
export function setBaselineIdleMsV2(ms) {
|
|
754
|
+
return (_baselineIdleMsV2 = _positiveIntV2(ms, "baselineIdleMs"));
|
|
755
|
+
}
|
|
756
|
+
export function getDefaultMigrationStuckMsV2() {
|
|
757
|
+
return DBEVO_DEFAULT_MIGRATION_STUCK_MS;
|
|
758
|
+
}
|
|
759
|
+
export function getMigrationStuckMsV2() {
|
|
760
|
+
return _migrationStuckMsV2;
|
|
761
|
+
}
|
|
762
|
+
export function setMigrationStuckMsV2(ms) {
|
|
763
|
+
return (_migrationStuckMsV2 = _positiveIntV2(ms, "migrationStuckMs"));
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
const _baselinesV2 = new Map();
|
|
767
|
+
const _runsV2 = new Map();
|
|
768
|
+
|
|
769
|
+
export function registerBaselineV2(
|
|
770
|
+
_db,
|
|
771
|
+
{ baselineId, databaseId, version, initialStatus, metadata } = {},
|
|
772
|
+
) {
|
|
773
|
+
if (!baselineId) throw new Error("baselineId is required");
|
|
774
|
+
if (!databaseId) throw new Error("databaseId is required");
|
|
775
|
+
if (!version) throw new Error("version is required");
|
|
776
|
+
if (_baselinesV2.has(baselineId))
|
|
777
|
+
throw new Error(`Baseline ${baselineId} already exists`);
|
|
778
|
+
const status = initialStatus || SCHEMA_BASELINE_V2.DRAFT;
|
|
779
|
+
if (!Object.values(SCHEMA_BASELINE_V2).includes(status))
|
|
780
|
+
throw new Error(`Invalid initial status: ${status}`);
|
|
781
|
+
if (BASELINE_TERMINALS_V2.has(status))
|
|
782
|
+
throw new Error(`Cannot register in terminal status: ${status}`);
|
|
783
|
+
if (status === SCHEMA_BASELINE_V2.ACTIVE) {
|
|
784
|
+
if (getActiveBaselineCount(databaseId) >= _maxActiveBaselinesPerDbV2)
|
|
785
|
+
throw new Error(
|
|
786
|
+
`Database ${databaseId} reached active-baseline cap (${_maxActiveBaselinesPerDbV2})`,
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
const now = Date.now();
|
|
790
|
+
const record = {
|
|
791
|
+
baselineId,
|
|
792
|
+
databaseId,
|
|
793
|
+
version,
|
|
794
|
+
status,
|
|
795
|
+
metadata: metadata || {},
|
|
796
|
+
createdAt: now,
|
|
797
|
+
updatedAt: now,
|
|
798
|
+
lastTouchedAt: now,
|
|
799
|
+
};
|
|
800
|
+
_baselinesV2.set(baselineId, record);
|
|
801
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export function getBaselineV2(baselineId) {
|
|
805
|
+
const r = _baselinesV2.get(baselineId);
|
|
806
|
+
return r ? { ...r, metadata: { ...r.metadata } } : null;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export function setBaselineStatusV2(_db, baselineId, newStatus, patch = {}) {
|
|
810
|
+
const record = _baselinesV2.get(baselineId);
|
|
811
|
+
if (!record) throw new Error(`Unknown baseline: ${baselineId}`);
|
|
812
|
+
if (!Object.values(SCHEMA_BASELINE_V2).includes(newStatus))
|
|
813
|
+
throw new Error(`Invalid status: ${newStatus}`);
|
|
814
|
+
const allowed = BASELINE_TRANSITIONS_V2.get(record.status) || new Set();
|
|
815
|
+
if (!allowed.has(newStatus))
|
|
816
|
+
throw new Error(`Invalid transition: ${record.status} -> ${newStatus}`);
|
|
817
|
+
if (newStatus === SCHEMA_BASELINE_V2.ACTIVE) {
|
|
818
|
+
if (getActiveBaselineCount(record.databaseId) >= _maxActiveBaselinesPerDbV2)
|
|
819
|
+
throw new Error(
|
|
820
|
+
`Database ${record.databaseId} reached active-baseline cap (${_maxActiveBaselinesPerDbV2})`,
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
record.status = newStatus;
|
|
824
|
+
record.updatedAt = Date.now();
|
|
825
|
+
if (patch.reason !== undefined) record.lastReason = patch.reason;
|
|
826
|
+
if (patch.metadata)
|
|
827
|
+
record.metadata = { ...record.metadata, ...patch.metadata };
|
|
828
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export function validateBaseline(db, id, reason) {
|
|
832
|
+
return setBaselineStatusV2(db, id, SCHEMA_BASELINE_V2.VALIDATED, { reason });
|
|
833
|
+
}
|
|
834
|
+
export function activateBaseline(db, id, reason) {
|
|
835
|
+
return setBaselineStatusV2(db, id, SCHEMA_BASELINE_V2.ACTIVE, { reason });
|
|
836
|
+
}
|
|
837
|
+
export function deprecateBaseline(db, id, reason) {
|
|
838
|
+
return setBaselineStatusV2(db, id, SCHEMA_BASELINE_V2.DEPRECATED, { reason });
|
|
839
|
+
}
|
|
840
|
+
export function retireBaseline(db, id, reason) {
|
|
841
|
+
return setBaselineStatusV2(db, id, SCHEMA_BASELINE_V2.RETIRED, { reason });
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
export function touchBaselineActivity(baselineId) {
|
|
845
|
+
const record = _baselinesV2.get(baselineId);
|
|
846
|
+
if (!record) throw new Error(`Unknown baseline: ${baselineId}`);
|
|
847
|
+
record.lastTouchedAt = Date.now();
|
|
848
|
+
record.updatedAt = record.lastTouchedAt;
|
|
849
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export function enqueueMigrationRunV2(
|
|
853
|
+
_db,
|
|
854
|
+
{ runId, databaseId, migrationId, direction, metadata } = {},
|
|
855
|
+
) {
|
|
856
|
+
if (!runId) throw new Error("runId is required");
|
|
857
|
+
if (!databaseId) throw new Error("databaseId is required");
|
|
858
|
+
if (!migrationId) throw new Error("migrationId is required");
|
|
859
|
+
if (!direction) throw new Error("direction is required");
|
|
860
|
+
if (!Object.values(MIGRATION_DIRECTION).includes(direction))
|
|
861
|
+
throw new Error(`Invalid direction: ${direction}`);
|
|
862
|
+
if (_runsV2.has(runId)) throw new Error(`Run ${runId} already exists`);
|
|
863
|
+
const now = Date.now();
|
|
864
|
+
const record = {
|
|
865
|
+
runId,
|
|
866
|
+
databaseId,
|
|
867
|
+
migrationId,
|
|
868
|
+
direction,
|
|
869
|
+
status: MIGRATION_RUN_V2.QUEUED,
|
|
870
|
+
metadata: metadata || {},
|
|
871
|
+
createdAt: now,
|
|
872
|
+
updatedAt: now,
|
|
873
|
+
};
|
|
874
|
+
_runsV2.set(runId, record);
|
|
875
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
export function getMigrationRunV2(runId) {
|
|
879
|
+
const r = _runsV2.get(runId);
|
|
880
|
+
return r ? { ...r, metadata: { ...r.metadata } } : null;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export function setMigrationRunStatusV2(_db, runId, newStatus, patch = {}) {
|
|
884
|
+
const record = _runsV2.get(runId);
|
|
885
|
+
if (!record) throw new Error(`Unknown run: ${runId}`);
|
|
886
|
+
if (!Object.values(MIGRATION_RUN_V2).includes(newStatus))
|
|
887
|
+
throw new Error(`Invalid status: ${newStatus}`);
|
|
888
|
+
const allowed = RUN_TRANSITIONS_V2.get(record.status) || new Set();
|
|
889
|
+
if (!allowed.has(newStatus))
|
|
890
|
+
throw new Error(`Invalid transition: ${record.status} -> ${newStatus}`);
|
|
891
|
+
if (newStatus === MIGRATION_RUN_V2.RUNNING) {
|
|
892
|
+
if (
|
|
893
|
+
getRunningMigrationCount(record.databaseId) >=
|
|
894
|
+
_maxRunningMigrationsPerDbV2
|
|
895
|
+
)
|
|
896
|
+
throw new Error(
|
|
897
|
+
`Database ${record.databaseId} reached running-migration cap (${_maxRunningMigrationsPerDbV2})`,
|
|
898
|
+
);
|
|
899
|
+
if (!record.startedAt) record.startedAt = Date.now();
|
|
900
|
+
}
|
|
901
|
+
record.status = newStatus;
|
|
902
|
+
record.updatedAt = Date.now();
|
|
903
|
+
if (patch.reason !== undefined) record.lastReason = patch.reason;
|
|
904
|
+
if (patch.metadata)
|
|
905
|
+
record.metadata = { ...record.metadata, ...patch.metadata };
|
|
906
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export function startMigrationRun(db, id, reason) {
|
|
910
|
+
return setMigrationRunStatusV2(db, id, MIGRATION_RUN_V2.RUNNING, { reason });
|
|
911
|
+
}
|
|
912
|
+
export function applyMigrationRun(db, id, reason) {
|
|
913
|
+
return setMigrationRunStatusV2(db, id, MIGRATION_RUN_V2.APPLIED, { reason });
|
|
914
|
+
}
|
|
915
|
+
export function failMigrationRun(db, id, reason) {
|
|
916
|
+
return setMigrationRunStatusV2(db, id, MIGRATION_RUN_V2.FAILED, { reason });
|
|
917
|
+
}
|
|
918
|
+
export function rollbackMigrationRun(db, id, reason) {
|
|
919
|
+
return setMigrationRunStatusV2(db, id, MIGRATION_RUN_V2.ROLLED_BACK, {
|
|
920
|
+
reason,
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
export function getActiveBaselineCount(databaseId) {
|
|
925
|
+
let n = 0;
|
|
926
|
+
for (const r of _baselinesV2.values()) {
|
|
927
|
+
if (r.status !== SCHEMA_BASELINE_V2.ACTIVE) continue;
|
|
928
|
+
if (databaseId && r.databaseId !== databaseId) continue;
|
|
929
|
+
n++;
|
|
930
|
+
}
|
|
931
|
+
return n;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export function getRunningMigrationCount(databaseId) {
|
|
935
|
+
let n = 0;
|
|
936
|
+
for (const r of _runsV2.values()) {
|
|
937
|
+
if (r.status !== MIGRATION_RUN_V2.RUNNING) continue;
|
|
938
|
+
if (databaseId && r.databaseId !== databaseId) continue;
|
|
939
|
+
n++;
|
|
940
|
+
}
|
|
941
|
+
return n;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
export function autoRetireIdleBaselines(_db, nowMs) {
|
|
945
|
+
const now = nowMs ?? Date.now();
|
|
946
|
+
const flipped = [];
|
|
947
|
+
for (const r of _baselinesV2.values()) {
|
|
948
|
+
if (
|
|
949
|
+
r.status === SCHEMA_BASELINE_V2.DEPRECATED ||
|
|
950
|
+
r.status === SCHEMA_BASELINE_V2.DRAFT ||
|
|
951
|
+
r.status === SCHEMA_BASELINE_V2.VALIDATED
|
|
952
|
+
) {
|
|
953
|
+
if (now - r.lastTouchedAt > _baselineIdleMsV2) {
|
|
954
|
+
r.status = SCHEMA_BASELINE_V2.RETIRED;
|
|
955
|
+
r.updatedAt = now;
|
|
956
|
+
r.lastReason = "idle_timeout";
|
|
957
|
+
flipped.push(r.baselineId);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return { flipped, count: flipped.length };
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
export function autoFailStuckMigrationRuns(_db, nowMs) {
|
|
965
|
+
const now = nowMs ?? Date.now();
|
|
966
|
+
const flipped = [];
|
|
967
|
+
for (const r of _runsV2.values()) {
|
|
968
|
+
if (r.status === MIGRATION_RUN_V2.RUNNING) {
|
|
969
|
+
const anchor = r.startedAt || r.createdAt;
|
|
970
|
+
if (now - anchor > _migrationStuckMsV2) {
|
|
971
|
+
r.status = MIGRATION_RUN_V2.FAILED;
|
|
972
|
+
r.updatedAt = now;
|
|
973
|
+
r.lastReason = "migration_timeout";
|
|
974
|
+
flipped.push(r.runId);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return { flipped, count: flipped.length };
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
export function getDbEvoStatsV2() {
|
|
982
|
+
const baselinesByStatus = {};
|
|
983
|
+
for (const s of Object.values(SCHEMA_BASELINE_V2)) baselinesByStatus[s] = 0;
|
|
984
|
+
const runsByStatus = {};
|
|
985
|
+
for (const s of Object.values(MIGRATION_RUN_V2)) runsByStatus[s] = 0;
|
|
986
|
+
for (const r of _baselinesV2.values()) baselinesByStatus[r.status]++;
|
|
987
|
+
for (const r of _runsV2.values()) runsByStatus[r.status]++;
|
|
988
|
+
return {
|
|
989
|
+
totalBaselinesV2: _baselinesV2.size,
|
|
990
|
+
totalRunsV2: _runsV2.size,
|
|
991
|
+
maxActiveBaselinesPerDb: _maxActiveBaselinesPerDbV2,
|
|
992
|
+
maxRunningMigrationsPerDb: _maxRunningMigrationsPerDbV2,
|
|
993
|
+
baselineIdleMs: _baselineIdleMsV2,
|
|
994
|
+
migrationStuckMs: _migrationStuckMsV2,
|
|
995
|
+
baselinesByStatus,
|
|
996
|
+
runsByStatus,
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
export function _resetStateV2() {
|
|
1001
|
+
_maxActiveBaselinesPerDbV2 = DBEVO_DEFAULT_MAX_ACTIVE_BASELINES_PER_DB;
|
|
1002
|
+
_maxRunningMigrationsPerDbV2 = DBEVO_DEFAULT_MAX_RUNNING_MIGRATIONS_PER_DB;
|
|
1003
|
+
_baselineIdleMsV2 = DBEVO_DEFAULT_BASELINE_IDLE_MS;
|
|
1004
|
+
_migrationStuckMsV2 = DBEVO_DEFAULT_MIGRATION_STUCK_MS;
|
|
1005
|
+
_baselinesV2.clear();
|
|
1006
|
+
_runsV2.clear();
|
|
1007
|
+
}
|
|
@@ -443,3 +443,343 @@ export function _resetState() {
|
|
|
443
443
|
_versions.clear();
|
|
444
444
|
_routes.clear();
|
|
445
445
|
}
|
|
446
|
+
|
|
447
|
+
/* ═════════════════════════════════════════════════════════ *
|
|
448
|
+
* Phase 74-75 V2 — Provider Maturity + Deal Lifecycle
|
|
449
|
+
* ═════════════════════════════════════════════════════════ */
|
|
450
|
+
|
|
451
|
+
export const PROVIDER_MATURITY_V2 = Object.freeze({
|
|
452
|
+
ONBOARDING: "onboarding",
|
|
453
|
+
ACTIVE: "active",
|
|
454
|
+
DEGRADED: "degraded",
|
|
455
|
+
OFFLINE: "offline",
|
|
456
|
+
RETIRED: "retired",
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
export const DEAL_LIFECYCLE_V2 = Object.freeze({
|
|
460
|
+
QUEUED: "queued",
|
|
461
|
+
ACTIVE: "active",
|
|
462
|
+
COMPLETED: "completed",
|
|
463
|
+
FAILED: "failed",
|
|
464
|
+
CANCELED: "canceled",
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
const PROVIDER_TRANSITIONS_V2 = new Map([
|
|
468
|
+
["onboarding", new Set(["active", "retired"])],
|
|
469
|
+
["active", new Set(["degraded", "offline", "retired"])],
|
|
470
|
+
["degraded", new Set(["active", "offline", "retired"])],
|
|
471
|
+
["offline", new Set(["active", "retired"])],
|
|
472
|
+
]);
|
|
473
|
+
const PROVIDER_TERMINALS_V2 = new Set(["retired"]);
|
|
474
|
+
|
|
475
|
+
const DEAL_TRANSITIONS_V2 = new Map([
|
|
476
|
+
["queued", new Set(["active", "canceled", "failed"])],
|
|
477
|
+
["active", new Set(["completed", "failed", "canceled"])],
|
|
478
|
+
]);
|
|
479
|
+
const DEAL_TERMINALS_V2 = new Set(["completed", "failed", "canceled"]);
|
|
480
|
+
|
|
481
|
+
export const DI_DEFAULT_MAX_ACTIVE_PROVIDERS_PER_OPERATOR = 20;
|
|
482
|
+
export const DI_DEFAULT_MAX_ACTIVE_DEALS_PER_PROVIDER = 10;
|
|
483
|
+
export const DI_DEFAULT_PROVIDER_IDLE_MS = 7 * 86400000; // 7 days
|
|
484
|
+
export const DI_DEFAULT_DEAL_STUCK_MS = 24 * 3600000; // 24 hours
|
|
485
|
+
|
|
486
|
+
let _maxActiveProvidersPerOperatorV2 =
|
|
487
|
+
DI_DEFAULT_MAX_ACTIVE_PROVIDERS_PER_OPERATOR;
|
|
488
|
+
let _maxActiveDealsPerProviderV2 = DI_DEFAULT_MAX_ACTIVE_DEALS_PER_PROVIDER;
|
|
489
|
+
let _providerIdleMsV2 = DI_DEFAULT_PROVIDER_IDLE_MS;
|
|
490
|
+
let _dealStuckMsV2 = DI_DEFAULT_DEAL_STUCK_MS;
|
|
491
|
+
|
|
492
|
+
function _positiveIntV2(n, label) {
|
|
493
|
+
const v = Math.floor(Number(n));
|
|
494
|
+
if (!Number.isFinite(v) || v <= 0)
|
|
495
|
+
throw new Error(`${label} must be a positive integer`);
|
|
496
|
+
return v;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export function getDefaultMaxActiveProvidersPerOperatorV2() {
|
|
500
|
+
return DI_DEFAULT_MAX_ACTIVE_PROVIDERS_PER_OPERATOR;
|
|
501
|
+
}
|
|
502
|
+
export function getMaxActiveProvidersPerOperatorV2() {
|
|
503
|
+
return _maxActiveProvidersPerOperatorV2;
|
|
504
|
+
}
|
|
505
|
+
export function setMaxActiveProvidersPerOperatorV2(n) {
|
|
506
|
+
return (_maxActiveProvidersPerOperatorV2 = _positiveIntV2(
|
|
507
|
+
n,
|
|
508
|
+
"maxActiveProvidersPerOperator",
|
|
509
|
+
));
|
|
510
|
+
}
|
|
511
|
+
export function getDefaultMaxActiveDealsPerProviderV2() {
|
|
512
|
+
return DI_DEFAULT_MAX_ACTIVE_DEALS_PER_PROVIDER;
|
|
513
|
+
}
|
|
514
|
+
export function getMaxActiveDealsPerProviderV2() {
|
|
515
|
+
return _maxActiveDealsPerProviderV2;
|
|
516
|
+
}
|
|
517
|
+
export function setMaxActiveDealsPerProviderV2(n) {
|
|
518
|
+
return (_maxActiveDealsPerProviderV2 = _positiveIntV2(
|
|
519
|
+
n,
|
|
520
|
+
"maxActiveDealsPerProvider",
|
|
521
|
+
));
|
|
522
|
+
}
|
|
523
|
+
export function getDefaultProviderIdleMsV2() {
|
|
524
|
+
return DI_DEFAULT_PROVIDER_IDLE_MS;
|
|
525
|
+
}
|
|
526
|
+
export function getProviderIdleMsV2() {
|
|
527
|
+
return _providerIdleMsV2;
|
|
528
|
+
}
|
|
529
|
+
export function setProviderIdleMsV2(ms) {
|
|
530
|
+
return (_providerIdleMsV2 = _positiveIntV2(ms, "providerIdleMs"));
|
|
531
|
+
}
|
|
532
|
+
export function getDefaultDealStuckMsV2() {
|
|
533
|
+
return DI_DEFAULT_DEAL_STUCK_MS;
|
|
534
|
+
}
|
|
535
|
+
export function getDealStuckMsV2() {
|
|
536
|
+
return _dealStuckMsV2;
|
|
537
|
+
}
|
|
538
|
+
export function setDealStuckMsV2(ms) {
|
|
539
|
+
return (_dealStuckMsV2 = _positiveIntV2(ms, "dealStuckMs"));
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const _providersV2 = new Map();
|
|
543
|
+
const _dealsV2 = new Map();
|
|
544
|
+
|
|
545
|
+
export function registerProviderV2(
|
|
546
|
+
_db,
|
|
547
|
+
{ providerId, operatorId, kind, initialStatus, metadata } = {},
|
|
548
|
+
) {
|
|
549
|
+
if (!providerId) throw new Error("providerId is required");
|
|
550
|
+
if (!operatorId) throw new Error("operatorId is required");
|
|
551
|
+
if (!kind) throw new Error("kind is required");
|
|
552
|
+
if (_providersV2.has(providerId))
|
|
553
|
+
throw new Error(`Provider ${providerId} already exists`);
|
|
554
|
+
const status = initialStatus || PROVIDER_MATURITY_V2.ONBOARDING;
|
|
555
|
+
if (!Object.values(PROVIDER_MATURITY_V2).includes(status))
|
|
556
|
+
throw new Error(`Invalid initial status: ${status}`);
|
|
557
|
+
if (PROVIDER_TERMINALS_V2.has(status))
|
|
558
|
+
throw new Error(`Cannot register in terminal status: ${status}`);
|
|
559
|
+
if (status === PROVIDER_MATURITY_V2.ACTIVE) {
|
|
560
|
+
if (getActiveProviderCount(operatorId) >= _maxActiveProvidersPerOperatorV2)
|
|
561
|
+
throw new Error(
|
|
562
|
+
`Operator ${operatorId} reached active-provider cap (${_maxActiveProvidersPerOperatorV2})`,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
const now = Date.now();
|
|
566
|
+
const record = {
|
|
567
|
+
providerId,
|
|
568
|
+
operatorId,
|
|
569
|
+
kind,
|
|
570
|
+
status,
|
|
571
|
+
metadata: metadata || {},
|
|
572
|
+
createdAt: now,
|
|
573
|
+
updatedAt: now,
|
|
574
|
+
lastHeartbeatAt: now,
|
|
575
|
+
};
|
|
576
|
+
_providersV2.set(providerId, record);
|
|
577
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export function getProviderV2(providerId) {
|
|
581
|
+
const r = _providersV2.get(providerId);
|
|
582
|
+
return r ? { ...r, metadata: { ...r.metadata } } : null;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export function setProviderMaturityV2(_db, providerId, newStatus, patch = {}) {
|
|
586
|
+
const record = _providersV2.get(providerId);
|
|
587
|
+
if (!record) throw new Error(`Unknown provider: ${providerId}`);
|
|
588
|
+
if (!Object.values(PROVIDER_MATURITY_V2).includes(newStatus))
|
|
589
|
+
throw new Error(`Invalid status: ${newStatus}`);
|
|
590
|
+
const allowed = PROVIDER_TRANSITIONS_V2.get(record.status) || new Set();
|
|
591
|
+
if (!allowed.has(newStatus))
|
|
592
|
+
throw new Error(`Invalid transition: ${record.status} -> ${newStatus}`);
|
|
593
|
+
if (newStatus === PROVIDER_MATURITY_V2.ACTIVE) {
|
|
594
|
+
if (
|
|
595
|
+
getActiveProviderCount(record.operatorId) >=
|
|
596
|
+
_maxActiveProvidersPerOperatorV2
|
|
597
|
+
)
|
|
598
|
+
throw new Error(
|
|
599
|
+
`Operator ${record.operatorId} reached active-provider cap (${_maxActiveProvidersPerOperatorV2})`,
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
record.status = newStatus;
|
|
603
|
+
record.updatedAt = Date.now();
|
|
604
|
+
if (patch.reason !== undefined) record.lastReason = patch.reason;
|
|
605
|
+
if (patch.metadata)
|
|
606
|
+
record.metadata = { ...record.metadata, ...patch.metadata };
|
|
607
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export function activateProvider(db, id, reason) {
|
|
611
|
+
return setProviderMaturityV2(db, id, PROVIDER_MATURITY_V2.ACTIVE, { reason });
|
|
612
|
+
}
|
|
613
|
+
export function degradeProvider(db, id, reason) {
|
|
614
|
+
return setProviderMaturityV2(db, id, PROVIDER_MATURITY_V2.DEGRADED, {
|
|
615
|
+
reason,
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
export function offlineProvider(db, id, reason) {
|
|
619
|
+
return setProviderMaturityV2(db, id, PROVIDER_MATURITY_V2.OFFLINE, {
|
|
620
|
+
reason,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
export function retireProvider(db, id, reason) {
|
|
624
|
+
return setProviderMaturityV2(db, id, PROVIDER_MATURITY_V2.RETIRED, {
|
|
625
|
+
reason,
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export function touchProviderHeartbeat(providerId) {
|
|
630
|
+
const record = _providersV2.get(providerId);
|
|
631
|
+
if (!record) throw new Error(`Unknown provider: ${providerId}`);
|
|
632
|
+
record.lastHeartbeatAt = Date.now();
|
|
633
|
+
record.updatedAt = record.lastHeartbeatAt;
|
|
634
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export function enqueueDealV2(
|
|
638
|
+
_db,
|
|
639
|
+
{ dealId, providerId, ownerId, metadata } = {},
|
|
640
|
+
) {
|
|
641
|
+
if (!dealId) throw new Error("dealId is required");
|
|
642
|
+
if (!providerId) throw new Error("providerId is required");
|
|
643
|
+
if (!ownerId) throw new Error("ownerId is required");
|
|
644
|
+
if (!_providersV2.has(providerId))
|
|
645
|
+
throw new Error(`Unknown provider: ${providerId}`);
|
|
646
|
+
if (_dealsV2.has(dealId)) throw new Error(`Deal ${dealId} already exists`);
|
|
647
|
+
const now = Date.now();
|
|
648
|
+
const record = {
|
|
649
|
+
dealId,
|
|
650
|
+
providerId,
|
|
651
|
+
ownerId,
|
|
652
|
+
status: DEAL_LIFECYCLE_V2.QUEUED,
|
|
653
|
+
metadata: metadata || {},
|
|
654
|
+
createdAt: now,
|
|
655
|
+
updatedAt: now,
|
|
656
|
+
};
|
|
657
|
+
_dealsV2.set(dealId, record);
|
|
658
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export function getDealV2(dealId) {
|
|
662
|
+
const r = _dealsV2.get(dealId);
|
|
663
|
+
return r ? { ...r, metadata: { ...r.metadata } } : null;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export function setDealStatusV2(_db, dealId, newStatus, patch = {}) {
|
|
667
|
+
const record = _dealsV2.get(dealId);
|
|
668
|
+
if (!record) throw new Error(`Unknown deal: ${dealId}`);
|
|
669
|
+
if (!Object.values(DEAL_LIFECYCLE_V2).includes(newStatus))
|
|
670
|
+
throw new Error(`Invalid status: ${newStatus}`);
|
|
671
|
+
const allowed = DEAL_TRANSITIONS_V2.get(record.status) || new Set();
|
|
672
|
+
if (!allowed.has(newStatus))
|
|
673
|
+
throw new Error(`Invalid transition: ${record.status} -> ${newStatus}`);
|
|
674
|
+
if (newStatus === DEAL_LIFECYCLE_V2.ACTIVE) {
|
|
675
|
+
if (getActiveDealCount(record.providerId) >= _maxActiveDealsPerProviderV2)
|
|
676
|
+
throw new Error(
|
|
677
|
+
`Provider ${record.providerId} reached active-deal cap (${_maxActiveDealsPerProviderV2})`,
|
|
678
|
+
);
|
|
679
|
+
if (!record.activatedAt) record.activatedAt = Date.now();
|
|
680
|
+
}
|
|
681
|
+
record.status = newStatus;
|
|
682
|
+
record.updatedAt = Date.now();
|
|
683
|
+
if (patch.reason !== undefined) record.lastReason = patch.reason;
|
|
684
|
+
if (patch.metadata)
|
|
685
|
+
record.metadata = { ...record.metadata, ...patch.metadata };
|
|
686
|
+
return { ...record, metadata: { ...record.metadata } };
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export function activateDeal(db, id, reason) {
|
|
690
|
+
return setDealStatusV2(db, id, DEAL_LIFECYCLE_V2.ACTIVE, { reason });
|
|
691
|
+
}
|
|
692
|
+
export function completeDeal(db, id, reason) {
|
|
693
|
+
return setDealStatusV2(db, id, DEAL_LIFECYCLE_V2.COMPLETED, { reason });
|
|
694
|
+
}
|
|
695
|
+
export function failDeal(db, id, reason) {
|
|
696
|
+
return setDealStatusV2(db, id, DEAL_LIFECYCLE_V2.FAILED, { reason });
|
|
697
|
+
}
|
|
698
|
+
export function cancelDeal(db, id, reason) {
|
|
699
|
+
return setDealStatusV2(db, id, DEAL_LIFECYCLE_V2.CANCELED, { reason });
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export function getActiveProviderCount(operatorId) {
|
|
703
|
+
let n = 0;
|
|
704
|
+
for (const r of _providersV2.values()) {
|
|
705
|
+
if (r.status !== PROVIDER_MATURITY_V2.ACTIVE) continue;
|
|
706
|
+
if (operatorId && r.operatorId !== operatorId) continue;
|
|
707
|
+
n++;
|
|
708
|
+
}
|
|
709
|
+
return n;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export function getActiveDealCount(providerId) {
|
|
713
|
+
let n = 0;
|
|
714
|
+
for (const r of _dealsV2.values()) {
|
|
715
|
+
if (r.status !== DEAL_LIFECYCLE_V2.ACTIVE) continue;
|
|
716
|
+
if (providerId && r.providerId !== providerId) continue;
|
|
717
|
+
n++;
|
|
718
|
+
}
|
|
719
|
+
return n;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export function autoOfflineStaleProviders(_db, nowMs) {
|
|
723
|
+
const now = nowMs ?? Date.now();
|
|
724
|
+
const flipped = [];
|
|
725
|
+
for (const r of _providersV2.values()) {
|
|
726
|
+
if (
|
|
727
|
+
r.status === PROVIDER_MATURITY_V2.ACTIVE ||
|
|
728
|
+
r.status === PROVIDER_MATURITY_V2.DEGRADED
|
|
729
|
+
) {
|
|
730
|
+
if (now - r.lastHeartbeatAt > _providerIdleMsV2) {
|
|
731
|
+
r.status = PROVIDER_MATURITY_V2.OFFLINE;
|
|
732
|
+
r.updatedAt = now;
|
|
733
|
+
r.lastReason = "heartbeat_timeout";
|
|
734
|
+
flipped.push(r.providerId);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return { flipped, count: flipped.length };
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
export function autoFailStuckActiveDeals(_db, nowMs) {
|
|
742
|
+
const now = nowMs ?? Date.now();
|
|
743
|
+
const flipped = [];
|
|
744
|
+
for (const r of _dealsV2.values()) {
|
|
745
|
+
if (r.status === DEAL_LIFECYCLE_V2.ACTIVE) {
|
|
746
|
+
const anchor = r.activatedAt || r.createdAt;
|
|
747
|
+
if (now - anchor > _dealStuckMsV2) {
|
|
748
|
+
r.status = DEAL_LIFECYCLE_V2.FAILED;
|
|
749
|
+
r.updatedAt = now;
|
|
750
|
+
r.lastReason = "deal_timeout";
|
|
751
|
+
flipped.push(r.dealId);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return { flipped, count: flipped.length };
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
export function getDecentralInfraStatsV2() {
|
|
759
|
+
const providersByStatus = {};
|
|
760
|
+
for (const s of Object.values(PROVIDER_MATURITY_V2)) providersByStatus[s] = 0;
|
|
761
|
+
const dealsByStatus = {};
|
|
762
|
+
for (const s of Object.values(DEAL_LIFECYCLE_V2)) dealsByStatus[s] = 0;
|
|
763
|
+
for (const r of _providersV2.values()) providersByStatus[r.status]++;
|
|
764
|
+
for (const r of _dealsV2.values()) dealsByStatus[r.status]++;
|
|
765
|
+
return {
|
|
766
|
+
totalProvidersV2: _providersV2.size,
|
|
767
|
+
totalDealsV2: _dealsV2.size,
|
|
768
|
+
maxActiveProvidersPerOperator: _maxActiveProvidersPerOperatorV2,
|
|
769
|
+
maxActiveDealsPerProvider: _maxActiveDealsPerProviderV2,
|
|
770
|
+
providerIdleMs: _providerIdleMsV2,
|
|
771
|
+
dealStuckMs: _dealStuckMsV2,
|
|
772
|
+
providersByStatus,
|
|
773
|
+
dealsByStatus,
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
export function _resetStateV2() {
|
|
778
|
+
_maxActiveProvidersPerOperatorV2 =
|
|
779
|
+
DI_DEFAULT_MAX_ACTIVE_PROVIDERS_PER_OPERATOR;
|
|
780
|
+
_maxActiveDealsPerProviderV2 = DI_DEFAULT_MAX_ACTIVE_DEALS_PER_PROVIDER;
|
|
781
|
+
_providerIdleMsV2 = DI_DEFAULT_PROVIDER_IDLE_MS;
|
|
782
|
+
_dealStuckMsV2 = DI_DEFAULT_DEAL_STUCK_MS;
|
|
783
|
+
_providersV2.clear();
|
|
784
|
+
_dealsV2.clear();
|
|
785
|
+
}
|