@zuplo/runtime 5.1804.0 → 5.1806.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,7 +2542,26 @@ export declare interface MoesifInboundPolicyOptions {
2517
2542
  logResponseBody?: boolean;
2518
2543
  }
2519
2544
 
2520
- /* Excluded from this release type: MonetizationInboundPolicy */
2545
+ /**
2546
+ * The Monetization policy enables you to track & monetize by your API's usage
2547
+ *
2548
+ * @remarks
2549
+ * The Monetization policy allows you to track and monetize the usage of our API resources,
2550
+ * declaratively and programatically.
2551
+ *
2552
+ * @title Monetization
2553
+ * @public
2554
+ * @param request - The ZuploRequest
2555
+ * @param context - The ZuploContext
2556
+ * @param options - The policy options set in policies.json
2557
+ * @param policyName - The name of the policy as set in policies.json
2558
+ * @returns A Request or a Response
2559
+ */
2560
+ export declare class MonetizationInboundPolicy extends InboundPolicy<MonetizationInboundPolicyOptions> {
2561
+ static getSubscription(context: ZuploContext): StoredMeteringSubscriptionWithQuotas | undefined;
2562
+ static setMeters(context: ZuploContext, meters: MonetizationPolicyMeters): void;
2563
+ handler(request: ZuploRequest<RequestGeneric>, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
2564
+ }
2521
2565
 
2522
2566
  /**
2523
2567
  * The options for this policy.
@@ -2555,6 +2599,10 @@ export declare interface MonetizationInboundPolicyOptions {
2555
2599
  meterOnStatusCodes?: string | number[];
2556
2600
  }
2557
2601
 
2602
+ declare type MonetizationPolicyMeters = {
2603
+ [Key in string]: number;
2604
+ };
2605
+
2558
2606
  declare interface NotFoundOptions {
2559
2607
  routesMatchedByPathOnly: RouteConfiguration[];
2560
2608
  }
@@ -3647,6 +3695,22 @@ export declare interface SleepInboundPolicyOptions {
3647
3695
 
3648
3696
  /* Excluded from this release type: StandardEnv */
3649
3697
 
3698
+ declare interface StoredMeteringSubscriptionWithQuotas extends MeteringSubscription {
3699
+ /**
3700
+ * Metering subscription id, starts with "sbsc_"
3701
+ */
3702
+ id: string;
3703
+ createdOn: string;
3704
+ updatedOn: string;
3705
+ quotaResetAnchor?: Date;
3706
+ meters: {
3707
+ [Key in string]: {
3708
+ consumed: number;
3709
+ max: number;
3710
+ };
3711
+ };
3712
+ }
3713
+
3650
3714
  /* Excluded from this release type: StripeMeteringPlugin */
3651
3715
 
3652
3716
  /* Excluded from this release type: StripeMeteringPluginOptions */