atmn 1.1.18 → 1.1.20
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 -124
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -45772,30 +45772,16 @@ async function startCallbackServer(port, onCallback, onListening) {
|
|
|
45772
45772
|
server.listen(port, onListening);
|
|
45773
45773
|
});
|
|
45774
45774
|
}
|
|
45775
|
+
function buildCliOAuthScopes() {
|
|
45776
|
+
return CLI_SCOPE_REQUESTS.flatMap(({ resource, actions }) => actions.map((action) => `${resource}:${action}`));
|
|
45777
|
+
}
|
|
45775
45778
|
async function startOAuthFlow(clientId, options) {
|
|
45776
45779
|
const codeVerifier = generateCodeVerifier();
|
|
45777
45780
|
const state = generateState();
|
|
45778
45781
|
for (const port of OAUTH_PORTS) {
|
|
45779
45782
|
const redirectUri = getOAuthRedirectUri(port);
|
|
45780
45783
|
const client = new OAuth2Client(clientId, null, redirectUri);
|
|
45781
|
-
const authUrl = client.createAuthorizationURLWithPKCE(getAuthorizationEndpoint(), state, CodeChallengeMethod.S256, codeVerifier,
|
|
45782
|
-
...[
|
|
45783
|
-
{
|
|
45784
|
-
resource: "customers",
|
|
45785
|
-
actions: ["create", "read", "list", "update", "delete"]
|
|
45786
|
-
},
|
|
45787
|
-
{
|
|
45788
|
-
resource: "features",
|
|
45789
|
-
actions: ["create", "read", "list", "update", "delete"]
|
|
45790
|
-
},
|
|
45791
|
-
{
|
|
45792
|
-
resource: "plans",
|
|
45793
|
-
actions: ["create", "read", "list", "update", "delete"]
|
|
45794
|
-
},
|
|
45795
|
-
{ resource: "apiKeys", actions: ["create", "read"] },
|
|
45796
|
-
{ resource: "organisation", actions: ["read"] }
|
|
45797
|
-
].flatMap(({ resource, actions }) => actions.map((action) => `${resource}:${action}`))
|
|
45798
|
-
]);
|
|
45784
|
+
const authUrl = client.createAuthorizationURLWithPKCE(getAuthorizationEndpoint(), state, CodeChallengeMethod.S256, codeVerifier, buildCliOAuthScopes());
|
|
45799
45785
|
authUrl.searchParams.set("prompt", "consent");
|
|
45800
45786
|
const result2 = await startCallbackServer(port, async (url) => {
|
|
45801
45787
|
const error = url.searchParams.get("error");
|
|
@@ -45872,12 +45858,29 @@ async function getApiKeysWithToken(accessToken) {
|
|
|
45872
45858
|
orgId: data.org_id
|
|
45873
45859
|
};
|
|
45874
45860
|
}
|
|
45875
|
-
var getAuthorizationEndpoint = () => `${getBackendUrl()}/api/auth/oauth2/authorize`, getTokenEndpoint = () => `${getBackendUrl()}/api/auth/oauth2/token
|
|
45861
|
+
var getAuthorizationEndpoint = () => `${getBackendUrl()}/api/auth/oauth2/authorize`, getTokenEndpoint = () => `${getBackendUrl()}/api/auth/oauth2/token`, CLI_SCOPE_REQUESTS;
|
|
45876
45862
|
var init_oauth = __esm(() => {
|
|
45877
45863
|
init_dist8();
|
|
45878
45864
|
init_open();
|
|
45879
45865
|
init_backendUrl();
|
|
45880
45866
|
init_constants();
|
|
45867
|
+
CLI_SCOPE_REQUESTS = [
|
|
45868
|
+
{
|
|
45869
|
+
resource: "customers",
|
|
45870
|
+
actions: ["create", "read", "list", "update", "delete"]
|
|
45871
|
+
},
|
|
45872
|
+
{
|
|
45873
|
+
resource: "features",
|
|
45874
|
+
actions: ["create", "read", "list", "update", "delete"]
|
|
45875
|
+
},
|
|
45876
|
+
{
|
|
45877
|
+
resource: "plans",
|
|
45878
|
+
actions: ["create", "read", "list", "update", "delete"]
|
|
45879
|
+
},
|
|
45880
|
+
{ resource: "rewards", actions: ["read", "write"] },
|
|
45881
|
+
{ resource: "apiKeys", actions: ["create", "read"] },
|
|
45882
|
+
{ resource: "organisation", actions: ["read"] }
|
|
45883
|
+
];
|
|
45881
45884
|
});
|
|
45882
45885
|
|
|
45883
45886
|
// src/lib/api/client.ts
|
|
@@ -47088,11 +47091,22 @@ var init_apiToSdk = __esm(() => {
|
|
|
47088
47091
|
|
|
47089
47092
|
// src/lib/transforms/inPlaceUpdate/parseConfig.ts
|
|
47090
47093
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
47091
|
-
function
|
|
47094
|
+
function extractIdentity({
|
|
47095
|
+
identitiesByTypeAndVarName,
|
|
47096
|
+
lines,
|
|
47097
|
+
type,
|
|
47098
|
+
varName
|
|
47099
|
+
}) {
|
|
47092
47100
|
const joined = lines.join(`
|
|
47093
47101
|
`);
|
|
47094
|
-
const
|
|
47095
|
-
|
|
47102
|
+
const mapped = type && varName ? identitiesByTypeAndVarName?.get(type)?.get(varName) : undefined;
|
|
47103
|
+
const id = joined.match(/id:\s*['"]([^'"]+)['"]/)?.[1];
|
|
47104
|
+
if (!id)
|
|
47105
|
+
return mapped ?? null;
|
|
47106
|
+
if (mapped?.id === id)
|
|
47107
|
+
return mapped;
|
|
47108
|
+
const version = joined.match(/id:\s*['"][^'"]+['"]\s*,?\s*version:\s*(\d+)/)?.[1];
|
|
47109
|
+
return { id, version: version === undefined ? undefined : Number(version) };
|
|
47096
47110
|
}
|
|
47097
47111
|
function extractVarName(line) {
|
|
47098
47112
|
const match = line.match(/export\s+const\s+(\w+)\s*=/);
|
|
@@ -47122,7 +47136,10 @@ function determineEntityType(lines) {
|
|
|
47122
47136
|
}
|
|
47123
47137
|
return null;
|
|
47124
47138
|
}
|
|
47125
|
-
function parseExistingConfig(
|
|
47139
|
+
function parseExistingConfig({
|
|
47140
|
+
configPath,
|
|
47141
|
+
identitiesByTypeAndVarName
|
|
47142
|
+
}) {
|
|
47126
47143
|
const source = readFileSync3(configPath, "utf-8");
|
|
47127
47144
|
const lines = source.split(`
|
|
47128
47145
|
`);
|
|
@@ -47138,7 +47155,7 @@ function parseExistingConfig(configPath) {
|
|
|
47138
47155
|
}
|
|
47139
47156
|
if (trimmed.startsWith("import ")) {
|
|
47140
47157
|
const startLine = i;
|
|
47141
|
-
while (i < lines.length &&
|
|
47158
|
+
while (i < lines.length && !/(?:["'];?|;)\s*(?:\/\/.*|\/\*.*)?$/.test(lines[i])) {
|
|
47142
47159
|
i++;
|
|
47143
47160
|
}
|
|
47144
47161
|
const endLine = i;
|
|
@@ -47191,18 +47208,30 @@ function parseExistingConfig(configPath) {
|
|
|
47191
47208
|
depth--;
|
|
47192
47209
|
}
|
|
47193
47210
|
}
|
|
47194
|
-
if (foundStart && depth === 0
|
|
47211
|
+
if (foundStart && depth === 0) {
|
|
47195
47212
|
break;
|
|
47196
47213
|
}
|
|
47197
47214
|
i++;
|
|
47198
47215
|
}
|
|
47199
47216
|
const endLine = i;
|
|
47200
47217
|
const blockLines = lines.slice(startLine, endLine + 1);
|
|
47201
|
-
const id = extractId(blockLines);
|
|
47202
47218
|
const entityType = determineEntityType(blockLines);
|
|
47203
|
-
|
|
47219
|
+
const blockSource = blockLines.join(`
|
|
47220
|
+
`);
|
|
47221
|
+
const declaration = entityType && varName && isResourceExpression(blockSource) ? {
|
|
47222
|
+
requiresRuntimeIdentity: !/id:\s*['"][^'"]+['"]/.test(blockSource),
|
|
47223
|
+
type: entityType,
|
|
47224
|
+
varName
|
|
47225
|
+
} : undefined;
|
|
47226
|
+
const identity2 = extractIdentity({
|
|
47227
|
+
identitiesByTypeAndVarName,
|
|
47228
|
+
lines: blockLines,
|
|
47229
|
+
type: entityType,
|
|
47230
|
+
varName
|
|
47231
|
+
});
|
|
47232
|
+
if (identity2 && entityType && varName) {
|
|
47204
47233
|
const entity = {
|
|
47205
|
-
|
|
47234
|
+
...identity2,
|
|
47206
47235
|
type: entityType,
|
|
47207
47236
|
varName,
|
|
47208
47237
|
startLine,
|
|
@@ -47214,6 +47243,7 @@ function parseExistingConfig(configPath) {
|
|
|
47214
47243
|
startLine,
|
|
47215
47244
|
endLine,
|
|
47216
47245
|
lines: blockLines,
|
|
47246
|
+
declaration,
|
|
47217
47247
|
entity
|
|
47218
47248
|
});
|
|
47219
47249
|
entities.push(entity);
|
|
@@ -47222,7 +47252,8 @@ function parseExistingConfig(configPath) {
|
|
|
47222
47252
|
type: "other",
|
|
47223
47253
|
startLine,
|
|
47224
47254
|
endLine,
|
|
47225
|
-
lines: blockLines
|
|
47255
|
+
lines: blockLines,
|
|
47256
|
+
declaration
|
|
47226
47257
|
});
|
|
47227
47258
|
}
|
|
47228
47259
|
i++;
|
|
@@ -47243,6 +47274,7 @@ function parseExistingConfig(configPath) {
|
|
|
47243
47274
|
source
|
|
47244
47275
|
};
|
|
47245
47276
|
}
|
|
47277
|
+
var isResourceExpression = (source) => /=\s*(?:feature|plan|referralProgram|reward)\s*\(/.test(source) || /=\s*\w+\.variant\s*\(/.test(source);
|
|
47246
47278
|
var init_parseConfig = () => {};
|
|
47247
47279
|
|
|
47248
47280
|
// src/lib/config/loadConfig.ts
|
|
@@ -47250,7 +47282,7 @@ import { existsSync as existsSync4 } from "node:fs";
|
|
|
47250
47282
|
import { resolve as resolve3 } from "node:path";
|
|
47251
47283
|
import { pathToFileURL } from "node:url";
|
|
47252
47284
|
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.",
|
|
47285
|
+
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
47286
|
cwd: cwd2
|
|
47255
47287
|
}) => {
|
|
47256
47288
|
const configPath = resolveConfigPath(cwd2);
|
|
@@ -47260,7 +47292,7 @@ var DEFAULT_REWARD_EXPORT_ERROR = "Rewards and referral programs must be named r
|
|
|
47260
47292
|
}, loadConfig = async ({
|
|
47261
47293
|
cwd: cwd2 = process.cwd()
|
|
47262
47294
|
} = {}) => {
|
|
47263
|
-
const mod = await
|
|
47295
|
+
const mod = await loadConfigModule({ cwd: cwd2 });
|
|
47264
47296
|
const config = {
|
|
47265
47297
|
features: [],
|
|
47266
47298
|
plans: [],
|
|
@@ -47410,7 +47442,10 @@ function formatValue(value) {
|
|
|
47410
47442
|
}
|
|
47411
47443
|
return String(value);
|
|
47412
47444
|
}
|
|
47413
|
-
var upperFirst2 = (value) => value.charAt(0).toUpperCase() + value.slice(1),
|
|
47445
|
+
var upperFirst2 = (value) => value.charAt(0).toUpperCase() + value.slice(1), versionedCodegenId = ({
|
|
47446
|
+
id,
|
|
47447
|
+
version
|
|
47448
|
+
}) => version === undefined ? id : `${id}-v-${version}`, allocateVarNames = ({
|
|
47414
47449
|
ids,
|
|
47415
47450
|
candidate,
|
|
47416
47451
|
suffix,
|
|
@@ -47779,7 +47814,7 @@ function generatePlanWithVariantsCode({
|
|
|
47779
47814
|
variant,
|
|
47780
47815
|
features,
|
|
47781
47816
|
featureVarMap,
|
|
47782
|
-
varNameOverride: variantVarMap.get(variant
|
|
47817
|
+
varNameOverride: variantVarMap.get(versionedCodegenId(variant))
|
|
47783
47818
|
}));
|
|
47784
47819
|
return [basePlanCode, ...variantCodes].join(`
|
|
47785
47820
|
|
|
@@ -47796,10 +47831,31 @@ async function updateConfigInPlace({
|
|
|
47796
47831
|
if (!existsSync5(configPath)) {
|
|
47797
47832
|
throw new Error(`Config file not found: ${configPath}`);
|
|
47798
47833
|
}
|
|
47799
|
-
|
|
47834
|
+
let parsed = parseExistingConfig({ configPath });
|
|
47800
47835
|
const hasDefaultResources = /\bexport\s+default\b/.test(parsed.source) && /\b(?:rewards|referralPrograms)\b/.test(parsed.source);
|
|
47801
47836
|
if (hasDefaultResources)
|
|
47802
47837
|
throw new Error(DEFAULT_REWARD_EXPORT_ERROR);
|
|
47838
|
+
const versionedIdsByType = new Map([
|
|
47839
|
+
["plan", versionedIds(plans)],
|
|
47840
|
+
["variant", versionedIds(plans.flatMap((plan) => plan.variants ?? []))]
|
|
47841
|
+
]);
|
|
47842
|
+
const runtimeDeclarations = parsed.blocks.flatMap(({ declaration, entity }) => declaration && (declaration.requiresRuntimeIdentity || entity && versionedIdsByType.get(entity.type)?.has(entity.id)) ? [declaration] : []);
|
|
47843
|
+
if (runtimeDeclarations.length) {
|
|
47844
|
+
const mod = await loadConfigModule({ cwd: cwd2 });
|
|
47845
|
+
const identitiesByTypeAndVarName = new Map;
|
|
47846
|
+
for (const declaration of runtimeDeclarations) {
|
|
47847
|
+
const value = mod[declaration.varName];
|
|
47848
|
+
if (typeof value?.id !== "string")
|
|
47849
|
+
throw new Error(`Could not resolve the ID of export '${declaration.varName}'.`);
|
|
47850
|
+
const identities = identitiesByTypeAndVarName.get(declaration.type) ?? new Map;
|
|
47851
|
+
identities.set(declaration.varName, {
|
|
47852
|
+
id: value.id,
|
|
47853
|
+
version: typeof value.version === "number" ? value.version : undefined
|
|
47854
|
+
});
|
|
47855
|
+
identitiesByTypeAndVarName.set(declaration.type, identities);
|
|
47856
|
+
}
|
|
47857
|
+
parsed = parseExistingConfig({ configPath, identitiesByTypeAndVarName });
|
|
47858
|
+
}
|
|
47803
47859
|
const requiredImports = [
|
|
47804
47860
|
...plans.some((plan) => plan.billingControls) ? ["billingControls"] : [],
|
|
47805
47861
|
...rewards?.length ? ["reward"] : [],
|
|
@@ -47814,17 +47870,17 @@ async function updateConfigInPlace({
|
|
|
47814
47870
|
plansDeleted: 0
|
|
47815
47871
|
};
|
|
47816
47872
|
const apiFeatureMap = new Map(features.map((f) => [f.id, f]));
|
|
47817
|
-
const apiPlanMap = new Map(plans.map((p) => [p
|
|
47873
|
+
const apiPlanMap = new Map(plans.map((p) => [versionedCodegenId(p), p]));
|
|
47818
47874
|
const apiRewardMap = new Map((rewards ?? []).map((reward) => [reward.id, reward]));
|
|
47819
47875
|
const apiReferralProgramMap = new Map((referralPrograms ?? []).map((program2) => [program2.id, program2]));
|
|
47820
|
-
const apiVariantMap = new Map(plans.flatMap((plan) => (plan.variants ?? []).map((variant) => [variant
|
|
47876
|
+
const apiVariantMap = new Map(plans.flatMap((plan) => (plan.variants ?? []).map((variant) => [versionedCodegenId(variant), variant])));
|
|
47821
47877
|
const featureVarMap = new Map;
|
|
47822
47878
|
const existingVariantVarMap = new Map;
|
|
47823
47879
|
for (const entity of parsed.entities) {
|
|
47824
47880
|
if (entity.type === "feature") {
|
|
47825
47881
|
featureVarMap.set(entity.id, entity.varName);
|
|
47826
47882
|
} else if (entity.type === "variant") {
|
|
47827
|
-
existingVariantVarMap.set(entity
|
|
47883
|
+
existingVariantVarMap.set(versionedCodegenId(entity), entity.varName);
|
|
47828
47884
|
}
|
|
47829
47885
|
}
|
|
47830
47886
|
const existingVarNames = new Set([...parsed.source.matchAll(/export\s+const\s+([\w$]+)\s*=/g)].flatMap(([, varName]) => varName ? [varName] : []));
|
|
@@ -47839,8 +47895,8 @@ async function updateConfigInPlace({
|
|
|
47839
47895
|
newFeatureVarMap.set(id, varName);
|
|
47840
47896
|
featureVarMap.set(id, varName);
|
|
47841
47897
|
}
|
|
47842
|
-
const existingPlanIds = new Set(parsed.entities.filter((e) => e.type === "plan").map(
|
|
47843
|
-
const newPlanIds = plans.filter((p) => !existingPlanIds.has(p
|
|
47898
|
+
const existingPlanIds = new Set(parsed.entities.filter((e) => e.type === "plan").map(versionedCodegenId));
|
|
47899
|
+
const newPlanIds = plans.filter((p) => !existingPlanIds.has(versionedCodegenId(p))).map(versionedCodegenId);
|
|
47844
47900
|
const newPlanVarMap = new Map;
|
|
47845
47901
|
for (const id of newPlanIds) {
|
|
47846
47902
|
const varName = claimVarName({
|
|
@@ -47851,17 +47907,17 @@ async function updateConfigInPlace({
|
|
|
47851
47907
|
newPlanVarMap.set(id, varName);
|
|
47852
47908
|
}
|
|
47853
47909
|
const variantVarMap = new Map;
|
|
47854
|
-
for (const
|
|
47855
|
-
if (existingVariantVarMap.has(
|
|
47856
|
-
variantVarMap.set(
|
|
47910
|
+
for (const key of apiVariantMap.keys()) {
|
|
47911
|
+
if (existingVariantVarMap.has(key)) {
|
|
47912
|
+
variantVarMap.set(key, existingVariantVarMap.get(key));
|
|
47857
47913
|
continue;
|
|
47858
47914
|
}
|
|
47859
47915
|
const varName = claimVarName({
|
|
47860
|
-
candidate: variantIdToVarName(
|
|
47916
|
+
candidate: variantIdToVarName(key),
|
|
47861
47917
|
suffix: "Variant",
|
|
47862
47918
|
usedNames: existingVarNames
|
|
47863
47919
|
});
|
|
47864
|
-
variantVarMap.set(
|
|
47920
|
+
variantVarMap.set(key, varName);
|
|
47865
47921
|
}
|
|
47866
47922
|
const newRewardVarMap = new Map;
|
|
47867
47923
|
for (const { id } of rewards ?? []) {
|
|
@@ -47941,7 +47997,8 @@ async function updateConfigInPlace({
|
|
|
47941
47997
|
result2.featuresDeleted++;
|
|
47942
47998
|
}
|
|
47943
47999
|
} else if (entity.type === "plan") {
|
|
47944
|
-
const
|
|
48000
|
+
const planKey2 = versionedCodegenId(entity);
|
|
48001
|
+
const apiPlan = apiPlanMap.get(planKey2);
|
|
47945
48002
|
if (apiPlan) {
|
|
47946
48003
|
const newCode = generatePlanWithVariantsCode({
|
|
47947
48004
|
featureVarMap,
|
|
@@ -47951,14 +48008,14 @@ async function updateConfigInPlace({
|
|
|
47951
48008
|
variantVarMap
|
|
47952
48009
|
});
|
|
47953
48010
|
outputBlocks.push(newCode);
|
|
47954
|
-
matchedPlanIds.add(
|
|
48011
|
+
matchedPlanIds.add(planKey2);
|
|
47955
48012
|
lastPlanBlockIndex = outputBlocks.length - 1;
|
|
47956
48013
|
result2.plansUpdated++;
|
|
47957
48014
|
} else {
|
|
47958
48015
|
result2.plansDeleted++;
|
|
47959
48016
|
}
|
|
47960
48017
|
} else if (entity.type === "variant") {
|
|
47961
|
-
if (!apiVariantMap.has(entity
|
|
48018
|
+
if (!apiVariantMap.has(versionedCodegenId(entity))) {
|
|
47962
48019
|
result2.plansDeleted++;
|
|
47963
48020
|
}
|
|
47964
48021
|
} else if (entity.type === "reward") {
|
|
@@ -48053,13 +48110,13 @@ ${newFeatureCode}`);
|
|
|
48053
48110
|
}
|
|
48054
48111
|
result2.featuresAdded = newFeatures.length;
|
|
48055
48112
|
}
|
|
48056
|
-
const newPlans = plans.filter((p) => !matchedPlanIds.has(p
|
|
48113
|
+
const newPlans = plans.filter((p) => !matchedPlanIds.has(versionedCodegenId(p)));
|
|
48057
48114
|
if (newPlans.length > 0) {
|
|
48058
48115
|
const newPlanCode = newPlans.map((p) => generatePlanWithVariantsCode({
|
|
48059
48116
|
featureVarMap,
|
|
48060
48117
|
features,
|
|
48061
48118
|
plan: p,
|
|
48062
|
-
planVarName: newPlanVarMap.get(p
|
|
48119
|
+
planVarName: newPlanVarMap.get(versionedCodegenId(p)),
|
|
48063
48120
|
variantVarMap
|
|
48064
48121
|
})).join(`
|
|
48065
48122
|
|
|
@@ -48119,7 +48176,7 @@ ${newReferralPrograms.map((program2) => buildReferralProgramCode(program2, newRe
|
|
|
48119
48176
|
writeFileSync2(configPath, output, "utf-8");
|
|
48120
48177
|
return result2;
|
|
48121
48178
|
}
|
|
48122
|
-
var ensureAtmnImports = (importText, imports) => imports.reduce((text, name) => new RegExp(`\\b${name}\\b`).test(text) ? text : text.replace(/\{/, `{ ${name},`), importText);
|
|
48179
|
+
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
48180
|
var init_updateConfig = __esm(() => {
|
|
48124
48181
|
init_loadConfig();
|
|
48125
48182
|
init_env();
|
|
@@ -48193,10 +48250,6 @@ function buildConfigFile(features, plans, rewards = [], referralPrograms = []) {
|
|
|
48193
48250
|
return sections.join(`
|
|
48194
48251
|
`);
|
|
48195
48252
|
}
|
|
48196
|
-
var versionedCodegenId = ({
|
|
48197
|
-
id,
|
|
48198
|
-
version
|
|
48199
|
-
}) => version === undefined ? id : `${id}-v-${version}`;
|
|
48200
48253
|
var init_configFile = __esm(() => {
|
|
48201
48254
|
init_feature2();
|
|
48202
48255
|
init_plan2();
|
|
@@ -48433,7 +48486,7 @@ var init_pull = __esm(() => {
|
|
|
48433
48486
|
});
|
|
48434
48487
|
|
|
48435
48488
|
// src/lib/version.ts
|
|
48436
|
-
var APP_VERSION = "1.1.
|
|
48489
|
+
var APP_VERSION = "1.1.20";
|
|
48437
48490
|
|
|
48438
48491
|
// ../../node_modules/.bun/@tanstack+query-core@5.101.1/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
48439
48492
|
var Subscribable = class {
|
|
@@ -92314,17 +92367,13 @@ var init_cusEntTable = __esm(() => {
|
|
|
92314
92367
|
name: "customer_entitlements_entitlement_id_fkey"
|
|
92315
92368
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
92316
92369
|
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
92370
|
index("idx_customer_entitlements_internal_customer_id_btree").on(table3.internal_customer_id),
|
|
92319
92371
|
index("idx_customer_entitlements_entitlement_id").on(table3.entitlement_id),
|
|
92320
92372
|
index("idx_customer_entitlements_internal_feature_id_c").on(sql`${table3.internal_feature_id} COLLATE "C"`).concurrently(),
|
|
92321
92373
|
index("idx_ce_internal_feature_id").on(table3.internal_feature_id).concurrently(),
|
|
92322
92374
|
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
92375
|
index("idx_customer_entitlements_internal_entity_id").using("hash", table3.internal_entity_id),
|
|
92326
92376
|
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
92377
|
index("idx_customer_entitlements_loose_customer_expires").on(table3.internal_customer_id, table3.expires_at).where(sql`${table3.customer_product_id} IS NULL`),
|
|
92329
92378
|
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
92379
|
index("idx_customer_entitlements_pooled_contribution").on(table3.pooled_contribution_id).where(sql`${table3.pooled_contribution_id} IS NOT NULL`).concurrently(),
|
|
@@ -105883,7 +105932,7 @@ var init_usageLimit = __esm(() => {
|
|
|
105883
105932
|
exports_external.string().min(1).max(USAGE_LIMIT_FILTER_MAX_VALUE_LENGTH),
|
|
105884
105933
|
exports_external.number(),
|
|
105885
105934
|
exports_external.boolean()
|
|
105886
|
-
]).transform(String);
|
|
105935
|
+
]).transform(String).pipe(exports_external.string());
|
|
105887
105936
|
UsageLimitFilterSchema = exports_external.object({
|
|
105888
105937
|
properties: exports_external.record(exports_external.string().min(1).max(USAGE_LIMIT_FILTER_MAX_KEY_LENGTH), UsageLimitFilterValueSchema).meta({
|
|
105889
105938
|
description: "Event property equality conditions. A usage event counts toward this cap only when every listed property matches (AND)."
|
|
@@ -116319,16 +116368,64 @@ var init_V0_2_CusProductChange = __esm(() => {
|
|
|
116319
116368
|
init_utils11();
|
|
116320
116369
|
});
|
|
116321
116370
|
|
|
116371
|
+
// ../../shared/models/orgModels/orgConfig.ts
|
|
116372
|
+
var InvoicePaymentMethodSchema, OrgConfigSchema;
|
|
116373
|
+
var init_orgConfig = __esm(() => {
|
|
116374
|
+
init_v4();
|
|
116375
|
+
init_usageAlert();
|
|
116376
|
+
InvoicePaymentMethodSchema = exports_external.enum([
|
|
116377
|
+
"card",
|
|
116378
|
+
"customer_balance",
|
|
116379
|
+
"us_bank_account",
|
|
116380
|
+
"sepa_debit",
|
|
116381
|
+
"bacs_debit",
|
|
116382
|
+
"acss_debit",
|
|
116383
|
+
"link"
|
|
116384
|
+
]);
|
|
116385
|
+
OrgConfigSchema = exports_external.object({
|
|
116386
|
+
usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
116387
|
+
sandbox_usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
116388
|
+
bill_upgrade_immediately: exports_external.boolean().default(true),
|
|
116389
|
+
convert_to_charge_automatically: exports_external.boolean().default(true),
|
|
116390
|
+
anchor_start_of_month: exports_external.boolean().default(false),
|
|
116391
|
+
cancel_on_past_due: exports_external.boolean().default(false),
|
|
116392
|
+
prorate_unused: exports_external.boolean().default(true),
|
|
116393
|
+
checkout_on_failed_payment: exports_external.boolean().default(true),
|
|
116394
|
+
reverse_deduction_order: exports_external.boolean().default(false),
|
|
116395
|
+
include_past_due: exports_external.boolean().default(true),
|
|
116396
|
+
sync_status: exports_external.boolean().default(true),
|
|
116397
|
+
merge_billing_cycles: exports_external.boolean().default(true),
|
|
116398
|
+
multiple_trials: exports_external.boolean().default(false),
|
|
116399
|
+
allow_paid_default: exports_external.boolean().default(false),
|
|
116400
|
+
cache_customer: exports_external.boolean().default(false),
|
|
116401
|
+
invoice_memos: exports_external.boolean().default(false),
|
|
116402
|
+
entity_product: exports_external.boolean().default(false),
|
|
116403
|
+
void_invoices_on_subscription_deletion: exports_external.boolean().default(false),
|
|
116404
|
+
default_applies_to_entities: exports_external.boolean().default(false),
|
|
116405
|
+
disable_overage_billing: exports_external.boolean().default(false),
|
|
116406
|
+
disable_stripe_writes: exports_external.boolean().default(false),
|
|
116407
|
+
disabled_auto_topup: exports_external.boolean().default(false),
|
|
116408
|
+
persist_free_overage: exports_external.boolean().default(false),
|
|
116409
|
+
dryrun_autotopups: exports_external.boolean().default(false),
|
|
116410
|
+
forward_customer_metadata: exports_external.boolean().default(false),
|
|
116411
|
+
automatic_tax: exports_external.boolean().default(false),
|
|
116412
|
+
multi_currency: exports_external.boolean().default(false),
|
|
116413
|
+
allowed_payment_methods: exports_external.array(InvoicePaymentMethodSchema).min(1).nullish()
|
|
116414
|
+
});
|
|
116415
|
+
});
|
|
116416
|
+
|
|
116322
116417
|
// ../../shared/models/billingModels/context/billingContext.ts
|
|
116323
116418
|
var InvoiceModeSchema, BillingVersion;
|
|
116324
116419
|
var init_billingContext = __esm(() => {
|
|
116420
|
+
init_orgConfig();
|
|
116325
116421
|
init_v4();
|
|
116326
116422
|
InvoiceModeSchema = exports_external.object({
|
|
116327
116423
|
finalizeInvoice: exports_external.boolean().default(false),
|
|
116328
116424
|
enableProductImmediately: exports_external.boolean().default(true),
|
|
116329
116425
|
footer: exports_external.string().optional(),
|
|
116330
116426
|
memo: exports_external.string().optional(),
|
|
116331
|
-
daysUntilDue: exports_external.number().optional()
|
|
116427
|
+
daysUntilDue: exports_external.number().optional(),
|
|
116428
|
+
paymentMethodTypes: exports_external.array(InvoicePaymentMethodSchema).optional()
|
|
116332
116429
|
});
|
|
116333
116430
|
((BillingVersion2) => {
|
|
116334
116431
|
BillingVersion2["V1"] = "v1";
|
|
@@ -120990,7 +121087,8 @@ var init_attachParamsV0 = __esm(() => {
|
|
|
120990
121087
|
carry_over_usages: exports_external.object({
|
|
120991
121088
|
enabled: exports_external.boolean(),
|
|
120992
121089
|
feature_ids: exports_external.array(exports_external.string()).optional()
|
|
120993
|
-
}).optional()
|
|
121090
|
+
}).optional(),
|
|
121091
|
+
remove_plan_ids: exports_external.array(exports_external.string()).optional()
|
|
120994
121092
|
});
|
|
120995
121093
|
});
|
|
120996
121094
|
|
|
@@ -121140,6 +121238,9 @@ var init_attachParamsV1 = __esm(() => {
|
|
|
121140
121238
|
}),
|
|
121141
121239
|
currency: CurrencyCodeSchema.optional().meta({
|
|
121142
121240
|
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."
|
|
121241
|
+
}),
|
|
121242
|
+
remove_plan_ids: exports_external.array(exports_external.string()).optional().meta({
|
|
121243
|
+
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."
|
|
121143
121244
|
})
|
|
121144
121245
|
});
|
|
121145
121246
|
});
|
|
@@ -121440,7 +121541,7 @@ var init_eventsAggregateResponseV0 = __esm(() => {
|
|
|
121440
121541
|
});
|
|
121441
121542
|
|
|
121442
121543
|
// ../../shared/api/events/aggregate/eventsAggregateResponseV1.ts
|
|
121443
|
-
var EventAggregateListItemV1Schema, EventAggregateTotalItemSchema, EventsAggregateResponseV1Schema;
|
|
121544
|
+
var EventAggregateListItemV1Schema, EventAggregateTotalItemSchema, DeductionBalanceSchema, DeductionFeatureSchema, DeductionPeriodSchema, EventsAggregateResponseV1Schema;
|
|
121444
121545
|
var init_eventsAggregateResponseV1 = __esm(() => {
|
|
121445
121546
|
init_v4();
|
|
121446
121547
|
EventAggregateListItemV1Schema = exports_external.object({
|
|
@@ -121458,12 +121559,57 @@ var init_eventsAggregateResponseV1 = __esm(() => {
|
|
|
121458
121559
|
count: exports_external.number().meta({ description: "Number of events for this feature" }),
|
|
121459
121560
|
sum: exports_external.number().meta({ description: "Sum of event values for this feature" })
|
|
121460
121561
|
});
|
|
121562
|
+
DeductionBalanceSchema = exports_external.object({
|
|
121563
|
+
balance_id: exports_external.string().meta({
|
|
121564
|
+
description: "ID of the balance row drawn from (customer_entitlement or rollover)."
|
|
121565
|
+
}),
|
|
121566
|
+
entity_id: exports_external.string().nullable().meta({
|
|
121567
|
+
description: "Entity that owns this balance, or null when it is customer-level and shared."
|
|
121568
|
+
}),
|
|
121569
|
+
plan_id: exports_external.string().nullable().meta({
|
|
121570
|
+
description: "Plan the balance came with. Null for balances created outside a plan."
|
|
121571
|
+
}),
|
|
121572
|
+
reset: exports_external.object({
|
|
121573
|
+
interval: exports_external.string(),
|
|
121574
|
+
resets_at: exports_external.number().nullable()
|
|
121575
|
+
}).nullable().meta({ description: "Reset config for this balance, captured at deduction time." }),
|
|
121576
|
+
credit_cost: exports_external.number().nullable().meta({
|
|
121577
|
+
description: "Multiplier applied converting the tracked feature into this balance. Null when 1:1, or when the query spans sources converting at different rates."
|
|
121578
|
+
}),
|
|
121579
|
+
deducted: exports_external.number(),
|
|
121580
|
+
events: exports_external.number()
|
|
121581
|
+
});
|
|
121582
|
+
DeductionFeatureSchema = exports_external.object({
|
|
121583
|
+
feature_type: exports_external.enum(["metered", "credit_system"]).meta({
|
|
121584
|
+
description: "credit_system means `deducted` is credits; metered means it is that feature's own amount."
|
|
121585
|
+
}),
|
|
121586
|
+
deducted: exports_external.number(),
|
|
121587
|
+
events: exports_external.number(),
|
|
121588
|
+
balances: exports_external.array(DeductionBalanceSchema)
|
|
121589
|
+
});
|
|
121590
|
+
DeductionPeriodSchema = exports_external.object({
|
|
121591
|
+
period: exports_external.number().meta({
|
|
121592
|
+
description: "Unix timestamp (epoch ms), same basis as `list`."
|
|
121593
|
+
}),
|
|
121594
|
+
values: exports_external.record(exports_external.string(), DeductionFeatureSchema).meta({
|
|
121595
|
+
description: "Keyed by the feature that OWNS the balance drawn from, not the feature that was tracked."
|
|
121596
|
+
}),
|
|
121597
|
+
grouped_values: exports_external.record(exports_external.string(), exports_external.record(exports_external.string(), exports_external.object({
|
|
121598
|
+
deducted: exports_external.number(),
|
|
121599
|
+
credit_cost: exports_external.number().nullable().optional()
|
|
121600
|
+
}))).optional().meta({
|
|
121601
|
+
description: "Present only when group_by is used. Keyed by balance_id, then by group value — the only way to attribute a shared balance to the entity that spent from it."
|
|
121602
|
+
})
|
|
121603
|
+
});
|
|
121461
121604
|
EventsAggregateResponseV1Schema = exports_external.object({
|
|
121462
121605
|
list: exports_external.array(EventAggregateListItemV1Schema).meta({
|
|
121463
121606
|
description: "Array of time periods with aggregated values"
|
|
121464
121607
|
}),
|
|
121465
121608
|
total: exports_external.record(exports_external.string(), EventAggregateTotalItemSchema).meta({
|
|
121466
121609
|
description: "Total aggregations per feature. Keys are feature IDs, values contain count and sum."
|
|
121610
|
+
}),
|
|
121611
|
+
deductions: exports_external.array(DeductionPeriodSchema).optional().meta({
|
|
121612
|
+
description: 'Per-balance breakdown of what was consumed. Present only when aggregate_on is "deducted".'
|
|
121467
121613
|
})
|
|
121468
121614
|
});
|
|
121469
121615
|
});
|
|
@@ -122148,6 +122294,11 @@ var init_customerProductsToStripeSubscriptionIds = __esm(() => {
|
|
|
122148
122294
|
init_shared2();
|
|
122149
122295
|
});
|
|
122150
122296
|
|
|
122297
|
+
// ../../shared/utils/cusProductUtils/convertCusProduct/customerProductToApiSubscriptionStatus.ts
|
|
122298
|
+
var init_customerProductToApiSubscriptionStatus = __esm(() => {
|
|
122299
|
+
init_cusProductEnums();
|
|
122300
|
+
});
|
|
122301
|
+
|
|
122151
122302
|
// ../../shared/utils/cusProductUtils/convertCusProduct/customerProductToReplacementKey.ts
|
|
122152
122303
|
var init_customerProductToReplacementKey = __esm(() => {
|
|
122153
122304
|
init_classifyProductUtils();
|
|
@@ -122618,6 +122769,7 @@ var init_cusProductUtils2 = __esm(() => {
|
|
|
122618
122769
|
init_cusProductToConvertedFeatureOptions();
|
|
122619
122770
|
init_customerProductsToRecurringActiveAndScheduled();
|
|
122620
122771
|
init_customerProductsToStripeSubscriptionIds();
|
|
122772
|
+
init_customerProductToApiSubscriptionStatus();
|
|
122621
122773
|
init_customerProductToEffectivePrices();
|
|
122622
122774
|
init_customerProductToReplacementKey();
|
|
122623
122775
|
init_cusProductConstants();
|
|
@@ -122858,7 +123010,6 @@ var init_classifyItemUtils = __esm(() => {
|
|
|
122858
123010
|
init_productItemModels();
|
|
122859
123011
|
init_convertItemUtils();
|
|
122860
123012
|
});
|
|
122861
|
-
|
|
122862
123013
|
// ../../shared/utils/productV2Utils/productItemUtils/sortPlanItems.ts
|
|
122863
123014
|
var init_sortPlanItems = __esm(() => {
|
|
122864
123015
|
init_productItemModels();
|
|
@@ -123356,6 +123507,98 @@ var init_planParamsV1ToProductV2 = __esm(() => {
|
|
|
123356
123507
|
init_planParamsV1ToProductItems();
|
|
123357
123508
|
});
|
|
123358
123509
|
|
|
123510
|
+
// ../../shared/api/products/components/planChange/planItemChangeV0.ts
|
|
123511
|
+
var PlanItemChangeV0Schema;
|
|
123512
|
+
var init_planItemChangeV0 = __esm(() => {
|
|
123513
|
+
init_v4();
|
|
123514
|
+
init_apiPlanItemV1();
|
|
123515
|
+
PlanItemChangeV0Schema = exports_external.object({
|
|
123516
|
+
action: exports_external.enum(["created", "deleted"]).meta({
|
|
123517
|
+
description: "Whether the item was added to or removed from the plan."
|
|
123518
|
+
}),
|
|
123519
|
+
feature_id: exports_external.string().meta({
|
|
123520
|
+
description: "The ID of the feature that was added or removed."
|
|
123521
|
+
}),
|
|
123522
|
+
item: ApiPlanItemV1Schema.meta({
|
|
123523
|
+
description: "The plan item snapshot that was added or removed."
|
|
123524
|
+
})
|
|
123525
|
+
});
|
|
123526
|
+
});
|
|
123527
|
+
|
|
123528
|
+
// ../../shared/api/products/components/planChange/planPreviousAttributesV0.ts
|
|
123529
|
+
var PlanPreviousAttributesV0Schema;
|
|
123530
|
+
var init_planPreviousAttributesV0 = __esm(() => {
|
|
123531
|
+
init_customerBillingControls();
|
|
123532
|
+
init_apiPlanV1();
|
|
123533
|
+
init_apiFreeTrialV2();
|
|
123534
|
+
PlanPreviousAttributesV0Schema = ApiPlanV1Schema.pick({
|
|
123535
|
+
id: true,
|
|
123536
|
+
name: true,
|
|
123537
|
+
description: true,
|
|
123538
|
+
group: true,
|
|
123539
|
+
add_on: true,
|
|
123540
|
+
auto_enable: true,
|
|
123541
|
+
config: true
|
|
123542
|
+
}).partial().extend({
|
|
123543
|
+
free_trial: ApiFreeTrialV2Schema.nullable().optional().meta({
|
|
123544
|
+
description: "Previous free trial when it changed. Null when the plan had none."
|
|
123545
|
+
}),
|
|
123546
|
+
billing_controls: CustomerBillingControlsSchema.nullable().optional().meta({
|
|
123547
|
+
description: "Previous billing controls when they changed. Null when unset."
|
|
123548
|
+
})
|
|
123549
|
+
});
|
|
123550
|
+
});
|
|
123551
|
+
|
|
123552
|
+
// ../../shared/api/products/components/planChange/planChangeV0.ts
|
|
123553
|
+
var PlanPriceChangeV0Schema, PlanFreeTrialChangeV0Schema, PlanChangeV0Schema;
|
|
123554
|
+
var init_planChangeV0 = __esm(() => {
|
|
123555
|
+
init_v4();
|
|
123556
|
+
init_apiPlanV1();
|
|
123557
|
+
init_apiFreeTrialV2();
|
|
123558
|
+
init_planItemChangeV0();
|
|
123559
|
+
init_planPreviousAttributesV0();
|
|
123560
|
+
PlanPriceChangeV0Schema = exports_external.object({
|
|
123561
|
+
previous: ApiPlanV1Schema.shape.price.meta({
|
|
123562
|
+
description: "The plan's price before the change."
|
|
123563
|
+
}),
|
|
123564
|
+
current: ApiPlanV1Schema.shape.price.meta({
|
|
123565
|
+
description: "The plan's price after the change."
|
|
123566
|
+
})
|
|
123567
|
+
});
|
|
123568
|
+
PlanFreeTrialChangeV0Schema = exports_external.object({
|
|
123569
|
+
previous: ApiFreeTrialV2Schema.nullable().meta({
|
|
123570
|
+
description: "The plan's free trial before the change. Null when none."
|
|
123571
|
+
}),
|
|
123572
|
+
current: ApiFreeTrialV2Schema.nullable().meta({
|
|
123573
|
+
description: "The plan's free trial after the change. Null when none."
|
|
123574
|
+
})
|
|
123575
|
+
});
|
|
123576
|
+
PlanChangeV0Schema = exports_external.object({
|
|
123577
|
+
plan: ApiPlanV1Schema.optional().meta({
|
|
123578
|
+
description: "The plan after the change. Omitted unless the caller expands it."
|
|
123579
|
+
}),
|
|
123580
|
+
previous_attributes: PlanPreviousAttributesV0Schema.nullable().meta({
|
|
123581
|
+
description: "Sparse map of scalar plan fields that changed, holding their previous values. Null when the plan is new."
|
|
123582
|
+
}),
|
|
123583
|
+
price_change: PlanPriceChangeV0Schema.optional().meta({
|
|
123584
|
+
description: "Present when the plan's price changed."
|
|
123585
|
+
}),
|
|
123586
|
+
free_trial_change: PlanFreeTrialChangeV0Schema.optional().meta({
|
|
123587
|
+
description: "Present when the plan's free trial changed."
|
|
123588
|
+
}),
|
|
123589
|
+
item_changes: exports_external.array(PlanItemChangeV0Schema).default([]).meta({
|
|
123590
|
+
description: "Feature items added to or removed from the plan."
|
|
123591
|
+
})
|
|
123592
|
+
});
|
|
123593
|
+
});
|
|
123594
|
+
|
|
123595
|
+
// ../../shared/api/products/components/planChange/index.ts
|
|
123596
|
+
var init_planChange = __esm(() => {
|
|
123597
|
+
init_planChangeV0();
|
|
123598
|
+
init_planItemChangeV0();
|
|
123599
|
+
init_planPreviousAttributesV0();
|
|
123600
|
+
});
|
|
123601
|
+
|
|
123359
123602
|
// ../../shared/api/products/crud/createVariantParamsV2.ts
|
|
123360
123603
|
var CreateVariantParamsV2Schema;
|
|
123361
123604
|
var init_createVariantParamsV2 = __esm(() => {
|
|
@@ -124233,6 +124476,7 @@ var init_products2 = __esm(() => {
|
|
|
124233
124476
|
init_basePriceToProductItem();
|
|
124234
124477
|
init_billingMethod();
|
|
124235
124478
|
init_display();
|
|
124479
|
+
init_planChange();
|
|
124236
124480
|
init_planExpand();
|
|
124237
124481
|
init_crud3();
|
|
124238
124482
|
init_items();
|
|
@@ -125221,17 +125465,22 @@ var init_checkoutResponseV0 = __esm(() => {
|
|
|
125221
125465
|
});
|
|
125222
125466
|
|
|
125223
125467
|
// ../../shared/api/billing/common/customerPlanChange.ts
|
|
125224
|
-
var PlanChangeActionEnum, SubscriptionStatusEnum, PurchaseStatusEnum, SubscriptionSnapshotSchema, PurchaseSnapshotSchema,
|
|
125468
|
+
var PlanChangeActionEnum, SubscriptionStatusEnum, PurchaseStatusEnum, SubscriptionSnapshotSchema, PurchaseSnapshotSchema, CustomerPlanPreviousAttributesSchema, CustomerPlanChangeSchema;
|
|
125225
125469
|
var init_customerPlanChange = __esm(() => {
|
|
125470
|
+
init_planChangeV0();
|
|
125471
|
+
init_planItemChangeV0();
|
|
125226
125472
|
init_v4();
|
|
125227
|
-
init_apiPlanItemV1();
|
|
125228
125473
|
PlanChangeActionEnum = exports_external.enum([
|
|
125229
125474
|
"activated",
|
|
125230
125475
|
"scheduled",
|
|
125231
125476
|
"updated",
|
|
125232
125477
|
"expired"
|
|
125233
125478
|
]);
|
|
125234
|
-
SubscriptionStatusEnum = exports_external.enum([
|
|
125479
|
+
SubscriptionStatusEnum = exports_external.enum([
|
|
125480
|
+
"active",
|
|
125481
|
+
"scheduled",
|
|
125482
|
+
"expired"
|
|
125483
|
+
]);
|
|
125235
125484
|
PurchaseStatusEnum = exports_external.enum(["active", "scheduled", "expired"]);
|
|
125236
125485
|
SubscriptionSnapshotSchema = exports_external.object({
|
|
125237
125486
|
plan_id: exports_external.string().meta({
|
|
@@ -125273,17 +125522,13 @@ var init_customerPlanChange = __esm(() => {
|
|
|
125273
125522
|
description: "When the purchase ends, in milliseconds since the Unix epoch, or null if no expiry is set."
|
|
125274
125523
|
})
|
|
125275
125524
|
});
|
|
125276
|
-
|
|
125277
|
-
|
|
125278
|
-
|
|
125279
|
-
|
|
125280
|
-
|
|
125281
|
-
|
|
125282
|
-
|
|
125283
|
-
item: ApiPlanItemV1Schema.meta({
|
|
125284
|
-
description: "The item snapshot that was added or removed."
|
|
125285
|
-
})
|
|
125286
|
-
});
|
|
125525
|
+
CustomerPlanPreviousAttributesSchema = SubscriptionSnapshotSchema.pick({
|
|
125526
|
+
status: true,
|
|
125527
|
+
past_due: true,
|
|
125528
|
+
canceled_at: true,
|
|
125529
|
+
expires_at: true,
|
|
125530
|
+
trial_ends_at: true
|
|
125531
|
+
}).partial();
|
|
125287
125532
|
CustomerPlanChangeSchema = exports_external.object({
|
|
125288
125533
|
action: PlanChangeActionEnum.meta({
|
|
125289
125534
|
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)."
|
|
@@ -125294,11 +125539,15 @@ var init_customerPlanChange = __esm(() => {
|
|
|
125294
125539
|
purchase: PurchaseSnapshotSchema.optional().meta({
|
|
125295
125540
|
description: "The purchase as it stands after this change. Present when the plan is a one-off purchase."
|
|
125296
125541
|
}),
|
|
125297
|
-
previous_attributes:
|
|
125298
|
-
description: "Sparse map of scalar fields whose values changed, holding their previous values. Null when the plan is newly activated or scheduled."
|
|
125542
|
+
previous_attributes: CustomerPlanPreviousAttributesSchema.nullable().meta({
|
|
125543
|
+
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."
|
|
125544
|
+
}),
|
|
125545
|
+
plan_change: PlanChangeV0Schema.optional().meta({
|
|
125546
|
+
description: "Content-level change to the plan definition for this customer plan (items, base price, free trial)."
|
|
125299
125547
|
}),
|
|
125300
|
-
item_changes: exports_external.array(
|
|
125301
|
-
|
|
125548
|
+
item_changes: exports_external.array(PlanItemChangeV0Schema).default([]).meta({
|
|
125549
|
+
deprecated: true,
|
|
125550
|
+
description: "Deprecated — use plan_change.item_changes. Features that were added to or removed from this plan."
|
|
125302
125551
|
})
|
|
125303
125552
|
});
|
|
125304
125553
|
});
|
|
@@ -125403,6 +125652,34 @@ var init_common3 = __esm(() => {
|
|
|
125403
125652
|
init_transitionRules();
|
|
125404
125653
|
});
|
|
125405
125654
|
|
|
125655
|
+
// ../../shared/api/billing/components/billingChanges/previewBalanceChange.ts
|
|
125656
|
+
var PreviewBalanceSchema, PreviewBalanceChangeSchema;
|
|
125657
|
+
var init_previewBalanceChange = __esm(() => {
|
|
125658
|
+
init_v4();
|
|
125659
|
+
PreviewBalanceSchema = exports_external.object({
|
|
125660
|
+
granted: exports_external.number(),
|
|
125661
|
+
remaining: exports_external.number(),
|
|
125662
|
+
usage: exports_external.number(),
|
|
125663
|
+
unlimited: exports_external.boolean(),
|
|
125664
|
+
next_reset_at: exports_external.number().nullable()
|
|
125665
|
+
});
|
|
125666
|
+
PreviewBalanceChangeSchema = exports_external.object({
|
|
125667
|
+
feature_id: exports_external.string(),
|
|
125668
|
+
balance: PreviewBalanceSchema,
|
|
125669
|
+
previous_attributes: exports_external.record(exports_external.string(), exports_external.unknown()).default({})
|
|
125670
|
+
});
|
|
125671
|
+
});
|
|
125672
|
+
|
|
125673
|
+
// ../../shared/api/billing/components/billingChanges/previewFlagChange.ts
|
|
125674
|
+
var PreviewFlagChangeSchema;
|
|
125675
|
+
var init_previewFlagChange = __esm(() => {
|
|
125676
|
+
init_v4();
|
|
125677
|
+
PreviewFlagChangeSchema = exports_external.object({
|
|
125678
|
+
action: exports_external.enum(["created", "deleted"]),
|
|
125679
|
+
feature_id: exports_external.string()
|
|
125680
|
+
});
|
|
125681
|
+
});
|
|
125682
|
+
|
|
125406
125683
|
// ../../shared/api/billing/dfu/dfuFlashParams.ts
|
|
125407
125684
|
var ProcessorTypeSchema, FlashCustomerDataSchema, FlashProcessorIdentitySchema, FlashLinkSchema, FlashStartingAfterSchema, FlashBalanceFilterSchema, FlashRolloverSchema, FlashBalanceSchema, FlashFeatureQuantitySchema, FlashPlanSchema, FlashPhaseSchema, FlashBillableSchema, FlashEntitySchema, DfuFlashParamsSchema, DfuFlashedPlanSchema, DfuFlashResultSchema;
|
|
125408
125685
|
var init_dfuFlashParams = __esm(() => {
|
|
@@ -125884,7 +126161,7 @@ var init_syncProposalsV2 = __esm(() => {
|
|
|
125884
126161
|
});
|
|
125885
126162
|
|
|
125886
126163
|
// ../../shared/api/billing/verify/verifyParamsV1.ts
|
|
125887
|
-
var VerifyParamsV1Schema, ItemMismatchReasonSchema, message, severity, ItemMismatchSchema, BasePriceMismatchSchema, PrepaidQuantityMismatchSchema, PrepaidPriceMismatchSchema, ScheduleMismatchSchema, CancelStateMismatchSchema, RewardMismatchSchema, StripeSubNotInAutumnMismatchSchema, StaleSubscriptionLinkMismatchSchema, ExpectedStateErrorMismatchSchema, SubscriptionMismatchSchema, SubscriptionVerifyResultSchema, VerifyResponseSchema;
|
|
126164
|
+
var VerifyParamsV1Schema, ItemMismatchReasonSchema, message, severity, ItemMismatchSchema, BasePriceMismatchSchema, PrepaidQuantityMismatchSchema, PrepaidPriceMismatchSchema, ScheduleMismatchSchema, CancelStateMismatchSchema, RewardMismatchSchema, StripeSubNotInAutumnMismatchSchema, StaleSubscriptionLinkMismatchSchema, ExpectedStateErrorMismatchSchema, SharedStripeCustomerMismatchSchema, SubscriptionMismatchSchema, SubscriptionVerifyResultSchema, VerifyResponseSchema;
|
|
125888
126165
|
var init_verifyParamsV1 = __esm(() => {
|
|
125889
126166
|
init_v4();
|
|
125890
126167
|
VerifyParamsV1Schema = exports_external.object({
|
|
@@ -126009,6 +126286,13 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
126009
126286
|
severity,
|
|
126010
126287
|
error: exports_external.string()
|
|
126011
126288
|
});
|
|
126289
|
+
SharedStripeCustomerMismatchSchema = exports_external.object({
|
|
126290
|
+
type: exports_external.literal("shared_stripe_customer"),
|
|
126291
|
+
message,
|
|
126292
|
+
severity,
|
|
126293
|
+
stripe_customer_id: exports_external.string(),
|
|
126294
|
+
other_customer_ids: exports_external.array(exports_external.string())
|
|
126295
|
+
});
|
|
126012
126296
|
SubscriptionMismatchSchema = exports_external.discriminatedUnion("type", [
|
|
126013
126297
|
BasePriceMismatchSchema,
|
|
126014
126298
|
ItemMismatchSchema,
|
|
@@ -126019,7 +126303,8 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
126019
126303
|
RewardMismatchSchema,
|
|
126020
126304
|
StripeSubNotInAutumnMismatchSchema,
|
|
126021
126305
|
StaleSubscriptionLinkMismatchSchema,
|
|
126022
|
-
ExpectedStateErrorMismatchSchema
|
|
126306
|
+
ExpectedStateErrorMismatchSchema,
|
|
126307
|
+
SharedStripeCustomerMismatchSchema
|
|
126023
126308
|
]);
|
|
126024
126309
|
SubscriptionVerifyResultSchema = exports_external.object({
|
|
126025
126310
|
stripe_subscription_id: exports_external.string(),
|
|
@@ -126028,6 +126313,7 @@ var init_verifyParamsV1 = __esm(() => {
|
|
|
126028
126313
|
});
|
|
126029
126314
|
VerifyResponseSchema = exports_external.object({
|
|
126030
126315
|
customer_id: exports_external.string(),
|
|
126316
|
+
customer_mismatches: exports_external.array(SubscriptionMismatchSchema),
|
|
126031
126317
|
subscriptions: exports_external.array(SubscriptionVerifyResultSchema)
|
|
126032
126318
|
});
|
|
126033
126319
|
});
|
|
@@ -126043,6 +126329,8 @@ var init_billing = __esm(() => {
|
|
|
126043
126329
|
init_checkoutParamsV0();
|
|
126044
126330
|
init_checkoutResponseV0();
|
|
126045
126331
|
init_common3();
|
|
126332
|
+
init_previewBalanceChange();
|
|
126333
|
+
init_previewFlagChange();
|
|
126046
126334
|
init_createScheduleParamsV0();
|
|
126047
126335
|
init_createScheduleResponse();
|
|
126048
126336
|
init_dfuFlashParams();
|
|
@@ -126296,6 +126584,9 @@ var init_eventsAggregateParams = __esm(() => {
|
|
|
126296
126584
|
}),
|
|
126297
126585
|
max_groups: exports_external.number().int().min(1).max(250).optional().meta({
|
|
126298
126586
|
description: "Maximum number of distinct group values to return per time bin when using group_by. Remaining values are bundled into an 'Other' bucket. Defaults to 9"
|
|
126587
|
+
}),
|
|
126588
|
+
aggregate_on: exports_external.enum(["deducted"]).optional().meta({
|
|
126589
|
+
description: 'Set to "deducted" to additionally return a per-balance breakdown of what each event consumed, under `deductions`. Purely additive: `list` and `total` are unchanged. Requires customer_id.'
|
|
126299
126590
|
})
|
|
126300
126591
|
});
|
|
126301
126592
|
EventsAggregateParamsSchema = ExtEventsAggregateParamsSchema.refine((data) => {
|
|
@@ -132868,42 +133159,6 @@ var init_idempotencyConfig = __esm(() => {
|
|
|
132868
133159
|
});
|
|
132869
133160
|
});
|
|
132870
133161
|
|
|
132871
|
-
// ../../shared/models/orgModels/orgConfig.ts
|
|
132872
|
-
var OrgConfigSchema;
|
|
132873
|
-
var init_orgConfig = __esm(() => {
|
|
132874
|
-
init_v4();
|
|
132875
|
-
init_usageAlert();
|
|
132876
|
-
OrgConfigSchema = exports_external.object({
|
|
132877
|
-
usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
132878
|
-
sandbox_usage_alerts: exports_external.array(DbUsageAlertSchema).optional().default([]),
|
|
132879
|
-
bill_upgrade_immediately: exports_external.boolean().default(true),
|
|
132880
|
-
convert_to_charge_automatically: exports_external.boolean().default(true),
|
|
132881
|
-
anchor_start_of_month: exports_external.boolean().default(false),
|
|
132882
|
-
cancel_on_past_due: exports_external.boolean().default(false),
|
|
132883
|
-
prorate_unused: exports_external.boolean().default(true),
|
|
132884
|
-
checkout_on_failed_payment: exports_external.boolean().default(true),
|
|
132885
|
-
reverse_deduction_order: exports_external.boolean().default(false),
|
|
132886
|
-
include_past_due: exports_external.boolean().default(true),
|
|
132887
|
-
sync_status: exports_external.boolean().default(true),
|
|
132888
|
-
merge_billing_cycles: exports_external.boolean().default(true),
|
|
132889
|
-
multiple_trials: exports_external.boolean().default(false),
|
|
132890
|
-
allow_paid_default: exports_external.boolean().default(false),
|
|
132891
|
-
cache_customer: exports_external.boolean().default(false),
|
|
132892
|
-
invoice_memos: exports_external.boolean().default(false),
|
|
132893
|
-
entity_product: exports_external.boolean().default(false),
|
|
132894
|
-
void_invoices_on_subscription_deletion: exports_external.boolean().default(false),
|
|
132895
|
-
default_applies_to_entities: exports_external.boolean().default(false),
|
|
132896
|
-
disable_overage_billing: exports_external.boolean().default(false),
|
|
132897
|
-
disable_stripe_writes: exports_external.boolean().default(false),
|
|
132898
|
-
disabled_auto_topup: exports_external.boolean().default(false),
|
|
132899
|
-
persist_free_overage: exports_external.boolean().default(false),
|
|
132900
|
-
dryrun_autotopups: exports_external.boolean().default(false),
|
|
132901
|
-
forward_customer_metadata: exports_external.boolean().default(false),
|
|
132902
|
-
automatic_tax: exports_external.boolean().default(false),
|
|
132903
|
-
multi_currency: exports_external.boolean().default(false)
|
|
132904
|
-
});
|
|
132905
|
-
});
|
|
132906
|
-
|
|
132907
133162
|
// ../../shared/models/orgModels/frontendOrg.ts
|
|
132908
133163
|
var FrontendOrgSchema;
|
|
132909
133164
|
var init_frontendOrg = __esm(() => {
|
|
@@ -133656,7 +133911,7 @@ var init_error3 = __esm(() => {
|
|
|
133656
133911
|
};
|
|
133657
133912
|
});
|
|
133658
133913
|
|
|
133659
|
-
// ../../node_modules/.bun/better-auth@1.6.25+
|
|
133914
|
+
// ../../node_modules/.bun/better-auth@1.6.25+fdfecc926c70e080/node_modules/better-auth/dist/plugins/access/access.mjs
|
|
133660
133915
|
function unknownResourceResponse(requestedResource) {
|
|
133661
133916
|
return {
|
|
133662
133917
|
success: false,
|
|
@@ -133745,12 +134000,12 @@ var init_access = __esm(() => {
|
|
|
133745
134000
|
init_error3();
|
|
133746
134001
|
});
|
|
133747
134002
|
|
|
133748
|
-
// ../../node_modules/.bun/better-auth@1.6.25+
|
|
134003
|
+
// ../../node_modules/.bun/better-auth@1.6.25+fdfecc926c70e080/node_modules/better-auth/dist/plugins/access/index.mjs
|
|
133749
134004
|
var init_access2 = __esm(() => {
|
|
133750
134005
|
init_access();
|
|
133751
134006
|
});
|
|
133752
134007
|
|
|
133753
|
-
// ../../node_modules/.bun/better-auth@1.6.25+
|
|
134008
|
+
// ../../node_modules/.bun/better-auth@1.6.25+fdfecc926c70e080/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
|
|
133754
134009
|
var defaultStatements, defaultAc, adminAc, ownerAc, memberAc;
|
|
133755
134010
|
var init_statement = __esm(() => {
|
|
133756
134011
|
init_access();
|
|
@@ -133824,7 +134079,7 @@ var init_statement = __esm(() => {
|
|
|
133824
134079
|
});
|
|
133825
134080
|
});
|
|
133826
134081
|
|
|
133827
|
-
// ../../node_modules/.bun/better-auth@1.6.25+
|
|
134082
|
+
// ../../node_modules/.bun/better-auth@1.6.25+fdfecc926c70e080/node_modules/better-auth/dist/plugins/organization/access/index.mjs
|
|
133828
134083
|
var init_access3 = __esm(() => {
|
|
133829
134084
|
init_statement();
|
|
133830
134085
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atmn",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"atmn": "dist/cli.js"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "bun run bun.config.ts",
|
|
35
35
|
"dev": "nodemon -e ts,tsx --watch src --ignore dist --exec \"bun run bun.config.ts\"",
|
|
36
36
|
"dev:bun": "bun run dev.ts",
|
|
37
|
-
"test": "bun test test/*.test.ts test/codegen test/nuke test/pull test/push test/workflow",
|
|
37
|
+
"test": "bun test test/*.test.ts test/auth test/codegen test/nuke test/pull test/push test/workflow",
|
|
38
38
|
"test:integration": "cd ../../server && ENV_FILE=.env infisical run --env=dev --recursive -- bun test --timeout 0 ../packages/atmn/test/integration",
|
|
39
39
|
"test:integration:cli": "cd ../../server && ENV_FILE=.env infisical run --env=dev --recursive -- bun ../packages/atmn/test/integration/cli.ts",
|
|
40
40
|
"test:unit": "bun test test/codegen",
|