@shaxpir/duiduidui-models 1.36.0 → 1.36.2

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.
@@ -44,6 +44,7 @@ export interface BillingPayload {
44
44
  grant_note: string | null;
45
45
  feature_grants: Record<string, FeatureGrant>;
46
46
  redeemed_codes: string[];
47
+ usage_ceilings: Record<string, number>;
47
48
  transactions: Transaction[];
48
49
  }
49
50
  export interface BillingBody extends ContentBody {
@@ -62,6 +63,8 @@ export declare class Billing extends Content {
62
63
  get featureGrants(): Record<string, FeatureGrant>;
63
64
  get redeemedCodes(): string[];
64
65
  get transactions(): Transaction[];
66
+ get usageCeilings(): Record<string, number>;
67
+ getUsageCeiling(usageName: string): number;
65
68
  isActive(): boolean;
66
69
  isTrialing(): boolean;
67
70
  isLifetimeFree(): boolean;
@@ -24,6 +24,7 @@ class Billing extends Content_1.Content {
24
24
  grant_note: null,
25
25
  feature_grants: {},
26
26
  redeemed_codes: [],
27
+ usage_ceilings: {},
27
28
  transactions: []
28
29
  };
29
30
  }
@@ -69,6 +70,12 @@ class Billing extends Content_1.Content {
69
70
  get transactions() {
70
71
  return this.payload.transactions ?? [];
71
72
  }
73
+ get usageCeilings() {
74
+ return this.payload.usage_ceilings ?? {};
75
+ }
76
+ getUsageCeiling(usageName) {
77
+ return this.usageCeilings[usageName] ?? 0;
78
+ }
72
79
  isActive() {
73
80
  const status = this.subscriptionStatus;
74
81
  return status === 'active' || status === 'trialing' || status === 'grace_period';
@@ -3,7 +3,7 @@ import { ShareSync } from '../repo';
3
3
  import { ContentId } from "./Content";
4
4
  import { Metric } from './Metric';
5
5
  export declare enum UsageName {
6
- AI_TOKENS = "ai_tokens"
6
+ CHAT_AI_TOKENS = "chat_ai_tokens"
7
7
  }
8
8
  export declare class Usage extends Metric {
9
9
  static makeUsageId(userId: ContentId, usageName: UsageName): ContentId;
@@ -7,7 +7,7 @@ const ContentKind_1 = require("./ContentKind");
7
7
  const Metric_1 = require("./Metric");
8
8
  var UsageName;
9
9
  (function (UsageName) {
10
- UsageName["AI_TOKENS"] = "ai_tokens";
10
+ UsageName["CHAT_AI_TOKENS"] = "chat_ai_tokens";
11
11
  })(UsageName || (exports.UsageName = UsageName = {}));
12
12
  class Usage extends Metric_1.Metric {
13
13
  static makeUsageId(userId, usageName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.36.0",
3
+ "version": "1.36.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"