feat: 🎸 sync pkg version

This commit is contained in:
amianthus
2026-03-25 16:32:53 +00:00
parent 2652ea72fd
commit 93fe18b6bb
7 changed files with 127 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
// AUTO-GENERATED by atmn pull
// DO NOT EDIT MANUALLY
import type {} from "@useautumn/sdk";
declare module '@useautumn/sdk' {
// Features
export const chat_messages: Feature;

View File

@@ -174,6 +174,7 @@ export default function UseEventsScenarioPage() {
<Button
size="sm"
variant="outline"
// @ts-expect-error
onClick={() => listEvents.refetch()}
disabled={listEvents.isFetching}
>

View File

@@ -0,0 +1,114 @@
import { Autumn } from "autumn-js";
const FAKE_URL =
"https://totallynotarealdomaingeneratedbyclaudetomakethetestsworktofail.co";
let passed = 0;
let failed = 0;
function assert(label: string, condition: boolean) {
if (condition) {
console.log(` PASS: ${label}`);
passed++;
} else {
console.error(` FAIL: ${label}`);
failed++;
}
}
async function testCheckFailOpen() {
console.log("\n--- check() fail-open (enabled by default) ---");
const autumn = new Autumn({
secretKey: "sk_fake",
serverURL: FAKE_URL,
failOpen: true,
});
const result = await autumn.check({
customerId: "cus_123",
featureId: "messages",
});
assert("allowed is true", result.allowed === true);
assert("customerId is empty string", result.customerId === "");
assert("balance is null", result.balance === null);
console.log("Response:", JSON.stringify(result, null, 2));
}
async function testTrackFailOpen() {
console.log("\n--- track() fail-open (enabled by default) ---");
const autumn = new Autumn({
secretKey: "sk_fake",
serverURL: FAKE_URL,
});
const result = await autumn.track({
customerId: "cus_123",
featureId: "messages",
value: 1,
});
assert("customerId is empty string", result.customerId === "");
assert("value is 0", result.value === 0);
assert("balance is null", result.balance === null);
console.log("Response:", JSON.stringify(result, null, 2));
}
async function testGetCustomerFailOpen() {
console.log(
"\n--- customers.getOrCreate() fail-open (enabled by default) ---",
);
const autumn = new Autumn({
secretKey: "sk_fake",
serverURL: FAKE_URL,
});
const result = await autumn.customers.getOrCreate({
customerId: "cus_123",
});
assert("id is null", result.id === null);
assert("createdAt is 0", result.createdAt === 0);
assert(
"subscriptions is empty array",
Array.isArray(result.subscriptions) && result.subscriptions.length === 0,
);
assert("balances is empty object", Object.keys(result.balances).length === 0);
console.log("Response:", JSON.stringify(result, null, 2));
}
async function testFailOpenDisabled() {
console.log("\n--- check() with failOpen: false (should throw) ---");
const autumn = new Autumn({
secretKey: "sk_fake",
serverURL: FAKE_URL,
failOpen: false,
});
try {
await autumn.check({
customerId: "cus_123",
featureId: "messages",
});
assert("should have thrown", false);
} catch (err) {
assert("correctly threw error", true);
console.log(` Error: ${(err as Error).message}`);
}
}
async function main() {
console.log("=== Autumn SDK Fail-Open Tests ===");
await testCheckFailOpen();
await testTrackFailOpen();
await testGetCustomerFailOpen();
await testFailOpenDisabled();
console.log(`\n=== Results: ${passed} passed, ${failed} failed ===`);
if (failed > 0) {
process.exit(1);
}
}
main().catch(console.error);

View File

@@ -175,7 +175,7 @@
},
"packages/autumn-js": {
"name": "autumn-js",
"version": "1.1.2",
"version": "1.1.3",
"dependencies": {
"query-string": "^9.2.2",
"rou3": "^0.6.1",
@@ -240,7 +240,7 @@
},
"packages/sdk": {
"name": "@useautumn/sdk",
"version": "0.10.17",
"version": "0.10.18",
"dependencies": {
"zod": "^3.25.65 || ^4.0.0",
},

View File

@@ -1,6 +1,8 @@
// AUTO-GENERATED by atmn pull
// DO NOT EDIT MANUALLY
import type {} from "@useautumn/sdk";
declare module '@useautumn/sdk' {
// Features
export const messages: Feature;

View File

@@ -21,10 +21,14 @@ export async function generateSdkTypes(options: {
// Generate type definitions
const sections: string[] = [];
// Header
// Header -- top-level import makes this a module file,
// turning `declare module` into an augmentation instead of
// an ambient declaration that replaces the real module types.
sections.push(`// AUTO-GENERATED by atmn pull`);
sections.push(`// DO NOT EDIT MANUALLY`);
sections.push(``);
sections.push(`import type {} from "@useautumn/sdk";`);
sections.push(``);
sections.push(`declare module '@useautumn/sdk' {`);
sections.push(``);

View File

@@ -1,7 +1,7 @@
{
"name": "autumn-js",
"description": "Autumn JS Library",
"version": "1.1.2",
"version": "1.1.3",
"repository": "github:useautumn/autumn",
"homepage": "https://docs.useautumn.com",
"main": "./dist/sdk/index.js",