@zuplo/runtime 5.1804.0 → 5.1805.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/index.d.ts CHANGED
@@ -2417,6 +2417,31 @@ export declare class MemoryZoneReadThroughCache<T = unknown> {
2417
2417
 
2418
2418
  /* Excluded from this release type: MeteringPlugin */
2419
2419
 
2420
+ declare type MeteringRegions = "us-central1" | "europe-west4";
2421
+
2422
+ declare interface MeteringSubscription {
2423
+ status: MeteringSubscriptionStatus;
2424
+ type: "credits" | "periodic";
2425
+ region: MeteringRegions;
2426
+ renewalStrategy: "hourly" | "monthly" | "yearly";
2427
+ customerKey: string;
2428
+ /**
2429
+ * Array of Stripe product ids, they start with "prod_"
2430
+ */
2431
+ planExternalIds: string[];
2432
+ /**
2433
+ * Stripe subscription id, starts with "sub_"
2434
+ */
2435
+ subscriptionExternalId?: string;
2436
+ /**
2437
+ * Stripe customer id, starts with "cus_"
2438
+ */
2439
+ customerExternalId?: string;
2440
+ metadata?: Record<string, string>;
2441
+ }
2442
+
2443
+ declare type MeteringSubscriptionStatus = "active" | "inactive" | "incomplete" | "incomplete-expired" | "trialing" | "past-due" | "canceled" | "unpaid";
2444
+
2420
2445
  /* Excluded from this release type: MetricsData */
2421
2446
 
2422
2447
  declare abstract class MetricsPlugin extends RuntimePlugin {
@@ -2517,8 +2542,6 @@ export declare interface MoesifInboundPolicyOptions {
2517
2542
  logResponseBody?: boolean;
2518
2543
  }
2519
2544
 
2520
- /* Excluded from this release type: MonetizationInboundPolicy */
2521
-
2522
2545
  /**
2523
2546
  * The options for this policy.
2524
2547
  */
@@ -2555,6 +2578,16 @@ export declare interface MonetizationInboundPolicyOptions {
2555
2578
  meterOnStatusCodes?: string | number[];
2556
2579
  }
2557
2580
 
2581
+ export declare class MonetizationPolicy extends InboundPolicy<MonetizationInboundPolicyOptions> {
2582
+ static getSubscription(context: ZuploContext): StoredMeteringSubscriptionWithQuotas | undefined;
2583
+ static setMeters(context: ZuploContext, meters: MonetizationPolicyMeters): void;
2584
+ handler(request: ZuploRequest<RequestGeneric>, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
2585
+ }
2586
+
2587
+ declare type MonetizationPolicyMeters = {
2588
+ [Key in string]: number;
2589
+ };
2590
+
2558
2591
  declare interface NotFoundOptions {
2559
2592
  routesMatchedByPathOnly: RouteConfiguration[];
2560
2593
  }
@@ -3647,6 +3680,22 @@ export declare interface SleepInboundPolicyOptions {
3647
3680
 
3648
3681
  /* Excluded from this release type: StandardEnv */
3649
3682
 
3683
+ declare interface StoredMeteringSubscriptionWithQuotas extends MeteringSubscription {
3684
+ /**
3685
+ * Metering subscription id, starts with "sbsc_"
3686
+ */
3687
+ id: string;
3688
+ createdOn: string;
3689
+ updatedOn: string;
3690
+ quotaResetAnchor?: Date;
3691
+ meters: {
3692
+ [Key in string]: {
3693
+ consumed: number;
3694
+ max: number;
3695
+ };
3696
+ };
3697
+ }
3698
+
3650
3699
  /* Excluded from this release type: StripeMeteringPlugin */
3651
3700
 
3652
3701
  /* Excluded from this release type: StripeMeteringPluginOptions */