@opengeni/db 3.2.2 → 3.3.1-canary.38922642121001
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/billing-subscription-operations.d.ts +28 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-reconciliation.js +2 -2
- package/dist/{chunk-OXO32LTK.js → chunk-2QADNZV6.js} +94 -1
- package/dist/chunk-2QADNZV6.js.map +1 -0
- package/dist/{chunk-IF63BST7.js → chunk-3YU3GU3E.js} +2 -2
- package/dist/{chunk-VBG4TW5C.js → chunk-AT6OYYTW.js} +2 -2
- package/dist/{chunk-K6NT66NP.js → chunk-BSYWZ4OE.js} +4 -4
- package/dist/{chunk-JYPBOJ2Y.js → chunk-CNN7SI45.js} +4 -4
- package/dist/{chunk-YWHG45TK.js → chunk-CXYIV33Q.js} +6 -6
- package/dist/{chunk-AYZC65QU.js → chunk-FZOH3MAC.js} +2 -2
- package/dist/{chunk-6UU7OVUN.js → chunk-GE5XUPYV.js} +38 -9
- package/dist/chunk-GE5XUPYV.js.map +1 -0
- package/dist/{chunk-VCJAYIPH.js → chunk-LDOJFAPS.js} +2 -2
- package/dist/{chunk-4BAKPTPG.js → chunk-MXC4VSKC.js} +3 -3
- package/dist/{chunk-YH4GWEDM.js → chunk-P64KTO2R.js} +2 -2
- package/dist/{chunk-HMKUJ6NI.js → chunk-PXFHMVLY.js} +168 -9
- package/dist/chunk-PXFHMVLY.js.map +1 -0
- package/dist/{chunk-LRRGVHAQ.js → chunk-QZ7SWGNE.js} +2 -2
- package/dist/{chunk-L3NT43Z5.js → chunk-QZMGPD3S.js} +141 -28
- package/dist/chunk-QZMGPD3S.js.map +1 -0
- package/dist/{chunk-V22DUH4C.js → chunk-RI75XARO.js} +5 -5
- package/dist/{chunk-XQHABE23.js → chunk-S7SSOWRQ.js} +4 -4
- package/dist/{chunk-D7LTIG33.js → chunk-SZ6WN2S4.js} +2 -2
- package/dist/{chunk-RCDMYTLP.js → chunk-VC23MB4Q.js} +2 -2
- package/dist/{chunk-V2X2NK7T.js → chunk-ZMZ2CIKY.js} +3305 -3003
- package/dist/{chunk-V2X2NK7T.js.map → chunk-ZMZ2CIKY.js.map} +1 -1
- package/dist/connect-attempts.js +3 -3
- package/dist/credit-balances.d.ts +5 -5
- package/dist/database.d.ts +9 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +78 -3
- package/dist/index.js +73 -19
- package/dist/insights-site-usage.d.ts +10 -0
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/mcp-operations.js +2 -2
- package/dist/migrate.js +19 -19
- package/dist/organization-integration-policy.js +3 -3
- package/dist/provision-roles.js +1 -1
- package/dist/retained-provider-commands.d.ts +21 -21
- package/dist/retained-provider-commands.js +6 -6
- package/dist/runtime-posture.d.ts +9 -5
- package/dist/schema.d.ts +800 -0
- package/dist/schema.js +9 -1
- package/dist/session-background-commands.js +5 -5
- package/dist/session-command-output.js +5 -5
- package/dist/session-event-slices.js +3 -3
- package/dist/session-mcp-credential-rotation.js +6 -6
- package/dist/session-tenancy.js +6 -6
- package/dist/site-publishing.d.ts +11 -0
- package/dist/{subscription-core-codex-4G4CCOJU.js → subscription-core-codex-D7PTEZH3.js} +6 -6
- package/dist/{subscription-core-codex-compat-64ACIZVP.js → subscription-core-codex-compat-L75WHH7M.js} +8 -8
- package/dist/subscription-plan-maintenance.d.ts +22 -0
- package/dist/subscription-plans.d.ts +65 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-tool-defaults.js +5 -5
- package/drizzle/0793_private_site_sessions.sql +166 -0
- package/drizzle/0794_site_ai_insights.sql +175 -0
- package/drizzle/0795_site_lifecycle_cancellation.sql +121 -0
- package/drizzle/0796_billing_subscription_operations.sql +85 -0
- package/drizzle/0797_subscription_plan_foundation.sql +587 -0
- package/drizzle/0798_subscription_plan_maintenance.sql +92 -0
- package/package.json +9 -9
- package/src/billing-subscription-operations.ts +74 -0
- package/src/credit-balances.ts +39 -10
- package/src/database.ts +45 -5
- package/src/index.ts +167 -18
- package/src/insights-site-usage.ts +37 -0
- package/src/provision-roles.ts +40 -0
- package/src/runtime-posture.ts +195 -7
- package/src/schema.ts +117 -0
- package/src/site-publishing.ts +35 -0
- package/src/subscription-plan-maintenance.ts +158 -0
- package/src/subscription-plans.ts +149 -0
- package/src/video-generation.ts +12 -1
- package/dist/chunk-6UU7OVUN.js.map +0 -1
- package/dist/chunk-HMKUJ6NI.js.map +0 -1
- package/dist/chunk-L3NT43Z5.js.map +0 -1
- package/dist/chunk-OXO32LTK.js.map +0 -1
- /package/dist/{chunk-IF63BST7.js.map → chunk-3YU3GU3E.js.map} +0 -0
- /package/dist/{chunk-VBG4TW5C.js.map → chunk-AT6OYYTW.js.map} +0 -0
- /package/dist/{chunk-K6NT66NP.js.map → chunk-BSYWZ4OE.js.map} +0 -0
- /package/dist/{chunk-JYPBOJ2Y.js.map → chunk-CNN7SI45.js.map} +0 -0
- /package/dist/{chunk-YWHG45TK.js.map → chunk-CXYIV33Q.js.map} +0 -0
- /package/dist/{chunk-AYZC65QU.js.map → chunk-FZOH3MAC.js.map} +0 -0
- /package/dist/{chunk-VCJAYIPH.js.map → chunk-LDOJFAPS.js.map} +0 -0
- /package/dist/{chunk-4BAKPTPG.js.map → chunk-MXC4VSKC.js.map} +0 -0
- /package/dist/{chunk-YH4GWEDM.js.map → chunk-P64KTO2R.js.map} +0 -0
- /package/dist/{chunk-LRRGVHAQ.js.map → chunk-QZ7SWGNE.js.map} +0 -0
- /package/dist/{chunk-V22DUH4C.js.map → chunk-RI75XARO.js.map} +0 -0
- /package/dist/{chunk-XQHABE23.js.map → chunk-S7SSOWRQ.js.map} +0 -0
- /package/dist/{chunk-D7LTIG33.js.map → chunk-SZ6WN2S4.js.map} +0 -0
- /package/dist/{chunk-RCDMYTLP.js.map → chunk-VC23MB4Q.js.map} +0 -0
- /package/dist/{subscription-core-codex-4G4CCOJU.js.map → subscription-core-codex-D7PTEZH3.js.map} +0 -0
- /package/dist/{subscription-core-codex-compat-64ACIZVP.js.map → subscription-core-codex-compat-L75WHH7M.js.map} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Database } from "./database.js";
|
|
2
|
+
export type BillingSubscriptionOperationKind = "upgrade" | "change" | "cancel";
|
|
3
|
+
export type BillingSubscriptionOperation = {
|
|
4
|
+
account_id: string;
|
|
5
|
+
operation_key: string;
|
|
6
|
+
kind: BillingSubscriptionOperationKind;
|
|
7
|
+
request: Record<string, unknown>;
|
|
8
|
+
intent: Record<string, unknown>;
|
|
9
|
+
result: Record<string, unknown> | null;
|
|
10
|
+
created_at: string;
|
|
11
|
+
completed_at: string | null;
|
|
12
|
+
};
|
|
13
|
+
/** Intent must commit before provider I/O; a caller-owned transaction/savepoint
|
|
14
|
+
* cannot supply that guarantee. The API runs two independent org-fenced phases. */
|
|
15
|
+
export declare function assertBillingSubscriptionOperationRoot(db: Database): void;
|
|
16
|
+
export declare function getBillingSubscriptionOperation(db: Database, accountId: string, operationKey: string): Promise<BillingSubscriptionOperation | null>;
|
|
17
|
+
export declare function beginBillingSubscriptionOperation(db: Database, input: {
|
|
18
|
+
accountId: string;
|
|
19
|
+
operationKey: string;
|
|
20
|
+
kind: BillingSubscriptionOperationKind;
|
|
21
|
+
request: Record<string, unknown>;
|
|
22
|
+
intent: Record<string, unknown>;
|
|
23
|
+
}): Promise<BillingSubscriptionOperation>;
|
|
24
|
+
export declare function completeBillingSubscriptionOperation(db: Database, input: {
|
|
25
|
+
accountId: string;
|
|
26
|
+
operationKey: string;
|
|
27
|
+
result: Record<string, unknown>;
|
|
28
|
+
}): Promise<BillingSubscriptionOperation>;
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
getCanonicalHumanIdentityProjection,
|
|
12
12
|
synchronizeCanonicalHumanLoginBindings,
|
|
13
13
|
validateCanonicalHumanSession
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-SZ6WN2S4.js";
|
|
15
|
+
import "./chunk-GE5XUPYV.js";
|
|
16
16
|
import "./chunk-SMCA7PNJ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-2QADNZV6.js";
|
|
18
18
|
import "./chunk-PZ5AY32C.js";
|
|
19
19
|
export {
|
|
20
20
|
CanonicalHumanIdentityAuthorityError,
|
|
@@ -25,6 +25,7 @@ __export(schema_exports, {
|
|
|
25
25
|
automationTriggers: () => automationTriggers,
|
|
26
26
|
automationWebhookEndpoints: () => automationWebhookEndpoints,
|
|
27
27
|
billingCustomers: () => billingCustomers,
|
|
28
|
+
billingSubscriptionOperations: () => billingSubscriptionOperations,
|
|
28
29
|
browserIdentities: () => browserIdentities,
|
|
29
30
|
browserRevisionComponents: () => browserRevisionComponents,
|
|
30
31
|
browserRevisions: () => browserRevisions,
|
|
@@ -218,6 +219,7 @@ __export(schema_exports, {
|
|
|
218
219
|
organizationModelProviderConnectionOperations: () => organizationModelProviderConnectionOperations,
|
|
219
220
|
organizationModelProviderConnections: () => organizationModelProviderConnections,
|
|
220
221
|
organizationModelProviderCustomModels: () => organizationModelProviderCustomModels,
|
|
222
|
+
organizationPlans: () => organizationPlans,
|
|
221
223
|
organizationPrivacyPreferences: () => organizationPrivacyPreferences,
|
|
222
224
|
organizationPrivateSessionSettingEvents: () => organizationPrivateSessionSettingEvents,
|
|
223
225
|
organizationPrivateSessionSettings: () => organizationPrivateSessionSettings,
|
|
@@ -245,6 +247,7 @@ __export(schema_exports, {
|
|
|
245
247
|
personalGitHubRepositorySelectionHeads: () => personalGitHubRepositorySelectionHeads,
|
|
246
248
|
personalGitHubRepositorySelectionOperations: () => personalGitHubRepositorySelectionOperations,
|
|
247
249
|
personalGitHubRepositorySelections: () => personalGitHubRepositorySelections,
|
|
250
|
+
planCreditPeriods: () => planCreditPeriods,
|
|
248
251
|
prReviewAppRegistrations: () => prReviewAppRegistrations,
|
|
249
252
|
prReviewManagedGithubAuthorityNonces: () => prReviewManagedGithubAuthorityNonces,
|
|
250
253
|
prReviewManagedGithubRoutes: () => prReviewManagedGithubRoutes,
|
|
@@ -366,6 +369,7 @@ __export(schema_exports, {
|
|
|
366
369
|
subscriptionLeases: () => subscriptionLeases,
|
|
367
370
|
subscriptionOperationLeases: () => subscriptionOperationLeases,
|
|
368
371
|
subscriptionPersonPreferences: () => subscriptionPersonPreferences,
|
|
372
|
+
subscriptionPlanCatalogRevisions: () => subscriptionPlanCatalogRevisions,
|
|
369
373
|
subscriptionProviderCutovers: () => subscriptionProviderCutovers,
|
|
370
374
|
subscriptionSessionBindings: () => subscriptionSessionBindings,
|
|
371
375
|
subscriptionSettings: () => subscriptionSettings,
|
|
@@ -12021,6 +12025,12 @@ var sessions = pgTable25(
|
|
|
12021
12025
|
ownerOrganizationMembershipId: uuid24("owner_organization_membership_id"),
|
|
12022
12026
|
ownerSubjectId: text25("owner_subject_id"),
|
|
12023
12027
|
visibility: text25("visibility").notNull().default("workspace_shared"),
|
|
12028
|
+
// Immutable server-derived Site audience. Independent of mutable metadata,
|
|
12029
|
+
// reservations, and native member ownership; descendants inherit the binding.
|
|
12030
|
+
siteId: uuid24("site_id"),
|
|
12031
|
+
siteAccessRootId: uuid24("site_access_root_id"),
|
|
12032
|
+
siteViewerPrincipal: text25("site_viewer_principal"),
|
|
12033
|
+
siteOwnerSubjectId: text25("site_owner_subject_id"),
|
|
12024
12034
|
createRequestedVisibility: text25("create_requested_visibility").notNull().default("workspace_shared"),
|
|
12025
12035
|
authorityEpoch: integer22("authority_epoch").notNull().default(1),
|
|
12026
12036
|
// Old accepted epochs remain valid across sharing, never across revocation.
|
|
@@ -18902,6 +18912,8 @@ var modelCallFacts = pgTable25(
|
|
|
18902
18912
|
initiatorKind: text25("initiator_kind"),
|
|
18903
18913
|
initiatorSubjectId: text25("initiator_subject_id"),
|
|
18904
18914
|
scheduledTaskId: uuid24("scheduled_task_id"),
|
|
18915
|
+
// Source-stamped attribution survives session/Site deletion. Not a foreign key.
|
|
18916
|
+
siteId: uuid24("site_id"),
|
|
18905
18917
|
inputTokens: bigint17("input_tokens", { mode: "number" }),
|
|
18906
18918
|
outputTokens: bigint17("output_tokens", { mode: "number" }),
|
|
18907
18919
|
cachedTokens: bigint17("cached_tokens", { mode: "number" }),
|
|
@@ -19236,6 +19248,8 @@ var creditLedgerEntries = pgTable25(
|
|
|
19236
19248
|
currency: text25("currency").notNull().default("usd"),
|
|
19237
19249
|
sourceType: text25("source_type"),
|
|
19238
19250
|
sourceId: text25("source_id"),
|
|
19251
|
+
// Immutable execution-origin attribution, not an allocated platform charge.
|
|
19252
|
+
siteId: uuid24("site_id"),
|
|
19239
19253
|
idempotencyKey: text25("idempotency_key").notNull(),
|
|
19240
19254
|
metadata: jsonb19("metadata").$type().notNull().default({}),
|
|
19241
19255
|
occurredAt: timestamp25("occurred_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -19263,6 +19277,81 @@ var creditLedgerEntries = pgTable25(
|
|
|
19263
19277
|
)
|
|
19264
19278
|
})
|
|
19265
19279
|
);
|
|
19280
|
+
var subscriptionPlanCatalogRevisions = opengeniPrivateSchema.table(
|
|
19281
|
+
"subscription_plan_catalog_revisions",
|
|
19282
|
+
{
|
|
19283
|
+
revision: bigint17("revision", { mode: "number" }).primaryKey().generatedAlwaysAsIdentity(),
|
|
19284
|
+
catalog: jsonb19("catalog").$type().notNull(),
|
|
19285
|
+
operator: text25("operator").notNull(),
|
|
19286
|
+
reason: text25("reason").notNull(),
|
|
19287
|
+
databaseRole: text25("database_role").notNull().default(sql21`session_user`),
|
|
19288
|
+
changedAt: timestamp25("changed_at", { withTimezone: true }).notNull().default(sql21`clock_timestamp()`)
|
|
19289
|
+
}
|
|
19290
|
+
);
|
|
19291
|
+
var billingSubscriptionOperations = pgTable25(
|
|
19292
|
+
"billing_subscription_operations",
|
|
19293
|
+
{
|
|
19294
|
+
accountId: uuid24("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19295
|
+
operationKey: uuid24("operation_key").notNull(),
|
|
19296
|
+
kind: text25("kind").notNull(),
|
|
19297
|
+
request: jsonb19("request").$type().notNull(),
|
|
19298
|
+
intent: jsonb19("intent").$type().notNull(),
|
|
19299
|
+
result: jsonb19("result").$type(),
|
|
19300
|
+
createdAt: timestamp25("created_at", { withTimezone: true }).notNull().default(sql21`clock_timestamp()`),
|
|
19301
|
+
completedAt: timestamp25("completed_at", { withTimezone: true })
|
|
19302
|
+
},
|
|
19303
|
+
(table) => ({
|
|
19304
|
+
pk: primaryKey12({ columns: [table.accountId, table.operationKey] }),
|
|
19305
|
+
pending: uniqueIndex24("billing_subscription_operations_pending_idx").on(table.accountId).where(sql21`${table.completedAt} is null`)
|
|
19306
|
+
})
|
|
19307
|
+
);
|
|
19308
|
+
var organizationPlans = pgTable25("organization_plans", {
|
|
19309
|
+
accountId: uuid24("account_id").primaryKey().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19310
|
+
planKey: text25("plan_key").notNull(),
|
|
19311
|
+
status: text25("status").notNull(),
|
|
19312
|
+
stripeSubscriptionId: text25("stripe_subscription_id").unique(),
|
|
19313
|
+
currentPeriodStart: timestamp25("current_period_start", { withTimezone: true }),
|
|
19314
|
+
currentPeriodEnd: timestamp25("current_period_end", { withTimezone: true }),
|
|
19315
|
+
cancelAtPeriodEnd: boolean15("cancel_at_period_end").notNull().default(false),
|
|
19316
|
+
createdAt: timestamp25("created_at", { withTimezone: true }).notNull().default(sql21`clock_timestamp()`),
|
|
19317
|
+
updatedAt: timestamp25("updated_at", { withTimezone: true }).notNull().default(sql21`clock_timestamp()`)
|
|
19318
|
+
});
|
|
19319
|
+
var planCreditPeriods = pgTable25(
|
|
19320
|
+
"plan_credit_periods",
|
|
19321
|
+
{
|
|
19322
|
+
id: uuid24("id").primaryKey().defaultRandom(),
|
|
19323
|
+
accountId: uuid24("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
19324
|
+
planKey: text25("plan_key").notNull(),
|
|
19325
|
+
catalogRevision: bigint17("catalog_revision", { mode: "number" }).notNull().references(() => subscriptionPlanCatalogRevisions.revision),
|
|
19326
|
+
stripeSubscriptionId: text25("stripe_subscription_id"),
|
|
19327
|
+
periodStart: timestamp25("period_start", { withTimezone: true }).notNull(),
|
|
19328
|
+
periodEnd: timestamp25("period_end", { withTimezone: true }).notNull(),
|
|
19329
|
+
grantedMicros: bigint17("granted_micros", { mode: "number" }).notNull(),
|
|
19330
|
+
openingDebtMicros: bigint17("opening_debt_micros", { mode: "number" }).notNull(),
|
|
19331
|
+
grantEntryId: uuid24("grant_entry_id").notNull().unique(),
|
|
19332
|
+
idempotencyKey: text25("idempotency_key").notNull().unique(),
|
|
19333
|
+
grantedAt: timestamp25("granted_at", { withTimezone: true }).notNull().default(sql21`clock_timestamp()`),
|
|
19334
|
+
expiredAt: timestamp25("expired_at", { withTimezone: true }),
|
|
19335
|
+
expiryEntryId: uuid24("expiry_entry_id").unique(),
|
|
19336
|
+
usageAtExpiryMicros: bigint17("usage_at_expiry_micros", { mode: "number" })
|
|
19337
|
+
},
|
|
19338
|
+
(table) => ({
|
|
19339
|
+
openingDebt: check14(
|
|
19340
|
+
"plan_credit_periods_opening_debt_check",
|
|
19341
|
+
sql21`${table.openingDebtMicros} between 0 and ${table.grantedMicros}`
|
|
19342
|
+
),
|
|
19343
|
+
grant: foreignKey({
|
|
19344
|
+
columns: [table.grantEntryId, table.accountId],
|
|
19345
|
+
foreignColumns: [creditLedgerEntries.id, creditLedgerEntries.accountId]
|
|
19346
|
+
}),
|
|
19347
|
+
expiry: foreignKey({
|
|
19348
|
+
columns: [table.expiryEntryId, table.accountId],
|
|
19349
|
+
foreignColumns: [creditLedgerEntries.id, creditLedgerEntries.accountId]
|
|
19350
|
+
}),
|
|
19351
|
+
open: uniqueIndex24("plan_credit_periods_open_idx").on(table.accountId).where(sql21`${table.expiredAt} is null`),
|
|
19352
|
+
due: index23("plan_credit_periods_due_idx").on(table.periodEnd, table.accountId).where(sql21`${table.expiredAt} is null`)
|
|
19353
|
+
})
|
|
19354
|
+
);
|
|
19266
19355
|
var creditDebitAllocations = pgTable25(
|
|
19267
19356
|
"credit_debit_allocations",
|
|
19268
19357
|
{
|
|
@@ -21273,6 +21362,10 @@ export {
|
|
|
21273
21362
|
hostExportConsumers,
|
|
21274
21363
|
hostExportDeadLetters,
|
|
21275
21364
|
creditLedgerEntries,
|
|
21365
|
+
subscriptionPlanCatalogRevisions,
|
|
21366
|
+
billingSubscriptionOperations,
|
|
21367
|
+
organizationPlans,
|
|
21368
|
+
planCreditPeriods,
|
|
21276
21369
|
creditDebitAllocations,
|
|
21277
21370
|
usageAllowanceAttributionReceipts,
|
|
21278
21371
|
workspaceAllowanceClearReceipts,
|
|
@@ -21326,4 +21419,4 @@ export {
|
|
|
21326
21419
|
feedbackSubmissions,
|
|
21327
21420
|
schema_exports
|
|
21328
21421
|
};
|
|
21329
|
-
//# sourceMappingURL=chunk-
|
|
21422
|
+
//# sourceMappingURL=chunk-2QADNZV6.js.map
|