pyric-admin 0.1.0-alpha.8 → 0.1.0-alpha.9
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/LICENSE +216 -0
- package/README.md +94 -77
- package/README.md.orig +26 -27
- package/dist/app/index.d.ts +23 -134
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +69 -202
- package/dist/app/index.js.map +1 -1
- package/dist/app/lifecycle.d.ts +7 -0
- package/dist/app/lifecycle.d.ts.map +1 -0
- package/dist/app/lifecycle.js +15 -0
- package/dist/app/lifecycle.js.map +1 -0
- package/dist/auth/index.d.ts +76 -105
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +27 -86
- package/dist/auth/index.js.map +1 -1
- package/dist/database/index.d.ts +72 -39
- package/dist/database/index.d.ts.map +1 -1
- package/dist/database/index.js +27 -45
- package/dist/database/index.js.map +1 -1
- package/dist/firestore/index.d.ts.map +1 -1
- package/dist/firestore/index.js +4 -1
- package/dist/firestore/index.js.map +1 -1
- package/dist/messaging/index.d.ts +154 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/index.js +238 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/storage/index.d.ts +19 -38
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +14 -43
- package/dist/storage/index.js.map +1 -1
- package/package.json +15 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
Copyright 2026 David East
|
|
205
|
+
|
|
206
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
+
you may not use this file except in compliance with the License.
|
|
208
|
+
You may obtain a copy of the License at
|
|
209
|
+
|
|
210
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
+
|
|
212
|
+
Unless required by applicable law or agreed to in writing, software
|
|
213
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
+
See the License for the specific language governing permissions and
|
|
216
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -2,138 +2,155 @@
|
|
|
2
2
|
<img src="https://pyric.dev/pyric-logo.svg" alt="Pyric" width="180" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center">
|
|
5
|
+
<h1 align="center">Build with Firebase without touching production</h1>
|
|
6
6
|
|
|
7
|
-
<p align="center">
|
|
7
|
+
<p align="center">Keep the same <code>firebase/*</code> code. Pyric runs it against a local backend during development, then gets out of the way when the app ships to Firebase.</p>
|
|
8
8
|
|
|
9
9
|
<p align="center"><a href="https://pyric.dev">pyric.dev</a></p>
|
|
10
10
|
|
|
11
11
|
<br />
|
|
12
12
|
|
|
13
|
-
Pyric
|
|
13
|
+
Pyric adds a development-only resolution layer to a Firebase application. Run the Vite development server and supported Firebase imports resolve to a browser-local backend. Run a normal production build and those imports resolve to Firebase again. The application source does not branch between the two.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
This is not the Firebase Emulator Suite behind a wrapper. There is no Java process, no localhost port, and no cloud Firebase project connected.
|
|
15
|
+
The mirrored data services do not connect to a production Firebase project. Local writes cannot delete production data or create Firebase usage charges, and local rules changes do not deploy. Pyric owns the development sandbox and verification workflow. Firebase owns production, with `firebase-tools` or the Firebase Console handling deployment.
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
## Start a new Firebase application locally
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Create a Vite application with canonical Firebase imports, Firestore rules, and the Pyric development plugin already configured:
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
npm
|
|
22
|
+
npx create-pyric my-app
|
|
23
|
+
cd my-app
|
|
24
|
+
npm install
|
|
25
|
+
npm run dev
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
`npm create pyric my-app` runs the same scaffold.
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
The services are an independent implementation of Firebase's observable behavior, and that claim is tested rather than assumed: probes run against production Firebase, their recorded behavior is committed as observations, and CI replays every observation against the sandbox on every change. The section [What matches Firebase and what doesn't](#what-matches-firebase-and-what-doesnt) has the numbers.
|
|
30
|
+
## Run an existing Firebase application locally
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
Install the development plugin:
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
```bash
|
|
35
|
+
npm install --save-dev @pyric/cli
|
|
36
|
+
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Add it to the existing Vite configuration:
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
```ts
|
|
41
|
+
// vite.config.ts
|
|
42
|
+
import { defineConfig } from 'vite';
|
|
43
|
+
import { pyricSandbox } from '@pyric/cli/vite';
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
plugins: [pyricSandbox()],
|
|
47
|
+
});
|
|
48
|
+
```
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
Start the normal development server:
|
|
45
51
|
|
|
46
52
|
```bash
|
|
47
|
-
npm
|
|
48
|
-
npx pyric init --template web # scaffold, or just run pyric dev in an existing app
|
|
49
|
-
npx pyric dev
|
|
53
|
+
npm run dev
|
|
50
54
|
```
|
|
51
55
|
|
|
52
|
-
`
|
|
56
|
+
During `vite dev`, the plugin swaps supported `firebase/*` modules at resolution time. The backend runs in a SharedWorker, so tabs on the same development origin use one local backend. Browser-local persistence uses IndexedDB.
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
Pyric Studio is available on the Vite origin at `/__pyric/ui/`. It opens the same backend used by the application.
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
For a static application or a Node process, `pyric dev` provides the same development-only package swap without the Vite plugin. The [CLI reference](packages/cli/docs/reference/cli.md) documents those paths and every command.
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
## Keep writing Firebase code
|
|
63
|
+
|
|
64
|
+
Application code continues to import Firebase:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// src/firebase.ts
|
|
68
|
+
import { initializeApp } from 'firebase/app';
|
|
69
|
+
import { getAuth } from 'firebase/auth';
|
|
70
|
+
import { getFirestore } from 'firebase/firestore';
|
|
71
|
+
|
|
72
|
+
const app = initializeApp({
|
|
73
|
+
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
|
|
74
|
+
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
|
|
75
|
+
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const auth = getAuth(app);
|
|
79
|
+
export const db = getFirestore(app);
|
|
62
80
|
```
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
The Firebase configuration is accepted by the local mirror during development. The production build passes that same configuration to Firebase. Normal Auth, Firestore, Realtime Database, Storage, Messaging, and Firebase AI Logic usage still belongs in the [Firebase documentation](https://firebase.google.com/docs).
|
|
65
83
|
|
|
66
|
-
|
|
84
|
+
Pyric documents the parts that differ locally, including supported behavior, Security Rules, persistence, inspection, verification, and known gaps. See [use the Vite plugin](packages/cli/docs/how-to/use-the-vite-plugin.md) for the complete plugin contract.
|
|
67
85
|
|
|
68
|
-
|
|
86
|
+
## Inspect and correct a failed operation
|
|
69
87
|
|
|
70
|
-
|
|
71
|
-
- Denial inspection: a rejected operation carries its verdict instead of a bare `permission-denied` error.
|
|
72
|
-
- Capture and replay: `pyric snapshot` records state, and captured sessions replay through the same event stream, which is what `pyric verify` is built on.
|
|
88
|
+
Pyric Studio shows local data, requests, authentication state, Security Rules verdicts, and denied operations. Open `/__pyric/ui/` on the development server and reproduce the failure. A denied request includes the path and verdict needed to correct the rule or the application code.
|
|
73
89
|
|
|
74
|
-
|
|
90
|
+
The Vite plugin discovers the Firestore rules path from `firebase.json`, or falls back to `firestore.rules`. Saving that file replaces the active local ruleset without a production deploy. A parse failure leaves the last valid ruleset active and reports the error in the development server.
|
|
75
91
|
|
|
76
|
-
|
|
92
|
+
State and test identities stay browser-local by default. Add `persist: true` to write a committable `.pyric/state/state.json`, or use `seed` to start from a known scenario:
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
```ts
|
|
95
|
+
pyricSandbox({
|
|
96
|
+
persist: true,
|
|
97
|
+
seed: 'seed.json',
|
|
98
|
+
});
|
|
99
|
+
```
|
|
84
100
|
|
|
85
|
-
|
|
101
|
+
See [persistence and multi-tab behavior](packages/cli/docs/how-to/serve-persistence-and-multi-tab.md) for reset and seed precedence.
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
## Give coding agents the same local Firebase target
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
An agent can keep writing the same Firebase code while inspecting and changing the backend that the application is already using. Agent access is opt-in. Enable the MCP bridge in the Vite plugin:
|
|
90
106
|
|
|
91
|
-
|
|
107
|
+
```ts
|
|
108
|
+
pyricSandbox({ bridge: true });
|
|
109
|
+
```
|
|
92
110
|
|
|
93
|
-
|
|
111
|
+
The bridge mounts on the Vite development origin and routes agent operations to the same SharedWorker backend used by the application and Studio. The included [Claude Code plugin](pyric-plugin/README.md) discovers that bridge, while other MCP clients can connect to its HTTP endpoint.
|
|
94
112
|
|
|
95
|
-
|
|
113
|
+
This protects the local workflow, not an independently credentialed process. A coding agent with production Firebase credentials or deployment access can still affect production outside Pyric.
|
|
96
114
|
|
|
97
|
-
|
|
115
|
+
## Verify the rules boundary
|
|
98
116
|
|
|
99
|
-
|
|
100
|
-
import { initializeSandbox } from 'pyric/sandbox';
|
|
101
|
-
import { initializeApp } from 'pyric-admin/app';
|
|
102
|
-
import { getDatabase } from 'pyric-admin/database';
|
|
117
|
+
Development sessions capture Firestore and Realtime Database operations in `.pyric/last-session.json` by default. Replay those requests against candidate rules before deployment:
|
|
103
118
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
await db.ref('rooms/lobby').set({ topic: 'launch day' });
|
|
119
|
+
```bash
|
|
120
|
+
npx pyric verify
|
|
107
121
|
```
|
|
108
122
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
| `@pyric/ui` | Headless React admin components and hooks | [docs](packages/ui/docs/) |
|
|
115
|
-
| `@pyric/studio` | The local console behind `pyric dev --ui` | [README](packages/studio/README.md) |
|
|
123
|
+
The default engine runs locally. The optional Firestore Rules Test API engine sends derived rule cases to Google's hosted evaluator when production-authority verification is needed. It verifies rules and does not deploy them. See [verify against a captured session](packages/cli/docs/how-to/verify-against-a-captured-session.md).
|
|
124
|
+
|
|
125
|
+
## Ship the same application code
|
|
126
|
+
|
|
127
|
+
A standard Vite production build leaves the development swap inactive:
|
|
116
128
|
|
|
117
129
|
```bash
|
|
118
|
-
npm
|
|
119
|
-
npm install pyric pyric-admin # for direct sandbox control
|
|
130
|
+
npm run build
|
|
120
131
|
```
|
|
121
132
|
|
|
122
|
-
|
|
133
|
+
The built application contains the real Firebase SDK and uses the Firebase configuration already present in the source. Deploy the build, rules, and indexes with `firebase-tools` or the Firebase Console. Pyric has no production deployment path.
|
|
134
|
+
|
|
135
|
+
## Check what Pyric mirrors
|
|
123
136
|
|
|
124
|
-
|
|
137
|
+
Pyric is an independent implementation of observable Firebase behavior. Conformance evidence records what has been compared with Firebase and keeps five outcomes distinct: conforms, documented divergence, bug, unsupported, and unverified. The evidence is a floor, not a claim that every Firebase behavior has been measured.
|
|
138
|
+
|
|
139
|
+
Read the generated matrices for [App](packages/pyric/docs/app/COMPAT.md), [Auth](packages/pyric/docs/auth/COMPAT.md), [Firestore](packages/pyric/docs/firestore/COMPAT.md), [Realtime Database](packages/pyric/docs/database/COMPAT.md), [Storage](packages/pyric/docs/storage/COMPAT.md), [Messaging](packages/pyric/docs/messaging/COMPAT.md), [AI Logic](packages/pyric/docs/ai/COMPAT.md), [Security Rules](packages/pyric/docs/rules/COMPAT.md), and [Functions with Realtime Database](packages/cli/docs/functions-rtdb/COMPAT.md). The [versioning and compatibility policy](packages/pyric/docs/explanation/versioning-and-compatibility.md) explains the release boundary.
|
|
140
|
+
|
|
141
|
+
## Stability
|
|
125
142
|
|
|
126
|
-
|
|
143
|
+
Pyric is alpha software, currently `0.1.0-alpha.8`. Firebase-shaped surfaces are tracked through the compatibility matrices. Pyric-specific development APIs may change between alpha releases. All packages are ESM-only and require Node 22.15 or later.
|
|
144
|
+
|
|
145
|
+
## Develop Pyric
|
|
146
|
+
|
|
147
|
+
The repository is a Bun workspace:
|
|
127
148
|
|
|
128
149
|
```bash
|
|
129
150
|
bun install
|
|
130
151
|
bun run build
|
|
131
|
-
bun test
|
|
132
|
-
|
|
152
|
+
bun run test
|
|
153
|
+
bun run compat:check
|
|
133
154
|
```
|
|
134
155
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
## Stability
|
|
138
|
-
|
|
139
|
-
Alpha, `0.1.0-alpha.7`, published as an experimental product. The one stability goal is the Firebase mirror: code written against mirrored surfaces is intended to keep working, tracked in the compatibility matrices. Pyric-specific APIs (sandbox lifecycle, replay, serve and bridge internals) are public-alpha and may change between releases.
|
|
156
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [CONTEXT.md](CONTEXT.md), and [AGENTS.md](AGENTS.md) before changing the codebase.
|
package/README.md.orig
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
# pyric-admin
|
|
1
|
+
# `pyric-admin`
|
|
2
2
|
|
|
3
|
-
Firebase Admin-shaped adapters
|
|
4
|
-
real Firebase Admin SDK backends.
|
|
3
|
+
Firebase Admin-shaped adapters for a Pyric sandbox.
|
|
5
4
|
|
|
6
|
-
Use
|
|
7
|
-
|
|
5
|
+
Use these subpaths when tests, development servers, or scripts need
|
|
6
|
+
`firebase-admin` ergonomics against local or browser-hosted sandbox state. In
|
|
7
|
+
activated development, `@pyric/cli/register` resolves canonical
|
|
8
|
+
`firebase-admin/*` imports here. With activation absent, production execution
|
|
9
|
+
loads `firebase-admin` directly.
|
|
8
10
|
|
|
9
|
-
> **Alpha.**
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
> and may change without notice.
|
|
11
|
+
> **Alpha.** These are best-effort mirror contracts of `firebase-admin`. Read
|
|
12
|
+
> the conformance matrices and service references for implemented behaviour and
|
|
13
|
+
> explicit gaps.
|
|
13
14
|
|
|
14
15
|
## Subpaths
|
|
15
16
|
|
|
16
|
-
| Subpath |
|
|
17
|
+
| Subpath | Sandbox surface |
|
|
17
18
|
|---|---|
|
|
18
|
-
| `pyric-admin/app` | Admin app
|
|
19
|
-
| `pyric-admin/firestore` | Admin Firestore shape
|
|
20
|
-
| `pyric-admin/auth` | Admin Auth shape
|
|
21
|
-
| `pyric-admin/database` | Admin Realtime Database shape
|
|
22
|
-
| `pyric-admin/storage` | Admin Storage shape
|
|
19
|
+
| `pyric-admin/app` | Admin app registry and sandbox binding |
|
|
20
|
+
| `pyric-admin/firestore` | Admin Firestore shape |
|
|
21
|
+
| `pyric-admin/auth` | Admin Auth shape |
|
|
22
|
+
| `pyric-admin/database` | Admin Realtime Database shape |
|
|
23
|
+
| `pyric-admin/storage` | Admin Storage shape |
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Explicit sandbox setup
|
|
25
26
|
|
|
26
27
|
```ts
|
|
27
28
|
import { initializeApp } from 'pyric-admin/app';
|
|
@@ -34,16 +35,14 @@ const db = getFirestore(app);
|
|
|
34
35
|
await db.collection('posts').doc('hello').set({ title: 'Hello' });
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
For unchanged server source, keep `firebase-admin/*` imports and run the
|
|
39
|
+
development command through `pyric dev`. Production runs the same source
|
|
40
|
+
without sandbox activation and therefore resolves Firebase Admin directly.
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
import { initializeApp, cert } from 'pyric-admin/app';
|
|
41
|
-
|
|
42
|
-
const app = initializeApp({
|
|
43
|
-
credential: cert(serviceAccount),
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Docs
|
|
42
|
+
## Documentation
|
|
48
43
|
|
|
49
|
-
- [
|
|
44
|
+
- [App registry and activation](docs/app/)
|
|
45
|
+
- [Firestore](docs/firestore/)
|
|
46
|
+
- [Auth API](https://pyric.dev/docs/pyric-admin-auth-reference-api/)
|
|
47
|
+
- [Realtime Database API](https://pyric.dev/docs/pyric-admin-database-reference-api/)
|
|
48
|
+
- [Storage API](https://pyric.dev/docs/pyric-admin-storage-reference-api/)
|