diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index 94afb82f..00000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-version: 2
-updates:
- - package-ecosystem: 'npm'
- directory: '/'
- schedule:
- interval: 'weekly'
-
- # Ignore dependencies managed by Nx - use nx migrate or vscode extension to update
- ignore:
- - dependency-name: 'nx'
- - dependency-name: '@nx/*'
- - dependency-name: 'eslint'
- - dependency-name: '@eslint/*'
- - dependency-name: 'typescript-eslint'
- - dependency-name: '@typescript-eslint/*'
- - dependency-name: 'vite'
-
- groups:
- # Combine all minor and patch updates in one PR
- bump:
- update-types:
- - patch
- - minor
-
- # Update github actions
- - package-ecosystem: 'github-actions'
- directory: '/'
- schedule:
- interval: 'weekly'
- groups:
- actions:
- patterns:
- - '*'
diff --git a/.gitignore b/.gitignore
index b3e22181..890ef158 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,3 +50,9 @@ vitest.config.*.timestamp*
vendor
vendor/effect
+
+.claude/worktrees
+.claude/settings.local.json
+.nx/polygraph
+.nx/self-healing
+.nx/migrate-runs
diff --git a/.prettierignore b/.prettierignore
index 16c44011..4d897e97 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -8,3 +8,6 @@ pnpm-lock.yaml
.claude
.cursor
.agents
+
+.nx/self-healing
+*.gen.ts
diff --git a/MIGRATION.md b/MIGRATION.md
index b27be935..c0baf54d 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -34,13 +34,13 @@ Effect v4 renames several built-in error types. These appear in the error channe
// Before (v3)
repo.getById(id).pipe(
Effect.catchTag('NoSuchElementException', () => Effect.succeed(null)),
- Effect.catchTag('ParseError', (e) => Effect.fail(new MyError({ cause: e })))
+ Effect.catchTag('ParseError', (e) => Effect.fail(new MyError({ cause: e }))),
);
// After (v4)
repo.getById(id).pipe(
Effect.catchTag('NoSuchElementError', () => Effect.succeed(null)),
- Effect.catchTag('SchemaError', (e) => Effect.fail(new MyError({ cause: e })))
+ Effect.catchTag('SchemaError', (e) => Effect.fail(new MyError({ cause: e }))),
);
```
diff --git a/REACT.md b/REACT.md
index d2dd8206..97a44aa2 100644
--- a/REACT.md
+++ b/REACT.md
@@ -50,7 +50,9 @@ export const firestoreLayerAtom = Atom.keepAlive(
// forgotten seed fails loudly instead of being silenced by a cast.
Layer.effect(
FirestoreService,
- Effect.die('firestoreLayerAtom must be seeded via RegistryProvider initialValues'),
+ Effect.die(
+ 'firestoreLayerAtom must be seeded via RegistryProvider initialValues',
+ ),
),
),
);
@@ -120,9 +122,7 @@ export const postByIdAtom = Atom.family((id: typeof PostId.Type) =>
// back-navigation) without leaking one listener per visited post.
export const postByIdLiveAtom = Atom.family((id: typeof PostId.Type) =>
clientRuntime
- .atom(
- Stream.unwrap(Effect.map(PostRepository, (r) => r.getByIdStream(id))),
- )
+ .atom(Stream.unwrap(Effect.map(PostRepository, (r) => r.getByIdStream(id))))
.pipe(Atom.setIdleTTL('30 seconds')),
);
@@ -164,7 +164,7 @@ Notes:
side with `reactivityKeys` on mutations: a completed mutation re-runs every
read that shares a key.
- **Concurrency:** without `concurrent: true`, a second invocation of an fn
- atom *interrupts* the in-flight previous one (latest-wins) and all pending
+ atom _interrupts_ the in-flight previous one (latest-wins) and all pending
promise-mode awaiters resolve with the last invocation's result. That
default suits search-as-you-type reads; for mutations it can silently drop
a write, so pass `concurrent: true`.
@@ -184,9 +184,15 @@ function PostList() {
.onInitial(() =>
{typeof code === 'string' ? code : JSON.stringify(code, null, 2)}
diff --git a/example/app/src/components/core/empty-state.tsx b/example/app/src/components/core/empty-state.tsx
index 7bb93c6e..9e76c1ab 100644
--- a/example/app/src/components/core/empty-state.tsx
+++ b/example/app/src/components/core/empty-state.tsx
@@ -34,7 +34,7 @@ export function EmptyState({
diff --git a/example/app/src/components/core/icon-button.tsx b/example/app/src/components/core/icon-button.tsx
index 611c1021..8c1796c6 100644
--- a/example/app/src/components/core/icon-button.tsx
+++ b/example/app/src/components/core/icon-button.tsx
@@ -45,11 +45,12 @@ const iconButtonVariants = cva(
variant: 'default',
size: 'md',
},
- }
+ },
);
export interface IconButtonProps
- extends ButtonHTMLAttributes,
+ extends
+ ButtonHTMLAttributes,
VariantProps {
icon: ReactNode;
}
@@ -65,7 +66,7 @@ export const IconButton = forwardRef(
{icon}
);
- }
+ },
);
IconButton.displayName = 'IconButton';
diff --git a/example/app/src/components/core/input.tsx b/example/app/src/components/core/input.tsx
index 53ec8550..bf97dfa3 100644
--- a/example/app/src/components/core/input.tsx
+++ b/example/app/src/components/core/input.tsx
@@ -34,11 +34,12 @@ const inputVariants = cva(
defaultVariants: {
state: 'default',
},
- }
+ },
);
export interface InputProps
- extends InputHTMLAttributes,
+ extends
+ InputHTMLAttributes,
VariantProps {
error?: string;
}
@@ -61,7 +62,7 @@ export const Input = forwardRef(
)}
);
- }
+ },
);
Input.displayName = 'Input';
diff --git a/example/app/src/components/core/spinner.tsx b/example/app/src/components/core/spinner.tsx
index 23575789..85ac75c3 100644
--- a/example/app/src/components/core/spinner.tsx
+++ b/example/app/src/components/core/spinner.tsx
@@ -32,7 +32,8 @@ const spinnerVariants = cva('animate-spin', {
});
export interface SpinnerProps
- extends Omit, 'children'>,
+ extends
+ Omit, 'children'>,
VariantProps {}
export function Spinner({ className, size, ...props }: SpinnerProps) {
diff --git a/example/app/src/components/core/textarea.tsx b/example/app/src/components/core/textarea.tsx
index d4f36439..826448c4 100644
--- a/example/app/src/components/core/textarea.tsx
+++ b/example/app/src/components/core/textarea.tsx
@@ -34,11 +34,12 @@ const textareaVariants = cva(
defaultVariants: {
state: 'default',
},
- }
+ },
);
export interface TextAreaProps
- extends TextareaHTMLAttributes,
+ extends
+ TextareaHTMLAttributes,
VariantProps {
error?: string;
}
@@ -61,7 +62,7 @@ export const TextArea = forwardRef(
)}
);
- }
+ },
);
TextArea.displayName = 'TextArea';
diff --git a/example/app/src/components/menu/menu-item.tsx b/example/app/src/components/menu/menu-item.tsx
index b596d920..dcbadcd8 100644
--- a/example/app/src/components/menu/menu-item.tsx
+++ b/example/app/src/components/menu/menu-item.tsx
@@ -1,6 +1,6 @@
import { cva } from 'class-variance-authority';
import { AnchorHTMLAttributes, forwardRef } from 'react';
-import { createLink, type LinkComponent } from '@tanstack/react-router'
+import { createLink, type LinkComponent } from '@tanstack/react-router';
import { cn } from '../../lib/utils';
const menuItemVariants = cva(
@@ -15,12 +15,13 @@ const menuItemVariants = cva(
defaultVariants: {
isActive: false,
},
- }
+ },
);
-
-interface MenuItemProps
- extends Omit, 'children'> {
+interface MenuItemProps extends Omit<
+ AnchorHTMLAttributes,
+ 'children'
+> {
icon: string;
label: string;
isActive?: boolean;
@@ -42,7 +43,7 @@ const BasicMenuItem = forwardRef(
);
- }
+ },
);
BasicMenuItem.displayName = 'BasicMenuItem';
diff --git a/example/app/src/components/menu/side-menu.tsx b/example/app/src/components/menu/side-menu.tsx
index 9c14ae86..a22623cd 100644
--- a/example/app/src/components/menu/side-menu.tsx
+++ b/example/app/src/components/menu/side-menu.tsx
@@ -32,7 +32,7 @@ export function SideMenu({ children }: SideMenuProps) {
'fixed top-0 left-0 h-full bg-gradient-to-b from-gray-900 to-gray-800',
'text-white shadow-xl z-40 transition-transform duration-300 ease-in-out w-64',
isOpen ? 'translate-x-0' : '-translate-x-full',
- 'md:translate-x-0'
+ 'md:translate-x-0',
)}
>
{/* Logo/Header */}
diff --git a/example/app/src/lib/atoms.ts b/example/app/src/lib/atoms.ts
index 8a3179d6..ce54cbd8 100644
--- a/example/app/src/lib/atoms.ts
+++ b/example/app/src/lib/atoms.ts
@@ -54,9 +54,7 @@ export const postByIdAtom = Atom.family((id: typeof PostId.Type) =>
// listener per visited post for the life of the app.
export const postByIdLiveAtom = Atom.family((id: typeof PostId.Type) =>
clientRuntime
- .atom(
- Stream.unwrap(Effect.map(PostRepository, (r) => r.getByIdStream(id))),
- )
+ .atom(Stream.unwrap(Effect.map(PostRepository, (r) => r.getByIdStream(id))))
.pipe(Atom.setIdleTTL('30 seconds')),
);
diff --git a/example/app/src/main.tsx b/example/app/src/main.tsx
index ddbd317b..b10f9723 100644
--- a/example/app/src/main.tsx
+++ b/example/app/src/main.tsx
@@ -16,11 +16,11 @@ declare module '@tanstack/react-router' {
}
const root = ReactDOM.createRoot(
- document.getElementById('root') as HTMLElement
+ document.getElementById('root') as HTMLElement,
);
root.render(
-
+ ,
);
diff --git a/example/app/src/routeTree.gen.ts b/example/app/src/routeTree.gen.ts
index c955aaba..bda5b6a8 100644
--- a/example/app/src/routeTree.gen.ts
+++ b/example/app/src/routeTree.gen.ts
@@ -9,13 +9,13 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as FunctionsRouteImport } from './routes/functions'
-import { Route as FirestoreRouteImport } from './routes/firestore'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as FirestoreRouteImport } from './routes/firestore'
+import { Route as FunctionsRouteImport } from './routes/functions'
-const FunctionsRoute = FunctionsRouteImport.update({
- id: '/functions',
- path: '/functions',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const FirestoreRoute = FirestoreRouteImport.update({
@@ -23,9 +23,9 @@ const FirestoreRoute = FirestoreRouteImport.update({
path: '/firestore',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const FunctionsRoute = FunctionsRouteImport.update({
+ id: '/functions',
+ path: '/functions',
getParentRoute: () => rootRouteImport,
} as any)
@@ -61,11 +61,11 @@ export interface RootRouteChildren {
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
- '/functions': {
- id: '/functions'
- path: '/functions'
- fullPath: '/functions'
- preLoaderRoute: typeof FunctionsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/firestore': {
@@ -75,11 +75,11 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof FirestoreRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/functions': {
+ id: '/functions'
+ path: '/functions'
+ fullPath: '/functions'
+ preLoaderRoute: typeof FunctionsRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/example/app/src/routes/firestore.tsx b/example/app/src/routes/firestore.tsx
index 06f12fb5..0b4cf284 100644
--- a/example/app/src/routes/firestore.tsx
+++ b/example/app/src/routes/firestore.tsx
@@ -51,15 +51,11 @@ const fieldError = (field: {
readonly state: {
readonly meta: {
readonly isTouched: boolean;
- readonly errors: ReadonlyArray<
- { readonly message?: string } | undefined
- >;
+ readonly errors: ReadonlyArray<{ readonly message?: string } | undefined>;
};
};
}) =>
- field.state.meta.isTouched
- ? field.state.meta.errors[0]?.message
- : undefined;
+ field.state.meta.isTouched ? field.state.meta.errors[0]?.message : undefined;
function PostForm({
editing,
@@ -183,11 +179,7 @@ function PostForm({
);
}
-export function PostList({
- onEdit,
-}: {
- onEdit: (post: Post) => void;
-}) {
+export function PostList({ onEdit }: { onEdit: (post: Post) => void }) {
const result = useAtomValue(latestPostsAtom);
const remove = useAtomSet(deletePostAtom, { mode: 'promise' });
const [deleteError, setDeleteError] = useState(null);
diff --git a/example/app/src/routes/functions.tsx b/example/app/src/routes/functions.tsx
index 2a2c4a52..f0eddc7a 100644
--- a/example/app/src/routes/functions.tsx
+++ b/example/app/src/routes/functions.tsx
@@ -29,7 +29,7 @@ function RouteComponent() {
inputSchema={OnExampleCall.Input}
onSendRequest={httpsCallable(
getFunctions(getApp(), 'europe-north1'),
- 'onExampleCall'
+ 'onExampleCall',
)}
/>
diff --git a/example/app/src/styles.css b/example/app/src/styles.css
index 844323d9..5f1cc276 100644
--- a/example/app/src/styles.css
+++ b/example/app/src/styles.css
@@ -1,4 +1,2 @@
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
+@import 'tailwindcss';
/* You can add global styles to this file, and also import other style files */
diff --git a/example/app/tailwind.config.js b/example/app/tailwind.config.js
deleted file mode 100644
index e1cf7cee..00000000
--- a/example/app/tailwind.config.js
+++ /dev/null
@@ -1,17 +0,0 @@
-const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
-const { join } = require('path');
-
-/** @type {import('tailwindcss').Config} */
-module.exports = {
- content: [
- join(
- __dirname,
- '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}'
- ),
- ...createGlobPatternsForDependencies(__dirname),
- ],
- theme: {
- extend: {},
- },
- plugins: [],
-};
diff --git a/example/app/tsconfig.app.json b/example/app/tsconfig.app.json
index 30221cf8..e08a4df2 100644
--- a/example/app/tsconfig.app.json
+++ b/example/app/tsconfig.app.json
@@ -7,7 +7,8 @@
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts",
"vite/client"
- ]
+ ],
+ "rootDir": "."
},
"exclude": [
"src/**/*.spec.ts",
diff --git a/example/app/tsconfig.json b/example/app/tsconfig.json
index c39e6455..696b6d22 100644
--- a/example/app/tsconfig.json
+++ b/example/app/tsconfig.json
@@ -9,7 +9,8 @@
"paths": {
"@example/shared": ["../../shared/src/index.ts"]
},
- "lib": ["dom", "dom.iterable", "esnext"]
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "ignoreDeprecations": "6.0"
},
"files": [],
"include": [],
diff --git a/example/app/tsconfig.spec.json b/example/app/tsconfig.spec.json
index b6fbf9de..4966eca7 100644
--- a/example/app/tsconfig.spec.json
+++ b/example/app/tsconfig.spec.json
@@ -10,7 +10,8 @@
"vitest",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
- ]
+ ],
+ "rootDir": "."
},
"include": [
"vite.config.ts",
diff --git a/example/app/vite.config.ts b/example/app/vite.config.ts
index ab7126a5..83f607be 100644
--- a/example/app/vite.config.ts
+++ b/example/app/vite.config.ts
@@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
import { tanstackRouter } from '@tanstack/router-plugin/vite';
+import tailwindcss from '@tailwindcss/vite';
export default defineConfig(() => ({
root: __dirname,
@@ -22,6 +23,7 @@ export default defineConfig(() => ({
autoCodeSplitting: true,
}),
react(),
+ tailwindcss(),
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
],
diff --git a/example/backend/eslint.config.mjs b/example/backend/eslint.config.mjs
index 3e8bde55..b4a90f20 100644
--- a/example/backend/eslint.config.mjs
+++ b/example/backend/eslint.config.mjs
@@ -5,5 +5,5 @@ export default [
{
files: ['**/*.ts', '**/*.js'],
rules: {},
- }
+ },
];
diff --git a/example/backend/src/lib/error-handler.ts b/example/backend/src/lib/error-handler.ts
index 67281869..f9fb6e55 100644
--- a/example/backend/src/lib/error-handler.ts
+++ b/example/backend/src/lib/error-handler.ts
@@ -26,7 +26,7 @@ const formatError = (error: unknown): Effect.Effect => {
};
export const SerializeError = Effect.catch((error: unknown) =>
- formatError(error)
+ formatError(error),
);
export const ErrorHandler = Effect.catchDefect((error) => formatError(error));
diff --git a/example/backend/src/lib/on-call.ts b/example/backend/src/lib/on-call.ts
index 0db06fce..fe031b68 100644
--- a/example/backend/src/lib/on-call.ts
+++ b/example/backend/src/lib/on-call.ts
@@ -21,5 +21,5 @@ export const onExampleCall = onCallEffect(
const posts = yield* PostRepository;
const post = yield* posts.getById(input.id);
return Option.getOrThrow(post);
- }).pipe(SerializeError, ErrorHandler)
+ }).pipe(SerializeError, ErrorHandler),
);
diff --git a/example/backend/src/lib/on-post-updated.ts b/example/backend/src/lib/on-post-updated.ts
index b41c4bb2..b3666993 100644
--- a/example/backend/src/lib/on-post-updated.ts
+++ b/example/backend/src/lib/on-post-updated.ts
@@ -16,5 +16,5 @@ export const onPostCreated = onDocumentCreatedEffect(
yield* Effect.log(`Post updated, setting check for: ${post.id}`);
const repo = yield* PostRepository;
yield* repo.update(post.id, { checked: true });
- }).pipe(Effect.withLogSpan('runtime'), Effect.catch(Effect.logError))
+ }).pipe(Effect.withLogSpan('runtime'), Effect.catch(Effect.logError)),
);
diff --git a/example/backend/src/lib/on-request.ts b/example/backend/src/lib/on-request.ts
index 7033315a..a341dbff 100644
--- a/example/backend/src/lib/on-request.ts
+++ b/example/backend/src/lib/on-request.ts
@@ -22,5 +22,5 @@ export const onExampleRequest = onRequestEffect(
const id = PostId.make(body.id);
const post = yield* posts.getById(id);
return Option.getOrThrow(post);
- }).pipe(SerializeError, ErrorHandler)
+ }).pipe(SerializeError, ErrorHandler),
);
diff --git a/example/backend/tsconfig.app.json b/example/backend/tsconfig.app.json
index 7dc325c6..dbeb398d 100644
--- a/example/backend/tsconfig.app.json
+++ b/example/backend/tsconfig.app.json
@@ -3,7 +3,8 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
- "types": ["node", "vite/client"]
+ "types": ["node", "vite/client"],
+ "rootDir": "."
},
"include": ["src/**/*.ts"],
"exclude": [
diff --git a/example/backend/tsconfig.json b/example/backend/tsconfig.json
index 74fc66f0..68750dc3 100644
--- a/example/backend/tsconfig.json
+++ b/example/backend/tsconfig.json
@@ -7,7 +7,8 @@
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
- "noPropertyAccessFromIndexSignature": true
+ "noPropertyAccessFromIndexSignature": true,
+ "ignoreDeprecations": "6.0"
},
"files": [],
"include": [],
diff --git a/example/shared/eslint.config.mjs b/example/shared/eslint.config.mjs
index 3e8bde55..b4a90f20 100644
--- a/example/shared/eslint.config.mjs
+++ b/example/shared/eslint.config.mjs
@@ -5,5 +5,5 @@ export default [
{
files: ['**/*.ts', '**/*.js'],
rules: {},
- }
+ },
];
diff --git a/example/shared/package.json b/example/shared/package.json
index 460cf445..a8255d50 100644
--- a/example/shared/package.json
+++ b/example/shared/package.json
@@ -21,7 +21,7 @@
],
"dependencies": {
"effect": "catalog:",
- "tslib": "^2.3.0"
+ "tslib": "^2.8.1"
},
"peerDependencies": {
"effect-firebase": "workspace:*"
diff --git a/example/shared/src/functions/error-schema.ts b/example/shared/src/functions/error-schema.ts
index d048ed5a..325a0ee8 100644
--- a/example/shared/src/functions/error-schema.ts
+++ b/example/shared/src/functions/error-schema.ts
@@ -11,7 +11,7 @@ const ParseError = Schema.Struct({
Schema.Struct({
path: Schema.String,
message: Schema.String,
- })
+ }),
),
});
diff --git a/example/shared/src/models/author-repository.ts b/example/shared/src/models/author-repository.ts
index d33a2e82..ec7cd2fc 100644
--- a/example/shared/src/models/author-repository.ts
+++ b/example/shared/src/models/author-repository.ts
@@ -10,5 +10,5 @@ export const AuthorRepository = Firestore.makeRepository(AuthorModel, {
Effect.map((repository) => ({
...repository,
// Additional methods can be added here
- }))
+ })),
);
diff --git a/example/shared/src/models/post-repository.ts b/example/shared/src/models/post-repository.ts
index f37d7e97..72f9844a 100644
--- a/example/shared/src/models/post-repository.ts
+++ b/example/shared/src/models/post-repository.ts
@@ -12,5 +12,5 @@ export const PostRepository = Firestore.makeRepository(PostModel, {
// Additional methods can be added here
latestPosts: () =>
repository.queryStream(Query.orderBy('createdAt', 'desc')),
- }))
+ })),
);
diff --git a/example/shared/src/models/post.ts b/example/shared/src/models/post.ts
index 6ea54f07..2c2de135 100644
--- a/example/shared/src/models/post.ts
+++ b/example/shared/src/models/post.ts
@@ -14,7 +14,7 @@ export class PostModel extends Model.Class('PostModel')({
title: Schema.String,
content: Schema.String,
checked: Schema.Boolean.pipe(
- Schema.withDecodingDefault(Effect.succeed(false))
+ Schema.withDecodingDefault(Effect.succeed(false)),
),
optional: Firestore.OptionalDeletable(Schema.String),
list: Firestore.Array(Schema.String),
diff --git a/example/shared/tsconfig.json b/example/shared/tsconfig.json
index c23e61c8..bead213d 100644
--- a/example/shared/tsconfig.json
+++ b/example/shared/tsconfig.json
@@ -6,5 +6,8 @@
{
"path": "./tsconfig.lib.json"
}
- ]
+ ],
+ "compilerOptions": {
+ "ignoreDeprecations": "6.0"
+ }
}
diff --git a/nx.json b/nx.json
index 888978a9..b3c0943c 100644
--- a/nx.json
+++ b/nx.json
@@ -71,6 +71,9 @@
"targetName": "typecheck"
}
}
+ },
+ {
+ "plugin": "@nx/vitest"
}
],
"targetDefaults": {
diff --git a/package.json b/package.json
index 76ba5c0d..88f2bc92 100644
--- a/package.json
+++ b/package.json
@@ -21,65 +21,63 @@
"firebase": "catalog:",
"firebase-admin": "catalog:",
"firebase-functions": "catalog:",
- "react": "19.2.4",
- "react-dom": "19.2.4"
+ "react": "19.2.8",
+ "react-dom": "19.2.8"
},
"devDependencies": {
"@effect/platform-browser": "catalog:",
"@effect/vitest": "catalog:",
- "@eslint/js": "^9.8.0",
- "@nx/esbuild": "22.5.4",
- "@nx/eslint": "22.5.4",
- "@nx/eslint-plugin": "22.5.4",
- "@nx/js": "22.5.4",
- "@nx/react": "22.5.4",
- "@nx/vite": "22.5.4",
- "@nx/vitest": "22.5.4",
- "@nx/web": "22.5.4",
- "@swc-node/register": "1.11.1",
- "@swc/cli": "0.7.10",
- "@swc/core": "1.15.8",
- "@swc/helpers": "0.5.19",
- "@tanstack/eslint-plugin-router": "^1.139.0",
- "@tanstack/react-router": "^1.139.3",
- "@tanstack/react-router-devtools": "^1.139.3",
- "@tanstack/router-plugin": "^1.139.3",
- "@tanstack/zod-adapter": "^1.139.3",
- "@testing-library/dom": "10.4.0",
- "@testing-library/react": "16.1.0",
- "@types/express": "^4.17.21",
- "@types/node": "20.19.9",
- "@types/react": "19.0.0",
- "@types/react-dom": "19.0.0",
- "@vitejs/plugin-react": "^4.2.0",
- "@vitest/coverage-v8": "4.0.9",
- "@vitest/ui": "4.0.9",
- "autoprefixer": "10.4.13",
+ "@eslint/js": "^9.39.5",
+ "@nx/esbuild": "23.1.1",
+ "@nx/eslint": "23.1.1",
+ "@nx/eslint-plugin": "23.1.1",
+ "@nx/js": "23.1.1",
+ "@nx/react": "23.1.1",
+ "@nx/vite": "23.1.1",
+ "@nx/vitest": "23.1.1",
+ "@nx/web": "23.1.1",
+ "@swc-node/register": "1.12.1",
+ "@swc/cli": "0.8.1",
+ "@swc/core": "1.15.47",
+ "@swc/helpers": "0.5.23",
+ "@tanstack/eslint-plugin-router": "^1.162.0",
+ "@tanstack/react-router": "^1.170.19",
+ "@tanstack/react-router-devtools": "^1.167.1",
+ "@tanstack/router-plugin": "^1.168.24",
+ "@tanstack/zod-adapter": "^1.167.0",
+ "@testing-library/dom": "10.4.1",
+ "@testing-library/react": "16.3.2",
+ "@types/express": "^5.0.6",
+ "@types/node": "24.13.3",
+ "@types/react": "19.2.18",
+ "@types/react-dom": "19.2.4",
+ "@vitejs/plugin-react": "6.0.5",
+ "@vitest/coverage-v8": "4.1.10",
+ "@vitest/ui": "4.1.10",
"cva": "npm:class-variance-authority@^0.7.1",
- "esbuild": "^0.19.2",
- "eslint": "^9.8.0",
- "eslint-config-prettier": "^10.0.0",
- "eslint-plugin-import": "2.31.0",
- "eslint-plugin-jsx-a11y": "6.10.1",
- "eslint-plugin-react": "7.35.0",
- "eslint-plugin-react-hooks": "5.0.0",
- "firebase-tools": "^15.22.4",
- "jiti": "2.4.2",
- "jsdom": "~22.1.0",
- "jsonc-eslint-parser": "^2.1.0",
- "nx": "22.5.4",
- "postcss": "8.4.38",
- "prettier": "^2.6.2",
- "tailwind-merge": "^3.4.0",
- "tailwindcss": "3.4.3",
- "ts-node": "10.9.1",
- "tslib": "^2.3.0",
- "typescript": "5.9.3",
- "typescript-eslint": "8.45.0",
- "verdaccio": "^6.0.5",
- "vite": "7.1.8",
- "vite-plugin-dts": "~4.5.0",
- "vitest": "4.0.9"
+ "esbuild": "^0.28.1",
+ "eslint": "^9.39.5",
+ "eslint-config-prettier": "^10.1.8",
+ "eslint-plugin-import": "2.32.0",
+ "eslint-plugin-jsx-a11y": "6.10.2",
+ "eslint-plugin-react": "7.37.5",
+ "eslint-plugin-react-hooks": "7.1.1",
+ "firebase-tools": "^15.25.1",
+ "jiti": "2.7.0",
+ "jsdom": "~30.0.1",
+ "jsonc-eslint-parser": "^3.2.0",
+ "nx": "23.1.1",
+ "prettier": "^3.9.6",
+ "tailwind-merge": "^3.6.0",
+ "tailwindcss": "^4.3.3",
+ "ts-node": "10.9.2",
+ "tslib": "^2.8.1",
+ "typescript": "6.0.3",
+ "typescript-eslint": "8.66.0",
+ "verdaccio": "6.9.2",
+ "vite": "8.2.0",
+ "vite-plugin-dts": "~4.5.4",
+ "vitest": "4.1.10"
},
"packageManager": "pnpm@10.25.0",
"workspaces": [
diff --git a/packages/admin/README.md b/packages/admin/README.md
index 798b00a1..e628c890 100644
--- a/packages/admin/README.md
+++ b/packages/admin/README.md
@@ -36,7 +36,7 @@ export const myFunction = onRequestEffect({ runtime }, (request, response) =>
Effect.gen(function* () {
const repo = yield* PostRepository;
response.json({ posts: yield* repo.query() });
- }).pipe(Effect.provide(PostRepository))
+ }).pipe(Effect.provide(PostRepository)),
);
```
@@ -56,7 +56,7 @@ export const createPost = onCallEffect(
const repo = yield* PostRepository;
const postId = yield* repo.add({ ...request.data, status: 'draft' });
return { postId };
- }).pipe(Effect.provide(PostRepository))
+ }).pipe(Effect.provide(PostRepository)),
);
```
@@ -74,7 +74,7 @@ import {
export const onPostCreated = onDocumentCreatedEffect(
{ runtime, document: 'posts/{postId}', schema: PostModel, idField: 'id' },
- (post) => Effect.log(`Created: ${post.id}`)
+ (post) => Effect.log(`Created: ${post.id}`),
);
```
@@ -87,7 +87,7 @@ const MessageSchema = Schema.Struct({ userId: Schema.String });
export const onMessage = onMessagePublishedEffect(
{ runtime, topic: 'my-topic', dataSchema: MessageSchema },
- (message) => Effect.log(`Received for user: ${message.userId}`)
+ (message) => Effect.log(`Received for user: ${message.userId}`),
);
```
@@ -100,7 +100,7 @@ const TaskSchema = Schema.Struct({ email: Schema.String });
export const processEmail = onTaskDispatchedEffect(
{ runtime, retryConfig: { maxAttempts: 5 }, dataSchema: TaskSchema },
- (task) => Effect.log(`Sending to: ${task.email}`)
+ (task) => Effect.log(`Sending to: ${task.email}`),
);
```
diff --git a/packages/admin/eslint.config.mjs b/packages/admin/eslint.config.mjs
index 3e8bde55..b4a90f20 100644
--- a/packages/admin/eslint.config.mjs
+++ b/packages/admin/eslint.config.mjs
@@ -5,5 +5,5 @@ export default [
{
files: ['**/*.ts', '**/*.js'],
rules: {},
- }
+ },
];
diff --git a/packages/admin/package.json b/packages/admin/package.json
index 13ca3155..3ce56226 100644
--- a/packages/admin/package.json
+++ b/packages/admin/package.json
@@ -26,22 +26,22 @@
"!**/*.tsbuildinfo"
],
"dependencies": {
- "tslib": "^2.3.0"
+ "tslib": "^2.8.1"
},
"devDependencies": {
"effect": "catalog:",
"effect-firebase": "workspace:*",
+ "express": "catalog:",
"firebase": "catalog:",
"firebase-admin": "catalog:",
- "firebase-functions": "catalog:",
- "express": "catalog:"
+ "firebase-functions": "catalog:"
},
"peerDependencies": {
"effect": "catalog:",
"effect-firebase": "workspace:*",
+ "express": "catalog:",
"firebase-admin": "catalog:",
- "firebase-functions": "catalog:",
- "express": "catalog:"
+ "firebase-functions": "catalog:"
},
"publishConfig": {
"access": "public",
diff --git a/packages/admin/src/lib/admin.ts b/packages/admin/src/lib/admin.ts
index f0bf2ed4..60bbcbc6 100644
--- a/packages/admin/src/lib/admin.ts
+++ b/packages/admin/src/lib/admin.ts
@@ -31,7 +31,7 @@ export interface LayerOptions {
type ReadyLayer = Layer.Layer;
const withCloudLogger = (
- services: Layer.Layer
+ services: Layer.Layer,
): Layer.Layer => Layer.merge(services, cloudConsole);
/**
@@ -71,16 +71,16 @@ const withCloudLogger = (
* ```
*/
export function layer(
- options: LayerOptions & { app: FirebaseAdminApp }
+ options: LayerOptions & { app: FirebaseAdminApp },
): ReadyLayer;
export function layer(
- options: LayerOptions & { firestore: Firestore }
+ options: LayerOptions & { firestore: Firestore },
): ReadyLayer;
export function layer(options?: LayerOptions): ReadyLayer;
export function layer(options: LayerOptions = {}): ReadyLayer {
if (options.app && options.firestore) {
throw new Error(
- 'Admin.layer: pass either { app } or { firestore }, not both.'
+ 'Admin.layer: pass either { app } or { firestore }, not both.',
);
}
diff --git a/packages/admin/src/lib/app.ts b/packages/admin/src/lib/app.ts
index 4012ca95..780d7140 100644
--- a/packages/admin/src/lib/app.ts
+++ b/packages/admin/src/lib/app.ts
@@ -6,7 +6,7 @@ export interface AppService {
}
export class App extends Context.Service()(
- '@effect-firebase/admin/App'
+ '@effect-firebase/admin/App',
) {}
export const layer = (app: FirebaseAdminApp): Layer.Layer =>
diff --git a/packages/admin/src/lib/firestore/converter.spec.ts b/packages/admin/src/lib/firestore/converter.spec.ts
index 0d770622..6c6cb21b 100644
--- a/packages/admin/src/lib/firestore/converter.spec.ts
+++ b/packages/admin/src/lib/firestore/converter.spec.ts
@@ -74,7 +74,7 @@ describe('Firestore Converter', () => {
const fakeFirestore = {} as unknown as Firestore;
const result = firestoreEncode(
fakeFirestore,
- FirestoreSchema.Timestamp.fromMillis(1705315800123)
+ FirestoreSchema.Timestamp.fromMillis(1705315800123),
);
expect(result).toBeInstanceOf(AdminTimestamp);
@@ -89,7 +89,7 @@ describe('Firestore Converter', () => {
new FirestoreSchema.GeoPoint({
latitude: 55.6761,
longitude: 12.5683,
- })
+ }),
);
expect(result).toBeInstanceOf(AdminGeoPoint);
@@ -109,7 +109,7 @@ describe('Firestore Converter', () => {
const result = firestoreEncode(
fakeFirestore,
- FirestoreSchema.Reference.makeFromPath('posts/post-1')
+ FirestoreSchema.Reference.makeFromPath('posts/post-1'),
);
expect(docCalls).toEqual(['posts/post-1']);
@@ -120,7 +120,7 @@ describe('Firestore Converter', () => {
const fakeFirestore = {} as unknown as Firestore;
const result = firestoreEncode(
fakeFirestore,
- FirestoreSchema.ServerTimestamp.make()
+ FirestoreSchema.ServerTimestamp.make(),
);
expect(result).toStrictEqual(FieldValue.serverTimestamp());
@@ -137,7 +137,7 @@ describe('Firestore Converter', () => {
const fakeFirestore = {} as unknown as Firestore;
const result = firestoreEncode(
fakeFirestore,
- FirestoreHelper.arrayUnion(['a', 'b'])
+ FirestoreHelper.arrayUnion(['a', 'b']),
);
expect(result).toStrictEqual(FieldValue.arrayUnion('a', 'b'));
});
@@ -146,7 +146,7 @@ describe('Firestore Converter', () => {
const fakeFirestore = {} as unknown as Firestore;
const result = firestoreEncode(
fakeFirestore,
- FirestoreHelper.arrayRemove(['a'])
+ FirestoreHelper.arrayRemove(['a']),
);
expect(result).toStrictEqual(FieldValue.arrayRemove('a'));
});
@@ -156,10 +156,10 @@ describe('Firestore Converter', () => {
const ts = FirestoreSchema.Timestamp.fromMillis(1705315800000);
const result = firestoreEncode(
fakeFirestore,
- FirestoreHelper.arrayUnion([ts])
+ FirestoreHelper.arrayUnion([ts]),
);
const expected = FieldValue.arrayUnion(
- AdminTimestamp.fromMillis(1705315800000)
+ AdminTimestamp.fromMillis(1705315800000),
);
expect(result).toStrictEqual(expected);
});
@@ -169,10 +169,10 @@ describe('Firestore Converter', () => {
const ts = FirestoreSchema.Timestamp.fromMillis(1705315800000);
const result = firestoreEncode(
fakeFirestore,
- FirestoreHelper.arrayRemove([ts])
+ FirestoreHelper.arrayRemove([ts]),
);
const expected = FieldValue.arrayRemove(
- AdminTimestamp.fromMillis(1705315800000)
+ AdminTimestamp.fromMillis(1705315800000),
);
expect(result).toStrictEqual(expected);
});
@@ -196,7 +196,7 @@ describe('Firestore Converter', () => {
});
expect((result as Record).createdAt).toBeInstanceOf(
- AdminTimestamp
+ AdminTimestamp,
);
expect(
(
@@ -204,7 +204,7 @@ describe('Firestore Converter', () => {
string,
unknown
>
- ).location
+ ).location,
).toBeInstanceOf(AdminGeoPoint);
expect(
(
@@ -212,17 +212,17 @@ describe('Firestore Converter', () => {
string,
unknown
>
- ).postRef
+ ).postRef,
).toEqual({ path: 'posts/post-1', __tag: 'fake-doc-ref' });
expect((result as Record).updates).toHaveLength(3);
expect(
- ((result as Record).updates as unknown[])[0]
+ ((result as Record).updates as unknown[])[0],
).toBeInstanceOf(AdminTimestamp);
expect(
- ((result as Record).updates as unknown[])[1]
+ ((result as Record).updates as unknown[])[1],
).toStrictEqual(FieldValue.delete());
expect(
- ((result as Record).updates as unknown[])[2]
+ ((result as Record).updates as unknown[])[2],
).toBeNull();
});
@@ -239,7 +239,7 @@ describe('Firestore Converter', () => {
});
expect((result as Record).timestamp).toBe(
- adminTimestamp
+ adminTimestamp,
);
expect((result as Record).geoPoint).toBe(adminGeoPoint);
expect((result as Record).delete).toBe(adminDelete);
diff --git a/packages/admin/src/lib/firestore/converter.ts b/packages/admin/src/lib/firestore/converter.ts
index 1e1b1348..bc8b9f21 100644
--- a/packages/admin/src/lib/firestore/converter.ts
+++ b/packages/admin/src/lib/firestore/converter.ts
@@ -17,7 +17,7 @@ import { FirestoreSchema, Firestore } from 'effect-firebase';
*/
export const firestoreEncode = (
db: FirebaseFirestore,
- data: unknown
+ data: unknown,
): unknown => {
if (
data === null ||
@@ -46,12 +46,12 @@ export const firestoreEncode = (
}
if (data instanceof Firestore.ArrayUnion) {
return FieldValue.arrayUnion(
- ...data.values.map((v) => firestoreEncode(db, v))
+ ...data.values.map((v) => firestoreEncode(db, v)),
);
}
if (data instanceof Firestore.ArrayRemove) {
return FieldValue.arrayRemove(
- ...data.values.map((v) => firestoreEncode(db, v))
+ ...data.values.map((v) => firestoreEncode(db, v)),
);
}
if (Array.isArray(data)) {
@@ -59,7 +59,7 @@ export const firestoreEncode = (
}
if (typeof data === 'object' && data !== null) {
return Object.fromEntries(
- Object.entries(data).map(([k, v]) => [k, firestoreEncode(db, v)])
+ Object.entries(data).map(([k, v]) => [k, firestoreEncode(db, v)]),
);
}
return data;
@@ -88,14 +88,14 @@ export const firestoreDecode = (data: DocumentData): DocumentData => {
}
if (typeof data === 'object' && data !== null) {
return Object.fromEntries(
- Object.entries(data).map(([k, v]) => [k, firestoreDecode(v)])
+ Object.entries(data).map(([k, v]) => [k, firestoreDecode(v)]),
);
}
return data;
};
export const makeConverter = (
- db: FirebaseFirestore
+ db: FirebaseFirestore,
): FirestoreDataConverter => ({
toFirestore: (modelObject) =>
firestoreEncode(db, modelObject) as DocumentData,
diff --git a/packages/admin/src/lib/firestore/firestore-service.spec.ts b/packages/admin/src/lib/firestore/firestore-service.spec.ts
index 5b87d06b..a4f706b7 100644
--- a/packages/admin/src/lib/firestore/firestore-service.spec.ts
+++ b/packages/admin/src/lib/firestore/firestore-service.spec.ts
@@ -131,16 +131,16 @@ const makeFakeDb = () => {
const run = (
db: Firestore,
- effect: Effect.Effect
+ effect: Effect.Effect,
) => Effect.runPromise(effect.pipe(Effect.provide(layerFromFirestore(db))));
const runExit = (
db: Firestore,
- effect: Effect.Effect
+ effect: Effect.Effect,
) => Effect.runPromiseExit(effect.pipe(Effect.provide(layerFromFirestore(db))));
const withService = (
- f: (service: FirestoreService['Service']) => Effect.Effect
+ f: (service: FirestoreService['Service']) => Effect.Effect,
) => Effect.flatMap(FirestoreService, f);
describe('FirestoreService (admin)', () => {
@@ -156,9 +156,9 @@ describe('FirestoreService (admin)', () => {
yield* fs.set('posts/1', { title: 'a' });
yield* fs.update('posts/2', { title: 'b' });
yield* fs.delete('posts/3');
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(state.runTransactionCalls).toBe(1);
@@ -175,7 +175,9 @@ describe('FirestoreService (admin)', () => {
const { db, state } = makeFakeDb();
const result = await run(
db,
- withService((fs) => fs.withTransaction(fs.add('posts', { title: 'a' })))
+ withService((fs) =>
+ fs.withTransaction(fs.add('posts', { title: 'a' })),
+ ),
);
expect(result).toEqual({
@@ -191,7 +193,7 @@ describe('FirestoreService (admin)', () => {
const { db, state } = makeFakeDb();
const results = await run(
db,
- withService((fs) => fs.withTransaction(fs.query('posts', [])))
+ withService((fs) => fs.withTransaction(fs.query('posts', []))),
);
expect(state.txOps).toEqual([['query', 'posts']]);
@@ -203,7 +205,7 @@ describe('FirestoreService (admin)', () => {
const { db } = makeFakeDb();
const result = await run(
db,
- withService((fs) => fs.withTransaction(Effect.succeed(42)))
+ withService((fs) => fs.withTransaction(Effect.succeed(42))),
);
expect(result).toBe(42);
});
@@ -217,9 +219,9 @@ describe('FirestoreService (admin)', () => {
Effect.gen(function* () {
yield* fs.set('posts/1', { title: 'a' });
yield* new TestError({ reason: 'boom' });
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(Exit.isFailure(exit)).toBe(true);
@@ -243,9 +245,9 @@ describe('FirestoreService (admin)', () => {
Effect.gen(function* () {
yield* fs.set('posts/1', { title: 'a' });
yield* fs.withTransaction(fs.set('posts/2', { title: 'b' }));
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(state.runTransactionCalls).toBe(1);
@@ -257,8 +259,8 @@ describe('FirestoreService (admin)', () => {
const exit = await runExit(
db,
withService((fs) =>
- fs.withTransaction(Stream.runCollect(fs.streamDoc('posts/1')))
- )
+ fs.withTransaction(Stream.runCollect(fs.streamDoc('posts/1'))),
+ ),
);
expect(Exit.isFailure(exit)).toBe(true);
@@ -271,7 +273,7 @@ describe('FirestoreService (admin)', () => {
const { db } = makeFakeDb();
const exit = await runExit(
db,
- withService((fs) => fs.withTransaction(fs.deleteRecursive('posts/1')))
+ withService((fs) => fs.withTransaction(fs.deleteRecursive('posts/1'))),
);
expect(Exit.isFailure(exit)).toBe(true);
@@ -293,9 +295,9 @@ describe('FirestoreService (admin)', () => {
yield* fs.update('posts/2', { title: 'b' });
yield* fs.delete('posts/3');
yield* fs.add('posts', { title: 'c' });
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(state.batchesCreated).toBe(1);
@@ -318,9 +320,9 @@ describe('FirestoreService (admin)', () => {
Effect.gen(function* () {
yield* fs.get('posts/1');
yield* fs.query('posts', []);
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(state.directOps.map((op) => op[0])).toEqual(['get', 'query']);
@@ -336,9 +338,9 @@ describe('FirestoreService (admin)', () => {
Effect.gen(function* () {
yield* fs.set('posts/1', { title: 'a' });
yield* new TestError({ reason: 'boom' });
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(Exit.isFailure(exit)).toBe(true);
@@ -354,9 +356,9 @@ describe('FirestoreService (admin)', () => {
Effect.gen(function* () {
yield* fs.set('posts/1', { title: 'a' });
yield* fs.withBatch(fs.set('posts/2', { title: 'b' }));
- })
- )
- )
+ }),
+ ),
+ ),
);
expect(state.batchesCreated).toBe(1);
@@ -369,8 +371,8 @@ describe('FirestoreService (admin)', () => {
await run(
db,
withService((fs) =>
- fs.withTransaction(fs.withBatch(fs.set('posts/1', { title: 'a' })))
- )
+ fs.withTransaction(fs.withBatch(fs.set('posts/1', { title: 'a' }))),
+ ),
);
expect(state.batchesCreated).toBe(0);
@@ -381,7 +383,7 @@ describe('FirestoreService (admin)', () => {
const { db } = makeFakeDb();
const exit = await runExit(
db,
- withService((fs) => fs.withBatch(fs.deleteRecursive('posts/1')))
+ withService((fs) => fs.withBatch(fs.deleteRecursive('posts/1'))),
);
expect(Exit.isFailure(exit)).toBe(true);
@@ -401,8 +403,8 @@ describe('FirestoreService (admin)', () => {
yield* fs.get('posts/1');
yield* fs.set('posts/1', { title: 'a' });
yield* fs.delete('posts/2');
- })
- )
+ }),
+ ),
);
expect(state.directOps.map((op) => op[0])).toEqual([
diff --git a/packages/admin/src/lib/firestore/firestore-service.ts b/packages/admin/src/lib/firestore/firestore-service.ts
index 0b869555..5bd3fa02 100644
--- a/packages/admin/src/lib/firestore/firestore-service.ts
+++ b/packages/admin/src/lib/firestore/firestore-service.ts
@@ -37,7 +37,7 @@ const packSnapshot = makeSnapshotPacker(firestoreDecode);
*/
const CurrentTransaction = Context.Reference>(
'@effect-firebase/admin/CurrentTransaction',
- { defaultValue: () => Option.none() }
+ { defaultValue: () => Option.none() },
);
/**
@@ -46,7 +46,7 @@ const CurrentTransaction = Context.Reference>(
*/
const CurrentBatch = Context.Reference>(
'@effect-firebase/admin/CurrentBatch',
- { defaultValue: () => Option.none() }
+ { defaultValue: () => Option.none() },
);
/**
@@ -79,7 +79,7 @@ const isInvalidCredentialError = (error: unknown): boolean => {
};
const isApplicationDefaultCredential = (
- credential: unknown
+ credential: unknown,
): credential is { constructor: { name: string } } => {
if (typeof credential !== 'object' || credential === null) {
return false;
@@ -106,7 +106,7 @@ const buildDuplicateFirebaseAdminError = (error: Error): Error =>
'Ensure firebase-admin is deduped in your deployment and create both initializeApp() and getFirestore() from the same firebase-admin package instance.',
'Alternatively, use Admin.layer({ firestore: getFirestore(app) }) to provide a Firestore instance directly.',
].join(' '),
- { cause: error }
+ { cause: error },
);
const getFirestoreFromApp = (app: FirebaseAdminApp): Firestore => {
@@ -139,7 +139,7 @@ const make = (db: Firestore) => {
return Option.some(tx.value as unknown as StagedWriter);
}
return yield* CurrentBatch;
- }
+ },
);
const assertNoTransaction = (operation: string) =>
@@ -147,10 +147,10 @@ const make = (db: Firestore) => {
Option.isSome(tx)
? Effect.die(
new Error(
- `FirestoreService.${operation} cannot be used inside withTransaction.`
- )
+ `FirestoreService.${operation} cannot be used inside withTransaction.`,
+ ),
)
- : Effect.void
+ : Effect.void,
);
const assertNoWriter = (operation: string) =>
@@ -158,15 +158,15 @@ const make = (db: Firestore) => {
Option.isSome(writer)
? Effect.die(
new Error(
- `FirestoreService.${operation} cannot be used inside withTransaction or withBatch.`
- )
+ `FirestoreService.${operation} cannot be used inside withTransaction or withBatch.`,
+ ),
)
- : Effect.void
+ : Effect.void,
);
const streamDoc = (
path: string,
- options?: Parameters[1]
+ options?: Parameters[1],
) =>
Stream.callback, FirestoreError>((queue) =>
Effect.acquireRelease(
@@ -183,20 +183,20 @@ const make = (db: Firestore) => {
} else {
Queue.failCauseUnsafe(
queue,
- Cause.fail(FirestoreError.fromError(error as Error))
+ Cause.fail(FirestoreError.fromError(error as Error)),
);
}
- }
+ },
);
}),
- (unsubscribe) => Effect.sync(() => unsubscribe())
- )
+ (unsubscribe) => Effect.sync(() => unsubscribe()),
+ ),
);
const streamQuery = (
collectionPath: string,
constraints: Parameters[2],
- options?: Parameters[1]
+ options?: Parameters[1],
) =>
Stream.callback, FirestoreError>((queue) =>
Effect.acquireRelease(
@@ -205,7 +205,7 @@ const make = (db: Firestore) => {
return query.onSnapshot(
(snapshot) => {
const snapshots = Arr.filterMap(snapshot.docs, (doc) =>
- Result.fromOption(packSnapshot(doc, options), () => void 0)
+ Result.fromOption(packSnapshot(doc, options), () => void 0),
);
Queue.offerUnsafe(queue, snapshots);
},
@@ -216,14 +216,14 @@ const make = (db: Firestore) => {
} else {
Queue.failCauseUnsafe(
queue,
- Cause.fail(FirestoreError.fromError(error as Error))
+ Cause.fail(FirestoreError.fromError(error as Error)),
);
}
- }
+ },
);
}),
- (unsubscribe) => Effect.sync(() => unsubscribe())
- )
+ (unsubscribe) => Effect.sync(() => unsubscribe()),
+ ),
);
return FirestoreService.of({
@@ -313,8 +313,8 @@ const make = (db: Firestore) => {
Effect.tryPromise({
try: () => db.recursiveDelete(db.doc(path)),
catch: (error) => mapError(error),
- })
- )
+ }),
+ ),
),
query: (collectionPath, constraints) =>
Effect.gen(function* () {
@@ -327,20 +327,20 @@ const make = (db: Firestore) => {
catch: (error) => mapError(error),
});
return Arr.filterMap(snapshot.docs, (doc) =>
- Result.fromOption(packSnapshot(doc), () => void 0)
+ Result.fromOption(packSnapshot(doc), () => void 0),
);
}),
streamDoc: (path, options) =>
Stream.unwrap(
assertNoTransaction('streamDoc').pipe(
- Effect.map(() => streamDoc(path, options))
- )
+ Effect.map(() => streamDoc(path, options)),
+ ),
),
streamQuery: (collectionPath, constraints, options) =>
Stream.unwrap(
assertNoTransaction('streamQuery').pipe(
- Effect.map(() => streamQuery(collectionPath, constraints, options))
- )
+ Effect.map(() => streamQuery(collectionPath, constraints, options)),
+ ),
),
withTransaction: (self: Effect.Effect) =>
Effect.gen(function* () {
@@ -356,16 +356,16 @@ const make = (db: Firestore) => {
Effect.runPromiseExit(
self.pipe(
Effect.provideService(CurrentTransaction, Option.some(tx)),
- Effect.provideContext(context)
+ Effect.provideContext(context),
),
- { signal }
+ { signal },
).then((exit) => {
if (Exit.isFailure(exit)) {
// Reject so Firestore rolls the transaction back.
throw new EffectFailure(exit);
}
return exit;
- })
+ }),
),
catch: (error) =>
error instanceof EffectFailure ? error : mapError(error),
@@ -373,8 +373,8 @@ const make = (db: Firestore) => {
Effect.catch((error) =>
error instanceof EffectFailure
? Effect.succeed(error.exit as Exit.Exit)
- : Effect.fail(error)
- )
+ : Effect.fail(error),
+ ),
);
return yield* exit;
}),
@@ -389,7 +389,7 @@ const make = (db: Firestore) => {
}
const batch = db.batch();
const result = yield* self.pipe(
- Effect.provideService(CurrentBatch, Option.some(batch))
+ Effect.provideService(CurrentBatch, Option.some(batch)),
);
yield* Effect.tryPromise({
try: () => batch.commit(),
@@ -401,7 +401,7 @@ const make = (db: Firestore) => {
};
export const layerFromFirestore = (
- db: Firestore
+ db: Firestore,
): Layer.Layer => Layer.succeed(FirestoreService, make(db));
/**
@@ -412,5 +412,5 @@ export const layer = Layer.effect(
Effect.gen(function* () {
const app = yield* App;
return make(getFirestoreFromApp(app.getApp()));
- })
+ }),
);
diff --git a/packages/admin/src/lib/firestore/query-builder.ts b/packages/admin/src/lib/firestore/query-builder.ts
index 8949ae13..80d23111 100644
--- a/packages/admin/src/lib/firestore/query-builder.ts
+++ b/packages/admin/src/lib/firestore/query-builder.ts
@@ -13,14 +13,14 @@ import { firestoreEncode } from './converter.js';
const applyConstraint = (
db: Firestore,
query: Query,
- constraint: QueryConstraint
+ constraint: QueryConstraint,
): Query => {
switch (constraint._tag) {
case 'Where':
return query.where(
constraint.field,
constraint.op,
- firestoreEncode(db, constraint.value)
+ firestoreEncode(db, constraint.value),
);
case 'OrderBy':
return query.orderBy(constraint.field, constraint.direction);
@@ -30,19 +30,19 @@ const applyConstraint = (
return query.limitToLast(constraint.count);
case 'StartAt':
return query.startAt(
- ...constraint.values.map((value) => firestoreEncode(db, value))
+ ...constraint.values.map((value) => firestoreEncode(db, value)),
);
case 'StartAfter':
return query.startAfter(
- ...constraint.values.map((value) => firestoreEncode(db, value))
+ ...constraint.values.map((value) => firestoreEncode(db, value)),
);
case 'EndAt':
return query.endAt(
- ...constraint.values.map((value) => firestoreEncode(db, value))
+ ...constraint.values.map((value) => firestoreEncode(db, value)),
);
case 'EndBefore':
return query.endBefore(
- ...constraint.values.map((value) => firestoreEncode(db, value))
+ ...constraint.values.map((value) => firestoreEncode(db, value)),
);
case 'And':
return query.where(buildCompositeFilter(db, constraint));
@@ -56,10 +56,10 @@ const applyConstraint = (
*/
const buildCompositeFilter = (
db: Firestore,
- constraint: QueryConstraint & { _tag: 'And' | 'Or' }
+ constraint: QueryConstraint & { _tag: 'And' | 'Or' },
): Filter => {
const filters = constraint.constraints.map((childConstraint) =>
- buildFilter(db, childConstraint)
+ buildFilter(db, childConstraint),
);
if (constraint._tag === 'Or') {
@@ -77,24 +77,24 @@ const buildFilter = (db: Firestore, constraint: QueryConstraint): Filter => {
return Filter.where(
constraint.field,
constraint.op,
- firestoreEncode(db, constraint.value)
+ firestoreEncode(db, constraint.value),
);
case 'And':
return Filter.and(
...constraint.constraints.map((childConstraint) =>
- buildFilter(db, childConstraint)
- )
+ buildFilter(db, childConstraint),
+ ),
);
case 'Or':
return Filter.or(
...constraint.constraints.map((childConstraint) =>
- buildFilter(db, childConstraint)
- )
+ buildFilter(db, childConstraint),
+ ),
);
default:
// Non-filter constraints (OrderBy, Limit, etc.) shouldn't appear in composite filters
throw new Error(
- `Cannot use ${constraint._tag} inside AND/OR composite filters`
+ `Cannot use ${constraint._tag} inside AND/OR composite filters`,
);
}
};
@@ -103,7 +103,7 @@ const buildFilter = (db: Firestore, constraint: QueryConstraint): Filter => {
* Check if a constraint is a composite (And/Or) filter.
*/
const isCompositeFilter = (
- constraint: QueryConstraint
+ constraint: QueryConstraint,
): constraint is QueryConstraint & { _tag: 'And' | 'Or' } =>
constraint._tag === 'And' || constraint._tag === 'Or';
@@ -113,7 +113,7 @@ const isCompositeFilter = (
export const buildQuery = (
db: Firestore,
collectionPath: string,
- constraints: ReadonlyArray
+ constraints: ReadonlyArray,
): Query => {
const collectionRef: CollectionReference = db.collection(collectionPath);
diff --git a/packages/admin/src/lib/functions/decode-document-data.ts b/packages/admin/src/lib/functions/decode-document-data.ts
index 1a63b47c..d2cf76fb 100644
--- a/packages/admin/src/lib/functions/decode-document-data.ts
+++ b/packages/admin/src/lib/functions/decode-document-data.ts
@@ -15,7 +15,7 @@ export const decodeDocumentData = (
rawData: Record | undefined,
docId: string | undefined,
schema: S,
- idField?: string
+ idField?: string,
): Effect.Effect, never, S['DecodingServices']> => {
const convertedData = firestoreDecode(rawData ?? {});
const dataWithId = idField
@@ -23,6 +23,6 @@ export const decodeDocumentData = (
: convertedData;
return Schema.decodeUnknownEffect(schema)(dataWithId).pipe(
Effect.orDie,
- Effect.withSpan('decodeDocumentData')
+ Effect.withSpan('decodeDocumentData'),
) as Effect.Effect, never, S['DecodingServices']>;
};
diff --git a/packages/admin/src/lib/functions/on-call-helpers.ts b/packages/admin/src/lib/functions/on-call-helpers.ts
index 2b98cd05..90b2b432 100644
--- a/packages/admin/src/lib/functions/on-call-helpers.ts
+++ b/packages/admin/src/lib/functions/on-call-helpers.ts
@@ -41,7 +41,7 @@ export const extractContext = (request: CallableRequest): CallableContext => ({
export const decodeInput =
(schema: I) =>
(
- request: CallableRequest
+ request: CallableRequest,
): Effect.Effect<
Schema.Schema.Type,
Schema.SchemaError,
@@ -68,7 +68,7 @@ export const decodeInput =
export const encodeOutput =
(schema: O) =>
(
- output: Schema.Schema.Type
+ output: Schema.Schema.Type,
): Effect.Effect<
Schema.Codec.Encoded,
Schema.SchemaError,
@@ -103,16 +103,16 @@ export const encodeOutput =
export const withSchemas =
(
inputSchema: I,
- outputSchema: O
+ outputSchema: O,
) =>
(
handler: (
input: Schema.Schema.Type,
- context: CallableContext
- ) => Effect.Effect, E, R>
+ context: CallableContext,
+ ) => Effect.Effect, E, R>,
) =>
(
- request: CallableRequest
+ request: CallableRequest,
): Effect.Effect<
Schema.Codec.Encoded,
E | Schema.SchemaError,
@@ -121,7 +121,7 @@ export const withSchemas =
pipe(
decodeInput(inputSchema)(request),
Effect.andThen((input) => handler(input, extractContext(request))),
- Effect.andThen(encodeOutput(outputSchema))
+ Effect.andThen(encodeOutput(outputSchema)),
);
/**
@@ -144,15 +144,15 @@ export const withInputSchema =
(
handler: (
input: Schema.Schema.Type,
- context: CallableContext
- ) => Effect.Effect
+ context: CallableContext,
+ ) => Effect.Effect,
) =>
(
- request: CallableRequest
+ request: CallableRequest,
): Effect.Effect =>
pipe(
decodeInput(inputSchema)(request),
- Effect.andThen((input) => handler(input, extractContext(request)))
+ Effect.andThen((input) => handler(input, extractContext(request))),
);
/**
@@ -173,11 +173,11 @@ export const withOutputSchema =
(outputSchema: O) =>
(
handler: (
- request: CallableRequest
- ) => Effect.Effect, E, R>
+ request: CallableRequest,
+ ) => Effect.Effect, E, R>,
) =>
(
- request: CallableRequest
+ request: CallableRequest,
): Effect.Effect<
Schema.Codec.Encoded,
E | Schema.SchemaError,
diff --git a/packages/admin/src/lib/functions/on-call.ts b/packages/admin/src/lib/functions/on-call.ts
index b1c5ae0c..6a15c1f5 100644
--- a/packages/admin/src/lib/functions/on-call.ts
+++ b/packages/admin/src/lib/functions/on-call.ts
@@ -19,20 +19,24 @@ interface CallEffectOptions extends CallableOptions {
runtime: Runtime;
}
-interface CallEffectOptionsWithInput
- extends CallEffectOptions {
+interface CallEffectOptionsWithInput<
+ R,
+ I extends Schema.Top,
+> extends CallEffectOptions {
inputSchema: I;
}
-interface CallEffectOptionsWithOutput
- extends CallEffectOptions {
+interface CallEffectOptionsWithOutput<
+ R,
+ O extends Schema.Top,
+> extends CallEffectOptions {
outputSchema: O;
}
interface CallEffectOptionsWithBoth<
R,
I extends Schema.Top,
- O extends Schema.Top
+ O extends Schema.Top,
> extends CallEffectOptions {
inputSchema: I;
outputSchema: O;
@@ -49,8 +53,8 @@ export function onCallEffect(
options: CallEffectOptionsWithBoth,
handler: (
input: Schema.Schema.Type,
- context: CallableContext
- ) => Effect.Effect, E, R>
+ context: CallableContext,
+ ) => Effect.Effect, E, R>,
): CallableFunction, Schema.Codec.Encoded>;
// Overload: only input schema
@@ -58,8 +62,8 @@ export function onCallEffect(
options: CallEffectOptionsWithInput,
handler: (
input: Schema.Schema.Type,
- context: CallableContext
- ) => Effect.Effect
+ context: CallableContext,
+ ) => Effect.Effect,
): CallableFunction>;
// Overload: only output schema
@@ -67,8 +71,8 @@ export function onCallEffect(
options: CallEffectOptionsWithOutput,
handler: (
request: CallableRequest,
- response?: CallableResponse
- ) => Effect.Effect, E, R>
+ response?: CallableResponse,
+ ) => Effect.Effect, E, R>,
): CallableFunction, unknown>;
// Overload: no schemas
@@ -76,8 +80,8 @@ export function onCallEffect(
options: CallEffectOptions,
handler: (
request: CallableRequest,
- response?: CallableResponse
- ) => Effect.Effect
+ response?: CallableResponse,
+ ) => Effect.Effect,
): CallableFunction;
// Implementation
@@ -87,7 +91,7 @@ export function onCallEffect(
outputSchema?: Schema.Top;
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- handler: (...args: any[]) => Effect.Effect
+ handler: (...args: any[]) => Effect.Effect,
): CallableFunction {
const { inputSchema, outputSchema } = options;
@@ -111,13 +115,13 @@ export function onCallEffect(
Effect.andThen((output) =>
outputSchema
? encodeOutput(outputSchema)(output)
- : Effect.succeed(output)
- )
+ : Effect.succeed(output),
+ ),
).pipe(Effect.withSpan('onCallEffect'));
return await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onCall', {
inner: error,
diff --git a/packages/admin/src/lib/functions/on-document-created.ts b/packages/admin/src/lib/functions/on-document-created.ts
index 46f398a9..6b8836ba 100644
--- a/packages/admin/src/lib/functions/on-document-created.ts
+++ b/packages/admin/src/lib/functions/on-document-created.ts
@@ -17,7 +17,7 @@ interface DocumentCreatedEffectOptions<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
> extends DocumentOptions {
runtime: Runtime;
schema?: S;
@@ -34,13 +34,16 @@ export function onDocumentCreatedEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentCreatedEffectOptions,
handler: (
data: Schema.Schema.Type,
- event: FirestoreEvent>
- ) => Effect.Effect
+ event: FirestoreEvent<
+ QueryDocumentSnapshot | undefined,
+ ParamsOf
+ >,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreEvent>
> {
@@ -52,20 +55,20 @@ export function onDocumentCreatedEffect<
event.data?.data(),
event.data?.id,
schema,
- options.idField
+ options.idField,
),
Effect.tap(() =>
Effect.annotateCurrentSpan({
document: event.data?.ref.path ?? 'unknown',
- })
+ }),
),
Effect.flatMap((data) => handler(data as Schema.Schema.Type, event)),
- Effect.withSpan('onDocumentCreatedEffect')
+ Effect.withSpan('onDocumentCreatedEffect'),
);
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentCreated', {
inner: error,
@@ -86,7 +89,7 @@ export function onDocumentCreatedWithAuthContextEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentCreatedEffectOptions,
handler: (
@@ -94,8 +97,8 @@ export function onDocumentCreatedWithAuthContextEffect<
QueryDocumentSnapshot | undefined,
ParamsOf
>,
- data: Schema.Schema.Type
- ) => Effect.Effect
+ data: Schema.Schema.Type,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreAuthEvent>
> {
@@ -110,14 +113,14 @@ export function onDocumentCreatedWithAuthContextEffect<
event.data?.data(),
event.data?.id,
schema,
- options.idField
+ options.idField,
);
return yield* handler(event, data as Schema.Schema.Type);
}).pipe(Effect.withSpan('onDocumentCreatedWithAuthContextEffect'));
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentCreatedWithAuthContext', {
inner: error,
diff --git a/packages/admin/src/lib/functions/on-document-deleted.ts b/packages/admin/src/lib/functions/on-document-deleted.ts
index 7eb9547b..a059ed32 100644
--- a/packages/admin/src/lib/functions/on-document-deleted.ts
+++ b/packages/admin/src/lib/functions/on-document-deleted.ts
@@ -17,7 +17,7 @@ interface DocumentDeletedEffectOptions<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
> extends DocumentOptions {
runtime: Runtime;
schema?: S;
@@ -34,13 +34,16 @@ export function onDocumentDeletedEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentDeletedEffectOptions,
handler: (
data: Schema.Schema.Type,
- event: FirestoreEvent>
- ) => Effect.Effect
+ event: FirestoreEvent<
+ QueryDocumentSnapshot | undefined,
+ ParamsOf
+ >,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreEvent>
> {
@@ -55,14 +58,14 @@ export function onDocumentDeletedEffect<
event.data?.data(),
event.data?.id,
schema,
- options.idField
+ options.idField,
);
return yield* handler(data as Schema.Schema.Type, event);
}).pipe(Effect.withSpan('onDocumentDeletedEffect'));
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentDeleted', {
inner: error,
@@ -83,7 +86,7 @@ export function onDocumentDeletedWithAuthContextEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentDeletedEffectOptions,
handler: (
@@ -91,8 +94,8 @@ export function onDocumentDeletedWithAuthContextEffect<
QueryDocumentSnapshot | undefined,
ParamsOf
>,
- data: Schema.Schema.Type
- ) => Effect.Effect
+ data: Schema.Schema.Type,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreAuthEvent>
> {
@@ -107,14 +110,14 @@ export function onDocumentDeletedWithAuthContextEffect<
event.data?.data(),
event.data?.id,
schema,
- options.idField
+ options.idField,
);
return yield* handler(event, data as Schema.Schema.Type);
}).pipe(Effect.withSpan('onDocumentDeletedWithAuthContextEffect'));
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentDeletedWithAuthContext', {
inner: error,
diff --git a/packages/admin/src/lib/functions/on-document-updated.ts b/packages/admin/src/lib/functions/on-document-updated.ts
index 1be2b585..bc48ca23 100644
--- a/packages/admin/src/lib/functions/on-document-updated.ts
+++ b/packages/admin/src/lib/functions/on-document-updated.ts
@@ -18,7 +18,7 @@ interface DocumentUpdatedEffectOptions<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
> extends DocumentOptions {
runtime: Runtime;
schema?: S;
@@ -43,7 +43,7 @@ export function onDocumentUpdatedEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentUpdatedEffectOptions,
handler: (
@@ -51,8 +51,8 @@ export function onDocumentUpdatedEffect<
event: FirestoreEvent<
Change | undefined,
ParamsOf
- >
- ) => Effect.Effect
+ >,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreEvent | undefined, ParamsOf>
> {
@@ -69,13 +69,13 @@ export function onDocumentUpdatedEffect<
event.data?.before.data(),
docId,
schema,
- options.idField
+ options.idField,
);
const after = yield* decodeDocumentData(
event.data?.after.data(),
docId,
schema,
- options.idField
+ options.idField,
);
return yield* handler(
@@ -83,13 +83,13 @@ export function onDocumentUpdatedEffect<
before,
after,
} as TypedChange>,
- event
+ event,
);
}).pipe(Effect.withSpan('onDocumentUpdatedEffect'));
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentUpdated', {
inner: error,
@@ -110,7 +110,7 @@ export function onDocumentUpdatedWithAuthContextEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentUpdatedEffectOptions,
handler: (
@@ -118,8 +118,8 @@ export function onDocumentUpdatedWithAuthContextEffect<
Change | undefined,
ParamsOf
>,
- data: TypedChange>
- ) => Effect.Effect
+ data: TypedChange>,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreAuthEvent<
Change | undefined,
@@ -138,13 +138,13 @@ export function onDocumentUpdatedWithAuthContextEffect<
event.data?.before.data(),
docId,
schema,
- options.idField
+ options.idField,
);
const after = yield* decodeDocumentData(
event.data?.after.data(),
docId,
schema,
- options.idField
+ options.idField,
);
return yield* handler(event, {
before,
@@ -154,7 +154,7 @@ export function onDocumentUpdatedWithAuthContextEffect<
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentUpdatedWithAuthContext', {
inner: error,
diff --git a/packages/admin/src/lib/functions/on-document-written.ts b/packages/admin/src/lib/functions/on-document-written.ts
index 4d8515fd..5a63807a 100644
--- a/packages/admin/src/lib/functions/on-document-written.ts
+++ b/packages/admin/src/lib/functions/on-document-written.ts
@@ -18,7 +18,7 @@ interface DocumentWrittenEffectOptions<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
> extends DocumentOptions {
runtime: Runtime;
schema?: S;
@@ -44,7 +44,7 @@ export function onDocumentWrittenEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentWrittenEffectOptions,
handler: (
@@ -52,8 +52,8 @@ export function onDocumentWrittenEffect<
event: FirestoreEvent<
Change | undefined,
ParamsOf
- >
- ) => Effect.Effect
+ >,
+ ) => Effect.Effect,
): CloudFunction<
FirestoreEvent | undefined, ParamsOf>
> {
@@ -77,13 +77,18 @@ export function onDocumentWrittenEffect<
beforeData,
docId,
schema,
- options.idField
- )
+ options.idField,
+ ),
)
: Option.none();
const after = afterData
? Option.some(
- yield* decodeDocumentData(afterData, docId, schema, options.idField)
+ yield* decodeDocumentData(
+ afterData,
+ docId,
+ schema,
+ options.idField,
+ ),
)
: Option.none();
@@ -92,13 +97,13 @@ export function onDocumentWrittenEffect<
before,
after,
} as TypedWrittenChange>,
- event
+ event,
);
}).pipe(Effect.withSpan('onDocumentWrittenEffect'));
await run(
options.runtime,
- effect as Effect.Effect
+ effect as Effect.Effect,
).catch((error) => {
logger.error('Defect in onDocumentWritten', {
inner: error,
@@ -119,7 +124,7 @@ export function onDocumentWrittenWithAuthContextEffect<
R,
Document extends string,
S extends Schema.Top = Schema.Schema,
- IdField extends keyof Schema.Schema.Type & string = never
+ IdField extends keyof Schema.Schema.Type & string = never,
>(
options: DocumentWrittenEffectOptions,
handler: (
@@ -127,8 +132,8 @@ export function onDocumentWrittenWithAuthContextEffect<
Change | undefined,
ParamsOf