@qcobro/common 1.13.0 → 1.14.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.
Files changed (57) hide show
  1. package/dist/billing/evaluate.d.ts +36 -0
  2. package/dist/billing/evaluate.d.ts.map +1 -0
  3. package/dist/billing/evaluate.js +136 -0
  4. package/dist/billing/evaluate.js.map +1 -0
  5. package/dist/billing/index.d.ts +7 -0
  6. package/dist/billing/index.d.ts.map +1 -0
  7. package/dist/billing/index.js +7 -0
  8. package/dist/billing/index.js.map +1 -0
  9. package/dist/billing/ledger.d.ts +70 -0
  10. package/dist/billing/ledger.d.ts.map +1 -0
  11. package/dist/billing/ledger.js +59 -0
  12. package/dist/billing/ledger.js.map +1 -0
  13. package/dist/billing/money.d.ts +26 -0
  14. package/dist/billing/money.d.ts.map +1 -0
  15. package/dist/billing/money.js +58 -0
  16. package/dist/billing/money.js.map +1 -0
  17. package/dist/billing/pricing.d.ts +58 -0
  18. package/dist/billing/pricing.d.ts.map +1 -0
  19. package/dist/billing/pricing.js +68 -0
  20. package/dist/billing/pricing.js.map +1 -0
  21. package/dist/billing/proration.d.ts +8 -0
  22. package/dist/billing/proration.d.ts.map +1 -0
  23. package/dist/billing/proration.js +17 -0
  24. package/dist/billing/proration.js.map +1 -0
  25. package/dist/billing/rates.d.ts +108 -0
  26. package/dist/billing/rates.d.ts.map +1 -0
  27. package/dist/billing/rates.js +56 -0
  28. package/dist/billing/rates.js.map +1 -0
  29. package/dist/config.d.ts +139 -0
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/config.js +62 -0
  32. package/dist/config.js.map +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/schemas/billing.d.ts +74 -0
  38. package/dist/schemas/billing.d.ts.map +1 -0
  39. package/dist/schemas/billing.js +68 -0
  40. package/dist/schemas/billing.js.map +1 -0
  41. package/dist/schemas/index.d.ts +1 -0
  42. package/dist/schemas/index.d.ts.map +1 -1
  43. package/dist/schemas/index.js +1 -0
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/types/billing.d.ts +134 -0
  46. package/dist/types/billing.d.ts.map +1 -0
  47. package/dist/types/billing.js +8 -0
  48. package/dist/types/billing.js.map +1 -0
  49. package/dist/types/engine.d.ts +8 -2
  50. package/dist/types/engine.d.ts.map +1 -1
  51. package/dist/types/engine.js +12 -1
  52. package/dist/types/engine.js.map +1 -1
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/dist/types/index.js +1 -0
  56. package/dist/types/index.js.map +1 -1
  57. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
@@ -14,4 +14,5 @@ export * from "./whatsApp.js";
14
14
  export * from "./voiceEvent.js";
15
15
  export * from "./insight.js";
16
16
  export * from "./engineEvents.js";
17
+ export * from "./billing.js";
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Client interfaces the billing service functions depend on — the Prisma subset
3
+ * they use, so tests inject stubs with no live database. Monetary columns are
4
+ * BigInt in the database; these interfaces surface them as `bigint` and the
5
+ * functions convert to safe-integer micro-unit `number`s at the boundary.
6
+ */
7
+ /** Prisma's BillingMeter enum values (DB spelling of the common meter keys). */
8
+ export type DbBillingMeter = "SMS" | "EMAIL" | "WHATSAPP_MESSAGE" | "VOICE_PRERECORDED" | "VOICE_AI" | "WHATSAPP_VOICE_PRERECORDED" | "WHATSAPP_VOICE_AI";
9
+ export type DbLedgerEntryKind = "GRANT" | "USAGE_DEBIT" | "VOID" | "ADJUSTMENT";
10
+ export interface WorkspaceBillingRecord {
11
+ workspaceRef: string;
12
+ billingAccountId: string;
13
+ planKey: string;
14
+ /** Enterprise overrides: a Partial of the shared rates schema (validated on read). */
15
+ rateOverrides: unknown;
16
+ stripeSubscriptionItemId: string | null;
17
+ cycleStart: Date | null;
18
+ cycleEnd: Date | null;
19
+ }
20
+ export interface UsageRecordRow {
21
+ id: string;
22
+ workspaceRef: string;
23
+ meter: DbBillingMeter;
24
+ quantity: number;
25
+ unitPriceMicro: bigint;
26
+ amountMicro: bigint;
27
+ increments: string | null;
28
+ settledAt: Date | null;
29
+ campaignId: string | null;
30
+ portfolioAccountId: string | null;
31
+ providerRef: string | null;
32
+ at: Date;
33
+ }
34
+ export interface LedgerEntryRow {
35
+ id: string;
36
+ workspaceRef: string;
37
+ kind: DbLedgerEntryKind;
38
+ amountMicro: bigint;
39
+ at: Date;
40
+ usageRecordId: string | null;
41
+ stripeInvoiceId: string | null;
42
+ }
43
+ /** The Prisma subset the billing functions reach through the tRPC/engine context. */
44
+ export interface BillingAccountRecord {
45
+ id: string;
46
+ createdFromUserRef: string;
47
+ stripeCustomerId: string;
48
+ stripeSubscriptionId: string | null;
49
+ collectionMethod: string;
50
+ paymentFailed: boolean;
51
+ }
52
+ export interface BillingClient {
53
+ workspaceBilling: {
54
+ findUnique(args: {
55
+ where: {
56
+ workspaceRef: string;
57
+ };
58
+ }): Promise<WorkspaceBillingRecord | null>;
59
+ create(args: {
60
+ data: Record<string, unknown>;
61
+ }): Promise<WorkspaceBillingRecord>;
62
+ update(args: {
63
+ where: {
64
+ workspaceRef: string;
65
+ };
66
+ data: Record<string, unknown>;
67
+ }): Promise<WorkspaceBillingRecord>;
68
+ };
69
+ billingAccount: {
70
+ findUnique(args: {
71
+ where: {
72
+ id: string;
73
+ };
74
+ }): Promise<BillingAccountRecord | null>;
75
+ findFirst(args: {
76
+ where: {
77
+ stripeCustomerId?: string;
78
+ createdFromUserRef?: string;
79
+ };
80
+ }): Promise<BillingAccountRecord | null>;
81
+ create(args: {
82
+ data: Record<string, unknown>;
83
+ }): Promise<BillingAccountRecord>;
84
+ update(args: {
85
+ where: {
86
+ id: string;
87
+ };
88
+ data: Record<string, unknown>;
89
+ }): Promise<BillingAccountRecord>;
90
+ updateMany(args: {
91
+ where: {
92
+ stripeCustomerId: string;
93
+ };
94
+ data: Record<string, unknown>;
95
+ }): Promise<{
96
+ count: number;
97
+ }>;
98
+ };
99
+ usageRecord: {
100
+ create(args: {
101
+ data: Record<string, unknown>;
102
+ }): Promise<UsageRecordRow>;
103
+ findUnique(args: {
104
+ where: {
105
+ providerRef: string;
106
+ };
107
+ }): Promise<UsageRecordRow | null>;
108
+ update(args: {
109
+ where: {
110
+ id: string;
111
+ };
112
+ data: Record<string, unknown>;
113
+ }): Promise<UsageRecordRow>;
114
+ };
115
+ ledgerEntry: {
116
+ create(args: {
117
+ data: Record<string, unknown>;
118
+ }): Promise<LedgerEntryRow>;
119
+ aggregate(args: {
120
+ where: {
121
+ workspaceRef: string;
122
+ };
123
+ _sum: {
124
+ amountMicro: true;
125
+ };
126
+ }): Promise<{
127
+ _sum: {
128
+ amountMicro: bigint | null;
129
+ };
130
+ }>;
131
+ };
132
+ $transaction<T>(fn: (tx: BillingClient) => Promise<T>): Promise<T>;
133
+ }
134
+ //# sourceMappingURL=billing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/types/billing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAChF,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,OAAO,GACP,kBAAkB,GAClB,mBAAmB,GACnB,UAAU,GACV,4BAA4B,GAC5B,mBAAmB,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,aAAa,EAAE,OAAO,CAAC;IACvB,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,EAAE,EAAE,I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C,cAAc,CAAC,CAAC;KACjG,CAAC;IAEF,WAAW,EAAE;QACX,MAAM,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QACzE,SAAS,CAAC,IAAI,EAAE;YACd,KAAK,EAAE;gBAAE,YAAY,EAAE,MAAM,CAAA;aAAE,CAAC;YAChC,IAAI,EAAE;gBAAE,WAAW,EAAE,IAAI,CAAA;aAAE,CAAC;SAC7B,GAAG,OAAO,CAAC;YAAE,IAAI,EAAE;gBAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KACvD,CAAC;IAEF,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACpE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Client interfaces the billing service functions depend on — the Prisma subset
3
+ * they use, so tests inject stubs with no live database. Monetary columns are
4
+ * BigInt in the database; these interfaces surface them as `bigint` and the
5
+ * functions convert to safe-integer micro-unit `number`s at the boundary.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/types/billing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -12,10 +12,16 @@ export interface Clock {
12
12
  }
13
13
  /** Channels the engine can dispatch (the subset `dispatchOutreach` supports). */
14
14
  export type EngineChannel = "VOICE_AI" | "VOICE_PRERECORDED" | "SMS" | "EMAIL" | "WHATSAPP";
15
+ /**
16
+ * Which billing meter a dispatch on each channel consumes — THE single mapping
17
+ * (used by the engine tick, manual outreach, and any future dispatch surface,
18
+ * so the same traffic can never be metered differently on different paths).
19
+ */
20
+ export declare const BILLING_METER_OF_CHANNEL: Record<EngineChannel, import("../billing/rates.js").BillingMeter>;
15
21
  /** Why a campaign was not dispatched at all this tick. */
16
- export type CampaignSkipReason = "not_active" | "out_of_window" | "channel_not_configured" | "channel_not_supported" | "empty_number_pool" | "voice_not_synced";
22
+ export type CampaignSkipReason = "not_active" | "out_of_window" | "channel_not_configured" | "channel_not_supported" | "empty_number_pool" | "voice_not_synced" | "credits_exhausted" | "payment_failed";
17
23
  /** The outcome of considering a single account during a tick. */
18
- export type AccountDecision = "dispatched" | "dispatch_failed" | "no_phone" | "no_email" | "intent_suppressed" | "account_suppressed" | "promise_suppressed" | "lifetime_cap" | "daily_cap" | "budget_exhausted";
24
+ export type AccountDecision = "dispatched" | "dispatch_failed" | "no_phone" | "no_email" | "intent_suppressed" | "account_suppressed" | "promise_suppressed" | "lifetime_cap" | "daily_cap" | "budget_exhausted" | "credits_exhausted";
19
25
  /** Per-account line in the tick report. */
20
26
  export interface AccountDecisionEntry {
21
27
  portfolioAccountId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/types/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oFAAoF;AACpF,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,IAAI,CAAC;CACb;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,mBAAmB,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAE5F,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,eAAe,GACf,wBAAwB,GACxB,uBAAuB,GACvB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,kBAAkB,CAAC;AAEvB,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB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6
6
  * The channel-dispatch ports (`OutboundCallClient`, `SmsClient`, `NumberSelector`)
7
7
  * are reused from `./dispatch.js` — channel emulators implement those interfaces.
8
8
  */
9
- export {};
9
+ /**
10
+ * Which billing meter a dispatch on each channel consumes — THE single mapping
11
+ * (used by the engine tick, manual outreach, and any future dispatch surface,
12
+ * so the same traffic can never be metered differently on different paths).
13
+ */
14
+ export const BILLING_METER_OF_CHANNEL = {
15
+ VOICE_AI: "voiceAi",
16
+ VOICE_PRERECORDED: "voicePrerecorded",
17
+ SMS: "sms",
18
+ EMAIL: "email",
19
+ WHATSAPP: "whatsappMessage"
20
+ };
10
21
  //# sourceMappingURL=engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/types/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/types/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAGjC;IACF,QAAQ,EAAE,SAAS;IACnB,iBAAiB,EAAE,kBAAkB;IACrC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,iBAAiB;CAC5B,CAAC"}
@@ -9,4 +9,5 @@ export * from "./email.js";
9
9
  export * from "./whatsApp.js";
10
10
  export * from "./engine.js";
11
11
  export * from "./insight.js";
12
+ export * from "./billing.js";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -9,4 +9,5 @@ export * from "./email.js";
9
9
  export * from "./whatsApp.js";
10
10
  export * from "./engine.js";
11
11
  export * from "./insight.js";
12
+ export * from "./billing.js";
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qcobro/common",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"