@adaptware/eagles-db 0.6.16 → 0.6.17
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/client/edge.js +124 -10
- package/client/index-browser.js +118 -3
- package/client/index.d.ts +10686 -436
- package/client/index.js +124 -10
- package/client/package.json +1 -1
- package/client/schema.prisma +217 -1
- package/client/wasm.js +124 -10
- package/package.json +1 -1
- package/prisma/schema/migrations/20261023120000_payment_mismatch_amount/migration.sql +5 -0
- package/prisma/schema/payment/billingTransaction.prisma +3 -0
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/client/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/client/query_engine-windows.dll.node +0 -0
- package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +0 -25
- package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +0 -24
- package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +0 -2
- package/prisma/schema/migrations/20260710120000_add_resume_rendered_export_fields/migration.sql +0 -9
- package/prisma/schema/migrations/20260714120000_add_job_description_display_html_document/migration.sql +0 -8
- package/prisma/schema/migrations/20260716120000_add_offer_letters/migration.sql +0 -183
- package/prisma/schema/migrations/20260716140000_offer_schema_refinements/migration.sql +0 -13
- package/prisma/schema/migrations/20260716160000_offer_schema_hardening/migration.sql +0 -95
- package/prisma/schema/migrations/20260716180000_offer_letter_template_config/migration.sql +0 -2
- package/prisma/schema/migrations/20260716190000_add_evaluation_focus_areas/migration.sql +0 -6
- package/prisma/schema/migrations/20260717120000_offer_workflow_approval/migration.sql +0 -30
- package/prisma/schema/migrations/20260720120000_offer_letter_template_is_draft/migration.sql +0 -5
- package/prisma/schema/migrations/20260720140000_offer_status_split/migration.sql +0 -51
- package/prisma/schema/migrations/20260720140001_offer_status_split_backfill/migration.sql +0 -37
- package/prisma/schema/migrations/20260722120000_offer_draft_edited_html/migration.sql +0 -13
- package/prisma/schema/migrations/20260723150000_offer_withdraw_actor_no_show_reason/migration.sql +0 -10
- package/prisma/schema/migrations/20260724120000_open_job_offer_accepted_declined_counts/migration.sql +0 -7
- package/prisma/schema/migrations/20260811120000_add_integration_provider_razorpay/migration.sql +0 -6
- package/prisma/schema/migrations/20260812120000_add_billing_transactions/migration.sql +0 -49
- package/prisma/schema/migrations/20260812130000_drop_billing_transaction_gst_snapshots/migration.sql +0 -3
- package/prisma/schema/migrations/20260812180000_billing_transaction_invoice_number/migration.sql +0 -5
- package/prisma/schema/migrations/20260813120000_payment_webhooks_gst_refunds/migration.sql +0 -79
- package/prisma/schema/migrations/20260813140000_platform_gst_profiles/migration.sql +0 -49
- package/prisma/schema/migrations/20260813150000_rename_gst_profiles/migration.sql +0 -53
- package/prisma/schema/migrations/20260813160000_remove_gst_billing/migration.sql +0 -16
- package/prisma/schema/migrations/20260813170000_billing_licensing_unrecoverable/migration.sql +0 -2
- package/prisma/schema/migrations/20260813180000_billing_transaction_payment_method/migration.sql +0 -2
- package/prisma/schema/migrations/20260814090000_billing_transaction_purchaser_email/migration.sql +0 -2
- package/prisma/schema/migrations/20260816100000_billing_product_organisations/migration.sql +0 -35
- package/prisma/schema/migrations/20260816120000_merge_billing_product_organisations/migration.sql +0 -25
- package/prisma/schema/migrations/20260817120000_billing_payment_mismatch/migration.sql +0 -7
- package/prisma/schema/migrations/20260819120000_billing_product_prices/migration.sql +0 -62
- package/prisma/schema/migrations/20260819140000_billing_exchange_rates/migration.sql +0 -25
- package/prisma/schema/migrations/20260820120000_billing_transaction_failure_category/migration.sql +0 -31
- package/prisma/schema/migrations/20260820130000_backfill_billing_transaction_failure_details/migration.sql +0 -23
- package/prisma/schema/migrations/20260820140000_drop_billing_product_price_overrides/migration.sql +0 -2
- package/prisma/schema/migrations/20260821120000_drop_billing_product_and_mock_licensing/migration.sql +0 -38
- package/prisma/schema/migrations/20260824120000_billing_transaction_purchase_display_name/migration.sql +0 -2
- package/prisma/schema/migrations/20260831120000_user_communication_email/migration.sql +0 -6
- package/prisma/schema/migrations/20260901143000_assessment_question_bank_state/migration.sql +0 -15
- package/prisma/schema/migrations/20260902120000_question_category_two_values/migration.sql +0 -16
- package/prisma/schema/migrations/20260902143000_question_bank_item_key/migration.sql +0 -17
- package/prisma/schema/migrations/20260903120000_split_round_type_assessment/migration.sql +0 -9
- package/prisma/schema/migrations/20260904110000_restore_round_type_assessment_enum/migration.sql +0 -5
- package/prisma/schema/migrations/20260904120000_revert_wrong_split_assessment_round_types/migration.sql +0 -42
- package/prisma/schema/migrations/20260909140000_profile_interview_session/migration.sql +0 -99
- package/prisma/schema/migrations/20260911120000_unify_profile_interview_into_interview/migration.sql +0 -139
- package/prisma/schema/migrations/20260929120000_add_evaluation_type_in_person/migration.sql +0 -2
- package/prisma/schema/migrations/20261015130000_interview_whiteboard_scene/migration.sql +0 -2
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -3183,6 +3183,212 @@ model LicensingLedgerEntry {
|
|
|
3183
3183
|
@@schema("licensing")
|
|
3184
3184
|
}
|
|
3185
3185
|
|
|
3186
|
+
// Org-level platform subscription: a recurring fee per organisation. Each period is a SubscriptionCharge, paid through
|
|
3187
|
+
// a Razorpay Order (BillingTransaction with transaction_type SUBSCRIPTION); the tax Invoice (kind SUBSCRIPTION) is issued
|
|
3188
|
+
// only once the charge is paid. Prices are all-inclusive (GST and fees are backed out on the invoice). Amounts are minor units.
|
|
3189
|
+
// Plan: docs/eagles-db/platform-subscription-implementation-plan.md.
|
|
3190
|
+
// Design sheet: https://docs.google.com/spreadsheets/d/1R-EBGAMdju_P78Qs05g4_NouSbCM_7W-IyCd8gyZCUI (Sheet2).
|
|
3191
|
+
|
|
3192
|
+
enum BillingCycle {
|
|
3193
|
+
MONTHLY
|
|
3194
|
+
ANNUAL
|
|
3195
|
+
|
|
3196
|
+
@@schema("licensing")
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
enum SubscriptionPlanType {
|
|
3200
|
+
TRIAL
|
|
3201
|
+
REGULAR
|
|
3202
|
+
/// Internal and demo orgs: amount 0, never charged, never PAST_DUE or SUSPENDED.
|
|
3203
|
+
INTERNAL
|
|
3204
|
+
|
|
3205
|
+
@@schema("licensing")
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
enum PlatformSubscriptionStatus {
|
|
3209
|
+
TRIALING
|
|
3210
|
+
ACTIVE
|
|
3211
|
+
/// Grace: charge OPEN until due_at; everyone in the org keeps full access.
|
|
3212
|
+
PAST_DUE
|
|
3213
|
+
/// After due_at (or a trial ending unpaid): only org admins can log in, payment screen only.
|
|
3214
|
+
SUSPENDED
|
|
3215
|
+
CANCELLED
|
|
3216
|
+
|
|
3217
|
+
@@schema("licensing")
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
enum SubscriptionChargeStatus {
|
|
3221
|
+
OPEN
|
|
3222
|
+
PAID
|
|
3223
|
+
VOID
|
|
3224
|
+
|
|
3225
|
+
@@schema("licensing")
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/// Tells the payment-captured handler what to do: RENEWAL keeps the current record;
|
|
3229
|
+
/// CONVERSION, REACTIVATION and UPGRADE close it and start a new one on the payment day.
|
|
3230
|
+
enum SubscriptionChargeKind {
|
|
3231
|
+
RENEWAL
|
|
3232
|
+
CONVERSION
|
|
3233
|
+
REACTIVATION
|
|
3234
|
+
UPGRADE
|
|
3235
|
+
|
|
3236
|
+
@@schema("licensing")
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
enum SubscriptionAccessAudience {
|
|
3240
|
+
/// Anyone in the suspended org (e.g. candidate-facing flows).
|
|
3241
|
+
ALL_USERS
|
|
3242
|
+
/// Org admins only (e.g. the payment screen).
|
|
3243
|
+
ADMIN_ONLY
|
|
3244
|
+
|
|
3245
|
+
@@schema("licensing")
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
/// Platform fee catalogue, one row per (currency, billing_cycle, type).
|
|
3249
|
+
/// A TRIAL plan has amount 0; trial_days sets the default trial length.
|
|
3250
|
+
/// An INTERNAL plan has amount 0 and is never billed (internal and demo orgs, assigned by org id).
|
|
3251
|
+
/// GST and fee rates come from the platform billing settings, not the plan.
|
|
3252
|
+
model SubscriptionPlan {
|
|
3253
|
+
id String @id @default(uuid())
|
|
3254
|
+
name String
|
|
3255
|
+
/// INR or USD; matched against Organisation.billing_currency.
|
|
3256
|
+
currency String @default("INR")
|
|
3257
|
+
/// All-inclusive price per billing cycle, minor units (1000000 = Rs 10,000): exactly what the org pays.
|
|
3258
|
+
amount Int
|
|
3259
|
+
billing_cycle BillingCycle @default(MONTHLY)
|
|
3260
|
+
type SubscriptionPlanType
|
|
3261
|
+
/// TRIAL plans only: default trial length in days, editable by Super Admin. Null otherwise.
|
|
3262
|
+
trial_days Int?
|
|
3263
|
+
/// Days to pay after a period starts unpaid.
|
|
3264
|
+
grace_days Int @default(7)
|
|
3265
|
+
created_at DateTime @default(now())
|
|
3266
|
+
updated_at DateTime @updatedAt
|
|
3267
|
+
created_by String
|
|
3268
|
+
updated_by String
|
|
3269
|
+
is_active Boolean @default(true)
|
|
3270
|
+
|
|
3271
|
+
subscriptions PlatformSubscription[] @relation("PlatformSubscriptionPlan")
|
|
3272
|
+
pending_downgrades PlatformSubscription[] @relation("PlatformSubscriptionNextPlan")
|
|
3273
|
+
subscription_charges SubscriptionCharge[]
|
|
3274
|
+
|
|
3275
|
+
@@unique([currency, billing_cycle, type])
|
|
3276
|
+
@@map("subscription_plans")
|
|
3277
|
+
@@schema("licensing")
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
/// History of an org's subscription: one record per plan/billing-anchor span.
|
|
3281
|
+
/// The current record has effective_end_date null and current_organisation_id set; the unique constraint on
|
|
3282
|
+
/// current_organisation_id allows at most one current record per org.
|
|
3283
|
+
model PlatformSubscription {
|
|
3284
|
+
id String @id @default(uuid())
|
|
3285
|
+
organisation_id String
|
|
3286
|
+
/// Equals organisation_id on the current record, null once the record is closed. Unique: one current record per org.
|
|
3287
|
+
current_organisation_id String? @unique
|
|
3288
|
+
plan_id String
|
|
3289
|
+
/// Pending downgrade, applied at the next billing date (billing date unchanged). Null when none.
|
|
3290
|
+
next_plan_id String?
|
|
3291
|
+
status PlatformSubscriptionStatus @default(TRIALING)
|
|
3292
|
+
/// Org's all-inclusive fee per billing cycle, minor units; copied from the plan, overridable.
|
|
3293
|
+
amount Int
|
|
3294
|
+
/// Billing anchor: the payment date that started this record (after a trial, after grace, or an
|
|
3295
|
+
/// upgrade). Unchanged when a renewal is paid within grace.
|
|
3296
|
+
effective_start_date DateTime
|
|
3297
|
+
/// Null on the current record; set to the date the next record starts.
|
|
3298
|
+
effective_end_date DateTime?
|
|
3299
|
+
/// TRIAL records only: start + plan.trial_days when the trial starts; Super Admin can change it
|
|
3300
|
+
/// per org. Unpaid at this time: SUSPENDED (no grace after a trial). Null otherwise.
|
|
3301
|
+
trial_ends_at DateTime?
|
|
3302
|
+
/// Copied from the plan.
|
|
3303
|
+
grace_days Int
|
|
3304
|
+
created_at DateTime @default(now())
|
|
3305
|
+
updated_at DateTime @updatedAt
|
|
3306
|
+
created_by String
|
|
3307
|
+
updated_by String
|
|
3308
|
+
is_active Boolean @default(true)
|
|
3309
|
+
|
|
3310
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3311
|
+
plan SubscriptionPlan @relation("PlatformSubscriptionPlan", fields: [plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3312
|
+
next_plan SubscriptionPlan? @relation("PlatformSubscriptionNextPlan", fields: [next_plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3313
|
+
charges SubscriptionCharge[]
|
|
3314
|
+
|
|
3315
|
+
@@index([organisation_id, effective_end_date])
|
|
3316
|
+
@@index([status, trial_ends_at])
|
|
3317
|
+
@@index([plan_id])
|
|
3318
|
+
@@index([next_plan_id])
|
|
3319
|
+
@@map("platform_subscriptions")
|
|
3320
|
+
@@schema("licensing")
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
/// What the org owes for one billing period, reactivation or upgrade; paid through one Razorpay Order.
|
|
3324
|
+
/// Not a tax invoice: the Invoice (kind SUBSCRIPTION) is issued when the charge is paid and linked via invoice_id.
|
|
3325
|
+
/// Total = subscription_amount + grace_amount - credit_amount (all-inclusive, not stored).
|
|
3326
|
+
model SubscriptionCharge {
|
|
3327
|
+
/// Sent to Razorpay as billing_transactions.purchase_reference (subscription_charge:{id}).
|
|
3328
|
+
id String @id @default(uuid())
|
|
3329
|
+
subscription_id String
|
|
3330
|
+
/// Plan this charge bills for; for an upgrade, the new plan.
|
|
3331
|
+
plan_id String
|
|
3332
|
+
organisation_id String
|
|
3333
|
+
kind SubscriptionChargeKind
|
|
3334
|
+
status SubscriptionChargeStatus @default(OPEN)
|
|
3335
|
+
period_start DateTime
|
|
3336
|
+
period_end DateTime
|
|
3337
|
+
/// period_start + grace_days, end of day in the org's timezone. Unpaid after this: SUSPENDED.
|
|
3338
|
+
due_at DateTime
|
|
3339
|
+
subscription_amount Int
|
|
3340
|
+
/// Prorated days used but not paid: grace days when paid after grace, or days from period_start
|
|
3341
|
+
/// to the upgrade date when upgrading with an OPEN charge (which is voided).
|
|
3342
|
+
grace_amount Int @default(0)
|
|
3343
|
+
/// Upgrade only: prorated unused days of the old plan's paid period.
|
|
3344
|
+
credit_amount Int @default(0)
|
|
3345
|
+
/// Successful payment. No FK: payment-service boundary.
|
|
3346
|
+
billing_transaction_id String? @unique
|
|
3347
|
+
/// Tax invoice issued when the charge was paid.
|
|
3348
|
+
invoice_id String? @unique
|
|
3349
|
+
paid_at DateTime?
|
|
3350
|
+
/// Stops the billing job issuing the same charge twice.
|
|
3351
|
+
idempotency_key String @unique
|
|
3352
|
+
created_at DateTime @default(now())
|
|
3353
|
+
updated_at DateTime @updatedAt
|
|
3354
|
+
created_by String
|
|
3355
|
+
updated_by String
|
|
3356
|
+
|
|
3357
|
+
subscription PlatformSubscription @relation(fields: [subscription_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3358
|
+
plan SubscriptionPlan @relation(fields: [plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3359
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3360
|
+
invoice Invoice? @relation(fields: [invoice_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3361
|
+
|
|
3362
|
+
@@index([organisation_id, status])
|
|
3363
|
+
@@index([subscription_id])
|
|
3364
|
+
@@index([plan_id])
|
|
3365
|
+
@@index([status, due_at])
|
|
3366
|
+
@@map("subscription_charges")
|
|
3367
|
+
@@schema("licensing")
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/// Routes that stay open while an org is SUSPENDED (access level ADMIN_PAYMENT_ONLY).
|
|
3371
|
+
/// Managed by Super Admin; seeded with defaults (auth, payment screen, candidate portal).
|
|
3372
|
+
/// Everything not matched is blocked with 402 SUBSCRIPTION_SUSPENDED.
|
|
3373
|
+
model SubscriptionAccessRule {
|
|
3374
|
+
id String @id @default(uuid())
|
|
3375
|
+
/// API path pattern, `*` wildcard, e.g. /candidate/*.
|
|
3376
|
+
route_pattern String
|
|
3377
|
+
/// GET, POST, ... or * for any method.
|
|
3378
|
+
http_method String @default("*")
|
|
3379
|
+
audience SubscriptionAccessAudience @default(ADMIN_ONLY)
|
|
3380
|
+
description String?
|
|
3381
|
+
created_at DateTime @default(now())
|
|
3382
|
+
updated_at DateTime @updatedAt
|
|
3383
|
+
created_by String
|
|
3384
|
+
updated_by String
|
|
3385
|
+
is_active Boolean @default(true)
|
|
3386
|
+
|
|
3387
|
+
@@unique([route_pattern, http_method])
|
|
3388
|
+
@@map("subscription_access_rules")
|
|
3389
|
+
@@schema("licensing")
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3186
3392
|
/// Historical package purchase by an organisation (independent per transaction).
|
|
3187
3393
|
model PurchasedLicensePackage {
|
|
3188
3394
|
id String @id @default(uuid())
|
|
@@ -3883,6 +4089,8 @@ model Organisation {
|
|
|
3883
4089
|
license_package_organisations LicensePackageOrganisation[]
|
|
3884
4090
|
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3885
4091
|
consent_documents ConsentDocument[]
|
|
4092
|
+
platform_subscriptions PlatformSubscription[]
|
|
4093
|
+
subscription_charges SubscriptionCharge[]
|
|
3886
4094
|
billing_transactions BillingTransaction[]
|
|
3887
4095
|
payment_webhook_events PaymentWebhookEvent[]
|
|
3888
4096
|
invoices Invoice[]
|
|
@@ -3925,6 +4133,8 @@ enum BillingTransactionType {
|
|
|
3925
4133
|
PURCHASE
|
|
3926
4134
|
TOP_UP
|
|
3927
4135
|
REFUND
|
|
4136
|
+
/// Platform subscription charge (purchase_reference subscription_charge:{id}).
|
|
4137
|
+
SUBSCRIPTION
|
|
3928
4138
|
|
|
3929
4139
|
@@schema("public")
|
|
3930
4140
|
}
|
|
@@ -3943,6 +4153,9 @@ enum BillingTransactionFailureCategory {
|
|
|
3943
4153
|
enum BillingPaymentMismatchStatus {
|
|
3944
4154
|
DETECTED
|
|
3945
4155
|
UNFULFILLED
|
|
4156
|
+
/// Razorpay captured a different amount or currency than the stored transaction: never applied, never
|
|
4157
|
+
/// recovered or refunded automatically (refund from the Razorpay dashboard).
|
|
4158
|
+
AMOUNT_MISMATCH
|
|
3946
4159
|
|
|
3947
4160
|
@@schema("public")
|
|
3948
4161
|
}
|
|
@@ -3993,11 +4206,13 @@ model BillingTransaction {
|
|
|
3993
4206
|
@@schema("public")
|
|
3994
4207
|
}
|
|
3995
4208
|
|
|
3996
|
-
// Tax invoices issued by Treadspace. Shared by license package purchases and
|
|
4209
|
+
// Tax invoices issued by Treadspace. Shared by license package purchases and platform subscriptions.
|
|
3997
4210
|
|
|
3998
4211
|
/// What the invoice was raised for.
|
|
3999
4212
|
enum InvoiceKind {
|
|
4000
4213
|
PACKAGE
|
|
4214
|
+
/// A paid platform subscription charge (licensing.subscription_charges.invoice_id).
|
|
4215
|
+
SUBSCRIPTION
|
|
4001
4216
|
|
|
4002
4217
|
@@schema("public")
|
|
4003
4218
|
}
|
|
@@ -4044,6 +4259,7 @@ model Invoice {
|
|
|
4044
4259
|
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict)
|
|
4045
4260
|
billing_transaction BillingTransaction? @relation(fields: [billing_transaction_id], references: [id], onDelete: Restrict)
|
|
4046
4261
|
purchased_license_package PurchasedLicensePackage?
|
|
4262
|
+
subscription_charge SubscriptionCharge?
|
|
4047
4263
|
|
|
4048
4264
|
@@index([organisation_id, issued_at])
|
|
4049
4265
|
@@map("invoices")
|