@secondlayer/shared 7.11.2 → 9.0.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/dist/src/archive/range-digest.d.ts +16 -169
- package/dist/src/archive/semantic-digest-builder.d.ts +16 -169
- package/dist/src/archive/status.js +11 -3
- package/dist/src/archive/status.js.map +3 -3
- package/dist/src/coverage/index.d.ts +15 -169
- package/dist/src/crypto/secrets.js +22 -3
- package/dist/src/crypto/secrets.js.map +3 -3
- package/dist/src/db/index.d.ts +18 -211
- package/dist/src/db/index.js +23 -16
- package/dist/src/db/index.js.map +4 -4
- package/dist/src/db/queries/chain-reorgs.d.ts +16 -169
- package/dist/src/db/queries/chain-reorgs.js +23 -16
- package/dist/src/db/queries/chain-reorgs.js.map +4 -4
- package/dist/src/db/queries/contracts.d.ts +16 -169
- package/dist/src/db/queries/instance.d.ts +16 -169
- package/dist/src/db/queries/integrity.d.ts +16 -169
- package/dist/src/db/queries/subgraph-gaps.d.ts +16 -169
- package/dist/src/db/queries/subgraph-operations.d.ts +17 -170
- package/dist/src/db/queries/subgraph-operations.js +1 -15
- package/dist/src/db/queries/subgraph-operations.js.map +3 -3
- package/dist/src/db/queries/subgraphs.d.ts +17 -191
- package/dist/src/db/queries/subgraphs.js +30 -1068
- package/dist/src/db/queries/subgraphs.js.map +5 -12
- package/dist/src/db/queries/subscriptions.d.ts +16 -169
- package/dist/src/db/queries/subscriptions.js +22 -3
- package/dist/src/db/queries/subscriptions.js.map +3 -3
- package/dist/src/db/queries/sync-scope.d.ts +1006 -0
- package/dist/src/db/queries/sync-scope.js +116 -0
- package/dist/src/db/queries/sync-scope.js.map +10 -0
- package/dist/src/db/schema.d.ts +17 -198
- package/dist/src/errors.d.ts +1 -22
- package/dist/src/errors.js +2 -4
- package/dist/src/errors.js.map +3 -3
- package/dist/src/index.d.ts +22 -256
- package/dist/src/index.js +24 -20
- package/dist/src/index.js.map +6 -6
- package/dist/src/mode.d.ts +16 -2
- package/dist/src/mode.js +25 -4
- package/dist/src/mode.js.map +3 -3
- package/dist/src/node/local-client.d.ts +16 -169
- package/dist/src/runtime/index.d.ts +137 -18
- package/dist/src/runtime/index.js +261 -41
- package/dist/src/runtime/index.js.map +9 -7
- package/dist/src/schemas/index.d.ts +5 -25
- package/dist/src/schemas/index.js +1 -2
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/subgraphs.d.ts +5 -25
- package/dist/src/schemas/subgraphs.js +1 -2
- package/dist/src/schemas/subgraphs.js.map +3 -3
- package/dist/src/streams-rows/index.d.ts +399 -0
- package/dist/src/streams-rows/index.js +336 -0
- package/dist/src/streams-rows/index.js.map +17 -0
- package/dist/src/subgraphs/spec.d.ts +0 -9
- package/migrations/0118_drop_retired_control_tables.ts +53 -0
- package/migrations/0119_drop_accounts_plan.ts +29 -0
- package/migrations/0120_sync_scopes.ts +42 -0
- package/package.json +10 -6
- package/dist/src/x402.d.ts +0 -47
- package/dist/src/x402.js +0 -79
- package/dist/src/x402.js.map +0 -10
package/dist/src/db/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ declare const FAILURE_CLASSES: readonly ["omission", "version", "digest_mismatch
|
|
|
36
36
|
type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
37
37
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
38
38
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
39
|
+
type BootstrapSource = "archive" | "genesis" | "import";
|
|
39
40
|
interface BlocksTable {
|
|
40
41
|
height: number;
|
|
41
42
|
hash: string;
|
|
@@ -241,11 +242,9 @@ interface AccountsTable {
|
|
|
241
242
|
ghost: Generated<boolean>;
|
|
242
243
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
243
244
|
wallet_principal: string | null;
|
|
244
|
-
plan: Generated<string>;
|
|
245
245
|
display_name: string | null;
|
|
246
246
|
bio: string | null;
|
|
247
247
|
avatar_url: string | null;
|
|
248
|
-
slug: string | null;
|
|
249
248
|
stripe_customer_id: string | null;
|
|
250
249
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
251
250
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -262,19 +261,6 @@ interface SessionsTable {
|
|
|
262
261
|
last_used_at: Date | null;
|
|
263
262
|
created_at: Generated<Date>;
|
|
264
263
|
}
|
|
265
|
-
/**
|
|
266
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
267
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
268
|
-
* the account as claimed (or merged into an existing account).
|
|
269
|
-
*/
|
|
270
|
-
interface ClaimTokensTable {
|
|
271
|
-
id: Generated<string>;
|
|
272
|
-
account_id: string;
|
|
273
|
-
token_hash: string;
|
|
274
|
-
created_at: Generated<Date>;
|
|
275
|
-
expires_at: Date;
|
|
276
|
-
used_at: Date | null;
|
|
277
|
-
}
|
|
278
264
|
interface MagicLinksTable {
|
|
279
265
|
id: Generated<string>;
|
|
280
266
|
email: string;
|
|
@@ -285,47 +271,6 @@ interface MagicLinksTable {
|
|
|
285
271
|
failed_attempts: Generated<number>;
|
|
286
272
|
created_at: Generated<Date>;
|
|
287
273
|
}
|
|
288
|
-
interface UsageDailyTable {
|
|
289
|
-
account_id: string;
|
|
290
|
-
tenant_id: string | null;
|
|
291
|
-
date: string;
|
|
292
|
-
api_requests: Generated<number>;
|
|
293
|
-
deliveries: Generated<number>;
|
|
294
|
-
streams_events_returned: Generated<number>;
|
|
295
|
-
index_decoded_events_returned: Generated<number>;
|
|
296
|
-
}
|
|
297
|
-
interface UsageSnapshotsTable {
|
|
298
|
-
id: Generated<string>;
|
|
299
|
-
account_id: string;
|
|
300
|
-
measured_at: Generated<Date>;
|
|
301
|
-
storage_bytes: Generated<number>;
|
|
302
|
-
}
|
|
303
|
-
interface AccountInsightsTable {
|
|
304
|
-
id: Generated<string>;
|
|
305
|
-
account_id: string;
|
|
306
|
-
category: string;
|
|
307
|
-
insight_type: string;
|
|
308
|
-
resource_id: string | null;
|
|
309
|
-
severity: string;
|
|
310
|
-
title: string;
|
|
311
|
-
body: string;
|
|
312
|
-
data: unknown;
|
|
313
|
-
dismissed_at: Date | null;
|
|
314
|
-
expires_at: Date | null;
|
|
315
|
-
created_at: Generated<Date>;
|
|
316
|
-
}
|
|
317
|
-
interface AccountAgentRunsTable {
|
|
318
|
-
id: Generated<string>;
|
|
319
|
-
account_id: string;
|
|
320
|
-
started_at: Generated<Date>;
|
|
321
|
-
completed_at: Date | null;
|
|
322
|
-
status: Generated<string>;
|
|
323
|
-
input_tokens: Generated<number>;
|
|
324
|
-
output_tokens: Generated<number>;
|
|
325
|
-
cost_usd: Generated<number>;
|
|
326
|
-
insights_created: Generated<number>;
|
|
327
|
-
error: string | null;
|
|
328
|
-
}
|
|
329
274
|
interface SubgraphProcessingStatsTable {
|
|
330
275
|
id: Generated<string>;
|
|
331
276
|
subgraph_name: string;
|
|
@@ -358,41 +303,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
358
303
|
last_processed_block: number | null;
|
|
359
304
|
captured_at: Generated<Date>;
|
|
360
305
|
}
|
|
361
|
-
interface SubgraphUsageDailyTable {
|
|
362
|
-
subgraph_id: string;
|
|
363
|
-
date: string;
|
|
364
|
-
query_count: Generated<number>;
|
|
365
|
-
}
|
|
366
|
-
interface ProjectsTable {
|
|
367
|
-
id: Generated<string>;
|
|
368
|
-
name: string;
|
|
369
|
-
slug: string;
|
|
370
|
-
account_id: string;
|
|
371
|
-
settings: Generated<Record<string, unknown>>;
|
|
372
|
-
network: Generated<string>;
|
|
373
|
-
node_rpc: string | null;
|
|
374
|
-
created_at: Generated<Date>;
|
|
375
|
-
updated_at: Generated<Date>;
|
|
376
|
-
}
|
|
377
|
-
interface TeamMembersTable {
|
|
378
|
-
id: Generated<string>;
|
|
379
|
-
project_id: string;
|
|
380
|
-
account_id: string;
|
|
381
|
-
role: Generated<string>;
|
|
382
|
-
invited_by: string | null;
|
|
383
|
-
created_at: Generated<Date>;
|
|
384
|
-
}
|
|
385
|
-
interface TeamInvitationsTable {
|
|
386
|
-
id: Generated<string>;
|
|
387
|
-
project_id: string;
|
|
388
|
-
email: string;
|
|
389
|
-
role: Generated<string>;
|
|
390
|
-
token: string;
|
|
391
|
-
invited_by: string | null;
|
|
392
|
-
expires_at: Date;
|
|
393
|
-
accepted_at: Date | null;
|
|
394
|
-
created_at: Generated<Date>;
|
|
395
|
-
}
|
|
396
306
|
interface ProcessedStripeEventsTable {
|
|
397
307
|
event_id: string;
|
|
398
308
|
event_type: string;
|
|
@@ -829,6 +739,20 @@ interface StageFailuresTable {
|
|
|
829
739
|
resolved_at: Date | null;
|
|
830
740
|
retain_until: Generated<Date>;
|
|
831
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* The instance's declared scope — one row per network. `start_height` is what
|
|
744
|
+
* makes missing history below it deliberate rather than a gap.
|
|
745
|
+
*/
|
|
746
|
+
interface SyncScopesTable {
|
|
747
|
+
network: string;
|
|
748
|
+
start_height: number;
|
|
749
|
+
target_height: number | null;
|
|
750
|
+
bootstrap_source: BootstrapSource;
|
|
751
|
+
bootstrap_manifest_digest: string | null;
|
|
752
|
+
genesis_hash: string | null;
|
|
753
|
+
created_at: Generated<Date>;
|
|
754
|
+
updated_at: Generated<Date>;
|
|
755
|
+
}
|
|
832
756
|
interface Database {
|
|
833
757
|
blocks: BlocksTable;
|
|
834
758
|
transactions: TransactionsTable;
|
|
@@ -845,27 +769,14 @@ interface Database {
|
|
|
845
769
|
accounts: AccountsTable;
|
|
846
770
|
sessions: SessionsTable;
|
|
847
771
|
magic_links: MagicLinksTable;
|
|
848
|
-
claim_tokens: ClaimTokensTable;
|
|
849
|
-
usage_daily: UsageDailyTable;
|
|
850
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
851
|
-
account_insights: AccountInsightsTable;
|
|
852
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
853
772
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
854
773
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
855
774
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
856
775
|
subgraph_gaps: SubgraphGapsTable;
|
|
857
776
|
subgraph_operations: SubgraphOperationsTable;
|
|
858
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
859
|
-
projects: ProjectsTable;
|
|
860
|
-
team_members: TeamMembersTable;
|
|
861
|
-
team_invitations: TeamInvitationsTable;
|
|
862
777
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
863
|
-
tenants: TenantsTable;
|
|
864
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
865
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
866
778
|
account_spend_caps: AccountSpendCapsTable;
|
|
867
779
|
account_credits: AccountCreditsTable;
|
|
868
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
869
780
|
subscriptions: SubscriptionsTable;
|
|
870
781
|
subscription_outbox: SubscriptionOutboxTable;
|
|
871
782
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -894,6 +805,7 @@ interface Database {
|
|
|
894
805
|
chain_read_cache: ChainReadCacheTable;
|
|
895
806
|
pending_fork_blocks: PendingForkBlocksTable;
|
|
896
807
|
observer_journal: ObserverJournalTable;
|
|
808
|
+
sync_scopes: SyncScopesTable;
|
|
897
809
|
stage_registry: StageRegistryTable;
|
|
898
810
|
stage_runs: StageRunsTable;
|
|
899
811
|
stage_block_receipts: StageBlockReceiptsTable;
|
|
@@ -940,66 +852,6 @@ interface X402PaymentsTable {
|
|
|
940
852
|
* reconciler's heal path can never double-credit them. */
|
|
941
853
|
credited_at: Generated<Date> | null;
|
|
942
854
|
}
|
|
943
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
944
|
-
interface TenantsTable {
|
|
945
|
-
id: Generated<string>;
|
|
946
|
-
account_id: string;
|
|
947
|
-
slug: string;
|
|
948
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
949
|
-
plan: string;
|
|
950
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
951
|
-
memory_mb: number;
|
|
952
|
-
storage_limit_mb: number;
|
|
953
|
-
storage_used_mb: number | null;
|
|
954
|
-
pg_container_id: string | null;
|
|
955
|
-
api_container_id: string | null;
|
|
956
|
-
processor_container_id: string | null;
|
|
957
|
-
target_database_url_enc: Buffer;
|
|
958
|
-
tenant_jwt_secret_enc: Buffer;
|
|
959
|
-
anon_key_enc: Buffer;
|
|
960
|
-
service_key_enc: Buffer;
|
|
961
|
-
api_url_internal: string;
|
|
962
|
-
api_url_public: string;
|
|
963
|
-
suspended_at: Date | null;
|
|
964
|
-
last_health_check_at: Date | null;
|
|
965
|
-
last_active_at: Generated<Date>;
|
|
966
|
-
service_gen: Generated<number>;
|
|
967
|
-
anon_gen: Generated<number>;
|
|
968
|
-
project_id: string | null;
|
|
969
|
-
created_at: Generated<Date>;
|
|
970
|
-
updated_at: Generated<Date>;
|
|
971
|
-
}
|
|
972
|
-
type Tenant = Selectable<TenantsTable>;
|
|
973
|
-
type InsertTenant = Insertable<TenantsTable>;
|
|
974
|
-
type UpdateTenant = Updateable<TenantsTable>;
|
|
975
|
-
interface TenantUsageMonthlyTable {
|
|
976
|
-
id: Generated<string>;
|
|
977
|
-
tenant_id: string;
|
|
978
|
-
period_month: Date;
|
|
979
|
-
storage_peak_mb: Generated<number>;
|
|
980
|
-
storage_avg_mb: Generated<number>;
|
|
981
|
-
storage_last_mb: Generated<number>;
|
|
982
|
-
measurements: Generated<number>;
|
|
983
|
-
first_at: Generated<Date>;
|
|
984
|
-
last_at: Generated<Date>;
|
|
985
|
-
}
|
|
986
|
-
type TenantUsageMonthly = Selectable<TenantUsageMonthlyTable>;
|
|
987
|
-
type InsertTenantUsageMonthly = Insertable<TenantUsageMonthlyTable>;
|
|
988
|
-
type UpdateTenantUsageMonthly = Updateable<TenantUsageMonthlyTable>;
|
|
989
|
-
interface TenantComputeAddonsTable {
|
|
990
|
-
id: Generated<string>;
|
|
991
|
-
tenant_id: string;
|
|
992
|
-
memory_mb_delta: Generated<number>;
|
|
993
|
-
cpu_delta: Generated<number | string>;
|
|
994
|
-
storage_mb_delta: Generated<number>;
|
|
995
|
-
effective_from: Generated<Date>;
|
|
996
|
-
effective_until: Date | null;
|
|
997
|
-
stripe_subscription_item_id: string | null;
|
|
998
|
-
created_at: Generated<Date>;
|
|
999
|
-
}
|
|
1000
|
-
type TenantComputeAddon = Selectable<TenantComputeAddonsTable>;
|
|
1001
|
-
type InsertTenantComputeAddon = Insertable<TenantComputeAddonsTable>;
|
|
1002
|
-
type UpdateTenantComputeAddon = Updateable<TenantComputeAddonsTable>;
|
|
1003
855
|
interface AccountSpendCapsTable {
|
|
1004
856
|
account_id: string;
|
|
1005
857
|
monthly_cap_cents: number | null;
|
|
@@ -1029,22 +881,6 @@ interface AccountCreditsTable {
|
|
|
1029
881
|
type AccountCredits = Selectable<AccountCreditsTable>;
|
|
1030
882
|
type InsertAccountCredits = Insertable<AccountCreditsTable>;
|
|
1031
883
|
type UpdateAccountCredits = Updateable<AccountCreditsTable>;
|
|
1032
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
1033
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1034
|
-
interface ProvisioningAuditLogTable {
|
|
1035
|
-
id: Generated<string>;
|
|
1036
|
-
tenant_id: string | null;
|
|
1037
|
-
tenant_slug: string | null;
|
|
1038
|
-
account_id: string | null;
|
|
1039
|
-
actor: string;
|
|
1040
|
-
event: ProvisioningAuditEvent;
|
|
1041
|
-
status: ProvisioningAuditStatus;
|
|
1042
|
-
detail: unknown | null;
|
|
1043
|
-
error: string | null;
|
|
1044
|
-
created_at: Generated<Date>;
|
|
1045
|
-
}
|
|
1046
|
-
type ProvisioningAuditLog = Selectable<ProvisioningAuditLogTable>;
|
|
1047
|
-
type InsertProvisioningAuditLog = Insertable<ProvisioningAuditLogTable>;
|
|
1048
884
|
type Block = Selectable<BlocksTable>;
|
|
1049
885
|
type InsertBlock = Insertable<BlocksTable>;
|
|
1050
886
|
type UpdateBlock = Updateable<BlocksTable>;
|
|
@@ -1075,29 +911,12 @@ type Account = Selectable<AccountsTable>;
|
|
|
1075
911
|
type InsertAccount = Insertable<AccountsTable>;
|
|
1076
912
|
type MagicLink = Selectable<MagicLinksTable>;
|
|
1077
913
|
type InsertMagicLink = Insertable<MagicLinksTable>;
|
|
1078
|
-
type ClaimToken = Selectable<ClaimTokensTable>;
|
|
1079
|
-
type InsertClaimToken = Insertable<ClaimTokensTable>;
|
|
1080
914
|
type Session = Selectable<SessionsTable>;
|
|
1081
915
|
type InsertSession = Insertable<SessionsTable>;
|
|
1082
|
-
type UsageDaily = Selectable<UsageDailyTable>;
|
|
1083
|
-
type UsageSnapshot = Selectable<UsageSnapshotsTable>;
|
|
1084
|
-
type AccountInsight = Selectable<AccountInsightsTable>;
|
|
1085
|
-
type InsertAccountInsight = Insertable<AccountInsightsTable>;
|
|
1086
|
-
type AccountAgentRun = Selectable<AccountAgentRunsTable>;
|
|
1087
|
-
type InsertAccountAgentRun = Insertable<AccountAgentRunsTable>;
|
|
1088
916
|
type SubgraphHealthSnapshot = Selectable<SubgraphHealthSnapshotsTable>;
|
|
1089
917
|
type InsertSubgraphHealthSnapshot = Insertable<SubgraphHealthSnapshotsTable>;
|
|
1090
918
|
type SubgraphGap = Selectable<SubgraphGapsTable>;
|
|
1091
919
|
type InsertSubgraphGap = Insertable<SubgraphGapsTable>;
|
|
1092
|
-
type SubgraphUsageDaily = Selectable<SubgraphUsageDailyTable>;
|
|
1093
|
-
type InsertSubgraphUsageDaily = Insertable<SubgraphUsageDailyTable>;
|
|
1094
|
-
type Project = Selectable<ProjectsTable>;
|
|
1095
|
-
type InsertProject = Insertable<ProjectsTable>;
|
|
1096
|
-
type UpdateProject = Updateable<ProjectsTable>;
|
|
1097
|
-
type TeamMember = Selectable<TeamMembersTable>;
|
|
1098
|
-
type InsertTeamMember = Insertable<TeamMembersTable>;
|
|
1099
|
-
type TeamInvitation = Selectable<TeamInvitationsTable>;
|
|
1100
|
-
type InsertTeamInvitation = Insertable<TeamInvitationsTable>;
|
|
1101
920
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1102
921
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1103
922
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -2091,6 +1910,7 @@ declare const TABLE_TO_DB: {
|
|
|
2091
1910
|
chain_read_cache: string
|
|
2092
1911
|
pending_fork_blocks: string
|
|
2093
1912
|
observer_journal: string
|
|
1913
|
+
sync_scopes: string
|
|
2094
1914
|
stage_registry: string
|
|
2095
1915
|
stage_runs: string
|
|
2096
1916
|
stage_block_receipts: string
|
|
@@ -2118,20 +1938,8 @@ declare const TABLE_TO_DB: {
|
|
|
2118
1938
|
api_keys: string
|
|
2119
1939
|
sessions: string
|
|
2120
1940
|
magic_links: string
|
|
2121
|
-
claim_tokens: string
|
|
2122
|
-
usage_daily: string
|
|
2123
|
-
usage_snapshots: string
|
|
2124
|
-
account_insights: string
|
|
2125
|
-
account_agent_runs: string
|
|
2126
1941
|
account_spend_caps: string
|
|
2127
1942
|
processed_stripe_events: string
|
|
2128
|
-
tenants: string
|
|
2129
|
-
tenant_usage_monthly: string
|
|
2130
|
-
tenant_compute_addons: string
|
|
2131
|
-
provisioning_audit_log: string
|
|
2132
|
-
projects: string
|
|
2133
|
-
team_members: string
|
|
2134
|
-
team_invitations: string
|
|
2135
1943
|
subscriptions: string
|
|
2136
1944
|
subscription_outbox: string
|
|
2137
1945
|
subscription_deliveries: string
|
|
@@ -2140,7 +1948,6 @@ declare const TABLE_TO_DB: {
|
|
|
2140
1948
|
subgraph_operations: string
|
|
2141
1949
|
subgraph_health_snapshots: string
|
|
2142
1950
|
subgraph_gaps: string
|
|
2143
|
-
subgraph_usage_daily: string
|
|
2144
1951
|
subgraph_processing_stats: string
|
|
2145
1952
|
subgraph_table_snapshots: string
|
|
2146
1953
|
x402_payments: string
|
|
@@ -2217,4 +2024,4 @@ declare function getRawClient(role?: "source" | "target"): ReturnType<typeof pos
|
|
|
2217
2024
|
declare function getRawClientFor(url: string): ReturnType<typeof postgres>;
|
|
2218
2025
|
/** Close all DB connection pools. Call in CLI commands to allow process exit. */
|
|
2219
2026
|
declare function closeDb(): Promise<void>;
|
|
2220
|
-
export { sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getDbSplitStatus, getDb, closeDb, assertDbSplit, applicationDatabaseUrl, X402PaymentsTable, X402BalancesTable,
|
|
2027
|
+
export { sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getDbSplitStatus, getDb, closeDb, assertDbSplit, applicationDatabaseUrl, X402PaymentsTable, X402BalancesTable, UpdateTransaction, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, UpdateAccountCredits, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TABLE_TO_DB, SyncScopesTable, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionKind, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, StageRunsTable, StageRegistryTable, StageKind, StageFailuresTable, StageBlockReceiptsTable, SessionsTable, Session, ServiceHeartbeatsTable, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcSettlementsTable, SbtcEventsTable, SbtcEventTopic, SOURCE_READ_TYPES, SOURCE_READ_PKS, SOURCE_READ_COLUMNS, RunStatus, RetryState, RepairMode, ProcessedStripeEventsTable, Pox5EventsTable, Pox5EventTopic, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, PendingForkBlocksTable, OutboxStatus, ObserverJournalTable, ObserverJournalStatus, NumericAsText, NativeClock, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, InstancesTable, InsertTransaction, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountCredits, InsertAccount, IndexProgressTable, IndexProgress, IndexPrimaryKey, IndexColumnType, IndexColumn, FailureUnit, FailureClass, EventsTable, EventsArchiveTable, Event, DecoderCheckpointsTable, DecodedEventsTable, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, Database, CoverageSegmentsTable, ContractsTable, Contract, ChainReorgsTable, ChainReadCacheTable, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountCreditsTable, AccountCredits, Account };
|
package/dist/src/db/index.js
CHANGED
|
@@ -139,14 +139,33 @@ class Logger {
|
|
|
139
139
|
var logger = new Logger;
|
|
140
140
|
|
|
141
141
|
// src/mode.ts
|
|
142
|
-
var VALID_MODES = [
|
|
143
|
-
|
|
142
|
+
var VALID_MODES = [
|
|
143
|
+
"oss",
|
|
144
|
+
"platform",
|
|
145
|
+
"archive"
|
|
146
|
+
];
|
|
147
|
+
function declaredMode() {
|
|
144
148
|
const raw = process.env.INSTANCE_MODE?.trim().toLowerCase();
|
|
145
149
|
if (raw && VALID_MODES.includes(raw)) {
|
|
146
150
|
return raw;
|
|
147
151
|
}
|
|
148
152
|
return "oss";
|
|
149
153
|
}
|
|
154
|
+
function getInstanceMode() {
|
|
155
|
+
const declared = declaredMode();
|
|
156
|
+
return declared === "archive" ? "platform" : declared;
|
|
157
|
+
}
|
|
158
|
+
function getDeclaredInstanceMode() {
|
|
159
|
+
return declaredMode();
|
|
160
|
+
}
|
|
161
|
+
function isMeteredReads() {
|
|
162
|
+
const override = process.env.METERED_READS?.trim().toLowerCase();
|
|
163
|
+
if (override === "true")
|
|
164
|
+
return true;
|
|
165
|
+
if (override === "false")
|
|
166
|
+
return false;
|
|
167
|
+
return getInstanceMode() === "platform";
|
|
168
|
+
}
|
|
150
169
|
function isPlatformMode() {
|
|
151
170
|
return getInstanceMode() === "platform";
|
|
152
171
|
}
|
|
@@ -722,6 +741,7 @@ var TABLE_TO_DB = {
|
|
|
722
741
|
chain_read_cache: "source",
|
|
723
742
|
pending_fork_blocks: "source",
|
|
724
743
|
observer_journal: "source",
|
|
744
|
+
sync_scopes: "source",
|
|
725
745
|
stage_registry: "source",
|
|
726
746
|
stage_runs: "source",
|
|
727
747
|
stage_block_receipts: "source",
|
|
@@ -749,20 +769,8 @@ var TABLE_TO_DB = {
|
|
|
749
769
|
api_keys: "target",
|
|
750
770
|
sessions: "target",
|
|
751
771
|
magic_links: "target",
|
|
752
|
-
claim_tokens: "target",
|
|
753
|
-
usage_daily: "target",
|
|
754
|
-
usage_snapshots: "target",
|
|
755
|
-
account_insights: "target",
|
|
756
|
-
account_agent_runs: "target",
|
|
757
772
|
account_spend_caps: "target",
|
|
758
773
|
processed_stripe_events: "target",
|
|
759
|
-
tenants: "target",
|
|
760
|
-
tenant_usage_monthly: "target",
|
|
761
|
-
tenant_compute_addons: "target",
|
|
762
|
-
provisioning_audit_log: "target",
|
|
763
|
-
projects: "target",
|
|
764
|
-
team_members: "target",
|
|
765
|
-
team_invitations: "target",
|
|
766
774
|
subscriptions: "target",
|
|
767
775
|
subscription_outbox: "target",
|
|
768
776
|
subscription_deliveries: "target",
|
|
@@ -771,7 +779,6 @@ var TABLE_TO_DB = {
|
|
|
771
779
|
subgraph_operations: "target",
|
|
772
780
|
subgraph_health_snapshots: "target",
|
|
773
781
|
subgraph_gaps: "target",
|
|
774
|
-
subgraph_usage_daily: "target",
|
|
775
782
|
subgraph_processing_stats: "target",
|
|
776
783
|
subgraph_table_snapshots: "target",
|
|
777
784
|
x402_payments: "target",
|
|
@@ -979,5 +986,5 @@ export {
|
|
|
979
986
|
SOURCE_READ_COLUMNS
|
|
980
987
|
};
|
|
981
988
|
|
|
982
|
-
//# debugId=
|
|
989
|
+
//# debugId=A4E58CDA73ECAF0164756E2164756E21
|
|
983
990
|
//# sourceMappingURL=index.js.map
|