@secondlayer/shared 7.11.1 → 8.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 +0 -169
- package/dist/src/archive/semantic-digest-builder.d.ts +0 -169
- package/dist/src/coverage/index.d.ts +0 -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 +1 -211
- package/dist/src/db/index.js +22 -16
- package/dist/src/db/index.js.map +4 -4
- package/dist/src/db/queries/chain-reorgs.d.ts +0 -169
- package/dist/src/db/queries/chain-reorgs.js +22 -16
- package/dist/src/db/queries/chain-reorgs.js.map +4 -4
- package/dist/src/db/queries/contracts.d.ts +0 -169
- package/dist/src/db/queries/instance.d.ts +0 -169
- package/dist/src/db/queries/integrity.d.ts +0 -169
- package/dist/src/db/queries/subgraph-gaps.d.ts +0 -169
- package/dist/src/db/queries/subgraph-operations.d.ts +1 -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 +1 -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 +0 -169
- package/dist/src/db/queries/subscriptions.js +22 -3
- package/dist/src/db/queries/subscriptions.js.map +3 -3
- package/dist/src/db/schema.d.ts +1 -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 +5 -256
- package/dist/src/index.js +23 -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 +0 -169
- package/dist/src/runtime/index.js +26 -3
- package/dist/src/runtime/index.js.map +3 -3
- 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/package.json +5 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -222,11 +222,9 @@ interface AccountsTable {
|
|
|
222
222
|
ghost: Generated<boolean>;
|
|
223
223
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
224
224
|
wallet_principal: string | null;
|
|
225
|
-
plan: Generated<string>;
|
|
226
225
|
display_name: string | null;
|
|
227
226
|
bio: string | null;
|
|
228
227
|
avatar_url: string | null;
|
|
229
|
-
slug: string | null;
|
|
230
228
|
stripe_customer_id: string | null;
|
|
231
229
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
232
230
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -243,19 +241,6 @@ interface SessionsTable {
|
|
|
243
241
|
last_used_at: Date | null;
|
|
244
242
|
created_at: Generated<Date>;
|
|
245
243
|
}
|
|
246
|
-
/**
|
|
247
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
248
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
249
|
-
* the account as claimed (or merged into an existing account).
|
|
250
|
-
*/
|
|
251
|
-
interface ClaimTokensTable {
|
|
252
|
-
id: Generated<string>;
|
|
253
|
-
account_id: string;
|
|
254
|
-
token_hash: string;
|
|
255
|
-
created_at: Generated<Date>;
|
|
256
|
-
expires_at: Date;
|
|
257
|
-
used_at: Date | null;
|
|
258
|
-
}
|
|
259
244
|
interface MagicLinksTable {
|
|
260
245
|
id: Generated<string>;
|
|
261
246
|
email: string;
|
|
@@ -266,47 +251,6 @@ interface MagicLinksTable {
|
|
|
266
251
|
failed_attempts: Generated<number>;
|
|
267
252
|
created_at: Generated<Date>;
|
|
268
253
|
}
|
|
269
|
-
interface UsageDailyTable {
|
|
270
|
-
account_id: string;
|
|
271
|
-
tenant_id: string | null;
|
|
272
|
-
date: string;
|
|
273
|
-
api_requests: Generated<number>;
|
|
274
|
-
deliveries: Generated<number>;
|
|
275
|
-
streams_events_returned: Generated<number>;
|
|
276
|
-
index_decoded_events_returned: Generated<number>;
|
|
277
|
-
}
|
|
278
|
-
interface UsageSnapshotsTable {
|
|
279
|
-
id: Generated<string>;
|
|
280
|
-
account_id: string;
|
|
281
|
-
measured_at: Generated<Date>;
|
|
282
|
-
storage_bytes: Generated<number>;
|
|
283
|
-
}
|
|
284
|
-
interface AccountInsightsTable {
|
|
285
|
-
id: Generated<string>;
|
|
286
|
-
account_id: string;
|
|
287
|
-
category: string;
|
|
288
|
-
insight_type: string;
|
|
289
|
-
resource_id: string | null;
|
|
290
|
-
severity: string;
|
|
291
|
-
title: string;
|
|
292
|
-
body: string;
|
|
293
|
-
data: unknown;
|
|
294
|
-
dismissed_at: Date | null;
|
|
295
|
-
expires_at: Date | null;
|
|
296
|
-
created_at: Generated<Date>;
|
|
297
|
-
}
|
|
298
|
-
interface AccountAgentRunsTable {
|
|
299
|
-
id: Generated<string>;
|
|
300
|
-
account_id: string;
|
|
301
|
-
started_at: Generated<Date>;
|
|
302
|
-
completed_at: Date | null;
|
|
303
|
-
status: Generated<string>;
|
|
304
|
-
input_tokens: Generated<number>;
|
|
305
|
-
output_tokens: Generated<number>;
|
|
306
|
-
cost_usd: Generated<number>;
|
|
307
|
-
insights_created: Generated<number>;
|
|
308
|
-
error: string | null;
|
|
309
|
-
}
|
|
310
254
|
interface SubgraphProcessingStatsTable {
|
|
311
255
|
id: Generated<string>;
|
|
312
256
|
subgraph_name: string;
|
|
@@ -339,41 +283,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
339
283
|
last_processed_block: number | null;
|
|
340
284
|
captured_at: Generated<Date>;
|
|
341
285
|
}
|
|
342
|
-
interface SubgraphUsageDailyTable {
|
|
343
|
-
subgraph_id: string;
|
|
344
|
-
date: string;
|
|
345
|
-
query_count: Generated<number>;
|
|
346
|
-
}
|
|
347
|
-
interface ProjectsTable {
|
|
348
|
-
id: Generated<string>;
|
|
349
|
-
name: string;
|
|
350
|
-
slug: string;
|
|
351
|
-
account_id: string;
|
|
352
|
-
settings: Generated<Record<string, unknown>>;
|
|
353
|
-
network: Generated<string>;
|
|
354
|
-
node_rpc: string | null;
|
|
355
|
-
created_at: Generated<Date>;
|
|
356
|
-
updated_at: Generated<Date>;
|
|
357
|
-
}
|
|
358
|
-
interface TeamMembersTable {
|
|
359
|
-
id: Generated<string>;
|
|
360
|
-
project_id: string;
|
|
361
|
-
account_id: string;
|
|
362
|
-
role: Generated<string>;
|
|
363
|
-
invited_by: string | null;
|
|
364
|
-
created_at: Generated<Date>;
|
|
365
|
-
}
|
|
366
|
-
interface TeamInvitationsTable {
|
|
367
|
-
id: Generated<string>;
|
|
368
|
-
project_id: string;
|
|
369
|
-
email: string;
|
|
370
|
-
role: Generated<string>;
|
|
371
|
-
token: string;
|
|
372
|
-
invited_by: string | null;
|
|
373
|
-
expires_at: Date;
|
|
374
|
-
accepted_at: Date | null;
|
|
375
|
-
created_at: Generated<Date>;
|
|
376
|
-
}
|
|
377
286
|
interface ProcessedStripeEventsTable {
|
|
378
287
|
event_id: string;
|
|
379
288
|
event_type: string;
|
|
@@ -826,27 +735,14 @@ interface Database {
|
|
|
826
735
|
accounts: AccountsTable;
|
|
827
736
|
sessions: SessionsTable;
|
|
828
737
|
magic_links: MagicLinksTable;
|
|
829
|
-
claim_tokens: ClaimTokensTable;
|
|
830
|
-
usage_daily: UsageDailyTable;
|
|
831
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
832
|
-
account_insights: AccountInsightsTable;
|
|
833
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
834
738
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
835
739
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
836
740
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
837
741
|
subgraph_gaps: SubgraphGapsTable;
|
|
838
742
|
subgraph_operations: SubgraphOperationsTable;
|
|
839
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
840
|
-
projects: ProjectsTable;
|
|
841
|
-
team_members: TeamMembersTable;
|
|
842
|
-
team_invitations: TeamInvitationsTable;
|
|
843
743
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
844
|
-
tenants: TenantsTable;
|
|
845
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
846
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
847
744
|
account_spend_caps: AccountSpendCapsTable;
|
|
848
745
|
account_credits: AccountCreditsTable;
|
|
849
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
850
746
|
subscriptions: SubscriptionsTable;
|
|
851
747
|
subscription_outbox: SubscriptionOutboxTable;
|
|
852
748
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -921,66 +817,6 @@ interface X402PaymentsTable {
|
|
|
921
817
|
* reconciler's heal path can never double-credit them. */
|
|
922
818
|
credited_at: Generated<Date> | null;
|
|
923
819
|
}
|
|
924
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
925
|
-
interface TenantsTable {
|
|
926
|
-
id: Generated<string>;
|
|
927
|
-
account_id: string;
|
|
928
|
-
slug: string;
|
|
929
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
930
|
-
plan: string;
|
|
931
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
932
|
-
memory_mb: number;
|
|
933
|
-
storage_limit_mb: number;
|
|
934
|
-
storage_used_mb: number | null;
|
|
935
|
-
pg_container_id: string | null;
|
|
936
|
-
api_container_id: string | null;
|
|
937
|
-
processor_container_id: string | null;
|
|
938
|
-
target_database_url_enc: Buffer;
|
|
939
|
-
tenant_jwt_secret_enc: Buffer;
|
|
940
|
-
anon_key_enc: Buffer;
|
|
941
|
-
service_key_enc: Buffer;
|
|
942
|
-
api_url_internal: string;
|
|
943
|
-
api_url_public: string;
|
|
944
|
-
suspended_at: Date | null;
|
|
945
|
-
last_health_check_at: Date | null;
|
|
946
|
-
last_active_at: Generated<Date>;
|
|
947
|
-
service_gen: Generated<number>;
|
|
948
|
-
anon_gen: Generated<number>;
|
|
949
|
-
project_id: string | null;
|
|
950
|
-
created_at: Generated<Date>;
|
|
951
|
-
updated_at: Generated<Date>;
|
|
952
|
-
}
|
|
953
|
-
type Tenant = Selectable<TenantsTable>;
|
|
954
|
-
type InsertTenant = Insertable<TenantsTable>;
|
|
955
|
-
type UpdateTenant = Updateable<TenantsTable>;
|
|
956
|
-
interface TenantUsageMonthlyTable {
|
|
957
|
-
id: Generated<string>;
|
|
958
|
-
tenant_id: string;
|
|
959
|
-
period_month: Date;
|
|
960
|
-
storage_peak_mb: Generated<number>;
|
|
961
|
-
storage_avg_mb: Generated<number>;
|
|
962
|
-
storage_last_mb: Generated<number>;
|
|
963
|
-
measurements: Generated<number>;
|
|
964
|
-
first_at: Generated<Date>;
|
|
965
|
-
last_at: Generated<Date>;
|
|
966
|
-
}
|
|
967
|
-
type TenantUsageMonthly = Selectable<TenantUsageMonthlyTable>;
|
|
968
|
-
type InsertTenantUsageMonthly = Insertable<TenantUsageMonthlyTable>;
|
|
969
|
-
type UpdateTenantUsageMonthly = Updateable<TenantUsageMonthlyTable>;
|
|
970
|
-
interface TenantComputeAddonsTable {
|
|
971
|
-
id: Generated<string>;
|
|
972
|
-
tenant_id: string;
|
|
973
|
-
memory_mb_delta: Generated<number>;
|
|
974
|
-
cpu_delta: Generated<number | string>;
|
|
975
|
-
storage_mb_delta: Generated<number>;
|
|
976
|
-
effective_from: Generated<Date>;
|
|
977
|
-
effective_until: Date | null;
|
|
978
|
-
stripe_subscription_item_id: string | null;
|
|
979
|
-
created_at: Generated<Date>;
|
|
980
|
-
}
|
|
981
|
-
type TenantComputeAddon = Selectable<TenantComputeAddonsTable>;
|
|
982
|
-
type InsertTenantComputeAddon = Insertable<TenantComputeAddonsTable>;
|
|
983
|
-
type UpdateTenantComputeAddon = Updateable<TenantComputeAddonsTable>;
|
|
984
820
|
interface AccountSpendCapsTable {
|
|
985
821
|
account_id: string;
|
|
986
822
|
monthly_cap_cents: number | null;
|
|
@@ -1010,22 +846,6 @@ interface AccountCreditsTable {
|
|
|
1010
846
|
type AccountCredits = Selectable<AccountCreditsTable>;
|
|
1011
847
|
type InsertAccountCredits = Insertable<AccountCreditsTable>;
|
|
1012
848
|
type UpdateAccountCredits = Updateable<AccountCreditsTable>;
|
|
1013
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
1014
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1015
|
-
interface ProvisioningAuditLogTable {
|
|
1016
|
-
id: Generated<string>;
|
|
1017
|
-
tenant_id: string | null;
|
|
1018
|
-
tenant_slug: string | null;
|
|
1019
|
-
account_id: string | null;
|
|
1020
|
-
actor: string;
|
|
1021
|
-
event: ProvisioningAuditEvent;
|
|
1022
|
-
status: ProvisioningAuditStatus;
|
|
1023
|
-
detail: unknown | null;
|
|
1024
|
-
error: string | null;
|
|
1025
|
-
created_at: Generated<Date>;
|
|
1026
|
-
}
|
|
1027
|
-
type ProvisioningAuditLog = Selectable<ProvisioningAuditLogTable>;
|
|
1028
|
-
type InsertProvisioningAuditLog = Insertable<ProvisioningAuditLogTable>;
|
|
1029
849
|
type Block = Selectable<BlocksTable>;
|
|
1030
850
|
type InsertBlock = Insertable<BlocksTable>;
|
|
1031
851
|
type UpdateBlock = Updateable<BlocksTable>;
|
|
@@ -1056,29 +876,12 @@ type Account = Selectable<AccountsTable>;
|
|
|
1056
876
|
type InsertAccount = Insertable<AccountsTable>;
|
|
1057
877
|
type MagicLink = Selectable<MagicLinksTable>;
|
|
1058
878
|
type InsertMagicLink = Insertable<MagicLinksTable>;
|
|
1059
|
-
type ClaimToken = Selectable<ClaimTokensTable>;
|
|
1060
|
-
type InsertClaimToken = Insertable<ClaimTokensTable>;
|
|
1061
879
|
type Session = Selectable<SessionsTable>;
|
|
1062
880
|
type InsertSession = Insertable<SessionsTable>;
|
|
1063
|
-
type UsageDaily = Selectable<UsageDailyTable>;
|
|
1064
|
-
type UsageSnapshot = Selectable<UsageSnapshotsTable>;
|
|
1065
|
-
type AccountInsight = Selectable<AccountInsightsTable>;
|
|
1066
|
-
type InsertAccountInsight = Insertable<AccountInsightsTable>;
|
|
1067
|
-
type AccountAgentRun = Selectable<AccountAgentRunsTable>;
|
|
1068
|
-
type InsertAccountAgentRun = Insertable<AccountAgentRunsTable>;
|
|
1069
881
|
type SubgraphHealthSnapshot = Selectable<SubgraphHealthSnapshotsTable>;
|
|
1070
882
|
type InsertSubgraphHealthSnapshot = Insertable<SubgraphHealthSnapshotsTable>;
|
|
1071
883
|
type SubgraphGap = Selectable<SubgraphGapsTable>;
|
|
1072
884
|
type InsertSubgraphGap = Insertable<SubgraphGapsTable>;
|
|
1073
|
-
type SubgraphUsageDaily = Selectable<SubgraphUsageDailyTable>;
|
|
1074
|
-
type InsertSubgraphUsageDaily = Insertable<SubgraphUsageDailyTable>;
|
|
1075
|
-
type Project = Selectable<ProjectsTable>;
|
|
1076
|
-
type InsertProject = Insertable<ProjectsTable>;
|
|
1077
|
-
type UpdateProject = Updateable<ProjectsTable>;
|
|
1078
|
-
type TeamMember = Selectable<TeamMembersTable>;
|
|
1079
|
-
type InsertTeamMember = Insertable<TeamMembersTable>;
|
|
1080
|
-
type TeamInvitation = Selectable<TeamInvitationsTable>;
|
|
1081
|
-
type InsertTeamInvitation = Insertable<TeamInvitationsTable>;
|
|
1082
885
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1083
886
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1084
887
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -2152,20 +1955,8 @@ declare const TABLE_TO_DB: {
|
|
|
2152
1955
|
api_keys: string
|
|
2153
1956
|
sessions: string
|
|
2154
1957
|
magic_links: string
|
|
2155
|
-
claim_tokens: string
|
|
2156
|
-
usage_daily: string
|
|
2157
|
-
usage_snapshots: string
|
|
2158
|
-
account_insights: string
|
|
2159
|
-
account_agent_runs: string
|
|
2160
1958
|
account_spend_caps: string
|
|
2161
1959
|
processed_stripe_events: string
|
|
2162
|
-
tenants: string
|
|
2163
|
-
tenant_usage_monthly: string
|
|
2164
|
-
tenant_compute_addons: string
|
|
2165
|
-
provisioning_audit_log: string
|
|
2166
|
-
projects: string
|
|
2167
|
-
team_members: string
|
|
2168
|
-
team_invitations: string
|
|
2169
1960
|
subscriptions: string
|
|
2170
1961
|
subscription_outbox: string
|
|
2171
1962
|
subscription_deliveries: string
|
|
@@ -2174,7 +1965,6 @@ declare const TABLE_TO_DB: {
|
|
|
2174
1965
|
subgraph_operations: string
|
|
2175
1966
|
subgraph_health_snapshots: string
|
|
2176
1967
|
subgraph_gaps: string
|
|
2177
|
-
subgraph_usage_daily: string
|
|
2178
1968
|
subgraph_processing_stats: string
|
|
2179
1969
|
subgraph_table_snapshots: string
|
|
2180
1970
|
x402_payments: string
|
|
@@ -2267,27 +2057,6 @@ declare const ErrorCodes: {
|
|
|
2267
2057
|
readonly INSTANCE_EXISTS: "INSTANCE_EXISTS"
|
|
2268
2058
|
};
|
|
2269
2059
|
type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
2270
|
-
/**
|
|
2271
|
-
* Structured payload carried on a refused BYO breaking-change deploy. Single-sourced
|
|
2272
|
-
* here so subgraphs (thrower), api (body), sdk (typed error), and cli (renderer) all
|
|
2273
|
-
* agree on shape. The deploy is still refused — this only describes the manual
|
|
2274
|
-
* DROP + rebuild the user must run themselves.
|
|
2275
|
-
*/
|
|
2276
|
-
interface ByoBreakingChangeDetails {
|
|
2277
|
-
reasons: string[];
|
|
2278
|
-
diff: {
|
|
2279
|
-
addedTables: string[]
|
|
2280
|
-
removedTables: string[]
|
|
2281
|
-
addedColumns: Record<string, string[]>
|
|
2282
|
-
breakingChanges: string[]
|
|
2283
|
-
};
|
|
2284
|
-
plan: {
|
|
2285
|
-
schemaName: string
|
|
2286
|
-
dropStatement: string
|
|
2287
|
-
statements: string[]
|
|
2288
|
-
grantScript: string
|
|
2289
|
-
};
|
|
2290
|
-
}
|
|
2291
2060
|
/** Base error class for all Secondlayer errors. */
|
|
2292
2061
|
declare class SecondLayerError extends Error {
|
|
2293
2062
|
code: ErrorCode;
|
|
@@ -2375,19 +2144,11 @@ interface DeploySubgraphRequest {
|
|
|
2375
2144
|
startBlock?: number;
|
|
2376
2145
|
/** Original TypeScript source, persisted so chat can read/diff/edit later. */
|
|
2377
2146
|
sourceCode?: string;
|
|
2378
|
-
/**
|
|
2379
|
-
* BYO data plane: a user-owned Postgres connection string. When set, the
|
|
2380
|
-
* subgraph's schema, handler writes, and serving reads live in this DB instead
|
|
2381
|
-
* of the managed one. Stored encrypted at rest, never returned.
|
|
2382
|
-
*/
|
|
2383
|
-
databaseUrl?: string;
|
|
2384
|
-
/** Validate the connection + print the DDL/grant plan without deploying. */
|
|
2147
|
+
/** Validate the definition + print the DDL plan without deploying. */
|
|
2385
2148
|
dryRun?: boolean;
|
|
2386
2149
|
/**
|
|
2387
|
-
* Read visibility. Server-side
|
|
2388
|
-
*
|
|
2389
|
-
* BYO-database deploys → private (public reads hit the user's own
|
|
2390
|
-
* Postgres, so going public is an explicit choice).
|
|
2150
|
+
* Read visibility. Server-side default: deploys → public (anon reads on
|
|
2151
|
+
* /v1/subgraphs, name claimed in the global public namespace).
|
|
2391
2152
|
*/
|
|
2392
2153
|
visibility?: "public" | "private";
|
|
2393
2154
|
}
|
|
@@ -2398,10 +2159,8 @@ interface DeploySubgraphResponse {
|
|
|
2398
2159
|
version: string;
|
|
2399
2160
|
visibility?: "public" | "private";
|
|
2400
2161
|
message: string;
|
|
2401
|
-
/** Effective indexing start height
|
|
2162
|
+
/** Effective indexing start height. */
|
|
2402
2163
|
start_block?: number;
|
|
2403
|
-
/** True when the free-tier forward-only policy adjusted the start. */
|
|
2404
|
-
start_block_clamped?: boolean;
|
|
2405
2164
|
operationId?: string;
|
|
2406
2165
|
reindexStarted?: boolean;
|
|
2407
2166
|
/** Bounded candidate-event denominator for the reindex just started, when the
|
|
@@ -2432,7 +2191,6 @@ interface SubgraphSummary {
|
|
|
2432
2191
|
progress: number;
|
|
2433
2192
|
blocksRemaining?: number;
|
|
2434
2193
|
syncMode?: "sync" | "reindex";
|
|
2435
|
-
resourceWarning?: SubgraphResourceWarning;
|
|
2436
2194
|
gapCount: number;
|
|
2437
2195
|
/** history_filling = expected gaps while a tip-first backfill op runs. */
|
|
2438
2196
|
integrity: "complete" | "gaps_detected" | "history_filling";
|
|
@@ -2480,7 +2238,6 @@ interface SubgraphSyncInfo {
|
|
|
2480
2238
|
estimatedEvents?: number;
|
|
2481
2239
|
processedEvents?: number;
|
|
2482
2240
|
etaSeconds?: number | null;
|
|
2483
|
-
resourceWarning?: SubgraphResourceWarning;
|
|
2484
2241
|
gaps: {
|
|
2485
2242
|
count: number
|
|
2486
2243
|
totalMissingBlocks: number
|
|
@@ -2489,14 +2246,6 @@ interface SubgraphSyncInfo {
|
|
|
2489
2246
|
/** history_filling = expected gaps while a tip-first backfill op runs. */
|
|
2490
2247
|
integrity: "complete" | "gaps_detected" | "history_filling";
|
|
2491
2248
|
}
|
|
2492
|
-
interface SubgraphResourceWarning {
|
|
2493
|
-
code: string;
|
|
2494
|
-
message: string;
|
|
2495
|
-
plan?: string;
|
|
2496
|
-
blockRange: number;
|
|
2497
|
-
processorMemoryMb: number;
|
|
2498
|
-
recommendedPlan: "launch";
|
|
2499
|
-
}
|
|
2500
2249
|
interface SubgraphDetail {
|
|
2501
2250
|
name: string;
|
|
2502
2251
|
version: string;
|
|
@@ -3254,4 +3003,4 @@ interface ChainTestDelivery {
|
|
|
3254
3003
|
* "Chain subscription webhook payloads" doc.
|
|
3255
3004
|
*/
|
|
3256
3005
|
type ChainWebhookDelivery = ChainApplyDeliveryOf<"stx_transfer", ChainEventEnvelope<"stx_transfer_event", ChainStxTransferData>> | ChainApplyDeliveryOf<"stx_mint", ChainEventEnvelope<"stx_mint_event", ChainStxMintData>> | ChainApplyDeliveryOf<"stx_burn", ChainEventEnvelope<"stx_burn_event", ChainStxBurnData>> | ChainApplyDeliveryOf<"stx_lock", ChainEventEnvelope<"stx_lock_event", ChainStxLockData>> | ChainApplyDeliveryOf<"ft_transfer", ChainEventEnvelope<"ft_transfer_event", ChainFtTransferData>> | ChainApplyDeliveryOf<"ft_mint", ChainEventEnvelope<"ft_mint_event", ChainFtMintData>> | ChainApplyDeliveryOf<"ft_burn", ChainEventEnvelope<"ft_burn_event", ChainFtBurnData>> | ChainApplyDeliveryOf<"nft_transfer", ChainEventEnvelope<"nft_transfer_event", ChainNftTransferData>> | ChainApplyDeliveryOf<"nft_mint", ChainEventEnvelope<"nft_mint_event", ChainNftMintData>> | ChainApplyDeliveryOf<"nft_burn", ChainEventEnvelope<"nft_burn_event", ChainNftBurnData>> | ChainApplyDeliveryOf<"print_event", ChainEventEnvelope<"contract_event", ChainPrintEventData>> | ChainApplyDeliveryOf<"contract_call", ChainTxLevelEvent> | ChainApplyDeliveryOf<"contract_deploy", ChainTxLevelEvent> | ChainApplyDeliveryOf<"sbtc_deposit", SbtcDepositEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_create", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_accept", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_reject", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_swept_confirmed", SbtcWithdrawalSweptConfirmedEvent> | ChainReorgRollbackDelivery | ChainTestDelivery;
|
|
3257
|
-
export { validateSubscriptionFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isPox5DecoderEnabled, isPox4DecoderEnabled, isEmptyRangeCursor, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, compareStreamsCursor, closeDb, blockEndCursor, assertDbSplit, applicationDatabaseUrl, X402PaymentsTable, X402BalancesTable, VersionConflictError, ValidationError,
|
|
3006
|
+
export { validateSubscriptionFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isPox5DecoderEnabled, isPox4DecoderEnabled, isEmptyRangeCursor, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, compareStreamsCursor, closeDb, blockEndCursor, assertDbSplit, applicationDatabaseUrl, X402PaymentsTable, X402BalancesTable, VersionConflictError, ValidationError, UpdateTransaction, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, UpdateAccountCredits, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantSuspendedError, TABLE_TO_DB, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionKind, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, SubgraphAgentSchema, Subgraph, StreamsEventType, StreamsDbEventType, StreamsCursor, StageRunsTable, StageRegistryTable, StageKind, StageFailuresTable, StageBlockReceiptsTable, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalEvent, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcSettlementsTable, SbtcEventsTable, SbtcEventTopic, SbtcDepositEvent, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, STREAMS_TO_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_DB_EVENT_TYPES, SOURCE_READ_TYPES, SOURCE_READ_PKS, SOURCE_READ_COLUMNS, RunStatus, RotateSecretResponse, RetryState, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, RepairMode, ReindexResponse, RateLimitError, ProcessedStripeEventsTable, Pox5EventsTable, Pox5EventTopic, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, PendingForkBlocksTable, PaymentRequiredError, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, ObserverJournalTable, ObserverJournalStatus, NumericAsText, NotFoundError, NativeClock, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, KeyRotatedError, 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, ForbiddenError, FailureUnit, FailureClass, EventsTable, EventsArchiveTable, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecoderCheckpointsTable, DecodedEventsTable, DecodedEventType2 as DecodedEventType, DeadRow, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DB_TO_STREAMS_EVENT_TYPE, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, CoverageSegmentsTable, ContractsTable, Contract, ChainWebhookEnvelope, ChainWebhookDelivery, ChainTxLevelEvent, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgsTable, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainReadCacheTable, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CODE_TO_STATUS, CHAIN_TRIGGER_TYPES, CHAIN_TRIGGER_FIELDS, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountCreditsTable, AccountCredits, Account };
|
package/dist/src/index.js
CHANGED
|
@@ -138,14 +138,33 @@ class Logger {
|
|
|
138
138
|
var logger = new Logger;
|
|
139
139
|
|
|
140
140
|
// src/mode.ts
|
|
141
|
-
var VALID_MODES = [
|
|
142
|
-
|
|
141
|
+
var VALID_MODES = [
|
|
142
|
+
"oss",
|
|
143
|
+
"platform",
|
|
144
|
+
"archive"
|
|
145
|
+
];
|
|
146
|
+
function declaredMode() {
|
|
143
147
|
const raw = process.env.INSTANCE_MODE?.trim().toLowerCase();
|
|
144
148
|
if (raw && VALID_MODES.includes(raw)) {
|
|
145
149
|
return raw;
|
|
146
150
|
}
|
|
147
151
|
return "oss";
|
|
148
152
|
}
|
|
153
|
+
function getInstanceMode() {
|
|
154
|
+
const declared = declaredMode();
|
|
155
|
+
return declared === "archive" ? "platform" : declared;
|
|
156
|
+
}
|
|
157
|
+
function getDeclaredInstanceMode() {
|
|
158
|
+
return declaredMode();
|
|
159
|
+
}
|
|
160
|
+
function isMeteredReads() {
|
|
161
|
+
const override = process.env.METERED_READS?.trim().toLowerCase();
|
|
162
|
+
if (override === "true")
|
|
163
|
+
return true;
|
|
164
|
+
if (override === "false")
|
|
165
|
+
return false;
|
|
166
|
+
return getInstanceMode() === "platform";
|
|
167
|
+
}
|
|
149
168
|
function isPlatformMode() {
|
|
150
169
|
return getInstanceMode() === "platform";
|
|
151
170
|
}
|
|
@@ -748,20 +767,8 @@ var TABLE_TO_DB = {
|
|
|
748
767
|
api_keys: "target",
|
|
749
768
|
sessions: "target",
|
|
750
769
|
magic_links: "target",
|
|
751
|
-
claim_tokens: "target",
|
|
752
|
-
usage_daily: "target",
|
|
753
|
-
usage_snapshots: "target",
|
|
754
|
-
account_insights: "target",
|
|
755
|
-
account_agent_runs: "target",
|
|
756
770
|
account_spend_caps: "target",
|
|
757
771
|
processed_stripe_events: "target",
|
|
758
|
-
tenants: "target",
|
|
759
|
-
tenant_usage_monthly: "target",
|
|
760
|
-
tenant_compute_addons: "target",
|
|
761
|
-
provisioning_audit_log: "target",
|
|
762
|
-
projects: "target",
|
|
763
|
-
team_members: "target",
|
|
764
|
-
team_invitations: "target",
|
|
765
772
|
subscriptions: "target",
|
|
766
773
|
subscription_outbox: "target",
|
|
767
774
|
subscription_deliveries: "target",
|
|
@@ -770,7 +777,6 @@ var TABLE_TO_DB = {
|
|
|
770
777
|
subgraph_operations: "target",
|
|
771
778
|
subgraph_health_snapshots: "target",
|
|
772
779
|
subgraph_gaps: "target",
|
|
773
|
-
subgraph_usage_daily: "target",
|
|
774
780
|
subgraph_processing_stats: "target",
|
|
775
781
|
subgraph_table_snapshots: "target",
|
|
776
782
|
x402_payments: "target",
|
|
@@ -1079,10 +1085,8 @@ var CODE_TO_STATUS = {
|
|
|
1079
1085
|
NO_TENANT_FOR_PROJECT: 404,
|
|
1080
1086
|
INSTANCE_EXISTS: 409,
|
|
1081
1087
|
SUBGRAPH_NOT_FOUND: 404,
|
|
1082
|
-
BYO_BREAKING_CHANGE: 422,
|
|
1083
1088
|
PUBLIC_NAME_TAKEN: 409,
|
|
1084
|
-
GHOST_KEY_READ_ONLY: 403
|
|
1085
|
-
GENESIS_BACKFILL_REQUIRES_PLAN: 403
|
|
1089
|
+
GHOST_KEY_READ_ONLY: 403
|
|
1086
1090
|
};
|
|
1087
1091
|
function getErrorMessage(err) {
|
|
1088
1092
|
return err instanceof Error ? err.message : String(err);
|
|
@@ -1099,7 +1103,6 @@ var DeploySubgraphRequestSchema = z2.object({
|
|
|
1099
1103
|
handlerCode: z2.string().max(1048576, "handler code exceeds 1MB limit"),
|
|
1100
1104
|
startBlock: z2.number().int().nonnegative().optional(),
|
|
1101
1105
|
sourceCode: z2.string().max(1048576, "source code exceeds 1MB limit").optional(),
|
|
1102
|
-
databaseUrl: z2.string().url().refine((u) => u.startsWith("postgres://") || u.startsWith("postgresql://"), "must be a postgres:// connection string").optional(),
|
|
1103
1106
|
dryRun: z2.boolean().optional(),
|
|
1104
1107
|
visibility: z2.enum(["public", "private"]).optional()
|
|
1105
1108
|
});
|
|
@@ -2143,5 +2146,5 @@ export {
|
|
|
2143
2146
|
AuthenticationError
|
|
2144
2147
|
};
|
|
2145
2148
|
|
|
2146
|
-
//# debugId=
|
|
2149
|
+
//# debugId=95914A05F165D58164756E2164756E21
|
|
2147
2150
|
//# sourceMappingURL=index.js.map
|