atmn 1.1.17 → 1.1.19
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 +379 -145
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -46954,7 +46954,7 @@ var hasBillingControls = (value) => Boolean(value && typeof value === "object" &
|
|
|
46954
46954
|
...filter2.feature_id !== undefined ? { featureId: filter2.feature_id } : {},
|
|
46955
46955
|
...filter2.billing_method !== undefined ? { billingMethod: filter2.billing_method } : {},
|
|
46956
46956
|
...filter2.interval !== undefined ? { interval: filter2.interval } : {},
|
|
46957
|
-
...filter2.interval_count !== undefined
|
|
46957
|
+
...filter2.interval_count !== undefined ? { intervalCount: filter2.interval_count } : {}
|
|
46958
46958
|
}), transformApiCustomizePlan = (customize) => {
|
|
46959
46959
|
if (!customize)
|
|
46960
46960
|
return;
|
|
@@ -47088,11 +47088,22 @@ var init_apiToSdk = __esm(() => {
|
|
|
47088
47088
|
|
|
47089
47089
|
// src/lib/transforms/inPlaceUpdate/parseConfig.ts
|
|
47090
47090
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
47091
|
-
function
|
|
47091
|
+
function extractIdentity({
|
|
47092
|
+
identitiesByTypeAndVarName,
|
|
47093
|
+
lines,
|
|
47094
|
+
type,
|
|
47095
|
+
varName
|
|
47096
|
+
}) {
|
|
47092
47097
|
const joined = lines.join(`
|
|
47093
47098
|
`);
|
|
47094
|
-
const
|
|
47095
|
-
|
|
47099
|
+
const mapped = type && varName ? identitiesByTypeAndVarName?.get(type)?.get(varName) : undefined;
|
|
47100
|
+
const id = joined.match(/id:\s*['"]([^'"]+)['"]/)?.[1];
|
|
47101
|
+
if (!id)
|
|
47102
|
+
return mapped ?? null;
|
|
47103
|
+
if (mapped?.id === id)
|
|
47104
|
+
return mapped;
|
|
47105
|
+
const version = joined.match(/id:\s*['"][^'"]+['"]\s*,?\s*version:\s*(\d+)/)?.[1];
|
|
47106
|
+
return { id, version: version === undefined ? undefined : Number(version) };
|
|
47096
47107
|
}
|
|
47097
47108
|
function extractVarName(line) {
|
|
47098
47109
|
const match = line.match(/export\s+const\s+(\w+)\s*=/);
|
|
@@ -47122,7 +47133,10 @@ function determineEntityType(lines) {
|
|
|
47122
47133
|
}
|
|
47123
47134
|
return null;
|
|
47124
47135
|
}
|
|
47125
|
-
function parseExistingConfig(
|
|
47136
|
+
function parseExistingConfig({
|
|
47137
|
+
configPath,
|
|
47138
|
+
identitiesByTypeAndVarName
|
|
47139
|
+
}) {
|
|
47126
47140
|
const source = readFileSync3(configPath, "utf-8");
|
|
47127
47141
|
const lines = source.split(`
|
|
47128
47142
|
`);
|
|
@@ -47198,11 +47212,23 @@ function parseExistingConfig(configPath) {
|
|
|
47198
47212
|
}
|
|
47199
47213
|
const endLine = i;
|
|
47200
47214
|
const blockLines = lines.slice(startLine, endLine + 1);
|
|
47201
|
-
const id = extractId(blockLines);
|
|
47202
47215
|
const entityType = determineEntityType(blockLines);
|
|
47203
|
-
|
|
47216
|
+
const blockSource = blockLines.join(`
|
|
47217
|
+
`);
|
|
47218
|
+
const declaration = entityType && varName && isResourceExpression(blockSource) ? {
|
|
47219
|
+
requiresRuntimeIdentity: !/id:\s*['"][^'"]+['"]/.test(blockSource),
|
|
47220
|
+
type: entityType,
|
|
47221
|
+
varName
|
|
47222
|
+
} : undefined;
|
|
47223
|
+
const identity2 = extractIdentity({
|
|
47224
|
+
identitiesByTypeAndVarName,
|
|
47225
|
+
lines: blockLines,
|
|
47226
|
+
type: entityType,
|
|
47227
|
+
varName
|
|
47228
|
+
});
|
|
47229
|
+
if (identity2 && entityType && varName) {
|
|
47204
47230
|
const entity = {
|
|
47205
|
-
|
|
47231
|
+
...identity2,
|
|
47206
47232
|
type: entityType,
|
|
47207
47233
|
varName,
|
|
47208
47234
|
startLine,
|
|
@@ -47214,6 +47240,7 @@ function parseExistingConfig(configPath) {
|
|
|
47214
47240
|
startLine,
|
|
47215
47241
|
endLine,
|
|
47216
47242
|
lines: blockLines,
|
|
47243
|
+
declaration,
|
|
47217
47244
|
entity
|
|
47218
47245
|
});
|
|
47219
47246
|
entities.push(entity);
|
|
@@ -47222,7 +47249,8 @@ function parseExistingConfig(configPath) {
|
|
|
47222
47249
|
type: "other",
|
|
47223
47250
|
startLine,
|
|
47224
47251
|
endLine,
|
|
47225
|
-
lines: blockLines
|
|
47252
|
+
lines: blockLines,
|
|
47253
|
+
declaration
|
|
47226
47254
|
});
|
|
47227
47255
|
}
|
|
47228
47256
|
i++;
|
|
@@ -47243,6 +47271,7 @@ function parseExistingConfig(configPath) {
|
|
|
47243
47271
|
source
|
|
47244
47272
|
};
|
|
47245
47273
|
}
|
|
47274
|
+
var isResourceExpression = (source) => /=\s*(?:feature|plan|referralProgram|reward)\s*\(/.test(source) || /=\s*\w+\.variant\s*\(/.test(source);
|
|
47246
47275
|
var init_parseConfig = () => {};
|
|
47247
47276
|
|
|
47248
47277
|
// src/lib/config/loadConfig.ts
|
|
@@ -47250,7 +47279,7 @@ import { existsSync as existsSync4 } from "node:fs";
|
|
|
47250
47279
|
import { resolve as resolve3 } from "node:path";
|
|
47251
47280
|
import { pathToFileURL } from "node:url";
|
|
47252
47281
|
import createJiti from "jiti";
|
|
47253
|
-
var DEFAULT_REWARD_EXPORT_ERROR = "Rewards and referral programs must be named reward() and referralProgram() exports; move them out of the default export before pulling or pushing.",
|
|
47282
|
+
var DEFAULT_REWARD_EXPORT_ERROR = "Rewards and referral programs must be named reward() and referralProgram() exports; move them out of the default export before pulling or pushing.", loadConfigModule = async ({
|
|
47254
47283
|
cwd: cwd2
|
|
47255
47284
|
}) => {
|
|
47256
47285
|
const configPath = resolveConfigPath(cwd2);
|
|
@@ -47260,7 +47289,7 @@ var DEFAULT_REWARD_EXPORT_ERROR = "Rewards and referral programs must be named r
|
|
|
47260
47289
|
}, loadConfig = async ({
|
|
47261
47290
|
cwd: cwd2 = process.cwd()
|
|
47262
47291
|
} = {}) => {
|
|
47263
|
-
const mod = await
|
|
47292
|
+
const mod = await loadConfigModule({ cwd: cwd2 });
|
|
47264
47293
|
const config = {
|
|
47265
47294
|
features: [],
|
|
47266
47295
|
plans: [],
|
|
@@ -47410,7 +47439,10 @@ function formatValue(value) {
|
|
|
47410
47439
|
}
|
|
47411
47440
|
return String(value);
|
|
47412
47441
|
}
|
|
47413
|
-
var upperFirst2 = (value) => value.charAt(0).toUpperCase() + value.slice(1),
|
|
47442
|
+
var upperFirst2 = (value) => value.charAt(0).toUpperCase() + value.slice(1), versionedCodegenId = ({
|
|
47443
|
+
id,
|
|
47444
|
+
version
|
|
47445
|
+
}) => version === undefined ? id : `${id}-v-${version}`, allocateVarNames = ({
|
|
47414
47446
|
ids,
|
|
47415
47447
|
candidate,
|
|
47416
47448
|
suffix,
|
|
@@ -47779,7 +47811,7 @@ function generatePlanWithVariantsCode({
|
|
|
47779
47811
|
variant,
|
|
47780
47812
|
features,
|
|
47781
47813
|
featureVarMap,
|
|
47782
|
-
varNameOverride: variantVarMap.get(variant
|
|
47814
|
+
varNameOverride: variantVarMap.get(versionedCodegenId(variant))
|
|
47783
47815
|
}));
|
|
47784
47816
|
return [basePlanCode, ...variantCodes].join(`
|
|
47785
47817
|
|
|
@@ -47796,10 +47828,31 @@ async function updateConfigInPlace({
|
|
|
47796
47828
|
if (!existsSync5(configPath)) {
|
|
47797
47829
|
throw new Error(`Config file not found: ${configPath}`);
|
|
47798
47830
|
}
|
|
47799
|
-
|
|
47831
|
+
let parsed = parseExistingConfig({ configPath });
|
|
47800
47832
|
const hasDefaultResources = /\bexport\s+default\b/.test(parsed.source) && /\b(?:rewards|referralPrograms)\b/.test(parsed.source);
|
|
47801
47833
|
if (hasDefaultResources)
|
|
47802
47834
|
throw new Error(DEFAULT_REWARD_EXPORT_ERROR);
|
|
47835
|
+
const versionedIdsByType = new Map([
|
|
47836
|
+
["plan", versionedIds(plans)],
|
|
47837
|
+
["variant", versionedIds(plans.flatMap((plan) => plan.variants ?? []))]
|
|
47838
|
+
]);
|
|
47839
|
+
const runtimeDeclarations = parsed.blocks.flatMap(({ declaration, entity }) => declaration && (declaration.requiresRuntimeIdentity || entity && versionedIdsByType.get(entity.type)?.has(entity.id)) ? [declaration] : []);
|
|
47840
|
+
if (runtimeDeclarations.length) {
|
|
47841
|
+
const mod = await loadConfigModule({ cwd: cwd2 });
|
|
47842
|
+
const identitiesByTypeAndVarName = new Map;
|
|
47843
|
+
for (const declaration of runtimeDeclarations) {
|
|
47844
|
+
const value = mod[declaration.varName];
|
|
47845
|
+
if (typeof value?.id !== "string")
|
|
47846
|
+
throw new Error(`Could not resolve the ID of export '${declaration.varName}'.`);
|
|
47847
|
+
const identities = identitiesByTypeAndVarName.get(declaration.type) ?? new Map;
|
|
47848
|
+
identities.set(declaration.varName, {
|
|
47849
|
+
id: value.id,
|
|
47850
|
+
version: typeof value.version === "number" ? value.version : undefined
|
|
47851
|
+
});
|
|
47852
|
+
identitiesByTypeAndVarName.set(declaration.type, identities);
|
|
47853
|
+
}
|
|
47854
|
+
parsed = parseExistingConfig({ configPath, identitiesByTypeAndVarName });
|
|
47855
|
+
}
|
|
47803
47856
|
const requiredImports = [
|
|
47804
47857
|
...plans.some((plan) => plan.billingControls) ? ["billingControls"] : [],
|
|
47805
47858
|
...rewards?.length ? ["reward"] : [],
|
|
@@ -47814,17 +47867,17 @@ async function updateConfigInPlace({
|
|
|
47814
47867
|
plansDeleted: 0
|
|
47815
47868
|
};
|
|
47816
47869
|
const apiFeatureMap = new Map(features.map((f) => [f.id, f]));
|
|
47817
|
-
const apiPlanMap = new Map(plans.map((p) => [p
|
|
47870
|
+
const apiPlanMap = new Map(plans.map((p) => [versionedCodegenId(p), p]));
|
|
47818
47871
|
const apiRewardMap = new Map((rewards ?? []).map((reward) => [reward.id, reward]));
|
|
47819
47872
|
const apiReferralProgramMap = new Map((referralPrograms ?? []).map((program2) => [program2.id, program2]));
|
|
47820
|
-
const apiVariantMap = new Map(plans.flatMap((plan) => (plan.variants ?? []).map((variant) => [variant
|
|
47873
|
+
const apiVariantMap = new Map(plans.flatMap((plan) => (plan.variants ?? []).map((variant) => [versionedCodegenId(variant), variant])));
|
|
47821
47874
|
const featureVarMap = new Map;
|
|
47822
47875
|
const existingVariantVarMap = new Map;
|
|
47823
47876
|
for (const entity of parsed.entities) {
|
|
47824
47877
|
if (entity.type === "feature") {
|
|
47825
47878
|
featureVarMap.set(entity.id, entity.varName);
|
|
47826
47879
|
} else if (entity.type === "variant") {
|
|
47827
|
-
existingVariantVarMap.set(entity
|
|
47880
|
+
existingVariantVarMap.set(versionedCodegenId(entity), entity.varName);
|
|
47828
47881
|
}
|
|
47829
47882
|
}
|
|
47830
47883
|
const existingVarNames = new Set([...parsed.source.matchAll(/export\s+const\s+([\w$]+)\s*=/g)].flatMap(([, varName]) => varName ? [varName] : []));
|
|
@@ -47839,8 +47892,8 @@ async function updateConfigInPlace({
|
|
|
47839
47892
|
newFeatureVarMap.set(id, varName);
|
|
47840
47893
|
featureVarMap.set(id, varName);
|
|
47841
47894
|
}
|
|
47842
|
-
const existingPlanIds = new Set(parsed.entities.filter((e) => e.type === "plan").map(
|
|
47843
|
-
const newPlanIds = plans.filter((p) => !existingPlanIds.has(p
|
|
47895
|
+
const existingPlanIds = new Set(parsed.entities.filter((e) => e.type === "plan").map(versionedCodegenId));
|
|
47896
|
+
const newPlanIds = plans.filter((p) => !existingPlanIds.has(versionedCodegenId(p))).map(versionedCodegenId);
|
|
47844
47897
|
const newPlanVarMap = new Map;
|
|
47845
47898
|
for (const id of newPlanIds) {
|
|
47846
47899
|
const varName = claimVarName({
|
|
@@ -47851,17 +47904,17 @@ async function updateConfigInPlace({
|
|
|
47851
47904
|
newPlanVarMap.set(id, varName);
|
|
47852
47905
|
}
|
|
47853
47906
|
const variantVarMap = new Map;
|
|
47854
|
-
for (const
|
|
47855
|
-
if (existingVariantVarMap.has(
|
|
47856
|
-
variantVarMap.set(
|
|
47907
|
+
for (const key of apiVariantMap.keys()) {
|
|
47908
|
+
if (existingVariantVarMap.has(key)) {
|
|
47909
|
+
variantVarMap.set(key, existingVariantVarMap.get(key));
|
|
47857
47910
|
continue;
|
|
47858
47911
|
}
|
|
47859
47912
|
const varName = claimVarName({
|
|
47860
|
-
candidate: variantIdToVarName(
|
|
47913
|
+
candidate: variantIdToVarName(key),
|
|
47861
47914
|
suffix: "Variant",
|
|
47862
47915
|
usedNames: existingVarNames
|
|
47863
47916
|
});
|
|
47864
|
-
variantVarMap.set(
|
|
47917
|
+
variantVarMap.set(key, varName);
|
|
47865
47918
|
}
|
|
47866
47919
|
const newRewardVarMap = new Map;
|
|
47867
47920
|
for (const { id } of rewards ?? []) {
|
|
@@ -47941,7 +47994,8 @@ async function updateConfigInPlace({
|
|
|
47941
47994
|
result2.featuresDeleted++;
|
|
47942
47995
|
}
|
|
47943
47996
|
} else if (entity.type === "plan") {
|
|
47944
|
-
const
|
|
47997
|
+
const planKey2 = versionedCodegenId(entity);
|
|
47998
|
+
const apiPlan = apiPlanMap.get(planKey2);
|
|
47945
47999
|
if (apiPlan) {
|
|
47946
48000
|
const newCode = generatePlanWithVariantsCode({
|
|
47947
48001
|
featureVarMap,
|
|
@@ -47951,14 +48005,14 @@ async function updateConfigInPlace({
|
|
|
47951
48005
|
variantVarMap
|
|
47952
48006
|
});
|
|
47953
48007
|
outputBlocks.push(newCode);
|
|
47954
|
-
matchedPlanIds.add(
|
|
48008
|
+
matchedPlanIds.add(planKey2);
|
|
47955
48009
|
lastPlanBlockIndex = outputBlocks.length - 1;
|
|
47956
48010
|
result2.plansUpdated++;
|
|
47957
48011
|
} else {
|
|
47958
48012
|
result2.plansDeleted++;
|
|
47959
48013
|
}
|
|
47960
48014
|
} else if (entity.type === "variant") {
|
|
47961
|
-
if (!apiVariantMap.has(entity
|
|
48015
|
+
if (!apiVariantMap.has(versionedCodegenId(entity))) {
|
|
47962
48016
|
result2.plansDeleted++;
|
|
47963
48017
|
}
|
|
47964
48018
|
} else if (entity.type === "reward") {
|
|
@@ -48053,13 +48107,13 @@ ${newFeatureCode}`);
|
|
|
48053
48107
|
}
|
|
48054
48108
|
result2.featuresAdded = newFeatures.length;
|
|
48055
48109
|
}
|
|
48056
|
-
const newPlans = plans.filter((p) => !matchedPlanIds.has(p
|
|
48110
|
+
const newPlans = plans.filter((p) => !matchedPlanIds.has(versionedCodegenId(p)));
|
|
48057
48111
|
if (newPlans.length > 0) {
|
|
48058
48112
|
const newPlanCode = newPlans.map((p) => generatePlanWithVariantsCode({
|
|
48059
48113
|
featureVarMap,
|
|
48060
48114
|
features,
|
|
48061
48115
|
plan: p,
|
|
48062
|
-
planVarName: newPlanVarMap.get(p
|
|
48116
|
+
planVarName: newPlanVarMap.get(versionedCodegenId(p)),
|
|
48063
48117
|
variantVarMap
|
|
48064
48118
|
})).join(`
|
|
48065
48119
|
|
|
@@ -48119,7 +48173,7 @@ ${newReferralPrograms.map((program2) => buildReferralProgramCode(program2, newRe
|
|
|
48119
48173
|
writeFileSync2(configPath, output, "utf-8");
|
|
48120
48174
|
return result2;
|
|
48121
48175
|
}
|
|
48122
|
-
var ensureAtmnImports = (importText, imports) => imports.reduce((text, name) => new RegExp(`\\b${name}\\b`).test(text) ? text : text.replace(/\{/, `{ ${name},`), importText);
|
|
48176
|
+
var ensureAtmnImports = (importText, imports) => imports.reduce((text, name) => new RegExp(`\\b${name}\\b`).test(text) ? text : text.replace(/\{/, `{ ${name},`), importText), versionedIds = (resources) => new Set(resources.flatMap(({ id, version }) => version === undefined ? [] : [id]));
|
|
48123
48177
|
var init_updateConfig = __esm(() => {
|
|
48124
48178
|
init_loadConfig();
|
|
48125
48179
|
init_env();
|
|
@@ -48193,10 +48247,6 @@ function buildConfigFile(features, plans, rewards = [], referralPrograms = []) {
|
|
|
48193
48247
|
return sections.join(`
|
|
48194
48248
|
`);
|
|
48195
48249
|
}
|
|
48196
|
-
var versionedCodegenId = ({
|
|
48197
|
-
id,
|
|
48198
|
-
version
|
|
48199
|
-
}) => version === undefined ? id : `${id}-v-${version}`;
|
|
48200
48250
|
var init_configFile = __esm(() => {
|
|
48201
48251
|
init_feature2();
|
|
48202
48252
|
init_plan2();
|
|
@@ -48433,7 +48483,7 @@ var init_pull = __esm(() => {
|
|
|
48433
48483
|
});
|
|
48434
48484
|
|
|
48435
48485
|
// src/lib/version.ts
|
|
48436
|
-
var APP_VERSION = "1.1.
|
|
48486
|
+
var APP_VERSION = "1.1.19";
|
|
48437
48487
|
|
|
48438
48488
|
// ../../node_modules/.bun/@tanstack+query-core@5.101.1/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
48439
48489
|
var Subscribable = class {
|
|
@@ -92314,17 +92364,13 @@ var init_cusEntTable = __esm(() => {
|
|
|
92314
92364
|
name: "customer_entitlements_entitlement_id_fkey"
|
|
92315
92365
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
92316
92366
|
index("idx_customer_entitlements_product_id").on(table3.customer_product_id),
|
|
92317
|
-
index("idx_customer_entitlements_internal_customer_id").using("hash", table3.internal_customer_id),
|
|
92318
92367
|
index("idx_customer_entitlements_internal_customer_id_btree").on(table3.internal_customer_id),
|
|
92319
92368
|
index("idx_customer_entitlements_entitlement_id").on(table3.entitlement_id),
|
|
92320
92369
|
index("idx_customer_entitlements_internal_feature_id_c").on(sql`${table3.internal_feature_id} COLLATE "C"`).concurrently(),
|
|
92321
92370
|
index("idx_ce_internal_feature_id").on(table3.internal_feature_id).concurrently(),
|
|
92322
92371
|
index("idx_ce_customer_product_id_c").on(sql`${table3.customer_product_id} COLLATE "C"`).concurrently(),
|
|
92323
|
-
index("idx_ce_loose_next_reset").on(table3.next_reset_at).where(sql`${table3.customer_product_id} IS NULL`).concurrently(),
|
|
92324
|
-
index("idx_customer_entitlements_nonnull_entity_by_id").on(table3.id).where(sql`${table3.internal_entity_id} IS NOT NULL`).concurrently(),
|
|
92325
92372
|
index("idx_customer_entitlements_internal_entity_id").using("hash", table3.internal_entity_id),
|
|
92326
92373
|
index("idx_customer_entitlements_on_next_reset_at").on(table3.next_reset_at),
|
|
92327
|
-
index("idx_customer_entitlements_separate_interval_reset").on(table3.next_reset_at, table3.id).where(sql`${table3.separate_interval} = true AND ${table3.next_reset_at} IS NOT NULL`).concurrently(),
|
|
92328
92374
|
index("idx_customer_entitlements_loose_customer_expires").on(table3.internal_customer_id, table3.expires_at).where(sql`${table3.customer_product_id} IS NULL`),
|
|
92329
92375
|
index("idx_customer_entitlements_next_reset_not_expired").on(table3.next_reset_at).where(sql`${table3.expired} IS NOT TRUE AND ${table3.next_reset_at} IS NOT NULL`).concurrently(),
|
|
92330
92376
|
index("idx_customer_entitlements_pooled_contribution").on(table3.pooled_contribution_id).where(sql`${table3.pooled_contribution_id} IS NOT NULL`).concurrently(),
|
|
@@ -110661,28 +110707,6 @@ var init_billingControls = __esm(() => {
|
|
|
110661
110707
|
init_usageLimit2();
|
|
110662
110708
|
});
|
|
110663
110709
|
|
|
110664
|
-
// ../../shared/api/errors/base/RecaseError.ts
|
|
110665
|
-
var RecaseError;
|
|
110666
|
-
var init_RecaseError = __esm(() => {
|
|
110667
|
-
RecaseError = class RecaseError extends Error {
|
|
110668
|
-
code;
|
|
110669
|
-
statusCode;
|
|
110670
|
-
data;
|
|
110671
|
-
constructor({
|
|
110672
|
-
message,
|
|
110673
|
-
code,
|
|
110674
|
-
statusCode = 400,
|
|
110675
|
-
data
|
|
110676
|
-
}) {
|
|
110677
|
-
super(message);
|
|
110678
|
-
this.name = "RecaseError";
|
|
110679
|
-
this.code = code || "invalid_request";
|
|
110680
|
-
this.statusCode = statusCode;
|
|
110681
|
-
this.data = data;
|
|
110682
|
-
}
|
|
110683
|
-
};
|
|
110684
|
-
});
|
|
110685
|
-
|
|
110686
110710
|
// ../../shared/enums/ErrCode.ts
|
|
110687
110711
|
var ErrCode;
|
|
110688
110712
|
var init_ErrCode = __esm(() => {
|
|
@@ -110823,6 +110847,28 @@ var init_ErrCode = __esm(() => {
|
|
|
110823
110847
|
};
|
|
110824
110848
|
});
|
|
110825
110849
|
|
|
110850
|
+
// ../../shared/api/errors/base/RecaseError.ts
|
|
110851
|
+
var RecaseError;
|
|
110852
|
+
var init_RecaseError = __esm(() => {
|
|
110853
|
+
RecaseError = class RecaseError extends Error {
|
|
110854
|
+
code;
|
|
110855
|
+
statusCode;
|
|
110856
|
+
data;
|
|
110857
|
+
constructor({
|
|
110858
|
+
message,
|
|
110859
|
+
code,
|
|
110860
|
+
statusCode = 400,
|
|
110861
|
+
data
|
|
110862
|
+
}) {
|
|
110863
|
+
super(message);
|
|
110864
|
+
this.name = "RecaseError";
|
|
110865
|
+
this.code = code || "invalid_request";
|
|
110866
|
+
this.statusCode = statusCode;
|
|
110867
|
+
this.data = data;
|
|
110868
|
+
}
|
|
110869
|
+
};
|
|
110870
|
+
});
|
|
110871
|
+
|
|
110826
110872
|
// ../../shared/api/common/cursorPaginationSchemas.ts
|
|
110827
110873
|
function defineCursor({
|
|
110828
110874
|
fieldsSchema
|
|
@@ -110898,7 +110944,7 @@ function defineCursor({
|
|
|
110898
110944
|
};
|
|
110899
110945
|
return { fieldsSchema, encode, decode, predicate };
|
|
110900
110946
|
}
|
|
110901
|
-
var CURRENT_CURSOR_VERSION = 0, StandardCursorFieldsSchema, StandardCursor, PaginationDefaults, CursorRequestFieldSchema, createCursorLimitSchema = ({
|
|
110947
|
+
var CURRENT_CURSOR_VERSION = 0, StandardCursorFieldsSchema, StandardCursor, SortOrderSchema, PaginationDefaults, CursorRequestFieldSchema, createCursorLimitSchema = ({
|
|
110902
110948
|
defaultLimit = PaginationDefaults.DefaultLimit,
|
|
110903
110949
|
maxLimit = PaginationDefaults.SchemaHardCeiling
|
|
110904
110950
|
} = {}) => exports_external.coerce.number().int().min(1).max(maxLimit).default(defaultLimit).describe(`Number of items to return. Default ${defaultLimit}, hard ceiling ${maxLimit}.`), createCursorPaginatedResponseSchema = (itemSchema) => exports_external.object({
|
|
@@ -110908,8 +110954,8 @@ var CURRENT_CURSOR_VERSION = 0, StandardCursorFieldsSchema, StandardCursor, Pagi
|
|
|
110908
110954
|
var init_cursorPaginationSchemas = __esm(() => {
|
|
110909
110955
|
init_drizzle_orm();
|
|
110910
110956
|
init_v4();
|
|
110911
|
-
init_RecaseError();
|
|
110912
110957
|
init_ErrCode();
|
|
110958
|
+
init_RecaseError();
|
|
110913
110959
|
StandardCursorFieldsSchema = exports_external.object({
|
|
110914
110960
|
v: exports_external.literal(CURRENT_CURSOR_VERSION),
|
|
110915
110961
|
id: exports_external.string().min(1),
|
|
@@ -110918,6 +110964,7 @@ var init_cursorPaginationSchemas = __esm(() => {
|
|
|
110918
110964
|
StandardCursor = defineCursor({
|
|
110919
110965
|
fieldsSchema: StandardCursorFieldsSchema
|
|
110920
110966
|
});
|
|
110967
|
+
SortOrderSchema = exports_external.enum(["asc", "desc"]);
|
|
110921
110968
|
PaginationDefaults = {
|
|
110922
110969
|
DefaultLimit: 50,
|
|
110923
110970
|
MaxLimit: 1000,
|
|
@@ -112071,7 +112118,7 @@ var init_migrationParams = __esm(() => {
|
|
|
112071
112118
|
// ../../shared/utils/planV1Utils/diff/diffPlanV1.ts
|
|
112072
112119
|
var DiffedCustomizePlanV1Schema;
|
|
112073
112120
|
var init_diffPlanV1 = __esm(() => {
|
|
112074
|
-
|
|
112121
|
+
init_customizePlanV1();
|
|
112075
112122
|
init_freeTrialEnums();
|
|
112076
112123
|
init_usagePriceConfig();
|
|
112077
112124
|
DiffedCustomizePlanV1Schema = refineCustomizePlanV1Schema(CustomizePlanV1BaseSchema.omit({
|
|
@@ -112554,6 +112601,9 @@ var init_productItemModels = __esm(() => {
|
|
|
112554
112601
|
}),
|
|
112555
112602
|
price_config: exports_external.any().nullish().meta({
|
|
112556
112603
|
internal: true
|
|
112604
|
+
}),
|
|
112605
|
+
_uid: exports_external.string().nullish().meta({
|
|
112606
|
+
internal: true
|
|
112557
112607
|
})
|
|
112558
112608
|
});
|
|
112559
112609
|
LimitedItemSchema = ProductItemSchema.extend({
|
|
@@ -112912,8 +112962,8 @@ var init_rewardsCreateOpModels = __esm(() => {
|
|
|
112912
112962
|
name: exports_external.string().min(1),
|
|
112913
112963
|
grants: exports_external.array(exports_external.object({
|
|
112914
112964
|
feature_id: exports_external.string().min(1),
|
|
112915
|
-
included: exports_external.number().
|
|
112916
|
-
description: "A
|
|
112965
|
+
included: exports_external.number().nonnegative().nullable().meta({
|
|
112966
|
+
description: "A non-negative amount to grant, or null for boolean features."
|
|
112917
112967
|
}),
|
|
112918
112968
|
expiry: GrantExpirySchema2
|
|
112919
112969
|
}).strict()).min(1).meta({ description: "Feature IDs must be unique." }),
|
|
@@ -113799,6 +113849,9 @@ var init_apiBalance = __esm(() => {
|
|
|
113799
113849
|
})
|
|
113800
113850
|
});
|
|
113801
113851
|
ApiBalanceRolloverSchema = exports_external.object({
|
|
113852
|
+
granted: exports_external.number().meta({
|
|
113853
|
+
description: "Amount originally rolled over from a previous period, before any of it was consumed."
|
|
113854
|
+
}),
|
|
113802
113855
|
balance: exports_external.number().meta({
|
|
113803
113856
|
description: "Amount of balance rolled over from a previous period."
|
|
113804
113857
|
}),
|
|
@@ -114869,11 +114922,31 @@ var init_listCustomersParamsV2 = __esm(() => {
|
|
|
114869
114922
|
});
|
|
114870
114923
|
});
|
|
114871
114924
|
|
|
114925
|
+
// ../../shared/api/customers/customerListFilters.ts
|
|
114926
|
+
var MAX_FILTER_VALUES = 1000, MAX_FILTER_VALUE_LENGTH = 200, FilterValuesSchema, CreatedAtRangeSchema, CustomerListFiltersSchema;
|
|
114927
|
+
var init_customerListFilters = __esm(() => {
|
|
114928
|
+
init_v4();
|
|
114929
|
+
FilterValuesSchema = exports_external.array(exports_external.string().max(MAX_FILTER_VALUE_LENGTH)).max(MAX_FILTER_VALUES);
|
|
114930
|
+
CreatedAtRangeSchema = exports_external.object({
|
|
114931
|
+
start: exports_external.coerce.number().optional().describe("Include customers created at or after this timestamp (epoch milliseconds, inclusive)"),
|
|
114932
|
+
end: exports_external.coerce.number().optional().describe("Include customers created at or before this timestamp (epoch milliseconds, inclusive)")
|
|
114933
|
+
}).refine(({ start, end }) => start === undefined || end === undefined || start <= end, { message: "created_at_range.start must be <= created_at_range.end" });
|
|
114934
|
+
CustomerListFiltersSchema = exports_external.object({
|
|
114935
|
+
status: FilterValuesSchema.optional(),
|
|
114936
|
+
version: FilterValuesSchema.optional(),
|
|
114937
|
+
none: exports_external.boolean().optional(),
|
|
114938
|
+
processor: FilterValuesSchema.optional(),
|
|
114939
|
+
interval: FilterValuesSchema.optional(),
|
|
114940
|
+
created_at_range: CreatedAtRangeSchema.optional()
|
|
114941
|
+
});
|
|
114942
|
+
});
|
|
114943
|
+
|
|
114872
114944
|
// ../../shared/api/customers/crud/listCustomersParamsV2_3.ts
|
|
114873
114945
|
var ListCustomersV2_3ParamsSchema;
|
|
114874
114946
|
var init_listCustomersParamsV2_3 = __esm(() => {
|
|
114875
114947
|
init_v4();
|
|
114876
114948
|
init_cursorPaginationSchemas();
|
|
114949
|
+
init_customerListFilters();
|
|
114877
114950
|
ListCustomersV2_3ParamsSchema = exports_external.object({
|
|
114878
114951
|
start_cursor: CursorRequestFieldSchema,
|
|
114879
114952
|
limit: createCursorLimitSchema({
|
|
@@ -114893,6 +114966,12 @@ var init_listCustomersParamsV2_3 = __esm(() => {
|
|
|
114893
114966
|
}),
|
|
114894
114967
|
processors: exports_external.array(exports_external.enum(["stripe", "revenuecat", "vercel"])).optional().meta({
|
|
114895
114968
|
description: "Filter by customer processor type (stripe, revenuecat, vercel)."
|
|
114969
|
+
}),
|
|
114970
|
+
sort_order: SortOrderSchema.optional().meta({
|
|
114971
|
+
description: "Sort by customer creation time. Defaults to desc (newest first)."
|
|
114972
|
+
}),
|
|
114973
|
+
created_at_range: CreatedAtRangeSchema.optional().meta({
|
|
114974
|
+
description: "Filter by customer creation time (epoch milliseconds, inclusive bounds)."
|
|
114896
114975
|
})
|
|
114897
114976
|
});
|
|
114898
114977
|
});
|
|
@@ -116286,16 +116365,64 @@ var init_V0_2_CusProductChange = __esm(() => {
|
|
|
116286
116365
|
init_utils11();
|
|
116287
116366
|
});
|
|
116288
116367
|
|
|
116368
|
+
// ../../shared/models/orgModels/orgConfig.ts
|
|
116369
|
+
var InvoicePaymentMethodSchema, OrgConfigSchema;
|
|
116370
|
+
var init_orgConfig = __esm(() => {
|
|
116371
|
+
init_v4();
|
|
116372
|
+
init_usageAlert();
|
|
116373
|
+
InvoicePaymentMethodSchema = exports_external.enum([
|
|
116374
|
+
"card",
|
|
116375
|
+
"customer_balance",
|
|
116376
|
+
"us_bank_account",
|
|
116377
|
+
"sepa_debit",
|
|
116378
|
+
"bacs_debit",
|
|
116379
|
+
"acss_debit",
|
|
116380
|
+
"link"
|
|
116381
|
+
]);
|
|
116382
|
+
OrgConfigSchema = exports_external.object({
|
|
116383
|
+
usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
116384
|
+
sandbox_usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
116385
|
+
bill_upgrade_immediately: exports_external.boolean().default(true),
|
|
116386
|
+
convert_to_charge_automatically: exports_external.boolean().default(true),
|
|
116387
|
+
anchor_start_of_month: exports_external.boolean().default(false),
|
|
116388
|
+
cancel_on_past_due: exports_external.boolean().default(false),
|
|
116389
|
+
prorate_unused: exports_external.boolean().default(true),
|
|
116390
|
+
checkout_on_failed_payment: exports_external.boolean().default(true),
|
|
116391
|
+
reverse_deduction_order: exports_external.boolean().default(false),
|
|
116392
|
+
include_past_due: exports_external.boolean().default(true),
|
|
116393
|
+
sync_status: exports_external.boolean().default(true),
|
|
116394
|
+
merge_billing_cycles: exports_external.boolean().default(true),
|
|
116395
|
+
multiple_trials: exports_external.boolean().default(false),
|
|
116396
|
+
allow_paid_default: exports_external.boolean().default(false),
|
|
116397
|
+
cache_customer: exports_external.boolean().default(false),
|
|
116398
|
+
invoice_memos: exports_external.boolean().default(false),
|
|
116399
|
+
entity_product: exports_external.boolean().default(false),
|
|
116400
|
+
void_invoices_on_subscription_deletion: exports_external.boolean().default(false),
|
|
116401
|
+
default_applies_to_entities: exports_external.boolean().default(false),
|
|
116402
|
+
disable_overage_billing: exports_external.boolean().default(false),
|
|
116403
|
+
disable_stripe_writes: exports_external.boolean().default(false),
|
|
116404
|
+
disabled_auto_topup: exports_external.boolean().default(false),
|
|
116405
|
+
persist_free_overage: exports_external.boolean().default(false),
|
|
116406
|
+
dryrun_autotopups: exports_external.boolean().default(false),
|
|
116407
|
+
forward_customer_metadata: exports_external.boolean().default(false),
|
|
116408
|
+
automatic_tax: exports_external.boolean().default(false),
|
|
116409
|
+
multi_currency: exports_external.boolean().default(false),
|
|
116410
|
+
allowed_payment_methods: exports_external.array(InvoicePaymentMethodSchema).min(1).nullish()
|
|
116411
|
+
});
|
|
116412
|
+
});
|
|
116413
|
+
|
|
116289
116414
|
// ../../shared/models/billingModels/context/billingContext.ts
|
|
116290
116415
|
var InvoiceModeSchema, BillingVersion;
|
|
116291
116416
|
var init_billingContext = __esm(() => {
|
|
116417
|
+
init_orgConfig();
|
|
116292
116418
|
init_v4();
|
|
116293
116419
|
InvoiceModeSchema = exports_external.object({
|
|
116294
116420
|
finalizeInvoice: exports_external.boolean().default(false),
|
|
116295
116421
|
enableProductImmediately: exports_external.boolean().default(true),
|
|
116296
116422
|
footer: exports_external.string().optional(),
|
|
116297
116423
|
memo: exports_external.string().optional(),
|
|
116298
|
-
daysUntilDue: exports_external.number().optional()
|
|
116424
|
+
daysUntilDue: exports_external.number().optional(),
|
|
116425
|
+
paymentMethodTypes: exports_external.array(InvoicePaymentMethodSchema).optional()
|
|
116299
116426
|
});
|
|
116300
116427
|
((BillingVersion2) => {
|
|
116301
116428
|
BillingVersion2["V1"] = "v1";
|
|
@@ -116476,6 +116603,7 @@ var init_productModels = __esm(() => {
|
|
|
116476
116603
|
UpdateProductSchema = exports_external.object({
|
|
116477
116604
|
id: exports_external.string().nullish(),
|
|
116478
116605
|
name: exports_external.string().min(1, "Product name cannot be empty").optional(),
|
|
116606
|
+
description: exports_external.string().nullish(),
|
|
116479
116607
|
is_add_on: exports_external.boolean().optional(),
|
|
116480
116608
|
is_default: exports_external.boolean().optional(),
|
|
116481
116609
|
group: exports_external.string().nullish(),
|
|
@@ -120956,7 +121084,8 @@ var init_attachParamsV0 = __esm(() => {
|
|
|
120956
121084
|
carry_over_usages: exports_external.object({
|
|
120957
121085
|
enabled: exports_external.boolean(),
|
|
120958
121086
|
feature_ids: exports_external.array(exports_external.string()).optional()
|
|
120959
|
-
}).optional()
|
|
121087
|
+
}).optional(),
|
|
121088
|
+
remove_plan_ids: exports_external.array(exports_external.string()).optional()
|
|
120960
121089
|
});
|
|
120961
121090
|
});
|
|
120962
121091
|
|
|
@@ -121106,6 +121235,9 @@ var init_attachParamsV1 = __esm(() => {
|
|
|
121106
121235
|
}),
|
|
121107
121236
|
currency: CurrencyCodeSchema.optional().meta({
|
|
121108
121237
|
description: "Currency to bill this attach in (e.g. usd, eur). Must match the customer's currency if they are already locked to one, and the plan must offer a paid price in it. Defaults to the customer's currency, then the org default."
|
|
121238
|
+
}),
|
|
121239
|
+
remove_plan_ids: exports_external.array(exports_external.string()).optional().meta({
|
|
121240
|
+
description: "Plan IDs to expire on the customer as part of this attach. Each must be an active plan billed on the same subscription as the attach (or a free plan); plans on a separate subscription are rejected."
|
|
121109
121241
|
})
|
|
121110
121242
|
});
|
|
121111
121243
|
});
|
|
@@ -121728,6 +121860,7 @@ var init_cusEntsToReset = __esm(() => {
|
|
|
121728
121860
|
|
|
121729
121861
|
// ../../shared/utils/cusEntUtils/balanceUtils/cusEntsToRollovers.ts
|
|
121730
121862
|
var init_cusEntsToRollovers = __esm(() => {
|
|
121863
|
+
init_decimal();
|
|
121731
121864
|
init_shared2();
|
|
121732
121865
|
});
|
|
121733
121866
|
// ../../shared/utils/cusEntUtils/balanceUtils/grantedBalanceUtils/cusEntsToAllowance.ts
|
|
@@ -122113,6 +122246,11 @@ var init_customerProductsToStripeSubscriptionIds = __esm(() => {
|
|
|
122113
122246
|
init_shared2();
|
|
122114
122247
|
});
|
|
122115
122248
|
|
|
122249
|
+
// ../../shared/utils/cusProductUtils/convertCusProduct/customerProductToApiSubscriptionStatus.ts
|
|
122250
|
+
var init_customerProductToApiSubscriptionStatus = __esm(() => {
|
|
122251
|
+
init_cusProductEnums();
|
|
122252
|
+
});
|
|
122253
|
+
|
|
122116
122254
|
// ../../shared/utils/cusProductUtils/convertCusProduct/customerProductToReplacementKey.ts
|
|
122117
122255
|
var init_customerProductToReplacementKey = __esm(() => {
|
|
122118
122256
|
init_classifyProductUtils();
|
|
@@ -122583,6 +122721,7 @@ var init_cusProductUtils2 = __esm(() => {
|
|
|
122583
122721
|
init_cusProductToConvertedFeatureOptions();
|
|
122584
122722
|
init_customerProductsToRecurringActiveAndScheduled();
|
|
122585
122723
|
init_customerProductsToStripeSubscriptionIds();
|
|
122724
|
+
init_customerProductToApiSubscriptionStatus();
|
|
122586
122725
|
init_customerProductToEffectivePrices();
|
|
122587
122726
|
init_customerProductToReplacementKey();
|
|
122588
122727
|
init_cusProductConstants();
|
|
@@ -122823,7 +122962,6 @@ var init_classifyItemUtils = __esm(() => {
|
|
|
122823
122962
|
init_productItemModels();
|
|
122824
122963
|
init_convertItemUtils();
|
|
122825
122964
|
});
|
|
122826
|
-
|
|
122827
122965
|
// ../../shared/utils/productV2Utils/productItemUtils/sortPlanItems.ts
|
|
122828
122966
|
var init_sortPlanItems = __esm(() => {
|
|
122829
122967
|
init_productItemModels();
|
|
@@ -122993,20 +123131,6 @@ var init_cusProcessors = __esm(() => {
|
|
|
122993
123131
|
init_apiCusProcessors();
|
|
122994
123132
|
});
|
|
122995
123133
|
|
|
122996
|
-
// ../../shared/api/customers/customerListFilters.ts
|
|
122997
|
-
var MAX_FILTER_VALUES = 1000, MAX_FILTER_VALUE_LENGTH = 200, FilterValuesSchema, CustomerListFiltersSchema;
|
|
122998
|
-
var init_customerListFilters = __esm(() => {
|
|
122999
|
-
init_v4();
|
|
123000
|
-
FilterValuesSchema = exports_external.array(exports_external.string().max(MAX_FILTER_VALUE_LENGTH)).max(MAX_FILTER_VALUES);
|
|
123001
|
-
CustomerListFiltersSchema = exports_external.object({
|
|
123002
|
-
status: FilterValuesSchema.optional(),
|
|
123003
|
-
version: FilterValuesSchema.optional(),
|
|
123004
|
-
none: exports_external.boolean().optional(),
|
|
123005
|
-
processor: FilterValuesSchema.optional(),
|
|
123006
|
-
interval: FilterValuesSchema.optional()
|
|
123007
|
-
});
|
|
123008
|
-
});
|
|
123009
|
-
|
|
123010
123134
|
// ../../shared/models/cusModels/cusExportModels.ts
|
|
123011
123135
|
var CustomerExportStatus, ACTIVE_CUSTOMER_EXPORT_STATUSES, CustomerExportField, CUSTOMER_EXPORT_FIELD_ORDER, CUSTOMER_EXPORT_FIELD_HEADERS, CustomerExportStatusSchema, CustomerExportFieldSchema, CustomerExportFieldsSchema, CustomerExportSnapshotSchema;
|
|
123012
123136
|
var init_cusExportModels = __esm(() => {
|
|
@@ -123335,6 +123459,98 @@ var init_planParamsV1ToProductV2 = __esm(() => {
|
|
|
123335
123459
|
init_planParamsV1ToProductItems();
|
|
123336
123460
|
});
|
|
123337
123461
|
|
|
123462
|
+
// ../../shared/api/products/components/planChange/planItemChangeV0.ts
|
|
123463
|
+
var PlanItemChangeV0Schema;
|
|
123464
|
+
var init_planItemChangeV0 = __esm(() => {
|
|
123465
|
+
init_v4();
|
|
123466
|
+
init_apiPlanItemV1();
|
|
123467
|
+
PlanItemChangeV0Schema = exports_external.object({
|
|
123468
|
+
action: exports_external.enum(["created", "deleted"]).meta({
|
|
123469
|
+
description: "Whether the item was added to or removed from the plan."
|
|
123470
|
+
}),
|
|
123471
|
+
feature_id: exports_external.string().meta({
|
|
123472
|
+
description: "The ID of the feature that was added or removed."
|
|
123473
|
+
}),
|
|
123474
|
+
item: ApiPlanItemV1Schema.meta({
|
|
123475
|
+
description: "The plan item snapshot that was added or removed."
|
|
123476
|
+
})
|
|
123477
|
+
});
|
|
123478
|
+
});
|
|
123479
|
+
|
|
123480
|
+
// ../../shared/api/products/components/planChange/planPreviousAttributesV0.ts
|
|
123481
|
+
var PlanPreviousAttributesV0Schema;
|
|
123482
|
+
var init_planPreviousAttributesV0 = __esm(() => {
|
|
123483
|
+
init_customerBillingControls();
|
|
123484
|
+
init_apiPlanV1();
|
|
123485
|
+
init_apiFreeTrialV2();
|
|
123486
|
+
PlanPreviousAttributesV0Schema = ApiPlanV1Schema.pick({
|
|
123487
|
+
id: true,
|
|
123488
|
+
name: true,
|
|
123489
|
+
description: true,
|
|
123490
|
+
group: true,
|
|
123491
|
+
add_on: true,
|
|
123492
|
+
auto_enable: true,
|
|
123493
|
+
config: true
|
|
123494
|
+
}).partial().extend({
|
|
123495
|
+
free_trial: ApiFreeTrialV2Schema.nullable().optional().meta({
|
|
123496
|
+
description: "Previous free trial when it changed. Null when the plan had none."
|
|
123497
|
+
}),
|
|
123498
|
+
billing_controls: CustomerBillingControlsSchema.nullable().optional().meta({
|
|
123499
|
+
description: "Previous billing controls when they changed. Null when unset."
|
|
123500
|
+
})
|
|
123501
|
+
});
|
|
123502
|
+
});
|
|
123503
|
+
|
|
123504
|
+
// ../../shared/api/products/components/planChange/planChangeV0.ts
|
|
123505
|
+
var PlanPriceChangeV0Schema, PlanFreeTrialChangeV0Schema, PlanChangeV0Schema;
|
|
123506
|
+
var init_planChangeV0 = __esm(() => {
|
|
123507
|
+
init_v4();
|
|
123508
|
+
init_apiPlanV1();
|
|
123509
|
+
init_apiFreeTrialV2();
|
|
123510
|
+
init_planItemChangeV0();
|
|
123511
|
+
init_planPreviousAttributesV0();
|
|
123512
|
+
PlanPriceChangeV0Schema = exports_external.object({
|
|
123513
|
+
previous: ApiPlanV1Schema.shape.price.meta({
|
|
123514
|
+
description: "The plan's price before the change."
|
|
123515
|
+
}),
|
|
123516
|
+
current: ApiPlanV1Schema.shape.price.meta({
|
|
123517
|
+
description: "The plan's price after the change."
|
|
123518
|
+
})
|
|
123519
|
+
});
|
|
123520
|
+
PlanFreeTrialChangeV0Schema = exports_external.object({
|
|
123521
|
+
previous: ApiFreeTrialV2Schema.nullable().meta({
|
|
123522
|
+
description: "The plan's free trial before the change. Null when none."
|
|
123523
|
+
}),
|
|
123524
|
+
current: ApiFreeTrialV2Schema.nullable().meta({
|
|
123525
|
+
description: "The plan's free trial after the change. Null when none."
|
|
123526
|
+
})
|
|
123527
|
+
});
|
|
123528
|
+
PlanChangeV0Schema = exports_external.object({
|
|
123529
|
+
plan: ApiPlanV1Schema.optional().meta({
|
|
123530
|
+
description: "The plan after the change. Omitted unless the caller expands it."
|
|
123531
|
+
}),
|
|
123532
|
+
previous_attributes: PlanPreviousAttributesV0Schema.nullable().meta({
|
|
123533
|
+
description: "Sparse map of scalar plan fields that changed, holding their previous values. Null when the plan is new."
|
|
123534
|
+
}),
|
|
123535
|
+
price_change: PlanPriceChangeV0Schema.optional().meta({
|
|
123536
|
+
description: "Present when the plan's price changed."
|
|
123537
|
+
}),
|
|
123538
|
+
free_trial_change: PlanFreeTrialChangeV0Schema.optional().meta({
|
|
123539
|
+
description: "Present when the plan's free trial changed."
|
|
123540
|
+
}),
|
|
123541
|
+
item_changes: exports_external.array(PlanItemChangeV0Schema).default([]).meta({
|
|
123542
|
+
description: "Feature items added to or removed from the plan."
|
|
123543
|
+
})
|
|
123544
|
+
});
|
|
123545
|
+
});
|
|
123546
|
+
|
|
123547
|
+
// ../../shared/api/products/components/planChange/index.ts
|
|
123548
|
+
var init_planChange = __esm(() => {
|
|
123549
|
+
init_planChangeV0();
|
|
123550
|
+
init_planItemChangeV0();
|
|
123551
|
+
init_planPreviousAttributesV0();
|
|
123552
|
+
});
|
|
123553
|
+
|
|
123338
123554
|
// ../../shared/api/products/crud/createVariantParamsV2.ts
|
|
123339
123555
|
var CreateVariantParamsV2Schema;
|
|
123340
123556
|
var init_createVariantParamsV2 = __esm(() => {
|
|
@@ -123936,6 +124152,9 @@ var init_productOpModels = __esm(() => {
|
|
|
123936
124152
|
create_in_stripe: exports_external.boolean().optional().meta({
|
|
123937
124153
|
internal: true
|
|
123938
124154
|
}),
|
|
124155
|
+
archived: exports_external.boolean().optional().meta({
|
|
124156
|
+
internal: true
|
|
124157
|
+
}),
|
|
123939
124158
|
base_internal_product_id: exports_external.string().nullable().optional().meta({
|
|
123940
124159
|
internal: true
|
|
123941
124160
|
})
|
|
@@ -124209,6 +124428,7 @@ var init_products2 = __esm(() => {
|
|
|
124209
124428
|
init_basePriceToProductItem();
|
|
124210
124429
|
init_billingMethod();
|
|
124211
124430
|
init_display();
|
|
124431
|
+
init_planChange();
|
|
124212
124432
|
init_planExpand();
|
|
124213
124433
|
init_crud3();
|
|
124214
124434
|
init_items();
|
|
@@ -124418,7 +124638,7 @@ var init_rewardsOpModels = __esm(() => {
|
|
|
124418
124638
|
name: exports_external.string().min(1).optional(),
|
|
124419
124639
|
grants: exports_external.array(exports_external.object({
|
|
124420
124640
|
feature_id: exports_external.string().min(1),
|
|
124421
|
-
included: exports_external.number().
|
|
124641
|
+
included: exports_external.number().nonnegative().nullable(),
|
|
124422
124642
|
expiry: ApiGrantV0Schema.shape.expiry
|
|
124423
124643
|
}).strict()).min(1).optional().meta({ description: "Replaces the existing grants when provided." }),
|
|
124424
124644
|
promo_codes: exports_external.array(exports_external.object({
|
|
@@ -125197,17 +125417,22 @@ var init_checkoutResponseV0 = __esm(() => {
|
|
|
125197
125417
|
});
|
|
125198
125418
|
|
|
125199
125419
|
// ../../shared/api/billing/common/customerPlanChange.ts
|
|
125200
|
-
var PlanChangeActionEnum, SubscriptionStatusEnum, PurchaseStatusEnum, SubscriptionSnapshotSchema, PurchaseSnapshotSchema,
|
|
125420
|
+
var PlanChangeActionEnum, SubscriptionStatusEnum, PurchaseStatusEnum, SubscriptionSnapshotSchema, PurchaseSnapshotSchema, CustomerPlanPreviousAttributesSchema, CustomerPlanChangeSchema;
|
|
125201
125421
|
var init_customerPlanChange = __esm(() => {
|
|
125422
|
+
init_planChangeV0();
|
|
125423
|
+
init_planItemChangeV0();
|
|
125202
125424
|
init_v4();
|
|
125203
|
-
init_apiPlanItemV1();
|
|
125204
125425
|
PlanChangeActionEnum = exports_external.enum([
|
|
125205
125426
|
"activated",
|
|
125206
125427
|
"scheduled",
|
|
125207
125428
|
"updated",
|
|
125208
125429
|
"expired"
|
|
125209
125430
|
]);
|
|
125210
|
-
SubscriptionStatusEnum = exports_external.enum([
|
|
125431
|
+
SubscriptionStatusEnum = exports_external.enum([
|
|
125432
|
+
"active",
|
|
125433
|
+
"scheduled",
|
|
125434
|
+
"expired"
|
|
125435
|
+
]);
|
|
125211
125436
|
PurchaseStatusEnum = exports_external.enum(["active", "scheduled", "expired"]);
|
|
125212
125437
|
SubscriptionSnapshotSchema = exports_external.object({
|
|
125213
125438
|
plan_id: exports_external.string().meta({
|
|
@@ -125249,17 +125474,13 @@ var init_customerPlanChange = __esm(() => {
|
|
|
125249
125474
|
description: "When the purchase ends, in milliseconds since the Unix epoch, or null if no expiry is set."
|
|
125250
125475
|
})
|
|
125251
125476
|
});
|
|
125252
|
-
|
|
125253
|
-
|
|
125254
|
-
|
|
125255
|
-
|
|
125256
|
-
|
|
125257
|
-
|
|
125258
|
-
|
|
125259
|
-
item: ApiPlanItemV1Schema.meta({
|
|
125260
|
-
description: "The item snapshot that was added or removed."
|
|
125261
|
-
})
|
|
125262
|
-
});
|
|
125477
|
+
CustomerPlanPreviousAttributesSchema = SubscriptionSnapshotSchema.pick({
|
|
125478
|
+
status: true,
|
|
125479
|
+
past_due: true,
|
|
125480
|
+
canceled_at: true,
|
|
125481
|
+
expires_at: true,
|
|
125482
|
+
trial_ends_at: true
|
|
125483
|
+
}).partial();
|
|
125263
125484
|
CustomerPlanChangeSchema = exports_external.object({
|
|
125264
125485
|
action: PlanChangeActionEnum.meta({
|
|
125265
125486
|
description: "The lifecycle action applied to this plan: activated (newly active on the customer), scheduled (queued for a future start), updated (mutated in place), or expired (ended)."
|
|
@@ -125270,11 +125491,15 @@ var init_customerPlanChange = __esm(() => {
|
|
|
125270
125491
|
purchase: PurchaseSnapshotSchema.optional().meta({
|
|
125271
125492
|
description: "The purchase as it stands after this change. Present when the plan is a one-off purchase."
|
|
125272
125493
|
}),
|
|
125273
|
-
previous_attributes:
|
|
125274
|
-
description: "Sparse map of scalar fields whose values changed, holding their previous values. Null when the plan is newly activated or scheduled."
|
|
125494
|
+
previous_attributes: CustomerPlanPreviousAttributesSchema.nullable().meta({
|
|
125495
|
+
description: "Sparse map of lifecycle scalar fields whose values changed, holding their previous values. Null when the plan is newly activated or scheduled, or when no lifecycle field changed."
|
|
125275
125496
|
}),
|
|
125276
|
-
|
|
125277
|
-
description: "
|
|
125497
|
+
plan_change: PlanChangeV0Schema.optional().meta({
|
|
125498
|
+
description: "Content-level change to the plan definition for this customer plan (items, base price, free trial)."
|
|
125499
|
+
}),
|
|
125500
|
+
item_changes: exports_external.array(PlanItemChangeV0Schema).default([]).meta({
|
|
125501
|
+
deprecated: true,
|
|
125502
|
+
description: "Deprecated — use plan_change.item_changes. Features that were added to or removed from this plan."
|
|
125278
125503
|
})
|
|
125279
125504
|
});
|
|
125280
125505
|
});
|
|
@@ -125379,6 +125604,34 @@ var init_common3 = __esm(() => {
|
|
|
125379
125604
|
init_transitionRules();
|
|
125380
125605
|
});
|
|
125381
125606
|
|
|
125607
|
+
// ../../shared/api/billing/components/billingChanges/previewBalanceChange.ts
|
|
125608
|
+
var PreviewBalanceSchema, PreviewBalanceChangeSchema;
|
|
125609
|
+
var init_previewBalanceChange = __esm(() => {
|
|
125610
|
+
init_v4();
|
|
125611
|
+
PreviewBalanceSchema = exports_external.object({
|
|
125612
|
+
granted: exports_external.number(),
|
|
125613
|
+
remaining: exports_external.number(),
|
|
125614
|
+
usage: exports_external.number(),
|
|
125615
|
+
unlimited: exports_external.boolean(),
|
|
125616
|
+
next_reset_at: exports_external.number().nullable()
|
|
125617
|
+
});
|
|
125618
|
+
PreviewBalanceChangeSchema = exports_external.object({
|
|
125619
|
+
feature_id: exports_external.string(),
|
|
125620
|
+
balance: PreviewBalanceSchema,
|
|
125621
|
+
previous_attributes: exports_external.record(exports_external.string(), exports_external.unknown()).default({})
|
|
125622
|
+
});
|
|
125623
|
+
});
|
|
125624
|
+
|
|
125625
|
+
// ../../shared/api/billing/components/billingChanges/previewFlagChange.ts
|
|
125626
|
+
var PreviewFlagChangeSchema;
|
|
125627
|
+
var init_previewFlagChange = __esm(() => {
|
|
125628
|
+
init_v4();
|
|
125629
|
+
PreviewFlagChangeSchema = exports_external.object({
|
|
125630
|
+
action: exports_external.enum(["created", "deleted"]),
|
|
125631
|
+
feature_id: exports_external.string()
|
|
125632
|
+
});
|
|
125633
|
+
});
|
|
125634
|
+
|
|
125382
125635
|
// ../../shared/api/billing/dfu/dfuFlashParams.ts
|
|
125383
125636
|
var ProcessorTypeSchema, FlashCustomerDataSchema, FlashProcessorIdentitySchema, FlashLinkSchema, FlashStartingAfterSchema, FlashBalanceFilterSchema, FlashRolloverSchema, FlashBalanceSchema, FlashFeatureQuantitySchema, FlashPlanSchema, FlashPhaseSchema, FlashBillableSchema, FlashEntitySchema, DfuFlashParamsSchema, DfuFlashedPlanSchema, DfuFlashResultSchema;
|
|
125384
125637
|
var init_dfuFlashParams = __esm(() => {
|
|
@@ -125860,7 +126113,7 @@ var init_syncProposalsV2 = __esm(() => {
|
|
|
125860
126113
|
});
|
|
125861
126114
|
|
|
125862
126115
|
// ../../shared/api/billing/verify/verifyParamsV1.ts
|
|
125863
|
-
var VerifyParamsV1Schema, ItemMismatchReasonSchema, message, severity, ItemMismatchSchema, BasePriceMismatchSchema, PrepaidQuantityMismatchSchema, PrepaidPriceMismatchSchema, ScheduleMismatchSchema, CancelStateMismatchSchema, RewardMismatchSchema, StripeSubNotInAutumnMismatchSchema, StaleSubscriptionLinkMismatchSchema, ExpectedStateErrorMismatchSchema, SubscriptionMismatchSchema, SubscriptionVerifyResultSchema, VerifyResponseSchema;
|
|
126116
|
+
var VerifyParamsV1Schema, ItemMismatchReasonSchema, message, severity, ItemMismatchSchema, BasePriceMismatchSchema, PrepaidQuantityMismatchSchema, PrepaidPriceMismatchSchema, ScheduleMismatchSchema, CancelStateMismatchSchema, RewardMismatchSchema, StripeSubNotInAutumnMismatchSchema, StaleSubscriptionLinkMismatchSchema, ExpectedStateErrorMismatchSchema, SharedStripeCustomerMismatchSchema, SubscriptionMismatchSchema, SubscriptionVerifyResultSchema, VerifyResponseSchema;
|
|
125864
126117
|
var init_verifyParamsV1 = __esm(() => {
|
|
125865
126118
|
init_v4();
|
|
125866
126119
|
VerifyParamsV1Schema = exports_external.object({
|
|
@@ -125985,6 +126238,13 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
125985
126238
|
severity,
|
|
125986
126239
|
error: exports_external.string()
|
|
125987
126240
|
});
|
|
126241
|
+
SharedStripeCustomerMismatchSchema = exports_external.object({
|
|
126242
|
+
type: exports_external.literal("shared_stripe_customer"),
|
|
126243
|
+
message,
|
|
126244
|
+
severity,
|
|
126245
|
+
stripe_customer_id: exports_external.string(),
|
|
126246
|
+
other_customer_ids: exports_external.array(exports_external.string())
|
|
126247
|
+
});
|
|
125988
126248
|
SubscriptionMismatchSchema = exports_external.discriminatedUnion("type", [
|
|
125989
126249
|
BasePriceMismatchSchema,
|
|
125990
126250
|
ItemMismatchSchema,
|
|
@@ -125995,7 +126255,8 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
125995
126255
|
RewardMismatchSchema,
|
|
125996
126256
|
StripeSubNotInAutumnMismatchSchema,
|
|
125997
126257
|
StaleSubscriptionLinkMismatchSchema,
|
|
125998
|
-
ExpectedStateErrorMismatchSchema
|
|
126258
|
+
ExpectedStateErrorMismatchSchema,
|
|
126259
|
+
SharedStripeCustomerMismatchSchema
|
|
125999
126260
|
]);
|
|
126000
126261
|
SubscriptionVerifyResultSchema = exports_external.object({
|
|
126001
126262
|
stripe_subscription_id: exports_external.string(),
|
|
@@ -126004,6 +126265,7 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
126004
126265
|
});
|
|
126005
126266
|
VerifyResponseSchema = exports_external.object({
|
|
126006
126267
|
customer_id: exports_external.string(),
|
|
126268
|
+
customer_mismatches: exports_external.array(SubscriptionMismatchSchema),
|
|
126007
126269
|
subscriptions: exports_external.array(SubscriptionVerifyResultSchema)
|
|
126008
126270
|
});
|
|
126009
126271
|
});
|
|
@@ -126019,6 +126281,8 @@ var init_billing = __esm(() => {
|
|
|
126019
126281
|
init_checkoutParamsV0();
|
|
126020
126282
|
init_checkoutResponseV0();
|
|
126021
126283
|
init_common3();
|
|
126284
|
+
init_previewBalanceChange();
|
|
126285
|
+
init_previewFlagChange();
|
|
126022
126286
|
init_createScheduleParamsV0();
|
|
126023
126287
|
init_createScheduleResponse();
|
|
126024
126288
|
init_dfuFlashParams();
|
|
@@ -126830,7 +127094,12 @@ var init_models = __esm(() => {
|
|
|
126830
127094
|
var LimitType, BALANCES_LIMIT_REACHED_EXAMPLE, BalancesLimitReachedSchema;
|
|
126831
127095
|
var init_balancesLimitReached = __esm(() => {
|
|
126832
127096
|
init_v4();
|
|
126833
|
-
LimitType = exports_external.enum([
|
|
127097
|
+
LimitType = exports_external.enum([
|
|
127098
|
+
"included",
|
|
127099
|
+
"max_purchase",
|
|
127100
|
+
"spend_limit",
|
|
127101
|
+
"usage_limit"
|
|
127102
|
+
]);
|
|
126834
127103
|
BALANCES_LIMIT_REACHED_EXAMPLE = {
|
|
126835
127104
|
customer_id: "org_123",
|
|
126836
127105
|
entity_id: "workspace_abc",
|
|
@@ -126848,7 +127117,7 @@ var init_balancesLimitReached = __esm(() => {
|
|
|
126848
127117
|
description: "The feature ID whose limit was reached."
|
|
126849
127118
|
}),
|
|
126850
127119
|
limit_type: LimitType.meta({
|
|
126851
|
-
description: "Which limit was hit: included allowance, max purchase cap, or
|
|
127120
|
+
description: "Which limit was hit: included allowance, max purchase cap, spend limit, or a usage-limit billing control."
|
|
126852
127121
|
})
|
|
126853
127122
|
}).meta({
|
|
126854
127123
|
examples: [BALANCES_LIMIT_REACHED_EXAMPLE]
|
|
@@ -127196,7 +127465,7 @@ var init_webhookRegistry = __esm(() => {
|
|
|
127196
127465
|
title: "Limit Reached",
|
|
127197
127466
|
schema: BalancesLimitReachedSchema,
|
|
127198
127467
|
group: "Balances",
|
|
127199
|
-
description: "Fired when a customer reaches the limit for a feature (included allowance, max purchase, or
|
|
127468
|
+
description: "Fired when a customer reaches the limit for a feature (included allowance, max purchase, spend limit, or a usage-limit billing control)."
|
|
127200
127469
|
},
|
|
127201
127470
|
{
|
|
127202
127471
|
eventType: "billing.auto_topup_failed" /* BillingAutoTopupFailed */,
|
|
@@ -132839,42 +133108,6 @@ var init_idempotencyConfig = __esm(() => {
|
|
|
132839
133108
|
});
|
|
132840
133109
|
});
|
|
132841
133110
|
|
|
132842
|
-
// ../../shared/models/orgModels/orgConfig.ts
|
|
132843
|
-
var OrgConfigSchema;
|
|
132844
|
-
var init_orgConfig = __esm(() => {
|
|
132845
|
-
init_v4();
|
|
132846
|
-
init_usageAlert();
|
|
132847
|
-
OrgConfigSchema = exports_external.object({
|
|
132848
|
-
usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
132849
|
-
sandbox_usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
132850
|
-
bill_upgrade_immediately: exports_external.boolean().default(true),
|
|
132851
|
-
convert_to_charge_automatically: exports_external.boolean().default(true),
|
|
132852
|
-
anchor_start_of_month: exports_external.boolean().default(false),
|
|
132853
|
-
cancel_on_past_due: exports_external.boolean().default(false),
|
|
132854
|
-
prorate_unused: exports_external.boolean().default(true),
|
|
132855
|
-
checkout_on_failed_payment: exports_external.boolean().default(true),
|
|
132856
|
-
reverse_deduction_order: exports_external.boolean().default(false),
|
|
132857
|
-
include_past_due: exports_external.boolean().default(true),
|
|
132858
|
-
sync_status: exports_external.boolean().default(true),
|
|
132859
|
-
merge_billing_cycles: exports_external.boolean().default(true),
|
|
132860
|
-
multiple_trials: exports_external.boolean().default(false),
|
|
132861
|
-
allow_paid_default: exports_external.boolean().default(false),
|
|
132862
|
-
cache_customer: exports_external.boolean().default(false),
|
|
132863
|
-
invoice_memos: exports_external.boolean().default(false),
|
|
132864
|
-
entity_product: exports_external.boolean().default(false),
|
|
132865
|
-
void_invoices_on_subscription_deletion: exports_external.boolean().default(false),
|
|
132866
|
-
default_applies_to_entities: exports_external.boolean().default(false),
|
|
132867
|
-
disable_overage_billing: exports_external.boolean().default(false),
|
|
132868
|
-
disable_stripe_writes: exports_external.boolean().default(false),
|
|
132869
|
-
disabled_auto_topup: exports_external.boolean().default(false),
|
|
132870
|
-
persist_free_overage: exports_external.boolean().default(false),
|
|
132871
|
-
dryrun_autotopups: exports_external.boolean().default(false),
|
|
132872
|
-
forward_customer_metadata: exports_external.boolean().default(false),
|
|
132873
|
-
automatic_tax: exports_external.boolean().default(false),
|
|
132874
|
-
multi_currency: exports_external.boolean().default(false)
|
|
132875
|
-
});
|
|
132876
|
-
});
|
|
132877
|
-
|
|
132878
133111
|
// ../../shared/models/orgModels/frontendOrg.ts
|
|
132879
133112
|
var FrontendOrgSchema;
|
|
132880
133113
|
var init_frontendOrg = __esm(() => {
|
|
@@ -133168,7 +133401,7 @@ var init_rewardModels = __esm(() => {
|
|
|
133168
133401
|
});
|
|
133169
133402
|
RewardEntitlementSchema = exports_external.object({
|
|
133170
133403
|
internal_feature_id: exports_external.string().min(1),
|
|
133171
|
-
allowance: exports_external.number().
|
|
133404
|
+
allowance: exports_external.number().nonnegative().optional(),
|
|
133172
133405
|
expiry: EntitlementExpirySchema.optional()
|
|
133173
133406
|
});
|
|
133174
133407
|
DiscountConfigSchema = exports_external.object({
|
|
@@ -134044,7 +134277,8 @@ var init_generateItemChanges = __esm(() => {
|
|
|
134044
134277
|
"price_id",
|
|
134045
134278
|
"price_config",
|
|
134046
134279
|
"isPrice",
|
|
134047
|
-
"isVariable"
|
|
134280
|
+
"isVariable",
|
|
134281
|
+
"_uid"
|
|
134048
134282
|
]);
|
|
134049
134283
|
});
|
|
134050
134284
|
|