atmn 1.1.23 → 1.1.24
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/dist/cli.js
CHANGED
|
@@ -65988,85 +65988,8 @@ var init_expandParam = __esm(() => {
|
|
|
65988
65988
|
});
|
|
65989
65989
|
});
|
|
65990
65990
|
|
|
65991
|
-
// ../../shared/models/cusModels/billingControls/
|
|
65992
|
-
var
|
|
65993
|
-
var init_overageAllowed = __esm(() => {
|
|
65994
|
-
init_v4();
|
|
65995
|
-
DbOverageAllowedSchema = exports_external.object({
|
|
65996
|
-
feature_id: exports_external.string().meta({
|
|
65997
|
-
description: "The feature ID this overage allowed control applies to."
|
|
65998
|
-
}),
|
|
65999
|
-
enabled: exports_external.boolean().default(false).meta({
|
|
66000
|
-
description: "Whether overage is allowed for this feature."
|
|
66001
|
-
})
|
|
66002
|
-
});
|
|
66003
|
-
});
|
|
66004
|
-
|
|
66005
|
-
// ../../shared/models/cusModels/billingControls/spendLimit.ts
|
|
66006
|
-
var SpendLimitType, DbSpendLimitSchema;
|
|
66007
|
-
var init_spendLimit = __esm(() => {
|
|
66008
|
-
init_v4();
|
|
66009
|
-
SpendLimitType = exports_external.enum(["absolute", "usage_percentage"]);
|
|
66010
|
-
DbSpendLimitSchema = exports_external.object({
|
|
66011
|
-
feature_id: exports_external.string().optional().meta({
|
|
66012
|
-
description: "Optional feature ID this spend limit applies to."
|
|
66013
|
-
}),
|
|
66014
|
-
enabled: exports_external.boolean().default(false).meta({
|
|
66015
|
-
description: "Whether the overage spend limit is enabled."
|
|
66016
|
-
}),
|
|
66017
|
-
limit_type: SpendLimitType.optional().meta({
|
|
66018
|
-
description: "How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance."
|
|
66019
|
-
}),
|
|
66020
|
-
overage_limit: exports_external.number().min(0).optional().meta({
|
|
66021
|
-
description: "Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage."
|
|
66022
|
-
}),
|
|
66023
|
-
skip_overage_billing: exports_external.boolean().optional().meta({
|
|
66024
|
-
description: "When true, overage for this feature is not posted to Stripe. Usage tracking and balance resets still behave normally."
|
|
66025
|
-
})
|
|
66026
|
-
}).refine((data) => data.overage_limit === undefined && data.skip_overage_billing === undefined || data.feature_id !== undefined, {
|
|
66027
|
-
message: "feature_id is required when overage_limit or skip_overage_billing is provided",
|
|
66028
|
-
path: ["feature_id"]
|
|
66029
|
-
});
|
|
66030
|
-
});
|
|
66031
|
-
|
|
66032
|
-
// ../../shared/models/cusModels/billingControls/usageAlert.ts
|
|
66033
|
-
var UsageAlertThresholdType, DbUsageAlertSchema;
|
|
66034
|
-
var init_usageAlert = __esm(() => {
|
|
66035
|
-
init_v4();
|
|
66036
|
-
UsageAlertThresholdType = exports_external.enum([
|
|
66037
|
-
"usage",
|
|
66038
|
-
"usage_percentage",
|
|
66039
|
-
"remaining",
|
|
66040
|
-
"remaining_percentage"
|
|
66041
|
-
]);
|
|
66042
|
-
DbUsageAlertSchema = exports_external.object({
|
|
66043
|
-
feature_id: exports_external.string().optional().meta({
|
|
66044
|
-
description: "The feature ID this alert applies to."
|
|
66045
|
-
}),
|
|
66046
|
-
enabled: exports_external.boolean().default(true).meta({
|
|
66047
|
-
description: "Whether this usage alert is enabled."
|
|
66048
|
-
}),
|
|
66049
|
-
threshold: exports_external.number().min(0).meta({
|
|
66050
|
-
description: "The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100)."
|
|
66051
|
-
}),
|
|
66052
|
-
threshold_type: UsageAlertThresholdType.meta({
|
|
66053
|
-
description: "Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance."
|
|
66054
|
-
}),
|
|
66055
|
-
name: exports_external.string().optional().meta({
|
|
66056
|
-
description: "Optional user-defined label to distinguish multiple alerts on the same feature."
|
|
66057
|
-
})
|
|
66058
|
-
}).check((ctx) => {
|
|
66059
|
-
const { threshold_type, threshold } = ctx.value;
|
|
66060
|
-
if (threshold_type === "remaining_percentage" && threshold > 100) {
|
|
66061
|
-
ctx.issues.push({
|
|
66062
|
-
code: "custom",
|
|
66063
|
-
input: threshold,
|
|
66064
|
-
path: ["threshold"],
|
|
66065
|
-
message: "Threshold must be between 0 and 100 for remaining_percentage"
|
|
66066
|
-
});
|
|
66067
|
-
}
|
|
66068
|
-
});
|
|
66069
|
-
});
|
|
65991
|
+
// ../../shared/models/cusModels/billingControls/identity/featureIdIdentity.ts
|
|
65992
|
+
var featureIdIdentity = (control) => control.feature_id || undefined;
|
|
66070
65993
|
|
|
66071
65994
|
// ../../shared/models/productModels/intervals/resetInterval.ts
|
|
66072
65995
|
var ResetInterval;
|
|
@@ -66148,6 +66071,214 @@ var init_usageLimit = __esm(() => {
|
|
|
66148
66071
|
};
|
|
66149
66072
|
});
|
|
66150
66073
|
|
|
66074
|
+
// ../../shared/models/cusModels/billingControls/usageAlert.ts
|
|
66075
|
+
var UsageAlertThresholdType, BALANCE_BASES, USAGE_ALERT_BASES, DEFAULT_USAGE_ALERT_BASIS = "balance", UsageAlertBasisSchema, DbUsageAlertSchema;
|
|
66076
|
+
var init_usageAlert = __esm(() => {
|
|
66077
|
+
init_v4();
|
|
66078
|
+
init_usageLimit();
|
|
66079
|
+
UsageAlertThresholdType = exports_external.enum([
|
|
66080
|
+
"usage",
|
|
66081
|
+
"usage_percentage",
|
|
66082
|
+
"remaining",
|
|
66083
|
+
"remaining_percentage"
|
|
66084
|
+
]);
|
|
66085
|
+
BALANCE_BASES = ["balance", "included", "recurring"];
|
|
66086
|
+
USAGE_ALERT_BASES = [...BALANCE_BASES, "usage_limit"];
|
|
66087
|
+
UsageAlertBasisSchema = exports_external.enum(USAGE_ALERT_BASES);
|
|
66088
|
+
DbUsageAlertSchema = exports_external.object({
|
|
66089
|
+
feature_id: exports_external.string().optional().meta({
|
|
66090
|
+
description: "The feature ID this alert applies to."
|
|
66091
|
+
}),
|
|
66092
|
+
enabled: exports_external.boolean().default(true).meta({
|
|
66093
|
+
description: "Whether this usage alert is enabled."
|
|
66094
|
+
}),
|
|
66095
|
+
threshold: exports_external.number().min(0).meta({
|
|
66096
|
+
description: "The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100)."
|
|
66097
|
+
}),
|
|
66098
|
+
threshold_type: UsageAlertThresholdType.meta({
|
|
66099
|
+
description: "Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance."
|
|
66100
|
+
}),
|
|
66101
|
+
basis: UsageAlertBasisSchema.default(DEFAULT_USAGE_ALERT_BASIS).meta({
|
|
66102
|
+
description: "What 100% means. balance: every grant on the feature. included: the plan allowance only. recurring: grants that reset. usage_limit: the cap of the usage limit with the same feature and filter."
|
|
66103
|
+
}),
|
|
66104
|
+
filter: UsageLimitFilterSchema.optional().meta({
|
|
66105
|
+
description: "Only valid with basis usage_limit. Points the alert at the usage limit carrying the same filter."
|
|
66106
|
+
}),
|
|
66107
|
+
name: exports_external.string().optional().meta({
|
|
66108
|
+
description: "Optional user-defined label to distinguish multiple alerts on the same feature."
|
|
66109
|
+
})
|
|
66110
|
+
}).check((ctx) => {
|
|
66111
|
+
const { feature_id, threshold_type, threshold, basis, filter: filter2 } = ctx.value;
|
|
66112
|
+
if (threshold_type === "remaining_percentage" && threshold > 100) {
|
|
66113
|
+
ctx.issues.push({
|
|
66114
|
+
code: "custom",
|
|
66115
|
+
input: threshold,
|
|
66116
|
+
path: ["threshold"],
|
|
66117
|
+
message: "Threshold must be between 0 and 100 for remaining_percentage"
|
|
66118
|
+
});
|
|
66119
|
+
}
|
|
66120
|
+
if (basis === "usage_limit" && !feature_id) {
|
|
66121
|
+
ctx.issues.push({
|
|
66122
|
+
code: "custom",
|
|
66123
|
+
input: feature_id,
|
|
66124
|
+
path: ["feature_id"],
|
|
66125
|
+
message: "feature_id is required when basis is usage_limit"
|
|
66126
|
+
});
|
|
66127
|
+
}
|
|
66128
|
+
if (filter2 && basis !== "usage_limit") {
|
|
66129
|
+
ctx.issues.push({
|
|
66130
|
+
code: "custom",
|
|
66131
|
+
input: filter2,
|
|
66132
|
+
path: ["filter"],
|
|
66133
|
+
message: "filter is only valid when basis is usage_limit"
|
|
66134
|
+
});
|
|
66135
|
+
}
|
|
66136
|
+
});
|
|
66137
|
+
});
|
|
66138
|
+
|
|
66139
|
+
// ../../shared/models/cusModels/billingControls/identity/usageAlertIdentity.ts
|
|
66140
|
+
var usageAlertIdentity = (alert) => [
|
|
66141
|
+
alert.feature_id ?? "",
|
|
66142
|
+
alert.basis ?? DEFAULT_USAGE_ALERT_BASIS,
|
|
66143
|
+
usageLimitFilterKey(alert.filter),
|
|
66144
|
+
alert.threshold_type,
|
|
66145
|
+
alert.threshold
|
|
66146
|
+
].join("|");
|
|
66147
|
+
var init_usageAlertIdentity = __esm(() => {
|
|
66148
|
+
init_usageAlert();
|
|
66149
|
+
init_usageLimit();
|
|
66150
|
+
});
|
|
66151
|
+
|
|
66152
|
+
// ../../shared/models/cusModels/billingControls/identity/usageLimitIdentity.ts
|
|
66153
|
+
var usageLimitIdentity = (usageLimit) => `${usageLimit.feature_id}|${usageLimitFilterKey(usageLimit.filter)}`;
|
|
66154
|
+
var init_usageLimitIdentity = __esm(() => {
|
|
66155
|
+
init_usageLimit();
|
|
66156
|
+
});
|
|
66157
|
+
|
|
66158
|
+
// ../../shared/models/cusModels/billingControls/duplicates/findDuplicateInControls.ts
|
|
66159
|
+
var findDuplicateInControls = ({
|
|
66160
|
+
controlKey,
|
|
66161
|
+
controls,
|
|
66162
|
+
rule
|
|
66163
|
+
}) => {
|
|
66164
|
+
const seen = new Set;
|
|
66165
|
+
for (const [index3, control] of controls.entries()) {
|
|
66166
|
+
const identity2 = rule.identityOf(control);
|
|
66167
|
+
if (identity2 === undefined)
|
|
66168
|
+
continue;
|
|
66169
|
+
if (seen.has(identity2)) {
|
|
66170
|
+
return {
|
|
66171
|
+
code: "custom",
|
|
66172
|
+
message: rule.message,
|
|
66173
|
+
input: control[rule.field],
|
|
66174
|
+
path: [controlKey, index3, rule.field]
|
|
66175
|
+
};
|
|
66176
|
+
}
|
|
66177
|
+
seen.add(identity2);
|
|
66178
|
+
}
|
|
66179
|
+
return;
|
|
66180
|
+
};
|
|
66181
|
+
|
|
66182
|
+
// ../../shared/models/cusModels/billingControls/duplicates/duplicateChecks.ts
|
|
66183
|
+
var duplicateCheck = ({
|
|
66184
|
+
controlKey,
|
|
66185
|
+
...rule
|
|
66186
|
+
}) => (billingControls) => findDuplicateInControls({
|
|
66187
|
+
controlKey,
|
|
66188
|
+
controls: billingControls[controlKey] ?? [],
|
|
66189
|
+
rule
|
|
66190
|
+
}), DUPLICATE_CHECKS;
|
|
66191
|
+
var init_duplicateChecks = __esm(() => {
|
|
66192
|
+
init_usageAlertIdentity();
|
|
66193
|
+
init_usageLimitIdentity();
|
|
66194
|
+
DUPLICATE_CHECKS = [
|
|
66195
|
+
duplicateCheck({
|
|
66196
|
+
controlKey: "auto_topups",
|
|
66197
|
+
identityOf: featureIdIdentity,
|
|
66198
|
+
field: "feature_id",
|
|
66199
|
+
message: "Only one auto top-up entry is allowed per feature_id"
|
|
66200
|
+
}),
|
|
66201
|
+
duplicateCheck({
|
|
66202
|
+
controlKey: "spend_limits",
|
|
66203
|
+
identityOf: featureIdIdentity,
|
|
66204
|
+
field: "feature_id",
|
|
66205
|
+
message: "Only one spend limit entry is allowed per feature_id"
|
|
66206
|
+
}),
|
|
66207
|
+
duplicateCheck({
|
|
66208
|
+
controlKey: "usage_limits",
|
|
66209
|
+
identityOf: usageLimitIdentity,
|
|
66210
|
+
field: "feature_id",
|
|
66211
|
+
message: "Only one usage limit entry is allowed per feature_id and filter"
|
|
66212
|
+
}),
|
|
66213
|
+
duplicateCheck({
|
|
66214
|
+
controlKey: "usage_alerts",
|
|
66215
|
+
identityOf: usageAlertIdentity,
|
|
66216
|
+
field: "threshold",
|
|
66217
|
+
message: "Only one usage alert entry is allowed per feature_id, basis, filter, threshold_type and threshold"
|
|
66218
|
+
}),
|
|
66219
|
+
duplicateCheck({
|
|
66220
|
+
controlKey: "overage_allowed",
|
|
66221
|
+
identityOf: featureIdIdentity,
|
|
66222
|
+
field: "feature_id",
|
|
66223
|
+
message: "Only one overage_allowed entry is allowed per feature_id"
|
|
66224
|
+
})
|
|
66225
|
+
];
|
|
66226
|
+
});
|
|
66227
|
+
|
|
66228
|
+
// ../../shared/models/cusModels/billingControls/duplicates/findDuplicateBillingControlIssue.ts
|
|
66229
|
+
var findDuplicateBillingControlIssue = (billingControls) => {
|
|
66230
|
+
for (const check4 of DUPLICATE_CHECKS) {
|
|
66231
|
+
const issue2 = check4(billingControls);
|
|
66232
|
+
if (issue2)
|
|
66233
|
+
return issue2;
|
|
66234
|
+
}
|
|
66235
|
+
return;
|
|
66236
|
+
};
|
|
66237
|
+
var init_findDuplicateBillingControlIssue = __esm(() => {
|
|
66238
|
+
init_duplicateChecks();
|
|
66239
|
+
});
|
|
66240
|
+
|
|
66241
|
+
// ../../shared/models/cusModels/billingControls/overageAllowed.ts
|
|
66242
|
+
var DbOverageAllowedSchema;
|
|
66243
|
+
var init_overageAllowed = __esm(() => {
|
|
66244
|
+
init_v4();
|
|
66245
|
+
DbOverageAllowedSchema = exports_external.object({
|
|
66246
|
+
feature_id: exports_external.string().meta({
|
|
66247
|
+
description: "The feature ID this overage allowed control applies to."
|
|
66248
|
+
}),
|
|
66249
|
+
enabled: exports_external.boolean().default(false).meta({
|
|
66250
|
+
description: "Whether overage is allowed for this feature."
|
|
66251
|
+
})
|
|
66252
|
+
});
|
|
66253
|
+
});
|
|
66254
|
+
|
|
66255
|
+
// ../../shared/models/cusModels/billingControls/spendLimit.ts
|
|
66256
|
+
var SpendLimitType, DbSpendLimitSchema;
|
|
66257
|
+
var init_spendLimit = __esm(() => {
|
|
66258
|
+
init_v4();
|
|
66259
|
+
SpendLimitType = exports_external.enum(["absolute", "usage_percentage"]);
|
|
66260
|
+
DbSpendLimitSchema = exports_external.object({
|
|
66261
|
+
feature_id: exports_external.string().optional().meta({
|
|
66262
|
+
description: "Optional feature ID this spend limit applies to."
|
|
66263
|
+
}),
|
|
66264
|
+
enabled: exports_external.boolean().default(false).meta({
|
|
66265
|
+
description: "Whether the overage spend limit is enabled."
|
|
66266
|
+
}),
|
|
66267
|
+
limit_type: SpendLimitType.optional().meta({
|
|
66268
|
+
description: "How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance."
|
|
66269
|
+
}),
|
|
66270
|
+
overage_limit: exports_external.number().min(0).optional().meta({
|
|
66271
|
+
description: "Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage."
|
|
66272
|
+
}),
|
|
66273
|
+
skip_overage_billing: exports_external.boolean().optional().meta({
|
|
66274
|
+
description: "When true, overage for this feature is not posted to Stripe. Usage tracking and balance resets still behave normally."
|
|
66275
|
+
})
|
|
66276
|
+
}).refine((data) => data.overage_limit === undefined && data.skip_overage_billing === undefined || data.feature_id !== undefined, {
|
|
66277
|
+
message: "feature_id is required when overage_limit or skip_overage_billing is provided",
|
|
66278
|
+
path: ["feature_id"]
|
|
66279
|
+
});
|
|
66280
|
+
});
|
|
66281
|
+
|
|
66151
66282
|
// ../../shared/models/cusModels/billingControls/entityBillingControls.ts
|
|
66152
66283
|
var EntityBillingControlsSchema;
|
|
66153
66284
|
var init_entityBillingControls = __esm(() => {
|
|
@@ -66185,6 +66316,18 @@ var init_purchaseLimitInterval = __esm(() => {
|
|
|
66185
66316
|
PurchaseLimitIntervalEnum = exports_external.enum(PurchaseLimitInterval);
|
|
66186
66317
|
});
|
|
66187
66318
|
|
|
66319
|
+
// ../../shared/models/cusModels/billingControls/classify/isUsageLimitBasisAlert.ts
|
|
66320
|
+
var isUsageLimitBasisAlert = (alert) => alert.basis === "usage_limit";
|
|
66321
|
+
|
|
66322
|
+
// ../../shared/models/cusModels/billingControls/identity/usageAlertTargetLimitIdentity.ts
|
|
66323
|
+
var usageAlertTargetLimitIdentity = (alert) => usageLimitIdentity({
|
|
66324
|
+
feature_id: alert.feature_id ?? "",
|
|
66325
|
+
filter: alert.filter
|
|
66326
|
+
});
|
|
66327
|
+
var init_usageAlertTargetLimitIdentity = __esm(() => {
|
|
66328
|
+
init_usageLimitIdentity();
|
|
66329
|
+
});
|
|
66330
|
+
|
|
66188
66331
|
// ../../shared/models/cusModels/billingControls/customerBillingControls.ts
|
|
66189
66332
|
var BILLING_CONTROL_KEYS, AutoTopupPurchaseLimitSchema, AutoTopupPurchaseLimitParamsSchema, AutoTopupSchema, AutoTopupParamsSchema, ExpandedPurchaseLimitSchema, AutoTopupResponseSchema, CustomerBillingControlsSchema, DbBillingControlsSchema, normalizeBillingControlsForCompare = (billingControls) => {
|
|
66190
66333
|
if (!billingControls)
|
|
@@ -66205,12 +66348,17 @@ var BILLING_CONTROL_KEYS, AutoTopupPurchaseLimitSchema, AutoTopupPurchaseLimitPa
|
|
|
66205
66348
|
}, CustomerBillingControlsParamsSchema;
|
|
66206
66349
|
var init_customerBillingControls = __esm(() => {
|
|
66207
66350
|
init_v4();
|
|
66351
|
+
init_findDuplicateBillingControlIssue();
|
|
66208
66352
|
init_entityBillingControls();
|
|
66209
66353
|
init_overageAllowed();
|
|
66210
66354
|
init_purchaseLimitInterval();
|
|
66211
66355
|
init_spendLimit();
|
|
66212
66356
|
init_usageAlert();
|
|
66213
66357
|
init_usageLimit();
|
|
66358
|
+
init_usageAlertIdentity();
|
|
66359
|
+
init_usageAlertTargetLimitIdentity();
|
|
66360
|
+
init_usageLimitIdentity();
|
|
66361
|
+
init_usageAlert();
|
|
66214
66362
|
init_usageLimit();
|
|
66215
66363
|
BILLING_CONTROL_KEYS = [
|
|
66216
66364
|
"auto_topups",
|
|
@@ -66311,63 +66459,9 @@ var init_customerBillingControls = __esm(() => {
|
|
|
66311
66459
|
description: "List of auto top-up configurations per feature."
|
|
66312
66460
|
})
|
|
66313
66461
|
}).check((ctx) => {
|
|
66314
|
-
const
|
|
66315
|
-
|
|
66316
|
-
|
|
66317
|
-
if (autoTopupFeatureIds.has(autoTopup.feature_id)) {
|
|
66318
|
-
ctx.issues.push({
|
|
66319
|
-
code: "custom",
|
|
66320
|
-
message: "Only one auto top-up entry is allowed per feature_id",
|
|
66321
|
-
input: autoTopup.feature_id,
|
|
66322
|
-
path: ["auto_topups", index3, "feature_id"]
|
|
66323
|
-
});
|
|
66324
|
-
return;
|
|
66325
|
-
}
|
|
66326
|
-
autoTopupFeatureIds.add(autoTopup.feature_id);
|
|
66327
|
-
}
|
|
66328
|
-
const spendLimitFeatureIds = new Set;
|
|
66329
|
-
for (const [index3, spendLimit] of (billingControls.spend_limits ?? []).entries()) {
|
|
66330
|
-
if (!spendLimit.feature_id) {
|
|
66331
|
-
continue;
|
|
66332
|
-
}
|
|
66333
|
-
if (spendLimitFeatureIds.has(spendLimit.feature_id)) {
|
|
66334
|
-
ctx.issues.push({
|
|
66335
|
-
code: "custom",
|
|
66336
|
-
message: "Only one spend limit entry is allowed per feature_id",
|
|
66337
|
-
input: spendLimit.feature_id,
|
|
66338
|
-
path: ["spend_limits", index3, "feature_id"]
|
|
66339
|
-
});
|
|
66340
|
-
return;
|
|
66341
|
-
}
|
|
66342
|
-
spendLimitFeatureIds.add(spendLimit.feature_id);
|
|
66343
|
-
}
|
|
66344
|
-
const usageLimitIdentities = new Set;
|
|
66345
|
-
for (const [index3, usageLimit] of (billingControls.usage_limits ?? []).entries()) {
|
|
66346
|
-
const identity2 = `${usageLimit.feature_id}|${usageLimitFilterKey(usageLimit.filter)}`;
|
|
66347
|
-
if (usageLimitIdentities.has(identity2)) {
|
|
66348
|
-
ctx.issues.push({
|
|
66349
|
-
code: "custom",
|
|
66350
|
-
message: "Only one usage limit entry is allowed per feature_id and filter",
|
|
66351
|
-
input: usageLimit.feature_id,
|
|
66352
|
-
path: ["usage_limits", index3, "feature_id"]
|
|
66353
|
-
});
|
|
66354
|
-
return;
|
|
66355
|
-
}
|
|
66356
|
-
usageLimitIdentities.add(identity2);
|
|
66357
|
-
}
|
|
66358
|
-
const overageAllowedFeatureIds = new Set;
|
|
66359
|
-
for (const [index3, overageAllowed] of (billingControls.overage_allowed ?? []).entries()) {
|
|
66360
|
-
if (overageAllowedFeatureIds.has(overageAllowed.feature_id)) {
|
|
66361
|
-
ctx.issues.push({
|
|
66362
|
-
code: "custom",
|
|
66363
|
-
message: "Only one overage_allowed entry is allowed per feature_id",
|
|
66364
|
-
input: overageAllowed.feature_id,
|
|
66365
|
-
path: ["overage_allowed", index3, "feature_id"]
|
|
66366
|
-
});
|
|
66367
|
-
return;
|
|
66368
|
-
}
|
|
66369
|
-
overageAllowedFeatureIds.add(overageAllowed.feature_id);
|
|
66370
|
-
}
|
|
66462
|
+
const issue2 = findDuplicateBillingControlIssue(ctx.value);
|
|
66463
|
+
if (issue2)
|
|
66464
|
+
ctx.issues.push(issue2);
|
|
66371
66465
|
});
|
|
66372
66466
|
});
|
|
66373
66467
|
|
|
@@ -69057,24 +69151,185 @@ var init_basePrice = __esm(() => {
|
|
|
69057
69151
|
});
|
|
69058
69152
|
});
|
|
69059
69153
|
|
|
69154
|
+
// ../../shared/models/featureModels/featureEnums.ts
|
|
69155
|
+
var FeatureType, FeatureUsageType;
|
|
69156
|
+
var init_featureEnums = __esm(() => {
|
|
69157
|
+
((FeatureType2) => {
|
|
69158
|
+
FeatureType2["Boolean"] = "boolean";
|
|
69159
|
+
FeatureType2["Metered"] = "metered";
|
|
69160
|
+
FeatureType2["CreditSystem"] = "credit_system";
|
|
69161
|
+
FeatureType2["AiCreditSystem"] = "ai_credit_system";
|
|
69162
|
+
})(FeatureType ||= {});
|
|
69163
|
+
((FeatureUsageType2) => {
|
|
69164
|
+
FeatureUsageType2["Single"] = "single_use";
|
|
69165
|
+
FeatureUsageType2["Continuous"] = "continuous_use";
|
|
69166
|
+
})(FeatureUsageType ||= {});
|
|
69167
|
+
});
|
|
69168
|
+
|
|
69169
|
+
// ../../shared/models/featureModels/featureConfig/creditConfig.ts
|
|
69170
|
+
var CreditTierSchema, flatCreditRateShape, graduatedCreditRateShape, CreditMatchSchema, CreditDimensionBaseSchema, CreditDimensionSchema, CreditMultiplierSchema, USAGE_ATTRIBUTION_DIMENSION_SEPARATOR = "::", CREDIT_DIMENSION_NAME_MAX_LENGTH = 64, CreditDimensionNameSchema, CreditSchemaItemBaseSchema, FlatCreditSchemaItemSchema, GraduatedCreditSchemaItemSchema, CreditSchemaItemSchema, MarkupEntrySchema, ProviderMarkupsSchema, CreditSystemConfigSchema, FeatureConfigOverrideSchema, ModelMarkupsSchema;
|
|
69171
|
+
var init_creditConfig = __esm(() => {
|
|
69172
|
+
init_v4();
|
|
69173
|
+
init_featureEnums();
|
|
69174
|
+
CreditTierSchema = exports_external.object({
|
|
69175
|
+
to: exports_external.union([exports_external.number(), exports_external.literal("inf")]),
|
|
69176
|
+
credit_amount: exports_external.number()
|
|
69177
|
+
});
|
|
69178
|
+
flatCreditRateShape = {
|
|
69179
|
+
credit_amount: exports_external.number(),
|
|
69180
|
+
tier_behavior: exports_external.never().optional(),
|
|
69181
|
+
tiers: exports_external.never().optional()
|
|
69182
|
+
};
|
|
69183
|
+
graduatedCreditRateShape = {
|
|
69184
|
+
credit_amount: exports_external.never().optional(),
|
|
69185
|
+
tier_behavior: exports_external.literal("graduated"),
|
|
69186
|
+
tiers: exports_external.array(CreditTierSchema)
|
|
69187
|
+
};
|
|
69188
|
+
CreditMatchSchema = exports_external.record(exports_external.string(), exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()]).transform(String));
|
|
69189
|
+
CreditDimensionBaseSchema = exports_external.object({
|
|
69190
|
+
match: CreditMatchSchema,
|
|
69191
|
+
priority: exports_external.number().int().optional()
|
|
69192
|
+
});
|
|
69193
|
+
CreditDimensionSchema = exports_external.union([
|
|
69194
|
+
CreditDimensionBaseSchema.extend(flatCreditRateShape),
|
|
69195
|
+
CreditDimensionBaseSchema.extend(graduatedCreditRateShape)
|
|
69196
|
+
]);
|
|
69197
|
+
CreditMultiplierSchema = exports_external.object({
|
|
69198
|
+
match: CreditMatchSchema,
|
|
69199
|
+
factor: exports_external.number().positive().optional(),
|
|
69200
|
+
add: exports_external.number().optional()
|
|
69201
|
+
}).refine((multiplier) => multiplier.factor !== undefined || multiplier.add !== undefined, {
|
|
69202
|
+
message: "A multiplier needs a factor or an add"
|
|
69203
|
+
});
|
|
69204
|
+
CreditDimensionNameSchema = exports_external.string().min(1).max(CREDIT_DIMENSION_NAME_MAX_LENGTH).refine((name) => !name.includes(USAGE_ATTRIBUTION_DIMENSION_SEPARATOR), {
|
|
69205
|
+
message: `Dimension names cannot contain "${USAGE_ATTRIBUTION_DIMENSION_SEPARATOR}"`
|
|
69206
|
+
});
|
|
69207
|
+
CreditSchemaItemBaseSchema = exports_external.object({
|
|
69208
|
+
metered_feature_id: exports_external.string(),
|
|
69209
|
+
feature_amount: exports_external.number().optional(),
|
|
69210
|
+
dimensions: exports_external.record(CreditDimensionNameSchema, CreditDimensionSchema).optional(),
|
|
69211
|
+
multipliers: exports_external.record(CreditDimensionNameSchema, CreditMultiplierSchema).optional()
|
|
69212
|
+
});
|
|
69213
|
+
FlatCreditSchemaItemSchema = CreditSchemaItemBaseSchema.extend(flatCreditRateShape);
|
|
69214
|
+
GraduatedCreditSchemaItemSchema = CreditSchemaItemBaseSchema.extend(graduatedCreditRateShape);
|
|
69215
|
+
CreditSchemaItemSchema = exports_external.union([
|
|
69216
|
+
FlatCreditSchemaItemSchema,
|
|
69217
|
+
GraduatedCreditSchemaItemSchema
|
|
69218
|
+
]);
|
|
69219
|
+
MarkupEntrySchema = exports_external.object({
|
|
69220
|
+
markup: exports_external.number().min(-100)
|
|
69221
|
+
});
|
|
69222
|
+
ProviderMarkupsSchema = exports_external.record(exports_external.string(), MarkupEntrySchema).nullish();
|
|
69223
|
+
CreditSystemConfigSchema = exports_external.object({
|
|
69224
|
+
schema: exports_external.array(CreditSchemaItemSchema),
|
|
69225
|
+
invoice_credit: exports_external.boolean().optional(),
|
|
69226
|
+
usage_type: exports_external.nativeEnum(FeatureUsageType),
|
|
69227
|
+
default_markup: exports_external.number().min(-100).optional(),
|
|
69228
|
+
provider_markups: ProviderMarkupsSchema
|
|
69229
|
+
});
|
|
69230
|
+
FeatureConfigOverrideSchema = exports_external.strictObject({
|
|
69231
|
+
schema: exports_external.array(CreditSchemaItemSchema).optional()
|
|
69232
|
+
});
|
|
69233
|
+
ModelMarkupsSchema = exports_external.record(exports_external.string(), MarkupEntrySchema.extend({
|
|
69234
|
+
markup: exports_external.number().min(-100).optional(),
|
|
69235
|
+
input_cost: exports_external.number().min(0).optional(),
|
|
69236
|
+
output_cost: exports_external.number().min(0).optional()
|
|
69237
|
+
})).nullish();
|
|
69238
|
+
});
|
|
69239
|
+
|
|
69240
|
+
// ../../shared/utils/featureUtils/creditDimensions/creditTierRules.ts
|
|
69241
|
+
var VIOLATION_MESSAGES, findCreditTierViolations = (boundaries) => {
|
|
69242
|
+
const violations = [];
|
|
69243
|
+
const violate = (index3, reason) => violations.push({ index: index3, reason, message: VIOLATION_MESSAGES[reason] });
|
|
69244
|
+
let previousBoundary = 0;
|
|
69245
|
+
for (const [index3, boundary] of boundaries.entries()) {
|
|
69246
|
+
const isLastTier = index3 === boundaries.length - 1;
|
|
69247
|
+
if (boundary === "inf") {
|
|
69248
|
+
if (!isLastTier)
|
|
69249
|
+
violate(index3, "non_final_infinity");
|
|
69250
|
+
continue;
|
|
69251
|
+
}
|
|
69252
|
+
if (!Number.isFinite(boundary) || boundary <= previousBoundary) {
|
|
69253
|
+
violate(index3, "not_increasing");
|
|
69254
|
+
}
|
|
69255
|
+
previousBoundary = boundary;
|
|
69256
|
+
if (isLastTier)
|
|
69257
|
+
violate(index3, "final_not_infinity");
|
|
69258
|
+
}
|
|
69259
|
+
return violations;
|
|
69260
|
+
};
|
|
69261
|
+
var init_creditTierRules = __esm(() => {
|
|
69262
|
+
VIOLATION_MESSAGES = {
|
|
69263
|
+
non_final_infinity: "Only the final tier may use an 'inf' boundary.",
|
|
69264
|
+
not_increasing: "Tier boundaries must be strictly increasing.",
|
|
69265
|
+
final_not_infinity: "The final tier must use an 'inf' boundary."
|
|
69266
|
+
};
|
|
69267
|
+
});
|
|
69268
|
+
|
|
69060
69269
|
// ../../shared/api/features/creditRateCard.ts
|
|
69061
|
-
var
|
|
69270
|
+
var ApiCreditTierSchema, refineGraduatedTiers = (item, ctx) => {
|
|
69271
|
+
const violations = findCreditTierViolations(item.tiers.map((tier) => tier.to));
|
|
69272
|
+
for (const { index: index3, message } of violations) {
|
|
69273
|
+
ctx.addIssue({
|
|
69274
|
+
code: "custom",
|
|
69275
|
+
message,
|
|
69276
|
+
path: ["tiers", index3, "to"]
|
|
69277
|
+
});
|
|
69278
|
+
}
|
|
69279
|
+
}, ApiCreditMatchSchema, ApiCreditDimensionBaseSchema, ApiCreditDimensionSchema, ApiCreditMultiplierSchema, ApiCreditSchemaItemBaseSchema, ApiFlatCreditSchemaItemSchema, ApiGraduatedCreditSchemaItemSchema, ApiCreditSchemaItemSchema, ApiLegacyFlatCreditSchemaItemSchema, ApiCreditSchemaResponseItemSchema, isGraduatedCreditSchemaItem = (item) => ("tier_behavior" in item) && item.tier_behavior === "graduated";
|
|
69062
69280
|
var init_creditRateCard = __esm(() => {
|
|
69063
69281
|
init_v4();
|
|
69282
|
+
init_creditConfig();
|
|
69283
|
+
init_creditTierRules();
|
|
69284
|
+
ApiCreditTierSchema = exports_external.object({
|
|
69285
|
+
to: exports_external.union([exports_external.number().positive(), exports_external.enum(["inf"])]).meta({
|
|
69286
|
+
description: "Inclusive upper usage boundary for this graduated tier. The final tier must be 'inf'."
|
|
69287
|
+
}),
|
|
69288
|
+
credit_cost: exports_external.number().min(0).meta({
|
|
69289
|
+
description: "Credits consumed per billing-unit group within this tier."
|
|
69290
|
+
})
|
|
69291
|
+
});
|
|
69292
|
+
ApiCreditMatchSchema = CreditMatchSchema.meta({
|
|
69293
|
+
description: "Event properties this entry applies to. Every key must equal the tracked property, compared as strings."
|
|
69294
|
+
});
|
|
69295
|
+
ApiCreditDimensionBaseSchema = exports_external.object({
|
|
69296
|
+
match: ApiCreditMatchSchema,
|
|
69297
|
+
priority: exports_external.number().int().optional().meta({
|
|
69298
|
+
description: "Breaks ties between dimensions that match the same number of keys. Higher wins."
|
|
69299
|
+
})
|
|
69300
|
+
});
|
|
69301
|
+
ApiCreditDimensionSchema = exports_external.union([
|
|
69302
|
+
ApiCreditDimensionBaseSchema.extend({
|
|
69303
|
+
tier_behavior: exports_external.literal("graduated"),
|
|
69304
|
+
tiers: exports_external.array(ApiCreditTierSchema).min(1)
|
|
69305
|
+
}).strict().superRefine(refineGraduatedTiers),
|
|
69306
|
+
ApiCreditDimensionBaseSchema.extend({
|
|
69307
|
+
credit_cost: exports_external.number().min(0).meta({
|
|
69308
|
+
description: "Credits consumed per billing-unit group when this dimension matches."
|
|
69309
|
+
})
|
|
69310
|
+
}).strict()
|
|
69311
|
+
]);
|
|
69312
|
+
ApiCreditMultiplierSchema = exports_external.object({
|
|
69313
|
+
match: ApiCreditMatchSchema,
|
|
69314
|
+
factor: exports_external.number().positive().optional().meta({
|
|
69315
|
+
description: "Multiplies the matched rate. All matching multipliers stack."
|
|
69316
|
+
}),
|
|
69317
|
+
add: exports_external.number().optional().meta({
|
|
69318
|
+
description: "Added to the rate after every factor is applied, in credits per billing-unit group."
|
|
69319
|
+
})
|
|
69320
|
+
}).strict().refine((multiplier) => multiplier.factor !== undefined || multiplier.add !== undefined, { message: "A multiplier needs a factor or an add." });
|
|
69064
69321
|
ApiCreditSchemaItemBaseSchema = exports_external.object({
|
|
69065
69322
|
metered_feature_id: exports_external.string().nonempty().meta({
|
|
69066
69323
|
description: "ID of the metered feature that draws from this credit system."
|
|
69067
69324
|
}),
|
|
69068
69325
|
billing_units: exports_external.number().positive().optional().meta({
|
|
69069
69326
|
description: "Number of metered-feature units priced together. Defaults to one when omitted."
|
|
69070
|
-
})
|
|
69071
|
-
});
|
|
69072
|
-
ApiCreditTierSchema = exports_external.object({
|
|
69073
|
-
to: exports_external.union([exports_external.number().positive(), exports_external.enum(["inf"])]).meta({
|
|
69074
|
-
description: "Inclusive upper usage boundary for this graduated tier. The final tier must be 'inf'."
|
|
69075
69327
|
}),
|
|
69076
|
-
|
|
69077
|
-
description: "
|
|
69328
|
+
dimensions: exports_external.record(CreditDimensionNameSchema, ApiCreditDimensionSchema).optional().meta({
|
|
69329
|
+
description: "Named rates chosen by event properties. The most specific match sets the rate; with no match the item's own rate applies."
|
|
69330
|
+
}),
|
|
69331
|
+
multipliers: exports_external.record(CreditDimensionNameSchema, ApiCreditMultiplierSchema).optional().meta({
|
|
69332
|
+
description: "Named adjustments chosen by event properties. Every match applies: factors multiply, then adds are summed."
|
|
69078
69333
|
})
|
|
69079
69334
|
});
|
|
69080
69335
|
ApiFlatCreditSchemaItemSchema = ApiCreditSchemaItemBaseSchema.extend({
|
|
@@ -69085,37 +69340,7 @@ var init_creditRateCard = __esm(() => {
|
|
|
69085
69340
|
ApiGraduatedCreditSchemaItemSchema = ApiCreditSchemaItemBaseSchema.extend({
|
|
69086
69341
|
tier_behavior: exports_external.literal("graduated"),
|
|
69087
69342
|
tiers: exports_external.array(ApiCreditTierSchema).min(1)
|
|
69088
|
-
}).strict().superRefine(
|
|
69089
|
-
let previousBoundary = 0;
|
|
69090
|
-
for (const [index3, tier] of item.tiers.entries()) {
|
|
69091
|
-
const isLastTier = index3 === item.tiers.length - 1;
|
|
69092
|
-
if (tier.to === "inf") {
|
|
69093
|
-
if (!isLastTier) {
|
|
69094
|
-
ctx.addIssue({
|
|
69095
|
-
code: "custom",
|
|
69096
|
-
message: "Only the final tier may use an 'inf' boundary.",
|
|
69097
|
-
path: ["tiers", index3, "to"]
|
|
69098
|
-
});
|
|
69099
|
-
}
|
|
69100
|
-
continue;
|
|
69101
|
-
}
|
|
69102
|
-
if (tier.to <= previousBoundary) {
|
|
69103
|
-
ctx.addIssue({
|
|
69104
|
-
code: "custom",
|
|
69105
|
-
message: "Tier boundaries must be strictly increasing.",
|
|
69106
|
-
path: ["tiers", index3, "to"]
|
|
69107
|
-
});
|
|
69108
|
-
}
|
|
69109
|
-
previousBoundary = tier.to;
|
|
69110
|
-
if (isLastTier) {
|
|
69111
|
-
ctx.addIssue({
|
|
69112
|
-
code: "custom",
|
|
69113
|
-
message: "The final tier must use an 'inf' boundary.",
|
|
69114
|
-
path: ["tiers", index3, "to"]
|
|
69115
|
-
});
|
|
69116
|
-
}
|
|
69117
|
-
}
|
|
69118
|
-
});
|
|
69343
|
+
}).strict().superRefine(refineGraduatedTiers);
|
|
69119
69344
|
ApiCreditSchemaItemSchema = exports_external.union([
|
|
69120
69345
|
ApiGraduatedCreditSchemaItemSchema,
|
|
69121
69346
|
ApiFlatCreditSchemaItemSchema
|
|
@@ -70259,7 +70484,6 @@ var init_apiPlanV1 = __esm(() => {
|
|
|
70259
70484
|
});
|
|
70260
70485
|
ApiPlanExpandedV1Schema = ApiPlanV1Schema.extend({
|
|
70261
70486
|
licenses: exports_external.array(ApiPlanLicenseV1Schema).optional().meta({
|
|
70262
|
-
internal: true,
|
|
70263
70487
|
description: "Plans offered as assignable licenses under this plan. Omitted when the plan has none."
|
|
70264
70488
|
}),
|
|
70265
70489
|
variants: exports_external.array(ApiPlanVariantV1Schema).optional().meta({
|
|
@@ -70542,16 +70766,6 @@ var init_cancelAction = __esm(() => {
|
|
|
70542
70766
|
});
|
|
70543
70767
|
});
|
|
70544
70768
|
|
|
70545
|
-
// ../../shared/api/billing/common/subscriptionParams.ts
|
|
70546
|
-
var SubscriptionParamsSchema;
|
|
70547
|
-
var init_subscriptionParams = __esm(() => {
|
|
70548
|
-
init_v4();
|
|
70549
|
-
SubscriptionParamsSchema = exports_external.record(exports_external.string(), exports_external.unknown()).meta({
|
|
70550
|
-
title: "SubscriptionParams",
|
|
70551
|
-
description: "Additional parameters to pass into the Stripe subscription update or cancel call."
|
|
70552
|
-
});
|
|
70553
|
-
});
|
|
70554
|
-
|
|
70555
70769
|
// ../../shared/api/billing/common/customLineItem.ts
|
|
70556
70770
|
var CustomLineItemSchema;
|
|
70557
70771
|
var init_customLineItem = __esm(() => {
|
|
@@ -70565,6 +70779,16 @@ var init_customLineItem = __esm(() => {
|
|
|
70565
70779
|
})
|
|
70566
70780
|
});
|
|
70567
70781
|
});
|
|
70782
|
+
// ../../shared/api/billing/common/subscriptionParams.ts
|
|
70783
|
+
var SubscriptionParamsSchema;
|
|
70784
|
+
var init_subscriptionParams = __esm(() => {
|
|
70785
|
+
init_v4();
|
|
70786
|
+
SubscriptionParamsSchema = exports_external.record(exports_external.string(), exports_external.unknown()).meta({
|
|
70787
|
+
title: "SubscriptionParams",
|
|
70788
|
+
description: "Additional parameters to pass into the Stripe subscription update or cancel call."
|
|
70789
|
+
});
|
|
70790
|
+
});
|
|
70791
|
+
|
|
70568
70792
|
// ../../shared/api/billing/common/featureQuantity/featureQuantityParamsV0.ts
|
|
70569
70793
|
var FeatureQuantityParamsV0Schema;
|
|
70570
70794
|
var init_featureQuantityParamsV0 = __esm(() => {
|
|
@@ -71034,6 +71258,7 @@ var init_customerBillingControls2 = __esm(() => {
|
|
|
71034
71258
|
var ApiEntityBillingControlsSchema, ApiEntityBillingControlsParamsBaseSchema, ApiEntityBillingControlsParamsSchema;
|
|
71035
71259
|
var init_entityBillingControls2 = __esm(() => {
|
|
71036
71260
|
init_v4();
|
|
71261
|
+
init_findDuplicateBillingControlIssue();
|
|
71037
71262
|
init_overageAllowed();
|
|
71038
71263
|
init_spendLimit();
|
|
71039
71264
|
init_usageAlert();
|
|
@@ -71071,48 +71296,42 @@ var init_entityBillingControls2 = __esm(() => {
|
|
|
71071
71296
|
})
|
|
71072
71297
|
});
|
|
71073
71298
|
ApiEntityBillingControlsParamsSchema = ApiEntityBillingControlsParamsBaseSchema.check((ctx) => {
|
|
71074
|
-
const
|
|
71075
|
-
|
|
71076
|
-
|
|
71077
|
-
|
|
71078
|
-
|
|
71079
|
-
|
|
71080
|
-
|
|
71081
|
-
|
|
71082
|
-
|
|
71083
|
-
|
|
71084
|
-
|
|
71085
|
-
|
|
71086
|
-
|
|
71087
|
-
|
|
71088
|
-
|
|
71089
|
-
|
|
71090
|
-
|
|
71091
|
-
|
|
71092
|
-
|
|
71093
|
-
|
|
71094
|
-
|
|
71095
|
-
|
|
71096
|
-
|
|
71097
|
-
|
|
71098
|
-
|
|
71099
|
-
|
|
71100
|
-
|
|
71101
|
-
|
|
71102
|
-
|
|
71103
|
-
}
|
|
71104
|
-
|
|
71105
|
-
|
|
71106
|
-
|
|
71107
|
-
|
|
71108
|
-
|
|
71109
|
-
|
|
71110
|
-
input: overageAllowed.feature_id,
|
|
71111
|
-
path: ["overage_allowed", index3, "feature_id"]
|
|
71112
|
-
});
|
|
71113
|
-
return;
|
|
71114
|
-
}
|
|
71115
|
-
overageAllowedFeatureIds.add(overageAllowed.feature_id);
|
|
71299
|
+
const issue2 = findDuplicateBillingControlIssue(ctx.value);
|
|
71300
|
+
if (issue2)
|
|
71301
|
+
ctx.issues.push(issue2);
|
|
71302
|
+
});
|
|
71303
|
+
});
|
|
71304
|
+
|
|
71305
|
+
// ../../shared/utils/billingControlUtils/filterUnresolvableUsageLimitAlerts.ts
|
|
71306
|
+
var filterUnresolvableUsageLimitAlerts = ({
|
|
71307
|
+
usageAlerts,
|
|
71308
|
+
usageLimitLists
|
|
71309
|
+
}) => {
|
|
71310
|
+
const limitIdentities = new Set(usageLimitLists.flatMap((list) => (list ?? []).map(usageLimitIdentity)));
|
|
71311
|
+
return usageAlerts.flatMap((usageAlert, index3) => isUsageLimitBasisAlert(usageAlert) && !limitIdentities.has(usageAlertTargetLimitIdentity(usageAlert)) ? [{ index: index3, usageAlert }] : []);
|
|
71312
|
+
};
|
|
71313
|
+
var init_filterUnresolvableUsageLimitAlerts = __esm(() => {
|
|
71314
|
+
init_usageAlertTargetLimitIdentity();
|
|
71315
|
+
init_usageLimitIdentity();
|
|
71316
|
+
});
|
|
71317
|
+
|
|
71318
|
+
// ../../shared/api/billingControls/planBillingControls.ts
|
|
71319
|
+
var PlanBillingControlsParamsSchema;
|
|
71320
|
+
var init_planBillingControls = __esm(() => {
|
|
71321
|
+
init_customerBillingControls();
|
|
71322
|
+
init_filterUnresolvableUsageLimitAlerts();
|
|
71323
|
+
PlanBillingControlsParamsSchema = CustomerBillingControlsParamsSchema.check((ctx) => {
|
|
71324
|
+
const unresolvable = filterUnresolvableUsageLimitAlerts({
|
|
71325
|
+
usageAlerts: ctx.value.usage_alerts ?? [],
|
|
71326
|
+
usageLimitLists: [ctx.value.usage_limits ?? []]
|
|
71327
|
+
});
|
|
71328
|
+
for (const { index: index3, usageAlert } of unresolvable) {
|
|
71329
|
+
ctx.issues.push({
|
|
71330
|
+
code: "custom",
|
|
71331
|
+
message: `No usage limit on this plan matches the usage_limit alert for feature ${usageAlert.feature_id}`,
|
|
71332
|
+
input: usageAlert,
|
|
71333
|
+
path: ["usage_alerts", index3, "basis"]
|
|
71334
|
+
});
|
|
71116
71335
|
}
|
|
71117
71336
|
});
|
|
71118
71337
|
});
|
|
@@ -71124,6 +71343,7 @@ var init_billingControls = __esm(() => {
|
|
|
71124
71343
|
init_customerBillingControls2();
|
|
71125
71344
|
init_entityBillingControls2();
|
|
71126
71345
|
init_overageAllowed2();
|
|
71346
|
+
init_planBillingControls();
|
|
71127
71347
|
init_spendLimit2();
|
|
71128
71348
|
init_usageAlert2();
|
|
71129
71349
|
init_usageLimit2();
|
|
@@ -72360,69 +72580,6 @@ var init_catalogMappingModels = __esm(() => {
|
|
|
72360
72580
|
});
|
|
72361
72581
|
});
|
|
72362
72582
|
|
|
72363
|
-
// ../../shared/models/featureModels/featureEnums.ts
|
|
72364
|
-
var FeatureType, FeatureUsageType;
|
|
72365
|
-
var init_featureEnums = __esm(() => {
|
|
72366
|
-
((FeatureType2) => {
|
|
72367
|
-
FeatureType2["Boolean"] = "boolean";
|
|
72368
|
-
FeatureType2["Metered"] = "metered";
|
|
72369
|
-
FeatureType2["CreditSystem"] = "credit_system";
|
|
72370
|
-
FeatureType2["AiCreditSystem"] = "ai_credit_system";
|
|
72371
|
-
})(FeatureType ||= {});
|
|
72372
|
-
((FeatureUsageType2) => {
|
|
72373
|
-
FeatureUsageType2["Single"] = "single_use";
|
|
72374
|
-
FeatureUsageType2["Continuous"] = "continuous_use";
|
|
72375
|
-
})(FeatureUsageType ||= {});
|
|
72376
|
-
});
|
|
72377
|
-
|
|
72378
|
-
// ../../shared/models/featureModels/featureConfig/creditConfig.ts
|
|
72379
|
-
var CreditSchemaItemBaseSchema, CreditTierSchema, FlatCreditSchemaItemSchema, GraduatedCreditSchemaItemSchema, CreditSchemaItemSchema, MarkupEntrySchema, ProviderMarkupsSchema, CreditSystemConfigSchema, FeatureConfigOverrideSchema, ModelMarkupsSchema;
|
|
72380
|
-
var init_creditConfig = __esm(() => {
|
|
72381
|
-
init_v4();
|
|
72382
|
-
init_featureEnums();
|
|
72383
|
-
CreditSchemaItemBaseSchema = exports_external.object({
|
|
72384
|
-
metered_feature_id: exports_external.string(),
|
|
72385
|
-
feature_amount: exports_external.number().optional()
|
|
72386
|
-
});
|
|
72387
|
-
CreditTierSchema = exports_external.object({
|
|
72388
|
-
to: exports_external.union([exports_external.number(), exports_external.literal("inf")]),
|
|
72389
|
-
credit_amount: exports_external.number()
|
|
72390
|
-
});
|
|
72391
|
-
FlatCreditSchemaItemSchema = CreditSchemaItemBaseSchema.extend({
|
|
72392
|
-
credit_amount: exports_external.number(),
|
|
72393
|
-
tier_behavior: exports_external.never().optional(),
|
|
72394
|
-
tiers: exports_external.never().optional()
|
|
72395
|
-
});
|
|
72396
|
-
GraduatedCreditSchemaItemSchema = CreditSchemaItemBaseSchema.extend({
|
|
72397
|
-
credit_amount: exports_external.never().optional(),
|
|
72398
|
-
tier_behavior: exports_external.literal("graduated"),
|
|
72399
|
-
tiers: exports_external.array(CreditTierSchema)
|
|
72400
|
-
});
|
|
72401
|
-
CreditSchemaItemSchema = exports_external.union([
|
|
72402
|
-
FlatCreditSchemaItemSchema,
|
|
72403
|
-
GraduatedCreditSchemaItemSchema
|
|
72404
|
-
]);
|
|
72405
|
-
MarkupEntrySchema = exports_external.object({
|
|
72406
|
-
markup: exports_external.number().min(-100)
|
|
72407
|
-
});
|
|
72408
|
-
ProviderMarkupsSchema = exports_external.record(exports_external.string(), MarkupEntrySchema).nullish();
|
|
72409
|
-
CreditSystemConfigSchema = exports_external.object({
|
|
72410
|
-
schema: exports_external.array(CreditSchemaItemSchema),
|
|
72411
|
-
invoice_credit: exports_external.boolean().optional(),
|
|
72412
|
-
usage_type: exports_external.nativeEnum(FeatureUsageType),
|
|
72413
|
-
default_markup: exports_external.number().min(-100).optional(),
|
|
72414
|
-
provider_markups: ProviderMarkupsSchema
|
|
72415
|
-
});
|
|
72416
|
-
FeatureConfigOverrideSchema = exports_external.strictObject({
|
|
72417
|
-
schema: exports_external.array(CreditSchemaItemSchema).optional()
|
|
72418
|
-
});
|
|
72419
|
-
ModelMarkupsSchema = exports_external.record(exports_external.string(), MarkupEntrySchema.extend({
|
|
72420
|
-
markup: exports_external.number().min(-100).optional(),
|
|
72421
|
-
input_cost: exports_external.number().min(0).optional(),
|
|
72422
|
-
output_cost: exports_external.number().min(0).optional()
|
|
72423
|
-
})).nullish();
|
|
72424
|
-
});
|
|
72425
|
-
|
|
72426
72583
|
// ../../shared/api/features/crud/common/baseFeatureParamsV1.ts
|
|
72427
72584
|
var BaseFeatureV1ParamsSchema;
|
|
72428
72585
|
var init_baseFeatureParamsV1 = __esm(() => {
|
|
@@ -72537,11 +72694,11 @@ var CreatePlanParamsV1Schema, CreatePlanParamsV2Schema;
|
|
|
72537
72694
|
var init_createPlanParamsV1 = __esm(() => {
|
|
72538
72695
|
init_freeTrialParamsV1();
|
|
72539
72696
|
init_basePrice();
|
|
72540
|
-
init_customerBillingControls();
|
|
72541
72697
|
init_productConfig();
|
|
72542
72698
|
init_productMetadata();
|
|
72543
72699
|
init_utils9();
|
|
72544
72700
|
init_v4();
|
|
72701
|
+
init_planBillingControls();
|
|
72545
72702
|
init_createPlanItemParamsV1();
|
|
72546
72703
|
init_planLicenseParams();
|
|
72547
72704
|
CreatePlanParamsV1Schema = exports_external.object({
|
|
@@ -72579,7 +72736,7 @@ var init_createPlanParamsV1 = __esm(() => {
|
|
|
72579
72736
|
config: ProductConfigParamsSchema.optional().meta({
|
|
72580
72737
|
description: "Miscellaneous plan-level configuration flags."
|
|
72581
72738
|
}),
|
|
72582
|
-
billing_controls:
|
|
72739
|
+
billing_controls: PlanBillingControlsParamsSchema.optional().meta({
|
|
72583
72740
|
description: "Plan-level billing controls used as customer defaults."
|
|
72584
72741
|
}),
|
|
72585
72742
|
metadata: ProductMetadataSchema.optional().meta({
|
|
@@ -76689,9 +76846,10 @@ var init_priceEnums = __esm(() => {
|
|
|
76689
76846
|
});
|
|
76690
76847
|
|
|
76691
76848
|
// ../../shared/api/versionUtils/ApiVersion.ts
|
|
76692
|
-
var ApiVersion, API_VERSIONS, LATEST_VERSION = "2.
|
|
76849
|
+
var ApiVersion, API_VERSIONS, LATEST_VERSION = "2.4.0" /* V2_4 */;
|
|
76693
76850
|
var init_ApiVersion = __esm(() => {
|
|
76694
76851
|
((ApiVersion2) => {
|
|
76852
|
+
ApiVersion2["V2_4"] = "2.4.0";
|
|
76695
76853
|
ApiVersion2["V2_3"] = "2.3.0";
|
|
76696
76854
|
ApiVersion2["V2_2"] = "2.2.0";
|
|
76697
76855
|
ApiVersion2["V2_1"] = "2.1.0";
|
|
@@ -77046,6 +77204,12 @@ var init_formatUtils = __esm(() => {
|
|
|
77046
77204
|
var init_mathUtils = __esm(() => {
|
|
77047
77205
|
init_decimal();
|
|
77048
77206
|
});
|
|
77207
|
+
|
|
77208
|
+
// ../../shared/utils/common/objectUtils.ts
|
|
77209
|
+
var mapRecordValues = ({
|
|
77210
|
+
record: record2,
|
|
77211
|
+
mapValue
|
|
77212
|
+
}) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [key, mapValue(value)]));
|
|
77049
77213
|
// ../../shared/utils/common/index.ts
|
|
77050
77214
|
var init_common2 = __esm(() => {
|
|
77051
77215
|
init_formatUtils();
|
|
@@ -77083,9 +77247,16 @@ var init_cusEntsToCurrentBalance = __esm(() => {
|
|
|
77083
77247
|
init_classifyCusEntUtils();
|
|
77084
77248
|
init_getRolloverFields();
|
|
77085
77249
|
});
|
|
77250
|
+
|
|
77251
|
+
// ../../shared/utils/productUtils/priceUtils/findPrice/findPrepaidQuantityTargetPrice.ts
|
|
77252
|
+
var init_findPrepaidQuantityTargetPrice = __esm(() => {
|
|
77253
|
+
init_intervalUtils();
|
|
77254
|
+
init_classifyPriceUtils();
|
|
77255
|
+
});
|
|
77086
77256
|
// ../../shared/utils/cusEntUtils/balanceUtils/cusEntsToPrepaidQuantity.ts
|
|
77087
77257
|
var init_cusEntsToPrepaidQuantity = __esm(() => {
|
|
77088
77258
|
init_cusEntToCusPrice();
|
|
77259
|
+
init_findPrepaidQuantityTargetPrice();
|
|
77089
77260
|
init_decimal();
|
|
77090
77261
|
init_shared();
|
|
77091
77262
|
});
|
|
@@ -77179,11 +77350,20 @@ var init_findFeatureUtils = __esm(() => {
|
|
|
77179
77350
|
init_featureErrClasses();
|
|
77180
77351
|
});
|
|
77181
77352
|
|
|
77353
|
+
// ../../shared/utils/featureUtils/classifyFeature/hasCreditDimensionRules.ts
|
|
77354
|
+
var hasCreditDimensionRules = (item) => Object.keys(item.dimensions ?? {}).length > 0 || Object.keys(item.multipliers ?? {}).length > 0;
|
|
77355
|
+
|
|
77182
77356
|
// ../../shared/api/versionUtils/versionRegistry.ts
|
|
77183
77357
|
var VERSION_REGISTRY;
|
|
77184
77358
|
var init_versionRegistry = __esm(() => {
|
|
77185
77359
|
init_ApiVersion();
|
|
77186
77360
|
VERSION_REGISTRY = {
|
|
77361
|
+
["2.4.0" /* V2_4 */]: {
|
|
77362
|
+
semver: "2.4.0" /* V2_4 */,
|
|
77363
|
+
calver: "2026-09-04",
|
|
77364
|
+
releasedAt: new Date("2026-09-04").getTime(),
|
|
77365
|
+
description: "Customer object no longer returns entity-level data"
|
|
77366
|
+
},
|
|
77187
77367
|
["2.3.0" /* V2_3 */]: {
|
|
77188
77368
|
semver: "2.3.0" /* V2_3 */,
|
|
77189
77369
|
calver: "2026-05-13",
|
|
@@ -77831,10 +78011,21 @@ var init_V0_2_CusProductChange = __esm(() => {
|
|
|
77831
78011
|
});
|
|
77832
78012
|
|
|
77833
78013
|
// ../../shared/models/orgModels/orgConfig.ts
|
|
77834
|
-
var InvoicePaymentMethodSchema, OrgConfigSchema;
|
|
78014
|
+
var OrgUsageAlertsSchema, InvoicePaymentMethodSchema, OrgConfigSchema;
|
|
77835
78015
|
var init_orgConfig = __esm(() => {
|
|
77836
78016
|
init_v4();
|
|
77837
78017
|
init_usageAlert();
|
|
78018
|
+
OrgUsageAlertsSchema = exports_external.array(DbUsageAlertSchema).optional().default([]).check((ctx) => {
|
|
78019
|
+
const index3 = ctx.value.findIndex(isUsageLimitBasisAlert);
|
|
78020
|
+
if (index3 === -1)
|
|
78021
|
+
return;
|
|
78022
|
+
ctx.issues.push({
|
|
78023
|
+
code: "custom",
|
|
78024
|
+
message: "Org-level usage alerts cannot use basis usage_limit",
|
|
78025
|
+
input: ctx.value[index3],
|
|
78026
|
+
path: [index3, "basis"]
|
|
78027
|
+
});
|
|
78028
|
+
});
|
|
77838
78029
|
InvoicePaymentMethodSchema = exports_external.enum([
|
|
77839
78030
|
"card",
|
|
77840
78031
|
"customer_balance",
|
|
@@ -77845,8 +78036,8 @@ var init_orgConfig = __esm(() => {
|
|
|
77845
78036
|
"link"
|
|
77846
78037
|
]);
|
|
77847
78038
|
OrgConfigSchema = exports_external.object({
|
|
77848
|
-
usage_alerts:
|
|
77849
|
-
sandbox_usage_alerts:
|
|
78039
|
+
usage_alerts: OrgUsageAlertsSchema,
|
|
78040
|
+
sandbox_usage_alerts: OrgUsageAlertsSchema,
|
|
77850
78041
|
bill_upgrade_immediately: exports_external.boolean().default(true),
|
|
77851
78042
|
convert_to_charge_automatically: exports_external.boolean().default(true),
|
|
77852
78043
|
anchor_start_of_month: exports_external.boolean().default(false),
|
|
@@ -79018,7 +79209,7 @@ var apiCreditSchemaToV0 = ({
|
|
|
79018
79209
|
return null;
|
|
79019
79210
|
const legacyCreditSchema = [];
|
|
79020
79211
|
for (const item of creditSchema) {
|
|
79021
|
-
if (isGraduatedCreditSchemaItem(item) || (item.billing_units ?? 1) !== 1) {
|
|
79212
|
+
if (isGraduatedCreditSchemaItem(item) || hasCreditDimensionRules(item) || (item.billing_units ?? 1) !== 1) {
|
|
79022
79213
|
return null;
|
|
79023
79214
|
}
|
|
79024
79215
|
legacyCreditSchema.push({
|
|
@@ -79640,7 +79831,7 @@ var toApiFeature = ({ feature }) => {
|
|
|
79640
79831
|
}
|
|
79641
79832
|
let creditSchema;
|
|
79642
79833
|
if (feature.type === "credit_system" /* CreditSystem */ && feature.config?.schema) {
|
|
79643
|
-
const canRepresentSchema = feature.config.schema.every((item) => item.tier_behavior !== "graduated" && (item.feature_amount === undefined || item.feature_amount === 1));
|
|
79834
|
+
const canRepresentSchema = feature.config.schema.every((item) => item.tier_behavior !== "graduated" && !hasCreditDimensionRules(item) && (item.feature_amount === undefined || item.feature_amount === 1));
|
|
79644
79835
|
if (canRepresentSchema) {
|
|
79645
79836
|
creditSchema = feature.config.schema.flatMap((item) => item.tier_behavior === "graduated" ? [] : [
|
|
79646
79837
|
{
|
|
@@ -80838,6 +81029,28 @@ var init_V2_2_PlanInheritedBillingControls = __esm(() => {
|
|
|
80838
81029
|
});
|
|
80839
81030
|
});
|
|
80840
81031
|
|
|
81032
|
+
// ../../shared/api/customers/changes/V2.3_CustomerEntityData.ts
|
|
81033
|
+
var NoOpSchema2, V2_3_CustomerEntityData;
|
|
81034
|
+
var init_V2_3_CustomerEntityData = __esm(() => {
|
|
81035
|
+
init_ApiVersion();
|
|
81036
|
+
init_VersionChange();
|
|
81037
|
+
init_v4();
|
|
81038
|
+
NoOpSchema2 = exports_external.any();
|
|
81039
|
+
V2_3_CustomerEntityData = defineVersionChange({
|
|
81040
|
+
name: "V2_3_CustomerEntityData",
|
|
81041
|
+
newVersion: "2.4.0" /* V2_4 */,
|
|
81042
|
+
oldVersion: "2.3.0" /* V2_3 */,
|
|
81043
|
+
description: [
|
|
81044
|
+
"Customer object aggregated entity-level subscriptions and balances before V2_4"
|
|
81045
|
+
],
|
|
81046
|
+
affectedResources: ["customer" /* Customer */],
|
|
81047
|
+
newSchema: NoOpSchema2,
|
|
81048
|
+
oldSchema: NoOpSchema2,
|
|
81049
|
+
hasSideEffects: true,
|
|
81050
|
+
transformResponse: ({ input }) => input
|
|
81051
|
+
});
|
|
81052
|
+
});
|
|
81053
|
+
|
|
80841
81054
|
// ../../shared/utils/productV3Utils/productItemUtils/productV3ItemUtils.ts
|
|
80842
81055
|
function productV2ToBasePrice({
|
|
80843
81056
|
product
|
|
@@ -83176,6 +83389,10 @@ var init_V2_0_AggregateEventsChange = __esm(() => {
|
|
|
83176
83389
|
|
|
83177
83390
|
// ../../shared/api/versionUtils/versionChangeUtils/versionChangeRegistry.ts
|
|
83178
83391
|
function registerAllVersionChanges() {
|
|
83392
|
+
VersionChangeRegistryClass.register({
|
|
83393
|
+
version: "2.4.0" /* V2_4 */,
|
|
83394
|
+
changes: V2_4_CHANGES
|
|
83395
|
+
});
|
|
83179
83396
|
VersionChangeRegistryClass.register({
|
|
83180
83397
|
version: "2.3.0" /* V2_3 */,
|
|
83181
83398
|
changes: V2_3_CHANGES
|
|
@@ -83213,7 +83430,7 @@ function registerAllVersionChanges() {
|
|
|
83213
83430
|
changes: V0_1_CHANGES
|
|
83214
83431
|
});
|
|
83215
83432
|
}
|
|
83216
|
-
var V2_3_CHANGES, V2_2_CHANGES, V2_1_CHANGES, V2_CHANGES, V1_4_CHANGES, V1_2_CHANGES, V1_1_CHANGES, V0_2_CHANGES, V0_1_CHANGES;
|
|
83433
|
+
var V2_4_CHANGES, V2_3_CHANGES, V2_2_CHANGES, V2_1_CHANGES, V2_CHANGES, V1_4_CHANGES, V1_2_CHANGES, V1_1_CHANGES, V0_2_CHANGES, V0_1_CHANGES;
|
|
83217
83434
|
var init_versionChangeRegistry = __esm(() => {
|
|
83218
83435
|
init_V0_1_CustomerChange();
|
|
83219
83436
|
init_V0_2_CustomerChange();
|
|
@@ -83231,6 +83448,7 @@ var init_versionChangeRegistry = __esm(() => {
|
|
|
83231
83448
|
init_V1_2_InvoiceChange();
|
|
83232
83449
|
init_V2_0_CustomerChange();
|
|
83233
83450
|
init_V2_2_PlanInheritedBillingControls();
|
|
83451
|
+
init_V2_3_CustomerEntityData();
|
|
83234
83452
|
init_V1_2_ProductChanges();
|
|
83235
83453
|
init_V2_0_PlanChanges();
|
|
83236
83454
|
init_V2_1_PlanChanges();
|
|
@@ -83247,6 +83465,9 @@ var init_versionChangeRegistry = __esm(() => {
|
|
|
83247
83465
|
init_V2_0_AggregateEventsChange();
|
|
83248
83466
|
init_ApiVersion();
|
|
83249
83467
|
init_VersionChangeRegistryClass();
|
|
83468
|
+
V2_4_CHANGES = [
|
|
83469
|
+
V2_3_CustomerEntityData
|
|
83470
|
+
];
|
|
83250
83471
|
V2_3_CHANGES = [
|
|
83251
83472
|
V2_2_PlanInheritedBillingControls
|
|
83252
83473
|
];
|
|
@@ -83327,43 +83548,57 @@ var featureToApiProcessors = (feature) => {
|
|
|
83327
83548
|
...meter_id ? { meter_id } : {}
|
|
83328
83549
|
}
|
|
83329
83550
|
};
|
|
83330
|
-
},
|
|
83331
|
-
|
|
83332
|
-
|
|
83333
|
-
|
|
83334
|
-
|
|
83335
|
-
|
|
83336
|
-
|
|
83337
|
-
|
|
83338
|
-
|
|
83339
|
-
|
|
83340
|
-
|
|
83341
|
-
|
|
83342
|
-
|
|
83343
|
-
|
|
83344
|
-
}
|
|
83345
|
-
|
|
83346
|
-
},
|
|
83551
|
+
}, apiCreditRateToDb = (rate) => ("tier_behavior" in rate) ? {
|
|
83552
|
+
tier_behavior: "graduated",
|
|
83553
|
+
tiers: rate.tiers.map((tier) => ({
|
|
83554
|
+
to: tier.to,
|
|
83555
|
+
credit_amount: tier.credit_cost
|
|
83556
|
+
}))
|
|
83557
|
+
} : { credit_amount: rate.credit_cost }, dbCreditRateToApi = (rate) => ("tier_behavior" in rate) ? {
|
|
83558
|
+
tier_behavior: "graduated",
|
|
83559
|
+
tiers: rate.tiers.map((tier) => ({
|
|
83560
|
+
to: tier.to,
|
|
83561
|
+
credit_cost: tier.credit_amount
|
|
83562
|
+
}))
|
|
83563
|
+
} : { credit_cost: rate.credit_amount }, apiCreditDimensionToDb = (dimension) => ({
|
|
83564
|
+
match: dimension.match,
|
|
83565
|
+
...dimension.priority === undefined ? {} : { priority: dimension.priority },
|
|
83566
|
+
...apiCreditRateToDb(dimension)
|
|
83567
|
+
}), dbCreditDimensionToApi = (dimension) => ({
|
|
83568
|
+
match: dimension.match,
|
|
83569
|
+
...dimension.priority === undefined ? {} : { priority: dimension.priority },
|
|
83570
|
+
...dbCreditRateToApi(dimension)
|
|
83571
|
+
}), apiCreditDimensionRulesToDb = (credit) => ({
|
|
83572
|
+
...credit.dimensions === undefined ? {} : {
|
|
83573
|
+
dimensions: mapRecordValues({
|
|
83574
|
+
record: credit.dimensions,
|
|
83575
|
+
mapValue: apiCreditDimensionToDb
|
|
83576
|
+
})
|
|
83577
|
+
},
|
|
83578
|
+
...credit.multipliers === undefined ? {} : { multipliers: credit.multipliers }
|
|
83579
|
+
}), dbCreditDimensionRulesToApi = (credit) => ({
|
|
83580
|
+
...credit.dimensions === undefined ? {} : {
|
|
83581
|
+
dimensions: mapRecordValues({
|
|
83582
|
+
record: credit.dimensions,
|
|
83583
|
+
mapValue: dbCreditDimensionToApi
|
|
83584
|
+
})
|
|
83585
|
+
},
|
|
83586
|
+
...credit.multipliers === undefined ? {} : { multipliers: credit.multipliers }
|
|
83587
|
+
}), apiCreditSchemaItemToDb = (credit) => ({
|
|
83588
|
+
metered_feature_id: credit.metered_feature_id,
|
|
83589
|
+
...credit.billing_units === undefined ? {} : { feature_amount: credit.billing_units },
|
|
83590
|
+
...apiCreditDimensionRulesToDb(credit),
|
|
83591
|
+
...apiCreditRateToDb(credit)
|
|
83592
|
+
}), apiFeatureOverrideToDb = (override) => ({
|
|
83347
83593
|
...override.credit_schema ? { schema: override.credit_schema.map(apiCreditSchemaItemToDb) } : {}
|
|
83348
83594
|
}), dbFeatureOverrideToApi = (override) => ({
|
|
83349
83595
|
...override.schema ? { credit_schema: override.schema.map(dbCreditSchemaItemToApi) } : {}
|
|
83350
|
-
}), dbCreditSchemaItemToApi = (credit) => {
|
|
83351
|
-
|
|
83352
|
-
|
|
83353
|
-
|
|
83354
|
-
|
|
83355
|
-
|
|
83356
|
-
return {
|
|
83357
|
-
...base3,
|
|
83358
|
-
tier_behavior: "graduated",
|
|
83359
|
-
tiers: credit.tiers.map((tier) => ({
|
|
83360
|
-
to: tier.to,
|
|
83361
|
-
credit_cost: tier.credit_amount
|
|
83362
|
-
}))
|
|
83363
|
-
};
|
|
83364
|
-
}
|
|
83365
|
-
return { ...base3, credit_cost: credit.credit_amount };
|
|
83366
|
-
}, dbToApiFeatureV1 = ({
|
|
83596
|
+
}), dbCreditSchemaItemToApi = (credit) => ({
|
|
83597
|
+
metered_feature_id: credit.metered_feature_id,
|
|
83598
|
+
...credit.feature_amount === undefined ? {} : { billing_units: credit.feature_amount },
|
|
83599
|
+
...dbCreditDimensionRulesToApi(credit),
|
|
83600
|
+
...dbCreditRateToApi(credit)
|
|
83601
|
+
}), dbToApiFeatureV1 = ({
|
|
83367
83602
|
ctx,
|
|
83368
83603
|
dbFeature,
|
|
83369
83604
|
targetVersion
|
|
@@ -83398,12 +83633,20 @@ var init_apiFeatureToDbFeature = __esm(() => {
|
|
|
83398
83633
|
init_featureEnums();
|
|
83399
83634
|
init_genEnums();
|
|
83400
83635
|
init_isAiCreditSystem();
|
|
83401
|
-
init_creditRateCard();
|
|
83402
83636
|
init_versionUtils();
|
|
83403
83637
|
init_utils9();
|
|
83404
83638
|
init_buildAiCreditSystemConfig();
|
|
83405
83639
|
init_isAnyCreditSystem();
|
|
83406
83640
|
});
|
|
83641
|
+
|
|
83642
|
+
// ../../shared/utils/featureUtils/creditDimensions/creditDimensionRulesEqual.ts
|
|
83643
|
+
var init_creditDimensionRulesEqual = () => {};
|
|
83644
|
+
|
|
83645
|
+
// ../../shared/utils/featureUtils/creditDimensions/creditMultipliersForMatch.ts
|
|
83646
|
+
var init_creditMultipliersForMatch = __esm(() => {
|
|
83647
|
+
init_usageLimit();
|
|
83648
|
+
init_decimal();
|
|
83649
|
+
});
|
|
83407
83650
|
// ../../shared/utils/featureUtils/index.ts
|
|
83408
83651
|
var featureUtils;
|
|
83409
83652
|
var init_featureUtils2 = __esm(() => {
|
|
@@ -83416,6 +83659,9 @@ var init_featureUtils2 = __esm(() => {
|
|
|
83416
83659
|
init_isAnyCreditSystem();
|
|
83417
83660
|
init_apiFeatureToDbFeature();
|
|
83418
83661
|
init_convertFeatureUtils();
|
|
83662
|
+
init_creditDimensionRulesEqual();
|
|
83663
|
+
init_creditMultipliersForMatch();
|
|
83664
|
+
init_creditTierRules();
|
|
83419
83665
|
init_creditSystemUtils();
|
|
83420
83666
|
init_findFeatureUtils();
|
|
83421
83667
|
featureUtils = {
|
|
@@ -83605,6 +83851,10 @@ var init_customerEntitlementFundsFeature = __esm(() => {
|
|
|
83605
83851
|
init_creditSystemUtils();
|
|
83606
83852
|
init_entitlementToCreditSystem();
|
|
83607
83853
|
});
|
|
83854
|
+
// ../../shared/utils/cusEntUtils/classifyCusEnt/isCusEntDisplayExpired.ts
|
|
83855
|
+
var init_isCusEntDisplayExpired = __esm(() => {
|
|
83856
|
+
init_cusProductEnums();
|
|
83857
|
+
});
|
|
83608
83858
|
// ../../shared/utils/cusEntUtils/convertCusEntUtils/cusEntsToMainPlanAllowance.ts
|
|
83609
83859
|
var init_cusEntsToMainPlanAllowance = __esm(() => {
|
|
83610
83860
|
init_shared();
|
|
@@ -83650,6 +83900,8 @@ var init_convertCusProduct = __esm(() => {
|
|
|
83650
83900
|
// ../../shared/utils/cusEntUtils/convertCusEntUtils/customerEntitlementToOptions.ts
|
|
83651
83901
|
var init_customerEntitlementToOptions = __esm(() => {
|
|
83652
83902
|
init_convertProductUtils();
|
|
83903
|
+
init_findPrepaidQuantityTargetPrice();
|
|
83904
|
+
init_cusEntToCusPrice();
|
|
83653
83905
|
});
|
|
83654
83906
|
|
|
83655
83907
|
// ../../shared/utils/cusEntUtils/convertCusEntUtils/cusEntToBillingObjects.ts
|
|
@@ -83753,6 +84005,16 @@ var init_cusEntToOptions = __esm(() => {
|
|
|
83753
84005
|
init_convertProductUtils();
|
|
83754
84006
|
});
|
|
83755
84007
|
|
|
84008
|
+
// ../../shared/utils/cusEntUtils/usageAttribution/buildUsageAttributionKey.ts
|
|
84009
|
+
var init_buildUsageAttributionKey = __esm(() => {
|
|
84010
|
+
init_creditConfig();
|
|
84011
|
+
});
|
|
84012
|
+
|
|
84013
|
+
// ../../shared/utils/cusEntUtils/usageAttribution/parseUsageAttributionKey.ts
|
|
84014
|
+
var init_parseUsageAttributionKey = __esm(() => {
|
|
84015
|
+
init_creditConfig();
|
|
84016
|
+
});
|
|
84017
|
+
|
|
83756
84018
|
// ../../shared/utils/cusEntUtils/index.ts
|
|
83757
84019
|
var init_cusEntUtils2 = __esm(() => {
|
|
83758
84020
|
init_balanceUtils();
|
|
@@ -83779,6 +84041,7 @@ var init_cusEntUtils2 = __esm(() => {
|
|
|
83779
84041
|
init_cusEntsHaveUnlimited();
|
|
83780
84042
|
init_cusEntsHaveUsageAllowed();
|
|
83781
84043
|
init_customerEntitlementFundsFeature();
|
|
84044
|
+
init_isCusEntDisplayExpired();
|
|
83782
84045
|
init_classifyCusEntUtils();
|
|
83783
84046
|
init_convertCusEntUtils();
|
|
83784
84047
|
init_cusEntsToMainPlanAllowance();
|
|
@@ -83803,6 +84066,8 @@ var init_cusEntUtils2 = __esm(() => {
|
|
|
83803
84066
|
init_cusEntToInvoiceUsage();
|
|
83804
84067
|
init_cusEntToOptions();
|
|
83805
84068
|
init_sortCusEntsForDeduction();
|
|
84069
|
+
init_buildUsageAttributionKey();
|
|
84070
|
+
init_parseUsageAttributionKey();
|
|
83806
84071
|
});
|
|
83807
84072
|
// ../../shared/utils/cusPriceUtils/convertCustomerPrice/customerPriceToCustomerEntitlement.ts
|
|
83808
84073
|
var init_customerPriceToCustomerEntitlement = __esm(() => {
|
|
@@ -84170,6 +84435,7 @@ var creditQuantityFormatter;
|
|
|
84170
84435
|
var init_invoiceCreditCustomerEntitlementToLineItems = __esm(() => {
|
|
84171
84436
|
init_decimal();
|
|
84172
84437
|
init_cusEntToInvoiceOverage();
|
|
84438
|
+
init_parseUsageAttributionKey();
|
|
84173
84439
|
init_findFeatureUtils();
|
|
84174
84440
|
init_convertAmountUtils();
|
|
84175
84441
|
init_buildLineItem();
|
|
@@ -84325,6 +84591,7 @@ var init_priceUtils2 = __esm(() => {
|
|
|
84325
84591
|
init_priceToStripeNickname();
|
|
84326
84592
|
init_priceToStripeTiersMode();
|
|
84327
84593
|
init_convertPriceUtils();
|
|
84594
|
+
init_findPrepaidQuantityTargetPrice();
|
|
84328
84595
|
init_findPriceSuccessor();
|
|
84329
84596
|
init_formatPriceUtils();
|
|
84330
84597
|
init_getPriceForOverage();
|
|
@@ -84487,6 +84754,7 @@ var init_cusUtils = __esm(() => {
|
|
|
84487
84754
|
// ../../shared/utils/featureUtils/diffFeature/diffFeatureV1.ts
|
|
84488
84755
|
var init_diffFeatureV1 = __esm(() => {
|
|
84489
84756
|
init_creditRateCard();
|
|
84757
|
+
init_creditDimensionRulesEqual();
|
|
84490
84758
|
});
|
|
84491
84759
|
|
|
84492
84760
|
// ../../shared/utils/intervalUtils/addBillingInterval.ts
|
|
@@ -85010,6 +85278,17 @@ var init_apiBalanceToAllowed = __esm(() => {
|
|
|
85010
85278
|
init_decimal();
|
|
85011
85279
|
});
|
|
85012
85280
|
|
|
85281
|
+
// ../../shared/api/customers/cusFeatures/utils/convert/apiBalanceV1ToIncludedGrant.ts
|
|
85282
|
+
var init_apiBalanceV1ToIncludedGrant = __esm(() => {
|
|
85283
|
+
init_utils9();
|
|
85284
|
+
});
|
|
85285
|
+
|
|
85286
|
+
// ../../shared/api/customers/cusFeatures/utils/convert/apiBalanceV1ToRecurringGrant.ts
|
|
85287
|
+
var init_apiBalanceV1ToRecurringGrant = __esm(() => {
|
|
85288
|
+
init_resetInterval();
|
|
85289
|
+
init_utils9();
|
|
85290
|
+
});
|
|
85291
|
+
|
|
85013
85292
|
// ../../shared/api/customers/cusFeatures/utils/getApiBalance.ts
|
|
85014
85293
|
var init_getApiBalance = __esm(() => {
|
|
85015
85294
|
init_shared();
|
|
@@ -85042,6 +85321,8 @@ var init_cusFeatures = __esm(() => {
|
|
|
85042
85321
|
init_check();
|
|
85043
85322
|
init_apiBalanceToAllowed();
|
|
85044
85323
|
init_apiBalanceV1ToAvailableOverage();
|
|
85324
|
+
init_apiBalanceV1ToIncludedGrant();
|
|
85325
|
+
init_apiBalanceV1ToRecurringGrant();
|
|
85045
85326
|
init_getApiBalance();
|
|
85046
85327
|
init_getApiBalances();
|
|
85047
85328
|
});
|
|
@@ -89059,10 +89340,40 @@ var init_models = __esm(() => {
|
|
|
89059
89340
|
init_platformModels();
|
|
89060
89341
|
});
|
|
89061
89342
|
|
|
89343
|
+
// ../../shared/api/webhooks/balances/usageLimitWebhookBlock.ts
|
|
89344
|
+
var UsageLimitWebhookBlockSchema;
|
|
89345
|
+
var init_usageLimitWebhookBlock = __esm(() => {
|
|
89346
|
+
init_v4();
|
|
89347
|
+
init_usageLimit();
|
|
89348
|
+
UsageLimitWebhookBlockSchema = exports_external.object({
|
|
89349
|
+
limit: exports_external.number().meta({ description: "Maximum units allowed per interval." }),
|
|
89350
|
+
interval: exports_external.enum(USAGE_LIMIT_INTERVALS).meta({
|
|
89351
|
+
description: "Interval of the cap."
|
|
89352
|
+
}),
|
|
89353
|
+
anchor: UsageLimitAnchorSchema.meta({
|
|
89354
|
+
description: "Window alignment the cap was configured with."
|
|
89355
|
+
}),
|
|
89356
|
+
usage: exports_external.number().meta({
|
|
89357
|
+
description: "Units consumed in the current window, after this event."
|
|
89358
|
+
}),
|
|
89359
|
+
remaining: exports_external.number().meta({
|
|
89360
|
+
description: "Units left in the current window, never below zero."
|
|
89361
|
+
}),
|
|
89362
|
+
window_start_at: exports_external.number().meta({
|
|
89363
|
+
description: "Start of the current window, in milliseconds since epoch."
|
|
89364
|
+
}),
|
|
89365
|
+
window_end_at: exports_external.number().meta({
|
|
89366
|
+
description: "End of the current window, in milliseconds since epoch."
|
|
89367
|
+
})
|
|
89368
|
+
});
|
|
89369
|
+
});
|
|
89370
|
+
|
|
89062
89371
|
// ../../shared/api/webhooks/balances/balancesLimitReached.ts
|
|
89063
89372
|
var LimitType, BALANCES_LIMIT_REACHED_EXAMPLE, BalancesLimitReachedSchema;
|
|
89064
89373
|
var init_balancesLimitReached = __esm(() => {
|
|
89065
89374
|
init_v4();
|
|
89375
|
+
init_usageLimit();
|
|
89376
|
+
init_usageLimitWebhookBlock();
|
|
89066
89377
|
LimitType = exports_external.enum([
|
|
89067
89378
|
"included",
|
|
89068
89379
|
"max_purchase",
|
|
@@ -89087,6 +89398,12 @@ var init_balancesLimitReached = __esm(() => {
|
|
|
89087
89398
|
}),
|
|
89088
89399
|
limit_type: LimitType.meta({
|
|
89089
89400
|
description: "Which limit was hit: included allowance, max purchase cap, spend limit, or a usage-limit billing control."
|
|
89401
|
+
}),
|
|
89402
|
+
filter: UsageLimitFilterSchema.optional().meta({
|
|
89403
|
+
description: "The filter of the usage limit that blocked, when a filtered cap was hit."
|
|
89404
|
+
}),
|
|
89405
|
+
usage_limit: UsageLimitWebhookBlockSchema.optional().meta({
|
|
89406
|
+
description: "The usage limit that blocked, with its live window. Present only when limit_type is usage_limit."
|
|
89090
89407
|
})
|
|
89091
89408
|
}).meta({
|
|
89092
89409
|
examples: [BALANCES_LIMIT_REACHED_EXAMPLE]
|
|
@@ -89094,11 +89411,14 @@ var init_balancesLimitReached = __esm(() => {
|
|
|
89094
89411
|
});
|
|
89095
89412
|
|
|
89096
89413
|
// ../../shared/api/webhooks/balances/balancesUsageAlertTriggered.ts
|
|
89097
|
-
var
|
|
89414
|
+
var BalanceBasisSchema, AlertFieldsSchema, SubjectFieldsSchema, BalancesUsageAlertBalanceBlockSchema, BalancesUsageAlertOnBalanceSchema, BalancesUsageAlertOnUsageLimitSchema, BALANCES_USAGE_ALERT_TRIGGERED_EXAMPLE, BALANCES_USAGE_ALERT_ON_USAGE_LIMIT_EXAMPLE, BalancesUsageAlertTriggeredSchema;
|
|
89098
89415
|
var init_balancesUsageAlertTriggered = __esm(() => {
|
|
89099
89416
|
init_v4();
|
|
89100
|
-
|
|
89101
|
-
|
|
89417
|
+
init_usageAlert();
|
|
89418
|
+
init_usageLimit();
|
|
89419
|
+
init_usageLimitWebhookBlock();
|
|
89420
|
+
BalanceBasisSchema = exports_external.enum(BALANCE_BASES);
|
|
89421
|
+
AlertFieldsSchema = exports_external.object({
|
|
89102
89422
|
name: exports_external.string().optional().meta({
|
|
89103
89423
|
description: "User-defined label for the alert, if provided."
|
|
89104
89424
|
}),
|
|
@@ -89109,17 +89429,7 @@ var init_balancesUsageAlertTriggered = __esm(() => {
|
|
|
89109
89429
|
description: "Whether the threshold is an absolute usage count or a percentage."
|
|
89110
89430
|
})
|
|
89111
89431
|
});
|
|
89112
|
-
|
|
89113
|
-
customer_id: "org_123",
|
|
89114
|
-
feature_id: "api_calls",
|
|
89115
|
-
entity_id: "workspace_abc",
|
|
89116
|
-
usage_alert: {
|
|
89117
|
-
name: "80% usage warning",
|
|
89118
|
-
threshold: 80,
|
|
89119
|
-
threshold_type: "usage_percentage_threshold"
|
|
89120
|
-
}
|
|
89121
|
-
};
|
|
89122
|
-
BalancesUsageAlertTriggeredSchema = exports_external.object({
|
|
89432
|
+
SubjectFieldsSchema = exports_external.object({
|
|
89123
89433
|
customer_id: exports_external.string().meta({
|
|
89124
89434
|
description: "The ID of the customer whose usage alert was triggered."
|
|
89125
89435
|
}),
|
|
@@ -89128,12 +89438,85 @@ var init_balancesUsageAlertTriggered = __esm(() => {
|
|
|
89128
89438
|
}),
|
|
89129
89439
|
entity_id: exports_external.string().optional().meta({
|
|
89130
89440
|
description: "The entity ID the alert applies to, if the usage was entity-scoped."
|
|
89441
|
+
})
|
|
89442
|
+
});
|
|
89443
|
+
BalancesUsageAlertBalanceBlockSchema = exports_external.object({
|
|
89444
|
+
usage: exports_external.number().meta({
|
|
89445
|
+
description: "Units consumed on the feature, after this event."
|
|
89446
|
+
}),
|
|
89447
|
+
granted: exports_external.number().meta({
|
|
89448
|
+
description: "Every grant on the feature: included, prepaid and rollover."
|
|
89449
|
+
}),
|
|
89450
|
+
included: exports_external.number().meta({
|
|
89451
|
+
description: "Grants from plan allowances only."
|
|
89131
89452
|
}),
|
|
89132
|
-
|
|
89133
|
-
description: "
|
|
89453
|
+
remaining: exports_external.number().meta({
|
|
89454
|
+
description: "The alert's denominator minus usage. Clamped at zero for included and recurring; balance can go negative on overage."
|
|
89455
|
+
})
|
|
89456
|
+
});
|
|
89457
|
+
BalancesUsageAlertOnBalanceSchema = SubjectFieldsSchema.extend({
|
|
89458
|
+
usage_alert: AlertFieldsSchema.extend({
|
|
89459
|
+
basis: BalanceBasisSchema.meta({
|
|
89460
|
+
description: "What 100% meant for this alert."
|
|
89461
|
+
})
|
|
89462
|
+
}).meta({ description: "Details of the usage alert that was triggered." }),
|
|
89463
|
+
balance: BalancesUsageAlertBalanceBlockSchema.meta({
|
|
89464
|
+
description: "The balance the alert measured."
|
|
89465
|
+
})
|
|
89466
|
+
});
|
|
89467
|
+
BalancesUsageAlertOnUsageLimitSchema = SubjectFieldsSchema.extend({
|
|
89468
|
+
usage_alert: AlertFieldsSchema.extend({
|
|
89469
|
+
basis: exports_external.literal("usage_limit").meta({
|
|
89470
|
+
description: "What 100% meant for this alert."
|
|
89471
|
+
}),
|
|
89472
|
+
filter: UsageLimitFilterSchema.optional().meta({
|
|
89473
|
+
description: "The usage limit filter this alert points at, when the alert targets a filtered cap."
|
|
89474
|
+
})
|
|
89475
|
+
}).meta({ description: "Details of the usage alert that was triggered." }),
|
|
89476
|
+
usage_limit: UsageLimitWebhookBlockSchema.meta({
|
|
89477
|
+
description: "The usage limit the alert measured."
|
|
89134
89478
|
})
|
|
89135
|
-
})
|
|
89136
|
-
|
|
89479
|
+
});
|
|
89480
|
+
BALANCES_USAGE_ALERT_TRIGGERED_EXAMPLE = {
|
|
89481
|
+
customer_id: "org_123",
|
|
89482
|
+
feature_id: "api_calls",
|
|
89483
|
+
entity_id: "workspace_abc",
|
|
89484
|
+
usage_alert: {
|
|
89485
|
+
name: "80% usage warning",
|
|
89486
|
+
threshold: 80,
|
|
89487
|
+
threshold_type: "usage_percentage",
|
|
89488
|
+
basis: "balance"
|
|
89489
|
+
},
|
|
89490
|
+
balance: { usage: 1600, granted: 2000, included: 2000, remaining: 400 }
|
|
89491
|
+
};
|
|
89492
|
+
BALANCES_USAGE_ALERT_ON_USAGE_LIMIT_EXAMPLE = {
|
|
89493
|
+
customer_id: "org_123",
|
|
89494
|
+
feature_id: "api_calls",
|
|
89495
|
+
usage_alert: {
|
|
89496
|
+
name: "Daily cap warning",
|
|
89497
|
+
threshold: 80,
|
|
89498
|
+
threshold_type: "usage_percentage",
|
|
89499
|
+
basis: "usage_limit",
|
|
89500
|
+
filter: { properties: { api_key_id: "key_abc" } }
|
|
89501
|
+
},
|
|
89502
|
+
usage_limit: {
|
|
89503
|
+
limit: 1000,
|
|
89504
|
+
interval: "day",
|
|
89505
|
+
anchor: "utc",
|
|
89506
|
+
usage: 800,
|
|
89507
|
+
remaining: 200,
|
|
89508
|
+
window_start_at: 1735689600000,
|
|
89509
|
+
window_end_at: 1735776000000
|
|
89510
|
+
}
|
|
89511
|
+
};
|
|
89512
|
+
BalancesUsageAlertTriggeredSchema = exports_external.union([
|
|
89513
|
+
BalancesUsageAlertOnBalanceSchema,
|
|
89514
|
+
BalancesUsageAlertOnUsageLimitSchema
|
|
89515
|
+
]).meta({
|
|
89516
|
+
examples: [
|
|
89517
|
+
BALANCES_USAGE_ALERT_TRIGGERED_EXAMPLE,
|
|
89518
|
+
BALANCES_USAGE_ALERT_ON_USAGE_LIMIT_EXAMPLE
|
|
89519
|
+
]
|
|
89137
89520
|
});
|
|
89138
89521
|
});
|
|
89139
89522
|
|
|
@@ -89503,6 +89886,7 @@ var init_webhookRegistry = __esm(() => {
|
|
|
89503
89886
|
var init_webhooks = __esm(() => {
|
|
89504
89887
|
init_balancesLimitReached();
|
|
89505
89888
|
init_balancesUsageAlertTriggered();
|
|
89889
|
+
init_usageLimitWebhookBlock();
|
|
89506
89890
|
init_billingAutoTopupFailed();
|
|
89507
89891
|
init_billingAutoTopupSucceeded();
|
|
89508
89892
|
init_billingUpdated();
|
|
@@ -94611,6 +94995,7 @@ var init_lineItem2 = __esm(() => {
|
|
|
94611
94995
|
var InsertPlanLicenseSpecSchema, CustomerLicenseTransitionSchema, CustomerLicenseUpdateSchema;
|
|
94612
94996
|
var init_customerLicensePlan = __esm(() => {
|
|
94613
94997
|
init_v4();
|
|
94998
|
+
init_carryOverUsages();
|
|
94614
94999
|
init_fullCustomerLicense();
|
|
94615
95000
|
init_entModels();
|
|
94616
95001
|
init_priceModels();
|
|
@@ -94631,7 +95016,9 @@ var init_customerLicensePlan = __esm(() => {
|
|
|
94631
95016
|
granted: exports_external.number(),
|
|
94632
95017
|
remaining: exports_external.number(),
|
|
94633
95018
|
paidQuantity: exports_external.number()
|
|
94634
|
-
})
|
|
95019
|
+
}),
|
|
95020
|
+
carryOverUsages: CarryOverUsagesSchema,
|
|
95021
|
+
billingCycleAnchorMs: exports_external.number().optional()
|
|
94635
95022
|
});
|
|
94636
95023
|
CustomerLicenseUpdateSchema = exports_external.object({
|
|
94637
95024
|
customerLicenseId: exports_external.string().optional(),
|
|
@@ -96109,6 +96496,11 @@ var init_authAccessControl = __esm(() => {
|
|
|
96109
96496
|
});
|
|
96110
96497
|
});
|
|
96111
96498
|
|
|
96499
|
+
// ../../shared/utils/billingControlUtils/index.ts
|
|
96500
|
+
var init_billingControlUtils = __esm(() => {
|
|
96501
|
+
init_filterUnresolvableUsageLimitAlerts();
|
|
96502
|
+
});
|
|
96503
|
+
|
|
96112
96504
|
// ../../shared/utils/checkoutUtils/checkoutPaths.ts
|
|
96113
96505
|
var ATTACH_CHECKOUT_PATH = "c", UPDATE_SUBSCRIPTION_CHECKOUT_PATH = "u", CHECKOUT_ACTION_PATHS;
|
|
96114
96506
|
var init_checkoutPaths = __esm(() => {
|
|
@@ -96238,6 +96630,7 @@ var init_fullSubjectToSpendLimit = __esm(() => {
|
|
|
96238
96630
|
});
|
|
96239
96631
|
// ../../shared/utils/fullSubjectUtils/mergeCustomerBillingControlsForCheck.ts
|
|
96240
96632
|
var init_mergeCustomerBillingControlsForCheck = __esm(() => {
|
|
96633
|
+
init_usageLimitIdentity();
|
|
96241
96634
|
init_usageLimit();
|
|
96242
96635
|
init_getCurrentUsageWindowUsage();
|
|
96243
96636
|
init_fullSubjectToUsageWindowLimits();
|
|
@@ -96246,6 +96639,7 @@ var init_mergeCustomerBillingControlsForCheck = __esm(() => {
|
|
|
96246
96639
|
|
|
96247
96640
|
// ../../shared/utils/fullSubjectUtils/mergePlanBillingControlsForResponse.ts
|
|
96248
96641
|
var init_mergePlanBillingControlsForResponse = __esm(() => {
|
|
96642
|
+
init_usageLimitIdentity();
|
|
96249
96643
|
init_buildNormalizeSpendLimitForCompare();
|
|
96250
96644
|
init_mergeCustomerBillingControlsForCheck();
|
|
96251
96645
|
init_planBillingControlUtils();
|
|
@@ -96380,8 +96774,8 @@ var init_shared = __esm(() => {
|
|
|
96380
96774
|
init_billingResponse();
|
|
96381
96775
|
init_cancelAction();
|
|
96382
96776
|
init_customizePlanV1();
|
|
96383
|
-
init_subscriptionParams();
|
|
96384
96777
|
init_customLineItem();
|
|
96778
|
+
init_subscriptionParams();
|
|
96385
96779
|
init_createScheduleParamsV0();
|
|
96386
96780
|
init_createScheduleResponse();
|
|
96387
96781
|
init_openBillingPortalParamsV1();
|
|
@@ -96423,6 +96817,7 @@ var init_shared = __esm(() => {
|
|
|
96423
96817
|
init_autoTopupLimitTable();
|
|
96424
96818
|
init_customerBillingControls();
|
|
96425
96819
|
init_purchaseLimitInterval();
|
|
96820
|
+
init_usageLimit();
|
|
96426
96821
|
init_cusModels();
|
|
96427
96822
|
init_chatThreadContextsTable();
|
|
96428
96823
|
init_cmaMemoryTable();
|
|
@@ -96565,6 +96960,7 @@ var init_shared = __esm(() => {
|
|
|
96565
96960
|
init_autumnOAuthScopes();
|
|
96566
96961
|
init_oauthScopeUtils();
|
|
96567
96962
|
init_authAccessControl();
|
|
96963
|
+
init_billingControlUtils();
|
|
96568
96964
|
init_billingUtils();
|
|
96569
96965
|
init_checkoutUtils();
|
|
96570
96966
|
init_common2();
|
|
@@ -96719,29 +97115,47 @@ function createTransformer(config3) {
|
|
|
96719
97115
|
}
|
|
96720
97116
|
|
|
96721
97117
|
// src/lib/transforms/apiToSdk/feature.ts
|
|
96722
|
-
function
|
|
96723
|
-
|
|
96724
|
-
const base3 = {
|
|
96725
|
-
meteredFeatureId: creditSchemaItem.metered_feature_id,
|
|
96726
|
-
...creditSchemaItem.billing_units !== undefined && {
|
|
96727
|
-
billingUnits: creditSchemaItem.billing_units
|
|
96728
|
-
}
|
|
96729
|
-
};
|
|
96730
|
-
if (isGraduatedCreditSchemaItem(creditSchemaItem)) {
|
|
96731
|
-
return {
|
|
96732
|
-
...base3,
|
|
96733
|
-
tierBehavior: "graduated",
|
|
96734
|
-
tiers: creditSchemaItem.tiers.map((tier) => ({
|
|
96735
|
-
to: tier.to,
|
|
96736
|
-
creditCost: tier.credit_cost
|
|
96737
|
-
}))
|
|
96738
|
-
};
|
|
96739
|
-
}
|
|
97118
|
+
function mapCreditRate(rate) {
|
|
97119
|
+
if ("tier_behavior" in rate) {
|
|
96740
97120
|
return {
|
|
96741
|
-
|
|
96742
|
-
|
|
97121
|
+
tierBehavior: "graduated",
|
|
97122
|
+
tiers: rate.tiers.map((tier) => ({
|
|
97123
|
+
to: tier.to,
|
|
97124
|
+
creditCost: tier.credit_cost
|
|
97125
|
+
}))
|
|
96743
97126
|
};
|
|
96744
|
-
}
|
|
97127
|
+
}
|
|
97128
|
+
return { creditCost: rate.credit_cost };
|
|
97129
|
+
}
|
|
97130
|
+
function mapCreditDimension(dimension) {
|
|
97131
|
+
return {
|
|
97132
|
+
match: dimension.match,
|
|
97133
|
+
...dimension.priority !== undefined && { priority: dimension.priority },
|
|
97134
|
+
...mapCreditRate(dimension)
|
|
97135
|
+
};
|
|
97136
|
+
}
|
|
97137
|
+
function mapCreditDimensionRules(creditSchemaItem) {
|
|
97138
|
+
return {
|
|
97139
|
+
...creditSchemaItem.dimensions !== undefined && {
|
|
97140
|
+
dimensions: mapRecordValues({
|
|
97141
|
+
record: creditSchemaItem.dimensions,
|
|
97142
|
+
mapValue: mapCreditDimension
|
|
97143
|
+
})
|
|
97144
|
+
},
|
|
97145
|
+
...creditSchemaItem.multipliers !== undefined && {
|
|
97146
|
+
multipliers: creditSchemaItem.multipliers
|
|
97147
|
+
}
|
|
97148
|
+
};
|
|
97149
|
+
}
|
|
97150
|
+
function mapCreditSchema(api2) {
|
|
97151
|
+
return (api2.credit_schema ?? []).map((creditSchemaItem) => ({
|
|
97152
|
+
meteredFeatureId: creditSchemaItem.metered_feature_id,
|
|
97153
|
+
...creditSchemaItem.billing_units !== undefined && {
|
|
97154
|
+
billingUnits: creditSchemaItem.billing_units
|
|
97155
|
+
},
|
|
97156
|
+
...mapCreditDimensionRules(creditSchemaItem),
|
|
97157
|
+
...mapCreditRate(creditSchemaItem)
|
|
97158
|
+
}));
|
|
96745
97159
|
}
|
|
96746
97160
|
function mapModelMarkups(api2) {
|
|
96747
97161
|
if (!api2.model_markups)
|
|
@@ -98492,7 +98906,7 @@ var init_pull = __esm(() => {
|
|
|
98492
98906
|
});
|
|
98493
98907
|
|
|
98494
98908
|
// src/lib/version.ts
|
|
98495
|
-
var APP_VERSION = "1.1.
|
|
98909
|
+
var APP_VERSION = "1.1.24";
|
|
98496
98910
|
|
|
98497
98911
|
// ../../node_modules/.bun/@tanstack+query-core@5.101.1/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
98498
98912
|
var Subscribable = class {
|
|
@@ -117599,6 +118013,44 @@ var init_prompts = __esm(() => {
|
|
|
117599
118013
|
});
|
|
117600
118014
|
|
|
117601
118015
|
// src/lib/transforms/sdkToApi/feature.ts
|
|
118016
|
+
function creditRateToApi(rate) {
|
|
118017
|
+
if (rate.tierBehavior === "graduated") {
|
|
118018
|
+
return {
|
|
118019
|
+
tier_behavior: "graduated",
|
|
118020
|
+
tiers: rate.tiers.map((tier) => ({
|
|
118021
|
+
to: tier.to,
|
|
118022
|
+
credit_cost: tier.creditCost
|
|
118023
|
+
}))
|
|
118024
|
+
};
|
|
118025
|
+
}
|
|
118026
|
+
return { credit_cost: rate.creditCost };
|
|
118027
|
+
}
|
|
118028
|
+
function creditDimensionToApi(dimension) {
|
|
118029
|
+
return {
|
|
118030
|
+
match: dimension.match,
|
|
118031
|
+
...dimension.priority !== undefined && { priority: dimension.priority },
|
|
118032
|
+
...creditRateToApi(dimension)
|
|
118033
|
+
};
|
|
118034
|
+
}
|
|
118035
|
+
function creditMultiplierToApi(multiplier) {
|
|
118036
|
+
return { ...multiplier, match: multiplier.match };
|
|
118037
|
+
}
|
|
118038
|
+
function creditDimensionRulesToApi(creditSchemaItem) {
|
|
118039
|
+
return {
|
|
118040
|
+
...creditSchemaItem.dimensions !== undefined && {
|
|
118041
|
+
dimensions: mapRecordValues({
|
|
118042
|
+
record: creditSchemaItem.dimensions,
|
|
118043
|
+
mapValue: creditDimensionToApi
|
|
118044
|
+
})
|
|
118045
|
+
},
|
|
118046
|
+
...creditSchemaItem.multipliers !== undefined && {
|
|
118047
|
+
multipliers: mapRecordValues({
|
|
118048
|
+
record: creditSchemaItem.multipliers,
|
|
118049
|
+
mapValue: creditMultiplierToApi
|
|
118050
|
+
})
|
|
118051
|
+
}
|
|
118052
|
+
};
|
|
118053
|
+
}
|
|
117602
118054
|
function transformFeatureToApi(feature) {
|
|
117603
118055
|
const base3 = {
|
|
117604
118056
|
id: feature.id,
|
|
@@ -117615,28 +118067,14 @@ function transformFeatureToApi(feature) {
|
|
|
117615
118067
|
base3.consumable = feature.consumable;
|
|
117616
118068
|
}
|
|
117617
118069
|
if (feature.type === "credit_system" && feature.creditSchema) {
|
|
117618
|
-
base3.credit_schema = feature.creditSchema.map((creditSchemaItem) => {
|
|
117619
|
-
|
|
117620
|
-
|
|
117621
|
-
|
|
117622
|
-
|
|
117623
|
-
|
|
117624
|
-
|
|
117625
|
-
|
|
117626
|
-
return {
|
|
117627
|
-
...baseItem,
|
|
117628
|
-
tier_behavior: "graduated",
|
|
117629
|
-
tiers: creditSchemaItem.tiers.map((tier) => ({
|
|
117630
|
-
to: tier.to,
|
|
117631
|
-
credit_cost: tier.creditCost
|
|
117632
|
-
}))
|
|
117633
|
-
};
|
|
117634
|
-
}
|
|
117635
|
-
return {
|
|
117636
|
-
...baseItem,
|
|
117637
|
-
credit_cost: creditSchemaItem.creditCost
|
|
117638
|
-
};
|
|
117639
|
-
});
|
|
118070
|
+
base3.credit_schema = feature.creditSchema.map((creditSchemaItem) => ({
|
|
118071
|
+
metered_feature_id: creditSchemaItem.meteredFeatureId,
|
|
118072
|
+
...creditSchemaItem.billingUnits !== undefined && {
|
|
118073
|
+
billing_units: creditSchemaItem.billingUnits
|
|
118074
|
+
},
|
|
118075
|
+
...creditDimensionRulesToApi(creditSchemaItem),
|
|
118076
|
+
...creditRateToApi(creditSchemaItem)
|
|
118077
|
+
}));
|
|
117640
118078
|
}
|
|
117641
118079
|
if (feature.type === "ai_credit_system") {
|
|
117642
118080
|
if (feature.modelMarkups) {
|
|
@@ -117658,6 +118096,9 @@ function transformFeatureToApi(feature) {
|
|
|
117658
118096
|
}
|
|
117659
118097
|
return base3;
|
|
117660
118098
|
}
|
|
118099
|
+
var init_feature3 = __esm(() => {
|
|
118100
|
+
init_shared();
|
|
118101
|
+
});
|
|
117661
118102
|
|
|
117662
118103
|
// src/lib/transforms/sdkToApi/plan.ts
|
|
117663
118104
|
function transformPlanItem(planItem) {
|
|
@@ -117849,7 +118290,9 @@ var transformRewardToApi = (reward) => {
|
|
|
117849
118290
|
});
|
|
117850
118291
|
|
|
117851
118292
|
// src/lib/transforms/sdkToApi/index.ts
|
|
117852
|
-
var init_sdkToApi = () => {
|
|
118293
|
+
var init_sdkToApi = __esm(() => {
|
|
118294
|
+
init_feature3();
|
|
118295
|
+
});
|
|
117853
118296
|
|
|
117854
118297
|
// src/commands/push/variantPropagation.ts
|
|
117855
118298
|
var isSelectableVariantPreview = (variant) => Boolean(variant.plan_id && variant.name && variant.versionable !== undefined), getDirectVariantUpdatePreviews = ({
|
|
@@ -139497,6 +139940,12 @@ function normalizeFeatureForCompare(f) {
|
|
|
139497
139940
|
meteredFeatureId: creditSchemaItem.meteredFeatureId,
|
|
139498
139941
|
...creditSchemaItem.billingUnits !== undefined && creditSchemaItem.billingUnits !== 1 && {
|
|
139499
139942
|
billingUnits: creditSchemaItem.billingUnits
|
|
139943
|
+
},
|
|
139944
|
+
...creditSchemaItem.dimensions !== undefined && {
|
|
139945
|
+
dimensions: creditSchemaItem.dimensions
|
|
139946
|
+
},
|
|
139947
|
+
...creditSchemaItem.multipliers !== undefined && {
|
|
139948
|
+
multipliers: creditSchemaItem.multipliers
|
|
139500
139949
|
}
|
|
139501
139950
|
};
|
|
139502
139951
|
return creditSchemaItem.tierBehavior === "graduated" ? {
|