Showing the changes to apps/cloud/src/api (4 of 33 files). Show all
Unified · Split
| @@ -56,7 +56,9 @@ export const BootSharedServices = Layer.mergeAll( · 55 unmodified lines | |||
| 56 | // `AutumnService.Default` is provided HERE because the `createOrganization` | 56 | // `AutumnService.Default` is provided HERE because the `createOrganization` |
| 57 | // handler reads it for the free-organizations-per-user limit gate — one of the | 57 | // handler reads it for the free-organizations-per-user limit gate — one of the |
| 58 | // few app-only billing touchpoints. (It is NOT on the neutral boot core.) | 58 | // few app-only billing touchpoints. (It is NOT on the neutral boot core.) |
| 59 | export const makeNonProtectedApiLive = (rsLive: Layer.Layer<DbService | UserStoreService>) => | 59 | export const makeNonProtectedApiLive = ( |
| 60 | rsLive: Layer.Layer<DbService | UserStoreService | WorkOsMirror>, | ||
| 61 | ) => | ||
| 60 | HttpApiBuilder.layer(NonProtectedApi).pipe( | 62 | HttpApiBuilder.layer(NonProtectedApi).pipe( |
| 61 | Layer.provide(Layer.mergeAll(CloudAuthPublicHandlers, CloudSessionAuthHandlers)), | 63 | Layer.provide(Layer.mergeAll(CloudAuthPublicHandlers, CloudSessionAuthHandlers)), |
| 62 | Layer.provide(requestScopedMiddleware(rsLive).layer), | 64 | Layer.provide(requestScopedMiddleware(rsLive).layer), |
| @@ -68,18 +68,27 @@ const stubUsers = Layer.succeed(UserStoreService)({ · 67 unmodified lines | |||
| 68 | upsertOrganization: async (org: { id: string; name: string }) => ({ | 68 | upsertOrganization: async (org: { id: string; name: string }) => ({ |
| 69 | ...org, | 69 | ...org, |
| 70 | slug: `org-slug-${org.id}`, | 70 | slug: `org-slug-${org.id}`, |
| 71 | backfilledAt: null, | ||
| 72 | deletedAt: null, | ||
| 73 | workosUpdatedAt: null, | ||
| 71 | createdAt, | 74 | createdAt, |
| 72 | }), | 75 | }), |
| 73 | getOrganization: async (id: string) => ({ | 76 | getOrganization: async (id: string) => ({ |
| 74 | id, | 77 | id, |
| 75 | name: `Org ${id}`, | 78 | name: `Org ${id}`, |
| 76 | slug: `org-slug-${id}`, | 79 | slug: `org-slug-${id}`, |
| 80 | backfilledAt: null, | ||
| 81 | deletedAt: null, | ||
| 82 | workosUpdatedAt: null, | ||
| 77 | createdAt, | 83 | createdAt, |
| 78 | }), | 84 | }), |
| 79 | getOrganizationBySlug: async (slug: string) => ({ | 85 | getOrganizationBySlug: async (slug: string) => ({ |
| 80 | id: "org_by_slug", | 86 | id: "org_by_slug", |
| 81 | name: `Org ${slug}`, | 87 | name: `Org ${slug}`, |
| 82 | slug, | 88 | slug, |
| 89 | backfilledAt: null, | ||
| 90 | deletedAt: null, | ||
| 91 | workosUpdatedAt: null, | ||
| 83 | createdAt, | 92 | createdAt, |
| 84 | }), | 93 | }), |
| 85 | deleteOrganizationCascade: async () => {}, | 94 | deleteOrganizationCascade: async () => {}, |
| @@ -85,18 +85,27 @@ const stubUsers = Layer.succeed(UserStoreService)({ · 84 unmodified lines | |||
| 85 | upsertOrganization: async (org: { id: string; name: string }) => ({ | 85 | upsertOrganization: async (org: { id: string; name: string }) => ({ |
| 86 | ...org, | 86 | ...org, |
| 87 | slug: `org-slug-${org.id}`, | 87 | slug: `org-slug-${org.id}`, |
| 88 | backfilledAt: null, | ||
| 89 | deletedAt: null, | ||
| 90 | workosUpdatedAt: null, | ||
| 88 | createdAt, | 91 | createdAt, |
| 89 | }), | 92 | }), |
| 90 | getOrganization: async (id: string) => ({ | 93 | getOrganization: async (id: string) => ({ |
| 91 | id, | 94 | id, |
| 92 | name: `Org ${id}`, | 95 | name: `Org ${id}`, |
| 93 | slug: `org-slug-${id}`, | 96 | slug: `org-slug-${id}`, |
| 97 | backfilledAt: null, | ||
| 98 | deletedAt: null, | ||
| 99 | workosUpdatedAt: null, | ||
| 94 | createdAt, | 100 | createdAt, |
| 95 | }), | 101 | }), |
| 96 | getOrganizationBySlug: async (slug: string) => ({ | 102 | getOrganizationBySlug: async (slug: string) => ({ |
| 97 | id: "org_by_slug", | 103 | id: "org_by_slug", |
| 98 | name: `Org ${slug}`, | 104 | name: `Org ${slug}`, |
| 99 | slug, | 105 | slug, |
| 106 | backfilledAt: null, | ||
| 107 | deletedAt: null, | ||
| 108 | workosUpdatedAt: null, | ||
| 100 | createdAt, | 109 | createdAt, |
| 101 | }), | 110 | }), |
| 102 | deleteOrganizationCascade: async () => {}, | 111 | deleteOrganizationCascade: async () => {}, |
| @@ -4,6 +4,7 @@ import { HttpRouter } from "effect/unstable/http"; · 3 unmodified lines | |||
| 4 | import { RouterConfigLive, requestScopedMiddleware } from "@executor-js/api/server"; | 4 | import { RouterConfigLive, requestScopedMiddleware } from "@executor-js/api/server"; |
| 5 | 5 | ||
| 6 | import { UserStoreService } from "../auth/context"; | 6 | import { UserStoreService } from "../auth/context"; |
| 7 | import { WorkOsMirror } from "../auth/workos-mirror"; | ||
| 7 | import { DbService } from "../db/db"; | 8 | import { DbService } from "../db/db"; |
| 8 | import { makeAccountApiLive } from "../account/account-api"; | 9 | import { makeAccountApiLive } from "../account/account-api"; |
| 9 | 10 | ||
| @@ -29,7 +30,9 @@ import { makeProtectedApiLive } from "./protected"; · 19 unmodified lines | |||
| 29 | // so tests can substitute a counting fake for `DbService.Live` and | 30 | // so tests can substitute a counting fake for `DbService.Live` and |
| 30 | // assert per-request semantics — see | 31 | // assert per-request semantics — see |
| 31 | // `apps/cloud/src/api.request-scope.node.test.ts`. | 32 | // `apps/cloud/src/api.request-scope.node.test.ts`. |
| 32 | export const makeApiLive = (requestScopedLive: Layer.Layer<DbService | UserStoreService>) => { | 33 | export const makeApiLive = ( |
| 34 | requestScopedLive: Layer.Layer<DbService | UserStoreService | WorkOsMirror>, | ||
| 35 | ) => { | ||
| 33 | const BillingRoutesLive = AutumnRoutesLive.pipe( | 36 | const BillingRoutesLive = AutumnRoutesLive.pipe( |
| 34 | Layer.provide(requestScopedMiddleware(requestScopedLive).layer), | 37 | Layer.provide(requestScopedMiddleware(requestScopedLive).layer), |
| 35 | ); | 38 | ); |