Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# Changelog

## 0.13.2
## 0.13.3

<!-- release:start -->

### New Features

- **Autumn `balances.check`** — the Autumn emulator now supports the SDK's `check()` call (`POST /v1/balances.check`). Access is computed from the same plan items and tracked usage that drive customer balances: unlimited and overage-allowed features always pass, metered features pass while remaining balance covers `required_balance` (default 1), and a feature the customer's plan does not carry is allowed with a `null` balance. The response carries the full balance object (`granted`, `remaining`, `usage`, `unlimited`, `overage_allowed`) in the shape autumn-js validates, and the route participates in fault injection and the request ledger like every other operation.
- **WorkOS `organizations.deleteOrganization`** — the WorkOS emulator now supports the SDK's org delete (`DELETE /organizations/:id`), returning 204 No Content like the real API. Deletion cascades to the organization's memberships, so a subsequent `getOrganization` 404s and the org drops out of `listOrganizationMemberships`, matching real WorkOS.

<!-- release:end -->

## 0.13.2

### New Features

- **Autumn `balances.check`** — the Autumn emulator now supports the SDK's `check()` call (`POST /v1/balances.check`). Access is computed from the same plan items and tracked usage that drive customer balances: unlimited and overage-allowed features always pass, metered features pass while remaining balance covers `required_balance` (default 1), and a feature the customer's plan does not carry is allowed with a `null` balance. The response carries the full balance object (`granted`, `remaining`, `usage`, `unlimited`, `overage_allowed`) in the shape autumn-js validates, and the route participates in fault injection and the request ledger like every other operation.

## 0.13.1

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/adapter-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/adapter-next",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/apple/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/apple",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/autumn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/autumn",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/aws/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/aws",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/clerk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/clerk",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/cloudflare",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/core",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/github",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/gitlab/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/gitlab",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/google/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/google",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/mcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/mcp",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/microsoft/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/microsoft",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/mongoatlas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/mongoatlas",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/okta/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/okta",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/posthog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/posthog",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/resend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/resend",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/slack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/slack",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/spotify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/spotify",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/stripe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/stripe",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/vercel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/vercel",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/workos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/workos",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
29 changes: 29 additions & 0 deletions packages/@emulators/workos/src/__tests__/workos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,35 @@ describe("workos emulator with the real @workos-inc/node SDK", () => {
}
});

it("deletes an organization and cascades its memberships", async () => {
const code = await signInAndGetCode("dana@example.com");
const auth = await workos.userManagement.authenticateWithCode({
code,
clientId: CLIENT_ID,
session: { sealSession: true, cookiePassword: COOKIE_PASSWORD },
});

const org = await workos.organizations.createOrganization({ name: "Doomed Org" });
await workos.userManagement.createOrganizationMembership({
organizationId: org.id,
userId: auth.user.id,
roleSlug: "admin",
});

// The real SDK's delete resolves (204 No Content), no throw.
await expect(workos.organizations.deleteOrganization(org.id)).resolves.toBeUndefined();

// The org is gone: fetching it now 404s.
await expect(workos.organizations.getOrganization(org.id)).rejects.toThrow();

// Its memberships cascaded, so the user no longer lists it.
const memberships = await workos.userManagement.listOrganizationMemberships({
userId: auth.user.id,
statuses: ["active", "pending"] as never,
});
expect(memberships.data.map((m) => m.organizationId)).not.toContain(org.id);
});

it("creates a pending organization membership when an invitation is sent", async () => {
const org = await workos.organizations.createOrganization({ name: "Invite Org" });
const invitation = await workos.userManagement.sendInvitation({
Expand Down
12 changes: 12 additions & 0 deletions packages/@emulators/workos/src/routes/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export function organizationRoutes(ctx: RouteContext): void {
return c.json(serializeOrganization(updated));
});

app.delete("/organizations/:id", (c) => {
const organization = ws().organizations.findOneBy("workos_id", c.req.param("id"));
if (!organization) return workosError(c, 404, "entity_not_found", "Organization not found.");
// Real WorkOS cascades org deletion to its memberships, so a listing for a
// deleted org comes back empty and members lose access.
for (const membership of ws().memberships.findBy("organization_id", organization.workos_id)) {
ws().memberships.delete(membership.id);
}
ws().organizations.delete(organization.id);
return c.body(null, 204);
});

app.get("/organizations/:id/roles", (c) => {
const organization = ws().organizations.findOneBy("workos_id", c.req.param("id"));
if (!organization) return workosError(c, 404, "entity_not_found", "Organization not found.");
Expand Down
2 changes: 1 addition & 1 deletion packages/@emulators/x/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emulators/x",
"version": "0.13.2",
"version": "0.13.3",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/emulate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@executor-js/emulate",
"version": "0.13.2",
"version": "0.13.3",
"description": "Local drop-in replacement services for CI and no-network sandboxes",
"license": "Apache-2.0",
"type": "module",
Expand Down
Loading