@opengeni/db 3.3.0 → 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-CEJ3NQ3B.js → chunk-2QADNZV6.js} +84 -1
- package/dist/chunk-2QADNZV6.js.map +1 -0
- package/dist/{chunk-Y4ERASEM.js → chunk-3YU3GU3E.js} +2 -2
- package/dist/{chunk-ZZOEKHGU.js → chunk-AT6OYYTW.js} +2 -2
- package/dist/{chunk-SDKFRIAN.js → chunk-BSYWZ4OE.js} +4 -4
- package/dist/{chunk-AAOKWNHE.js → chunk-CNN7SI45.js} +4 -4
- package/dist/{chunk-PNEJVKKV.js → chunk-CXYIV33Q.js} +6 -6
- package/dist/{chunk-CGSINPLW.js → chunk-FZOH3MAC.js} +2 -2
- package/dist/{chunk-JTBJGSUZ.js → chunk-GE5XUPYV.js} +5 -6
- package/dist/chunk-GE5XUPYV.js.map +1 -0
- package/dist/{chunk-FX2PSMGH.js → chunk-LDOJFAPS.js} +2 -2
- package/dist/{chunk-S74WULCK.js → chunk-MXC4VSKC.js} +3 -3
- package/dist/{chunk-KPC7I5WG.js → chunk-P64KTO2R.js} +2 -2
- package/dist/{chunk-HQWXEF77.js → chunk-PXFHMVLY.js} +112 -1
- package/dist/chunk-PXFHMVLY.js.map +1 -0
- package/dist/{chunk-VUR5U5B3.js → chunk-QZ7SWGNE.js} +2 -2
- package/dist/{chunk-7K5AVQUZ.js → chunk-QZMGPD3S.js} +141 -28
- package/dist/chunk-QZMGPD3S.js.map +1 -0
- package/dist/{chunk-HWEHZKHA.js → chunk-RI75XARO.js} +5 -5
- package/dist/{chunk-OWM6XG55.js → chunk-S7SSOWRQ.js} +4 -4
- package/dist/{chunk-B4RMLA2X.js → chunk-SZ6WN2S4.js} +2 -2
- package/dist/{chunk-UWS5DJQ6.js → chunk-VC23MB4Q.js} +2 -2
- package/dist/{chunk-5MPQZI43.js → chunk-ZMZ2CIKY.js} +2788 -2621
- package/dist/{chunk-5MPQZI43.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/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +27 -23
- package/dist/index.js +61 -19
- 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 +698 -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/{subscription-core-codex-HIAP7CY2.js → subscription-core-codex-D7PTEZH3.js} +6 -6
- package/dist/{subscription-core-codex-compat-IBERN7DU.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/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 +3 -4
- package/src/index.ts +25 -7
- package/src/provision-roles.ts +25 -0
- package/src/runtime-posture.ts +119 -0
- package/src/schema.ts +107 -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-7K5AVQUZ.js.map +0 -1
- package/dist/chunk-CEJ3NQ3B.js.map +0 -1
- package/dist/chunk-HQWXEF77.js.map +0 -1
- package/dist/chunk-JTBJGSUZ.js.map +0 -1
- /package/dist/{chunk-Y4ERASEM.js.map → chunk-3YU3GU3E.js.map} +0 -0
- /package/dist/{chunk-ZZOEKHGU.js.map → chunk-AT6OYYTW.js.map} +0 -0
- /package/dist/{chunk-SDKFRIAN.js.map → chunk-BSYWZ4OE.js.map} +0 -0
- /package/dist/{chunk-AAOKWNHE.js.map → chunk-CNN7SI45.js.map} +0 -0
- /package/dist/{chunk-PNEJVKKV.js.map → chunk-CXYIV33Q.js.map} +0 -0
- /package/dist/{chunk-CGSINPLW.js.map → chunk-FZOH3MAC.js.map} +0 -0
- /package/dist/{chunk-FX2PSMGH.js.map → chunk-LDOJFAPS.js.map} +0 -0
- /package/dist/{chunk-S74WULCK.js.map → chunk-MXC4VSKC.js.map} +0 -0
- /package/dist/{chunk-KPC7I5WG.js.map → chunk-P64KTO2R.js.map} +0 -0
- /package/dist/{chunk-VUR5U5B3.js.map → chunk-QZ7SWGNE.js.map} +0 -0
- /package/dist/{chunk-HWEHZKHA.js.map → chunk-RI75XARO.js.map} +0 -0
- /package/dist/{chunk-OWM6XG55.js.map → chunk-S7SSOWRQ.js.map} +0 -0
- /package/dist/{chunk-B4RMLA2X.js.map → chunk-SZ6WN2S4.js.map} +0 -0
- /package/dist/{chunk-UWS5DJQ6.js.map → chunk-VC23MB4Q.js.map} +0 -0
- /package/dist/{subscription-core-codex-HIAP7CY2.js.map → subscription-core-codex-D7PTEZH3.js.map} +0 -0
- /package/dist/{subscription-core-codex-compat-IBERN7DU.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,
|
|
@@ -19273,6 +19277,81 @@ var creditLedgerEntries = pgTable25(
|
|
|
19273
19277
|
)
|
|
19274
19278
|
})
|
|
19275
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
|
+
);
|
|
19276
19355
|
var creditDebitAllocations = pgTable25(
|
|
19277
19356
|
"credit_debit_allocations",
|
|
19278
19357
|
{
|
|
@@ -21283,6 +21362,10 @@ export {
|
|
|
21283
21362
|
hostExportConsumers,
|
|
21284
21363
|
hostExportDeadLetters,
|
|
21285
21364
|
creditLedgerEntries,
|
|
21365
|
+
subscriptionPlanCatalogRevisions,
|
|
21366
|
+
billingSubscriptionOperations,
|
|
21367
|
+
organizationPlans,
|
|
21368
|
+
planCreditPeriods,
|
|
21286
21369
|
creditDebitAllocations,
|
|
21287
21370
|
usageAllowanceAttributionReceipts,
|
|
21288
21371
|
workspaceAllowanceClearReceipts,
|
|
@@ -21336,4 +21419,4 @@ export {
|
|
|
21336
21419
|
feedbackSubmissions,
|
|
21337
21420
|
schema_exports
|
|
21338
21421
|
};
|
|
21339
|
-
//# sourceMappingURL=chunk-
|
|
21422
|
+
//# sourceMappingURL=chunk-2QADNZV6.js.map
|