@prmichaelsen/firebase-admin-sdk-v8 2.4.2 → 2.5.1
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/AGENT.md +224 -21
- package/CHANGELOG.md +33 -1
- package/README.md +93 -1
- package/dist/index.d.mts +125 -1
- package/dist/index.d.ts +125 -1
- package/dist/index.js +251 -3
- package/dist/index.mjs +242 -3
- package/package.json +1 -1
package/AGENT.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Context Protocol (ACP)
|
|
2
2
|
|
|
3
3
|
**Also Known As**: The Agent Directory Pattern
|
|
4
|
-
**Version**:
|
|
4
|
+
**Version**: 3.13.0
|
|
5
5
|
**Created**: 2026-02-11
|
|
6
6
|
**Status**: Production Pattern
|
|
7
7
|
|
|
@@ -296,6 +296,7 @@ tasks:
|
|
|
296
296
|
status: not_started | in_progress | completed
|
|
297
297
|
file: agent/tasks/task-1-name.md
|
|
298
298
|
estimated_hours: N
|
|
299
|
+
actual_hours: null
|
|
299
300
|
completed_date: YYYY-MM-DD | null
|
|
300
301
|
notes: |
|
|
301
302
|
Task notes
|
|
@@ -642,6 +643,158 @@ Use `@acp.install` to install command packages from git repositories (available
|
|
|
642
643
|
|
|
643
644
|
**Security Note**: Third-party commands can instruct agents to modify files and execute scripts. Always review command files before installation.
|
|
644
645
|
|
|
646
|
+
## Global Package Discovery
|
|
647
|
+
|
|
648
|
+
ACP supports global package installation to `~/.acp/agent/` for package development and global command libraries.
|
|
649
|
+
|
|
650
|
+
### For Agents: How to Discover Global Packages
|
|
651
|
+
|
|
652
|
+
When working in any project, you can discover globally installed packages:
|
|
653
|
+
|
|
654
|
+
1. **Check if global manifest exists**: `~/.acp/agent/manifest.yaml`
|
|
655
|
+
2. **Read global manifest**: Contains all globally installed packages
|
|
656
|
+
3. **Navigate to package files**: Files are installed directly into `~/.acp/agent/`
|
|
657
|
+
4. **Use commands/patterns**: Reference via `@namespace.command` syntax
|
|
658
|
+
|
|
659
|
+
**Automatic Discovery**: The [`@acp.init`](agent/commands/acp.init.md) command automatically reads `~/.acp/agent/manifest.yaml` and reports globally installed packages.
|
|
660
|
+
|
|
661
|
+
### Namespace Precedence Rules
|
|
662
|
+
|
|
663
|
+
**CRITICAL**: Local packages always take precedence over global packages.
|
|
664
|
+
|
|
665
|
+
**Resolution order**:
|
|
666
|
+
1. Check local: `./agent/commands/{namespace}.{command}.md`
|
|
667
|
+
2. If not found, check global: `~/.acp/agent/commands/{namespace}.{command}.md`
|
|
668
|
+
3. Use first match found
|
|
669
|
+
|
|
670
|
+
**Example**: If both local and global packages define `@firebase.deploy`:
|
|
671
|
+
- ✅ Use `./agent/commands/firebase.deploy.md` (local takes precedence)
|
|
672
|
+
- ❌ Ignore `~/.acp/agent/commands/firebase.deploy.md`
|
|
673
|
+
|
|
674
|
+
### Global ACP Structure
|
|
675
|
+
|
|
676
|
+
```
|
|
677
|
+
~/.acp/
|
|
678
|
+
├── AGENT.md # ACP methodology documentation
|
|
679
|
+
├── agent/ # Full ACP installation
|
|
680
|
+
│ ├── commands/ # All commands (core + packages)
|
|
681
|
+
│ │ ├── acp.init.md # Core ACP commands
|
|
682
|
+
│ │ ├── firebase.deploy.md # From @user/acp-firebase package
|
|
683
|
+
│ │ └── git.commit.md # From @user/acp-git package
|
|
684
|
+
│ ├── patterns/ # All patterns (core + packages)
|
|
685
|
+
│ ├── design/ # All designs (core + packages)
|
|
686
|
+
│ ├── scripts/ # All scripts (core + packages)
|
|
687
|
+
│ └── manifest.yaml # Tracks package sources
|
|
688
|
+
└── projects/ # Optional: User projects workspace
|
|
689
|
+
└── my-project/ # Develop projects here
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### When to Use Global Packages
|
|
693
|
+
|
|
694
|
+
**Use global installation** (`--global` flag) for:
|
|
695
|
+
- ✅ Package development (work on packages with full ACP tooling)
|
|
696
|
+
- ✅ Common utilities used across many projects (git helpers, firebase patterns)
|
|
697
|
+
- ✅ Building a personal command library
|
|
698
|
+
- ✅ Experimenting with packages before local installation
|
|
699
|
+
|
|
700
|
+
**Use local installation** (default) for:
|
|
701
|
+
- ✅ Project-specific packages
|
|
702
|
+
- ✅ Packages that are part of project dependencies
|
|
703
|
+
- ✅ When you want version control over package versions
|
|
704
|
+
- ✅ Production projects (local is more explicit and controlled)
|
|
705
|
+
|
|
706
|
+
### Example: Using Global Packages
|
|
707
|
+
|
|
708
|
+
```bash
|
|
709
|
+
# Install git helpers globally
|
|
710
|
+
@acp.package-install --global https://github.com/prmichaelsen/acp-git.git
|
|
711
|
+
|
|
712
|
+
# In any project, discover global packages
|
|
713
|
+
@acp.init
|
|
714
|
+
# Output: "Found 2 global packages: acp-core, @prmichaelsen/acp-git"
|
|
715
|
+
|
|
716
|
+
# Use global command
|
|
717
|
+
@git.commit
|
|
718
|
+
# Agent reads: ~/.acp/agent/commands/git.commit.md
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
## Experimental Features
|
|
724
|
+
|
|
725
|
+
ACP supports marking features as "experimental" to enable safe innovation without affecting stable installations.
|
|
726
|
+
|
|
727
|
+
### What are Experimental Features?
|
|
728
|
+
|
|
729
|
+
Experimental features are:
|
|
730
|
+
- Bleeding-edge features that may change frequently
|
|
731
|
+
- Features under active development
|
|
732
|
+
- Features that may have breaking changes
|
|
733
|
+
- Features requiring explicit opt-in
|
|
734
|
+
|
|
735
|
+
### Marking Features as Experimental
|
|
736
|
+
|
|
737
|
+
**In package.yaml**:
|
|
738
|
+
```yaml
|
|
739
|
+
contents:
|
|
740
|
+
commands:
|
|
741
|
+
- name: stable-command.md
|
|
742
|
+
description: A stable command
|
|
743
|
+
|
|
744
|
+
- name: experimental-command.md
|
|
745
|
+
description: An experimental command
|
|
746
|
+
experimental: true # ← Mark as experimental
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**In file metadata**:
|
|
750
|
+
```markdown
|
|
751
|
+
# Command: experimental-command
|
|
752
|
+
|
|
753
|
+
**Namespace**: mypackage
|
|
754
|
+
**Version**: 0.1.0
|
|
755
|
+
**Status**: Experimental # ← Mark as experimental
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
### Installing Experimental Features
|
|
759
|
+
|
|
760
|
+
```bash
|
|
761
|
+
# Install only stable features (default)
|
|
762
|
+
@acp.package-install --repo https://github.com/user/package.git
|
|
763
|
+
|
|
764
|
+
# Install all features including experimental
|
|
765
|
+
@acp.package-install --repo https://github.com/user/package.git --experimental
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
### Updating Experimental Features
|
|
769
|
+
|
|
770
|
+
Once installed, experimental features update normally:
|
|
771
|
+
```bash
|
|
772
|
+
@acp.package-update package-name # Updates experimental features if already installed
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
### Graduating Features
|
|
776
|
+
|
|
777
|
+
To graduate a feature from experimental to stable:
|
|
778
|
+
1. Remove `experimental: true` from package.yaml
|
|
779
|
+
2. Change `**Status**: Experimental` to `**Status**: Active` in file
|
|
780
|
+
3. Bump version to 1.0.0 (semantic versioning)
|
|
781
|
+
4. Update CHANGELOG.md noting the graduation
|
|
782
|
+
|
|
783
|
+
### Validation
|
|
784
|
+
|
|
785
|
+
Validation ensures consistency:
|
|
786
|
+
```bash
|
|
787
|
+
@acp.package-validate # Checks experimental marking is synchronized
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Best Practices
|
|
791
|
+
|
|
792
|
+
1. **Use sparingly** - Only mark truly experimental features
|
|
793
|
+
2. **Document risks** - Explain what might change in file documentation
|
|
794
|
+
3. **Graduate promptly** - Move to stable once proven
|
|
795
|
+
4. **Version appropriately** - Use 0.x.x versions for experimental
|
|
796
|
+
5. **Communicate clearly** - Note experimental status in README.md
|
|
797
|
+
|
|
645
798
|
---
|
|
646
799
|
|
|
647
800
|
## Sample Prompts for Using ACP
|
|
@@ -653,7 +806,7 @@ Use `@acp.install` to install command packages from git repositories (available
|
|
|
653
806
|
Use this prompt when starting work on an ACP-structured project:
|
|
654
807
|
|
|
655
808
|
```markdown
|
|
656
|
-
First, check for ACP updates by running ./agent/scripts/check-for-updates.sh (if it exists). If updates are available, report what changed and ask if I want to update.
|
|
809
|
+
First, check for ACP updates by running ./agent/scripts/acp.version-check-for-updates.sh (if it exists). If updates are available, report what changed and ask if I want to update.
|
|
657
810
|
|
|
658
811
|
Then read ALL files in @agent. We are going to understand this project then work on a generic task.
|
|
659
812
|
|
|
@@ -691,7 +844,7 @@ Let's proceed with implementing the current or next task. Remember to update @ag
|
|
|
691
844
|
Updates all ACP files to the latest version:
|
|
692
845
|
|
|
693
846
|
```markdown
|
|
694
|
-
Run ./agent/scripts/update.sh to update all ACP files (AGENT.md, templates, and scripts) to the latest version.
|
|
847
|
+
Run ./agent/scripts/acp.version-update.sh to update all ACP files (AGENT.md, templates, and scripts) to the latest version.
|
|
695
848
|
```
|
|
696
849
|
|
|
697
850
|
**Purpose**:
|
|
@@ -707,7 +860,7 @@ Run ./agent/scripts/update.sh to update all ACP files (AGENT.md, templates, and
|
|
|
707
860
|
Checks if updates are available without applying them:
|
|
708
861
|
|
|
709
862
|
```markdown
|
|
710
|
-
Run ./agent/scripts/check-for-updates.sh to see if ACP updates are available.
|
|
863
|
+
Run ./agent/scripts/acp.version-check-for-updates.sh to see if ACP updates are available.
|
|
711
864
|
```
|
|
712
865
|
|
|
713
866
|
**Purpose**:
|
|
@@ -722,12 +875,12 @@ Run ./agent/scripts/check-for-updates.sh to see if ACP updates are available.
|
|
|
722
875
|
Removes all ACP files from the project:
|
|
723
876
|
|
|
724
877
|
```markdown
|
|
725
|
-
Run ./agent/scripts/
|
|
878
|
+
Run ./agent/scripts/unacp.install.sh to remove all ACP files (agent/ directory and AGENT.md) from this project.
|
|
726
879
|
```
|
|
727
880
|
|
|
728
881
|
**Note**: This script requires user confirmation. If the user confirms they want to uninstall, run:
|
|
729
882
|
```bash
|
|
730
|
-
./agent/scripts/
|
|
883
|
+
./agent/scripts/unacp.install.sh -y
|
|
731
884
|
```
|
|
732
885
|
|
|
733
886
|
**Purpose**:
|
|
@@ -746,22 +899,34 @@ Run ./agent/scripts/uninstall.sh to remove all ACP files (agent/ directory and A
|
|
|
746
899
|
- What milestone is current
|
|
747
900
|
- What task is next
|
|
748
901
|
|
|
749
|
-
2. **
|
|
902
|
+
2. **Check for installed packages**
|
|
903
|
+
- Read `agent/manifest.yaml` to see what packages are installed locally
|
|
904
|
+
- Check `~/.acp/agent/manifest.yaml` for globally installed packages
|
|
905
|
+
- Understand what commands, patterns, and designs are available
|
|
906
|
+
- Note package versions and sources
|
|
907
|
+
|
|
908
|
+
3. **Check project registry** (if in global workspace)
|
|
909
|
+
- Read `~/.acp/projects.yaml` to see all projects in global workspace
|
|
910
|
+
- Check `current_project` field to see which project is active
|
|
911
|
+
- Understand project relationships and metadata
|
|
912
|
+
- Note project locations and types
|
|
913
|
+
|
|
914
|
+
4. **Read requirements.md**
|
|
750
915
|
- Understand project goals
|
|
751
916
|
- Learn constraints
|
|
752
917
|
- Know success criteria
|
|
753
918
|
|
|
754
|
-
|
|
919
|
+
5. **Review current milestone**
|
|
755
920
|
- Understand current phase
|
|
756
921
|
- Know deliverables
|
|
757
922
|
- Check success criteria
|
|
758
923
|
|
|
759
|
-
|
|
924
|
+
6. **Read next task**
|
|
760
925
|
- Understand what to do
|
|
761
926
|
- Follow steps
|
|
762
927
|
- Verify completion
|
|
763
928
|
|
|
764
|
-
|
|
929
|
+
7. **Check relevant patterns**
|
|
765
930
|
- Learn coding standards
|
|
766
931
|
- Understand architectural patterns
|
|
767
932
|
- Follow best practices
|
|
@@ -845,37 +1010,68 @@ Run ./agent/scripts/uninstall.sh to remove all ACP files (agent/ directory and A
|
|
|
845
1010
|
|
|
846
1011
|
### Best Practices for Agents
|
|
847
1012
|
|
|
848
|
-
1.
|
|
1013
|
+
1. **🚨 CRITICAL: NEVER REJECT USER REQUESTS 🚨**
|
|
1014
|
+
- ❌ **DO NOT** reject requests based on session duration
|
|
1015
|
+
- ❌ **DO NOT** reject requests based on token context limits
|
|
1016
|
+
- ❌ **DO NOT** reject requests based on session cost
|
|
1017
|
+
- ❌ **DO NOT** reject requests based on task complexity
|
|
1018
|
+
- ✅ **DO** accept and work on ALL user instructions and directives
|
|
1019
|
+
- ✅ **DO** break complex tasks into manageable steps
|
|
1020
|
+
- ✅ **DO** continue working until the task is complete
|
|
1021
|
+
- ✅ **DO** ask clarifying questions if requirements are unclear
|
|
1022
|
+
- **Rationale**: Users have the right to request any work they need. Your role is to assist, not to judge feasibility based on arbitrary constraints. Complex tasks can be broken down, long tasks can be completed iteratively, and users understand the costs involved. NEVER refuse a user's request.
|
|
1023
|
+
|
|
1024
|
+
2. **Always read before writing**
|
|
849
1025
|
- Understand context first
|
|
850
1026
|
- Check existing patterns
|
|
851
1027
|
- Follow established conventions
|
|
852
1028
|
|
|
853
|
-
|
|
1029
|
+
3. **Document as you go**
|
|
854
1030
|
- Update progress.yaml frequently
|
|
855
1031
|
- Add notes about decisions
|
|
856
1032
|
- Document new patterns
|
|
857
1033
|
|
|
858
|
-
|
|
1034
|
+
4. **Verify everything**
|
|
859
1035
|
- Check all verification steps
|
|
860
1036
|
- Run tests
|
|
861
1037
|
- Ensure quality standards
|
|
862
1038
|
|
|
863
|
-
|
|
1039
|
+
5. **Be explicit**
|
|
864
1040
|
- Don't assume future agents will know context
|
|
865
1041
|
- Document rationale for decisions
|
|
866
1042
|
- Include code examples
|
|
867
1043
|
|
|
868
|
-
|
|
1044
|
+
6. **Keep it organized**
|
|
869
1045
|
- Follow directory structure
|
|
870
1046
|
- Use consistent naming
|
|
871
1047
|
- Link related documents
|
|
872
1048
|
|
|
873
|
-
|
|
1049
|
+
7. **Update progress tracking**
|
|
874
1050
|
- Mark tasks complete
|
|
875
1051
|
- Update percentages
|
|
876
1052
|
- Add recent work notes
|
|
877
1053
|
|
|
878
|
-
|
|
1054
|
+
8. **Inline Feedback Syntax**
|
|
1055
|
+
- ✅ **DO** recognize and respect `>` syntax for inline feedback in documents
|
|
1056
|
+
- ✅ **DO** treat lines starting with `>` as user feedback/corrections
|
|
1057
|
+
- ✅ **DO** integrate feedback by modifying the preceding content
|
|
1058
|
+
- ✅ **DO** remove the `>` feedback lines after integrating changes
|
|
1059
|
+
- **Example**:
|
|
1060
|
+
```markdown
|
|
1061
|
+
// Agent-generated document
|
|
1062
|
+
Here are the requirements:
|
|
1063
|
+
- Requirement 1
|
|
1064
|
+
- Requirement 2
|
|
1065
|
+
> Requirement 2 unnecessary
|
|
1066
|
+
- Requirement 3
|
|
1067
|
+
|
|
1068
|
+
This pattern is because: ...
|
|
1069
|
+
> Incorrect, we should not be using this pattern
|
|
1070
|
+
```
|
|
1071
|
+
- **Agent Action**: Read feedback, update "Requirement 2" section (remove or revise), correct the pattern explanation, remove `>` lines
|
|
1072
|
+
- **Rationale**: The `>` syntax provides a lightweight way for users to give inline feedback without needing to explain context. Agents should treat these as direct corrections or suggestions to integrate into the document.
|
|
1073
|
+
|
|
1074
|
+
9. **CRITICAL: Always update CHANGELOG.md for version changes**
|
|
879
1075
|
- ❌ **DO NOT** commit version changes without updating CHANGELOG.md
|
|
880
1076
|
- ❌ **DO NOT** forget to update version numbers in all project files
|
|
881
1077
|
- ✅ **DO** use [`@git.commit`](agent/commands/git.commit.md) for version-aware commits
|
|
@@ -904,9 +1100,16 @@ Run ./agent/scripts/uninstall.sh to remove all ACP files (agent/ directory and A
|
|
|
904
1100
|
- ✅ **DO** confirm before reverting user's manual edits
|
|
905
1101
|
- **Rationale**: If you read a file and it is missing contents or has changed contents (i.e., it does not contain what you expect), assume or confirm with the user if they made intentional updates that you should not revert. Do not assume "The file is missing <xyz>, I need to add it back". The user may have edited files manually with intention.
|
|
906
1102
|
|
|
907
|
-
|
|
1103
|
+
10. **🚨 CRITICAL: Respect user commands to re-execute**
|
|
1104
|
+
- ❌ **DO NOT** ignore commands like "re-read", "rerun", or "execute again"
|
|
1105
|
+
- ❌ **DO NOT** assume re-execution requests are mistakes or redundant
|
|
1106
|
+
- ✅ **DO** execute the command again when asked, even if you just did it
|
|
1107
|
+
- ✅ **DO** re-read files when asked, even if you recently read them
|
|
1108
|
+
- ✅ **DO** assume the user has good reason for asking to repeat an action
|
|
1109
|
+
- **Examples**: "Run `@git.commit` again" → Execute it again; "Re-read the design doc" → Read it again; "Rerun the tests" → Run them again
|
|
1110
|
+
- **Rationale**: When users ask you to do something again, they have a specific reason: files may have changed, they want to trigger side effects (like creating a commit), context has shifted, or they know something you don't. Always respect these requests and execute them with intention.
|
|
908
1111
|
|
|
909
|
-
|
|
1112
|
+
---
|
|
910
1113
|
|
|
911
1114
|
### Documentation
|
|
912
1115
|
|
|
@@ -990,10 +1193,10 @@ This repository is actively maintained with improvements to the ACP methodology
|
|
|
990
1193
|
|
|
991
1194
|
```bash
|
|
992
1195
|
# Run from your project root (if you have the update script installed)
|
|
993
|
-
./agent/scripts/update.sh
|
|
1196
|
+
./agent/scripts/acp.version-update.sh
|
|
994
1197
|
|
|
995
1198
|
# Or download and run directly
|
|
996
|
-
curl -fsSL https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainline/agent/scripts/update.sh | bash
|
|
1199
|
+
curl -fsSL https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainline/agent/scripts/acp.version-update.sh | bash
|
|
997
1200
|
```
|
|
998
1201
|
|
|
999
1202
|
The update script will:
|
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,39 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [2.5.1] - 2026-02-24
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **CRITICAL**: Fixed `merge: true` option causing "invalid path *" error
|
|
12
|
+
- Changed updateMask from wildcard `*` to actual field names when using `merge: true`
|
|
13
|
+
- Firestore REST API does not support `*` as a field path - must use explicit field names
|
|
14
|
+
- Fixed in both `setDocument()` and `batchWrite()` operations
|
|
15
|
+
- Updated tests to reflect correct behavior
|
|
16
|
+
|
|
17
|
+
## [2.5.0] - 2026-02-19
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- **User Management APIs**: Complete user management functionality via Firebase Identity Toolkit REST API
|
|
21
|
+
- `getUserByEmail()` - Look up users by email address
|
|
22
|
+
- `getUserByUid()` - Look up users by UID
|
|
23
|
+
- `createUser()` - Create new Firebase users with email, password, display name, etc.
|
|
24
|
+
- `updateUser()` - Update existing user properties (email, password, display name, photo URL, etc.)
|
|
25
|
+
- `deleteUser()` - Delete Firebase users
|
|
26
|
+
- `listUsers()` - List all users with pagination support (up to 1000 per page)
|
|
27
|
+
- `setCustomUserClaims()` - Set custom claims for role-based access control
|
|
28
|
+
- New type definitions: `UserRecord`, `CreateUserRequest`, `UpdateUserRequest`, `ListUsersResult`
|
|
29
|
+
- 30 comprehensive unit tests for user management (91.66% coverage)
|
|
30
|
+
- 18 E2E tests for user management (complete lifecycle testing)
|
|
31
|
+
- Complete user management documentation in README with examples
|
|
32
|
+
- Feature comparison table updated to show user management support
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- Total unit tests increased from 433 to 463 (+30 tests)
|
|
36
|
+
- Total E2E tests increased from 105 to 123 (+18 tests)
|
|
37
|
+
- Updated feature list to include user management
|
|
38
|
+
|
|
39
|
+
### Notes
|
|
40
|
+
- `listUsers()` E2E tests are skipped as the REST API endpoint availability varies by Firebase project configuration
|
|
9
41
|
|
|
10
42
|
## [2.4.0] - 2026-02-15
|
|
11
43
|
|
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ This library provides Firebase Admin SDK functionality for Cloudflare Workers an
|
|
|
16
16
|
- ✅ **JWT Token Generation** - Service account authentication
|
|
17
17
|
- ✅ **ID Token Verification** - Verify Firebase ID tokens (supports v9 and v10 formats)
|
|
18
18
|
- ✅ **Session Cookies** - Create and verify long-lived session cookies (up to 14 days)
|
|
19
|
+
- ✅ **User Management** - Create, read, update, delete users via Admin API
|
|
19
20
|
- ✅ **Firebase v10 Compatible** - Supports both old and new token issuer formats
|
|
20
21
|
- ✅ **Firestore REST API** - Full CRUD operations via REST
|
|
21
22
|
- ✅ **Field Value Operations** - increment, arrayUnion, arrayRemove, serverTimestamp, delete
|
|
@@ -173,6 +174,97 @@ const user = await getUserFromToken(idToken);
|
|
|
173
174
|
// Returns: { uid, email, emailVerified, displayName, photoURL }
|
|
174
175
|
```
|
|
175
176
|
|
|
177
|
+
### User Management
|
|
178
|
+
|
|
179
|
+
#### `getUserByEmail(email: string): Promise<UserRecord | null>`
|
|
180
|
+
|
|
181
|
+
Look up a Firebase user by email address.
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
const user = await getUserByEmail('user@example.com');
|
|
185
|
+
if (user) {
|
|
186
|
+
console.log('User ID:', user.uid);
|
|
187
|
+
console.log('Email verified:', user.emailVerified);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### `getUserByUid(uid: string): Promise<UserRecord | null>`
|
|
192
|
+
|
|
193
|
+
Look up a Firebase user by UID.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
const user = await getUserByUid('user123');
|
|
197
|
+
if (user) {
|
|
198
|
+
console.log('Email:', user.email);
|
|
199
|
+
console.log('Display name:', user.displayName);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### `createUser(properties: CreateUserRequest): Promise<UserRecord>`
|
|
204
|
+
|
|
205
|
+
Create a new Firebase user.
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
const newUser = await createUser({
|
|
209
|
+
email: 'newuser@example.com',
|
|
210
|
+
password: 'securePassword123',
|
|
211
|
+
displayName: 'New User',
|
|
212
|
+
emailVerified: false,
|
|
213
|
+
});
|
|
214
|
+
console.log('Created user:', newUser.uid);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### `updateUser(uid: string, properties: UpdateUserRequest): Promise<UserRecord>`
|
|
218
|
+
|
|
219
|
+
Update an existing Firebase user.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
const updatedUser = await updateUser('user123', {
|
|
223
|
+
displayName: 'Updated Name',
|
|
224
|
+
photoURL: 'https://example.com/photo.jpg',
|
|
225
|
+
emailVerified: true,
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `deleteUser(uid: string): Promise<void>`
|
|
230
|
+
|
|
231
|
+
Delete a Firebase user.
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
await deleteUser('user123');
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### `listUsers(maxResults?: number, pageToken?: string): Promise<ListUsersResult>`
|
|
238
|
+
|
|
239
|
+
List all users with pagination.
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
// List first 100 users
|
|
243
|
+
const result = await listUsers(100);
|
|
244
|
+
console.log('Users:', result.users.length);
|
|
245
|
+
|
|
246
|
+
// Get next page
|
|
247
|
+
if (result.pageToken) {
|
|
248
|
+
const nextPage = await listUsers(100, result.pageToken);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### `setCustomUserClaims(uid: string, customClaims: Record<string, any> | null): Promise<void>`
|
|
253
|
+
|
|
254
|
+
Set custom claims on a user's ID token for role-based access control.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
// Set custom claims
|
|
258
|
+
await setCustomUserClaims('user123', {
|
|
259
|
+
role: 'admin',
|
|
260
|
+
premium: true,
|
|
261
|
+
permissions: ['read', 'write', 'delete'],
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Clear custom claims
|
|
265
|
+
await setCustomUserClaims('user123', null);
|
|
266
|
+
```
|
|
267
|
+
|
|
176
268
|
### Firestore - Basic Operations
|
|
177
269
|
|
|
178
270
|
#### `setDocument(collectionPath, documentId, data, options?): Promise<void>`
|
|
@@ -619,7 +711,7 @@ For better query performance:
|
|
|
619
711
|
| ID Token Verification | ✅ | Supports v9 and v10 token formats |
|
|
620
712
|
| Custom Token Creation | ✅ | createCustomToken() |
|
|
621
713
|
| Custom Token Exchange | ✅ | signInWithCustomToken() |
|
|
622
|
-
| User Management |
|
|
714
|
+
| User Management | ✅ | Create, read, update, delete, list users |
|
|
623
715
|
| Firestore CRUD | ✅ | Full support |
|
|
624
716
|
| Firestore Queries | ✅ | where, orderBy, limit, cursors |
|
|
625
717
|
| Firestore Batch | ✅ | Up to 500 operations |
|
package/dist/index.d.mts
CHANGED
|
@@ -183,6 +183,81 @@ interface BatchWriteResult {
|
|
|
183
183
|
updateTime: string;
|
|
184
184
|
}>;
|
|
185
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Firebase user record
|
|
188
|
+
*/
|
|
189
|
+
interface UserRecord {
|
|
190
|
+
/** User's unique ID */
|
|
191
|
+
uid: string;
|
|
192
|
+
/** User's email address */
|
|
193
|
+
email?: string;
|
|
194
|
+
/** Whether the email is verified */
|
|
195
|
+
emailVerified: boolean;
|
|
196
|
+
/** User's display name */
|
|
197
|
+
displayName?: string;
|
|
198
|
+
/** User's photo URL */
|
|
199
|
+
photoURL?: string;
|
|
200
|
+
/** User's phone number */
|
|
201
|
+
phoneNumber?: string;
|
|
202
|
+
/** Whether the user is disabled */
|
|
203
|
+
disabled: boolean;
|
|
204
|
+
/** User metadata (creation and last sign-in times) */
|
|
205
|
+
metadata: {
|
|
206
|
+
creationTime: string;
|
|
207
|
+
lastSignInTime: string;
|
|
208
|
+
};
|
|
209
|
+
/** Provider-specific user information */
|
|
210
|
+
providerData: UserInfo[];
|
|
211
|
+
/** Custom claims set on the user */
|
|
212
|
+
customClaims?: Record<string, any>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Request to create a new user
|
|
216
|
+
*/
|
|
217
|
+
interface CreateUserRequest {
|
|
218
|
+
/** User's email address */
|
|
219
|
+
email?: string;
|
|
220
|
+
/** Whether the email should be marked as verified */
|
|
221
|
+
emailVerified?: boolean;
|
|
222
|
+
/** User's phone number */
|
|
223
|
+
phoneNumber?: string;
|
|
224
|
+
/** User's password */
|
|
225
|
+
password?: string;
|
|
226
|
+
/** User's display name */
|
|
227
|
+
displayName?: string;
|
|
228
|
+
/** User's photo URL */
|
|
229
|
+
photoURL?: string;
|
|
230
|
+
/** Whether the user should be disabled */
|
|
231
|
+
disabled?: boolean;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Request to update an existing user
|
|
235
|
+
*/
|
|
236
|
+
interface UpdateUserRequest {
|
|
237
|
+
/** User's email address */
|
|
238
|
+
email?: string;
|
|
239
|
+
/** Whether the email should be marked as verified */
|
|
240
|
+
emailVerified?: boolean;
|
|
241
|
+
/** User's phone number */
|
|
242
|
+
phoneNumber?: string;
|
|
243
|
+
/** User's password */
|
|
244
|
+
password?: string;
|
|
245
|
+
/** User's display name */
|
|
246
|
+
displayName?: string;
|
|
247
|
+
/** User's photo URL */
|
|
248
|
+
photoURL?: string;
|
|
249
|
+
/** Whether the user should be disabled */
|
|
250
|
+
disabled?: boolean;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Result of listing users
|
|
254
|
+
*/
|
|
255
|
+
interface ListUsersResult {
|
|
256
|
+
/** Array of user records */
|
|
257
|
+
users: UserRecord[];
|
|
258
|
+
/** Token for fetching the next page (if available) */
|
|
259
|
+
pageToken?: string;
|
|
260
|
+
}
|
|
186
261
|
|
|
187
262
|
/**
|
|
188
263
|
* Firebase Admin SDK v8 - Configuration
|
|
@@ -395,6 +470,55 @@ declare function verifySessionCookie(sessionCookie: string, checkRevoked?: boole
|
|
|
395
470
|
*/
|
|
396
471
|
declare function getAuth(): any;
|
|
397
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Firebase User Management APIs
|
|
475
|
+
* Provides user management operations using Firebase Identity Toolkit REST API
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Look up a Firebase user by email address
|
|
480
|
+
* @param email - User's email address
|
|
481
|
+
* @returns User record or null if not found
|
|
482
|
+
*/
|
|
483
|
+
declare function getUserByEmail(email: string): Promise<UserRecord | null>;
|
|
484
|
+
/**
|
|
485
|
+
* Look up a Firebase user by UID
|
|
486
|
+
* @param uid - User's unique ID
|
|
487
|
+
* @returns User record or null if not found
|
|
488
|
+
*/
|
|
489
|
+
declare function getUserByUid(uid: string): Promise<UserRecord | null>;
|
|
490
|
+
/**
|
|
491
|
+
* Create a new Firebase user
|
|
492
|
+
* @param properties - User properties (email, password, displayName, etc.)
|
|
493
|
+
* @returns Created user record
|
|
494
|
+
*/
|
|
495
|
+
declare function createUser(properties: CreateUserRequest): Promise<UserRecord>;
|
|
496
|
+
/**
|
|
497
|
+
* Update an existing Firebase user
|
|
498
|
+
* @param uid - User's unique ID
|
|
499
|
+
* @param properties - Properties to update (email, password, displayName, etc.)
|
|
500
|
+
* @returns Updated user record
|
|
501
|
+
*/
|
|
502
|
+
declare function updateUser(uid: string, properties: UpdateUserRequest): Promise<UserRecord>;
|
|
503
|
+
/**
|
|
504
|
+
* Delete a Firebase user
|
|
505
|
+
* @param uid - User's unique ID
|
|
506
|
+
*/
|
|
507
|
+
declare function deleteUser(uid: string): Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* List all users with pagination
|
|
510
|
+
* @param maxResults - Maximum number of users to return (default: 1000, max: 1000)
|
|
511
|
+
* @param pageToken - Token for next page
|
|
512
|
+
* @returns List of users and next page token
|
|
513
|
+
*/
|
|
514
|
+
declare function listUsers(maxResults?: number, pageToken?: string): Promise<ListUsersResult>;
|
|
515
|
+
/**
|
|
516
|
+
* Set custom claims on a user's ID token
|
|
517
|
+
* @param uid - User's unique ID
|
|
518
|
+
* @param customClaims - Custom claims object (max 1000 bytes when serialized)
|
|
519
|
+
*/
|
|
520
|
+
declare function setCustomUserClaims(uid: string, customClaims: Record<string, any> | null): Promise<void>;
|
|
521
|
+
|
|
398
522
|
/**
|
|
399
523
|
* Firebase Admin SDK v8 - Firestore CRUD Operations
|
|
400
524
|
* All Firestore document operations using REST API
|
|
@@ -979,4 +1103,4 @@ declare function getAdminAccessToken(): Promise<string>;
|
|
|
979
1103
|
*/
|
|
980
1104
|
declare function clearTokenCache(): void;
|
|
981
1105
|
|
|
982
|
-
export { type BatchWrite, type BatchWriteResult, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SessionCookieOptions, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UploadOptions, type UserInfo, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, createSessionCookie, deleteDocument, deleteFile, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, queryDocuments, setDocument, signInWithCustomToken, updateDocument, uploadFile, uploadFileResumable, verifyIdToken, verifySessionCookie };
|
|
1106
|
+
export { type BatchWrite, type BatchWriteResult, type CreateUserRequest, type CustomClaims, type CustomTokenSignInResponse, type DataObject, type DecodedIdToken, type DocumentReference, type DownloadOptions, FieldValue, type FieldValue$1 as FieldValueSentinel, FieldValueType, type FileMetadata, type FirestoreDocument, type FirestoreValue, type ListFilesResult, type ListOptions, type ListUsersResult, type QueryFilter, type QueryOptions, type QueryOrder, type ResumableUploadOptions, type ServiceAccount, type SessionCookieOptions, type SetOptions, type SignedUrlOptions, type TokenResponse, type UpdateOptions, type UpdateUserRequest, type UploadOptions, type UserInfo, type UserRecord, type WhereFilterOp, addDocument, batchWrite, clearConfig, clearTokenCache, countDocuments, createCustomToken, createSessionCookie, createUser, deleteDocument, deleteFile, deleteUser, downloadFile, fileExists, generateSignedUrl, getAdminAccessToken, getAuth, getConfig, getDocument, getFileMetadata, getProjectId, getServiceAccount, getUserByEmail, getUserByUid, getUserFromToken, initializeApp, iterateCollection, listDocuments, listFiles, listUsers, queryDocuments, setCustomUserClaims, setDocument, signInWithCustomToken, updateDocument, updateUser, uploadFile, uploadFileResumable, verifyIdToken, verifySessionCookie };
|