@tungthedev/streams-local 0.2.0
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/CODE_OF_CONDUCT.md +45 -0
- package/CONTRIBUTING.md +76 -0
- package/LICENSE +201 -0
- package/README.md +72 -0
- package/SECURITY.md +42 -0
- package/dist/README.md +72 -0
- package/dist/local/daemon.js +54 -0
- package/dist/local/hash_vendor/LICENSE.hash-wasm +38 -0
- package/dist/local/hash_vendor/NOTICE.md +8 -0
- package/dist/local/hash_vendor/xxhash3.umd.min.cjs +7 -0
- package/dist/local/hash_vendor/xxhash32.umd.min.cjs +7 -0
- package/dist/local/hash_vendor/xxhash64.umd.min.cjs +7 -0
- package/dist/local/index-7e8ccwrd.js +26594 -0
- package/dist/local/index.js +6 -0
- package/dist/touch/hash_vendor/LICENSE.hash-wasm +38 -0
- package/dist/touch/hash_vendor/NOTICE.md +8 -0
- package/dist/touch/hash_vendor/xxhash3.umd.min.cjs +7 -0
- package/dist/touch/hash_vendor/xxhash32.umd.min.cjs +7 -0
- package/dist/touch/hash_vendor/xxhash64.umd.min.cjs +7 -0
- package/dist/touch/processor_worker.js +10313 -0
- package/dist/types/local/daemon.d.ts +1 -0
- package/dist/types/local/index.d.ts +1 -0
- package/dist/types/local/server.d.ts +20 -0
- package/package.json +47 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Prisma Streams Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in Prisma Streams and its community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
- Using welcoming and inclusive language
|
|
12
|
+
- Being respectful of differing viewpoints and experiences
|
|
13
|
+
- Gracefully accepting constructive criticism
|
|
14
|
+
- Focusing on what is best for the community
|
|
15
|
+
- Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior by participants include:
|
|
18
|
+
|
|
19
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
21
|
+
- Public or private harassment
|
|
22
|
+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
+
|
|
25
|
+
## Our Responsibilities
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for behavior they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies within project spaces and in public spaces when an individual is representing the project or its community. Examples include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers through a private channel available in the repository hosting platform. Maintainers will review and investigate complaints and will respond in a way that is appropriate to the circumstances. Maintainers are expected to respect the confidentiality of reporters as much as practical.
|
|
38
|
+
|
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other project maintainers.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, and follows the Prisma open-source baseline.
|
|
44
|
+
|
|
45
|
+
[homepage]: http://contributor-covenant.org
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributing to Prisma Streams
|
|
2
|
+
|
|
3
|
+
Welcome. This repository is being prepared for public production use, and contributions that improve correctness, operator experience, and protocol clarity are useful.
|
|
4
|
+
|
|
5
|
+
This file follows the same general baseline Prisma uses in [`prisma/prisma`](https://github.com/prisma/prisma), but is scoped to this repository and its Bun + TypeScript workflow.
|
|
6
|
+
|
|
7
|
+
Please read the [Code of Conduct](./code-of-conduct.md) before participating.
|
|
8
|
+
|
|
9
|
+
## Contributing Via Comments
|
|
10
|
+
|
|
11
|
+
To help maintainers triage efficiently:
|
|
12
|
+
|
|
13
|
+
- Use GitHub reactions on the main issue or comment to signal support.
|
|
14
|
+
- Add a comment only when you have new, actionable information: a reproduction, impact details, logs, or a concrete proposal.
|
|
15
|
+
- Avoid `+1`, `same here`, or `any update?` comments. They add notification noise without improving triage.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- Bun `>=1.3.6`
|
|
20
|
+
- Node.js `>=22`
|
|
21
|
+
- Git
|
|
22
|
+
|
|
23
|
+
For Windows development, use WSL or another Unix-like environment. The scripts and examples in this repository assume a POSIX shell.
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone <your-fork-or-repo-url>
|
|
29
|
+
cd prisma-streams
|
|
30
|
+
bun install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Common Commands
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bun run typecheck
|
|
37
|
+
bun run check:result-policy
|
|
38
|
+
bun test
|
|
39
|
+
bun run test:conformance:local
|
|
40
|
+
bun run test:conformance
|
|
41
|
+
bun run test:large-index-filter
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Notes:
|
|
45
|
+
|
|
46
|
+
- `bun test` is the current fast repository baseline.
|
|
47
|
+
- `test:conformance:local` and `test:conformance` run the upstream black-box suite against local and full server modes.
|
|
48
|
+
- `test:large-index-filter` is an opt-in full-mode integration/performance test
|
|
49
|
+
that writes 1 GiB of indexed JSON data into a MockR2-backed stream and
|
|
50
|
+
measures filtered read time. The packaged script pins `16 MiB` segments to
|
|
51
|
+
match the production default. Use `DS_LARGE_INDEX_FILTER=1 bun test
|
|
52
|
+
test/large_index_filter.test.ts` directly only when you intentionally want to
|
|
53
|
+
override the segment size or other large-test settings. It is intentionally
|
|
54
|
+
excluded from the fast baseline.
|
|
55
|
+
- The current upstream conformance status is tracked in [conformance.md](./conformance.md).
|
|
56
|
+
|
|
57
|
+
## Development Expectations
|
|
58
|
+
|
|
59
|
+
- Keep changes focused. Avoid mixing refactors with unrelated cleanup.
|
|
60
|
+
- Add or update tests for behavior changes.
|
|
61
|
+
- Update documentation when public behavior, deployment guidance, or package surfaces change.
|
|
62
|
+
- Do not commit generated archives, local databases, `.DS_Store`, or other workstation artifacts.
|
|
63
|
+
- Follow the repository `better-result` policy. The current automated policy check covers `src/`; see [better-result-adoption.md](./better-result-adoption.md).
|
|
64
|
+
|
|
65
|
+
## Pull Requests
|
|
66
|
+
|
|
67
|
+
Before opening a pull request:
|
|
68
|
+
|
|
69
|
+
- Run `bun run verify`.
|
|
70
|
+
- If you touched protocol behavior, run the relevant conformance suite and note the result.
|
|
71
|
+
- Explain the motivation, scope, and any behavior changes clearly.
|
|
72
|
+
- Call out follow-up work instead of silently leaving partial migrations behind.
|
|
73
|
+
|
|
74
|
+
## Security Reports
|
|
75
|
+
|
|
76
|
+
Do not open public issues for suspected vulnerabilities. Follow [security.md](./security.md).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf of
|
|
171
|
+
any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Prisma Streams Local Build
|
|
2
|
+
|
|
3
|
+
This directory contains the generated Node/Bun-compatible package artifacts for
|
|
4
|
+
the published `@tungthedev/streams-local` runtime.
|
|
5
|
+
|
|
6
|
+
## What Local Streams Is
|
|
7
|
+
|
|
8
|
+
Prisma Streams local is a trusted-development Durable Streams server intended
|
|
9
|
+
for embedded workflows such as `prisma dev`.
|
|
10
|
+
|
|
11
|
+
It keeps all state in a single local SQLite database and supports the live /
|
|
12
|
+
touch system, but it does not run the full production segmenting and object
|
|
13
|
+
store pipeline.
|
|
14
|
+
|
|
15
|
+
The embedded local runtime always applies the built-in `1024 MB` auto-tune
|
|
16
|
+
preset, so Prisma CLI gets a predictable cache and concurrency budget and the
|
|
17
|
+
same current HTTP surface, including `GET /v1/server/_details`.
|
|
18
|
+
|
|
19
|
+
Published runtime floor:
|
|
20
|
+
|
|
21
|
+
- Bun `>=1.2.0`
|
|
22
|
+
- Node.js `>=22`
|
|
23
|
+
|
|
24
|
+
## Supported Package Surface
|
|
25
|
+
|
|
26
|
+
- `@tungthedev/streams-local`
|
|
27
|
+
- `@tungthedev/streams-local/internal/daemon` (internal Prisma CLI plumbing)
|
|
28
|
+
|
|
29
|
+
The full self-hosted server remains Bun-only and is not part of this local
|
|
30
|
+
build surface.
|
|
31
|
+
|
|
32
|
+
## Integrating It
|
|
33
|
+
|
|
34
|
+
1. Start a named local server from `@tungthedev/streams-local`.
|
|
35
|
+
2. Install your touch-enabled `state-protocol` profile via `/_profile`.
|
|
36
|
+
3. Feed normalized State Protocol change events into the server.
|
|
37
|
+
4. Use `/touch/meta` and `/touch/wait` to drive invalidation.
|
|
38
|
+
|
|
39
|
+
Programmatic example:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { startLocalDurableStreamsServer } from "@tungthedev/streams-local";
|
|
43
|
+
|
|
44
|
+
const server = await startLocalDurableStreamsServer({
|
|
45
|
+
name: "default",
|
|
46
|
+
hostname: "127.0.0.1",
|
|
47
|
+
port: 0,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log(server.exports.http.url);
|
|
51
|
+
console.log(server.exports.sqlite.path);
|
|
52
|
+
|
|
53
|
+
await server.close();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Daemon example:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { fork } from "node:child_process";
|
|
60
|
+
|
|
61
|
+
const child = fork(require.resolve("@tungthedev/streams-local/internal/daemon"), [
|
|
62
|
+
"--name",
|
|
63
|
+
"default",
|
|
64
|
+
"--port",
|
|
65
|
+
"0",
|
|
66
|
+
], {
|
|
67
|
+
stdio: "inherit",
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
See ../docs/overview.md and ../docs/local-dev.md for the full runtime and release
|
|
72
|
+
documentation.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Prisma Streams Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Security fixes are currently provided on the active main branch only. There are no long-lived release branches yet.
|
|
6
|
+
|
|
7
|
+
## Reporting A Vulnerability
|
|
8
|
+
|
|
9
|
+
Please do not open a public GitHub issue for security vulnerabilities.
|
|
10
|
+
|
|
11
|
+
Use GitHub's private vulnerability reporting flow for this repository if it is enabled. If that is not available, contact the maintainers privately before disclosing the issue publicly.
|
|
12
|
+
|
|
13
|
+
When reporting a vulnerability, include:
|
|
14
|
+
|
|
15
|
+
- The affected commit, branch, or version
|
|
16
|
+
- Your deployment mode: full server or local development server
|
|
17
|
+
- Reproduction steps or a minimal proof of concept
|
|
18
|
+
- Any relevant logs, traces, or configuration details
|
|
19
|
+
|
|
20
|
+
## Current Security Posture
|
|
21
|
+
|
|
22
|
+
The full Prisma Streams server requires an explicit startup auth mode:
|
|
23
|
+
|
|
24
|
+
- `--auth-strategy api-key` enables built-in API key authentication for every
|
|
25
|
+
request
|
|
26
|
+
- `--no-auth` disables built-in authentication for deployments that rely on a
|
|
27
|
+
trusted external boundary
|
|
28
|
+
|
|
29
|
+
That has concrete deployment consequences:
|
|
30
|
+
|
|
31
|
+
- Prefer `--auth-strategy api-key` when the server receives network traffic
|
|
32
|
+
directly.
|
|
33
|
+
- Use `--no-auth` only behind a trusted reverse proxy, API gateway, VPN
|
|
34
|
+
boundary, or local-only deployment wrapper.
|
|
35
|
+
- Terminate TLS outside the server.
|
|
36
|
+
- Treat the local development server as a loopback-only tool for trusted local workflows such as `npx prisma dev`.
|
|
37
|
+
|
|
38
|
+
The local development server is intentionally optimized for local integration,
|
|
39
|
+
not hostile-network deployment, and does not participate in the full-server auth
|
|
40
|
+
contract.
|
|
41
|
+
|
|
42
|
+
More detail is documented in [auth.md](./auth.md).
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Prisma Streams Local Build
|
|
2
|
+
|
|
3
|
+
This directory contains the generated Node/Bun-compatible package artifacts for
|
|
4
|
+
the published `@tungthedev/streams-local` runtime.
|
|
5
|
+
|
|
6
|
+
## What Local Streams Is
|
|
7
|
+
|
|
8
|
+
Prisma Streams local is a trusted-development Durable Streams server intended
|
|
9
|
+
for embedded workflows such as `prisma dev`.
|
|
10
|
+
|
|
11
|
+
It keeps all state in a single local SQLite database and supports the live /
|
|
12
|
+
touch system, but it does not run the full production segmenting and object
|
|
13
|
+
store pipeline.
|
|
14
|
+
|
|
15
|
+
The embedded local runtime always applies the built-in `1024 MB` auto-tune
|
|
16
|
+
preset, so Prisma CLI gets a predictable cache and concurrency budget and the
|
|
17
|
+
same current HTTP surface, including `GET /v1/server/_details`.
|
|
18
|
+
|
|
19
|
+
Published runtime floor:
|
|
20
|
+
|
|
21
|
+
- Bun `>=1.2.0`
|
|
22
|
+
- Node.js `>=22`
|
|
23
|
+
|
|
24
|
+
## Supported Package Surface
|
|
25
|
+
|
|
26
|
+
- `@tungthedev/streams-local`
|
|
27
|
+
- `@tungthedev/streams-local/internal/daemon` (internal Prisma CLI plumbing)
|
|
28
|
+
|
|
29
|
+
The full self-hosted server remains Bun-only and is not part of this local
|
|
30
|
+
build surface.
|
|
31
|
+
|
|
32
|
+
## Integrating It
|
|
33
|
+
|
|
34
|
+
1. Start a named local server from `@tungthedev/streams-local`.
|
|
35
|
+
2. Install your touch-enabled `state-protocol` profile via `/_profile`.
|
|
36
|
+
3. Feed normalized State Protocol change events into the server.
|
|
37
|
+
4. Use `/touch/meta` and `/touch/wait` to drive invalidation.
|
|
38
|
+
|
|
39
|
+
Programmatic example:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { startLocalDurableStreamsServer } from "@tungthedev/streams-local";
|
|
43
|
+
|
|
44
|
+
const server = await startLocalDurableStreamsServer({
|
|
45
|
+
name: "default",
|
|
46
|
+
hostname: "127.0.0.1",
|
|
47
|
+
port: 0,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log(server.exports.http.url);
|
|
51
|
+
console.log(server.exports.sqlite.path);
|
|
52
|
+
|
|
53
|
+
await server.close();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Daemon example:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { fork } from "node:child_process";
|
|
60
|
+
|
|
61
|
+
const child = fork(require.resolve("@tungthedev/streams-local/internal/daemon"), [
|
|
62
|
+
"--name",
|
|
63
|
+
"default",
|
|
64
|
+
"--port",
|
|
65
|
+
"0",
|
|
66
|
+
], {
|
|
67
|
+
stdio: "inherit",
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
See ../docs/overview.md and ../docs/local-dev.md for the full runtime and release
|
|
72
|
+
documentation.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseLocalProcessOptions,
|
|
3
|
+
startLocalDurableStreamsServer
|
|
4
|
+
} from "./index-7e8ccwrd.js";
|
|
5
|
+
|
|
6
|
+
// src/local/process.ts
|
|
7
|
+
async function runLocalServerProcess(opts, cfg) {
|
|
8
|
+
const server = await startLocalDurableStreamsServer(opts);
|
|
9
|
+
cfg.onReady(server.exports);
|
|
10
|
+
let shuttingDown = false;
|
|
11
|
+
const shutdown = async () => {
|
|
12
|
+
if (shuttingDown)
|
|
13
|
+
return;
|
|
14
|
+
shuttingDown = true;
|
|
15
|
+
try {
|
|
16
|
+
await server.close();
|
|
17
|
+
} finally {
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
process.on("SIGTERM", () => {
|
|
22
|
+
shutdown();
|
|
23
|
+
});
|
|
24
|
+
process.on("SIGINT", () => {
|
|
25
|
+
shutdown();
|
|
26
|
+
});
|
|
27
|
+
if (cfg.closeOnDisconnect) {
|
|
28
|
+
process.on("disconnect", () => {
|
|
29
|
+
shutdown();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/local/daemon.ts
|
|
35
|
+
var opts = parseLocalProcessOptions(process.argv.slice(2), {
|
|
36
|
+
allowPositionalName: true,
|
|
37
|
+
defaultNameWhenMissing: "default",
|
|
38
|
+
defaultHostnameWhenMissing: "127.0.0.1",
|
|
39
|
+
defaultPortWhenMissing: 0
|
|
40
|
+
});
|
|
41
|
+
await runLocalServerProcess({
|
|
42
|
+
name: opts.name,
|
|
43
|
+
hostname: opts.hostname,
|
|
44
|
+
port: opts.port
|
|
45
|
+
}, {
|
|
46
|
+
onReady: (exportsPayload) => {
|
|
47
|
+
if (typeof process.send === "function") {
|
|
48
|
+
process.send({ type: "ready", exports: exportsPayload });
|
|
49
|
+
} else {
|
|
50
|
+
console.log(JSON.stringify(exportsPayload));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
closeOnDisconnect: true
|
|
54
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Dani Biró
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Embedded C implementations might use other, similarly permissive licenses.
|
|
24
|
+
Check the beginning of the files from the /src directory.
|
|
25
|
+
|
|
26
|
+
Special thank you to the authors of original C algorithms:
|
|
27
|
+
- Alexander Peslyak <solar@openwall.com>
|
|
28
|
+
- Aleksey Kravchenko <rhash.admin@gmail.com>
|
|
29
|
+
- Colin Percival
|
|
30
|
+
- Stephan Brumme <create@stephan-brumme.com>
|
|
31
|
+
- Steve Reid <steve@edmweb.com>
|
|
32
|
+
- Samuel Neves <sneves@dei.uc.pt>
|
|
33
|
+
- Solar Designer <solar@openwall.com>
|
|
34
|
+
- Project Nayuki
|
|
35
|
+
- ARM Limited
|
|
36
|
+
- Yanbo Li dreamfly281@gmail.com, goldboar@163.comYanbo Li
|
|
37
|
+
- Mark Adler
|
|
38
|
+
- Yann Collet
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Vendored xxhash runtime files in this directory are copied from `hash-wasm@4.12.0`:
|
|
2
|
+
|
|
3
|
+
- `dist/xxhash3.umd.min.js`
|
|
4
|
+
- `dist/xxhash32.umd.min.js`
|
|
5
|
+
- `dist/xxhash64.umd.min.js`
|
|
6
|
+
|
|
7
|
+
These files are used only for the Node runtime path in local development builds.
|
|
8
|
+
The upstream license is preserved in `LICENSE.hash-wasm` in this directory.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* hash-wasm (https://www.npmjs.com/package/hash-wasm)
|
|
3
|
+
* (c) Dani Biro
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
!function(A,I){"object"==typeof exports&&"undefined"!=typeof module?I(exports):"function"==typeof define&&define.amd?define(["exports"],I):I((A="undefined"!=typeof globalThis?globalThis:A||self).hashwasm=A.hashwasm||{})}(this,(function(A){"use strict";var I,g={name:"xxhash3",data:"AGFzbQEAAAABNAhgAAF/YAR/f39/AGAHf39/f39/fwBgBH9+fn4BfmAEf39/fgF+YAN/f34BfmAAAGABfwADDg0AAQIDBAUFBQYHBgAGBQQBAQICBg4CfwFBwI4FC38AQcAJCwdwCAZtZW1vcnkCAA5IYXNoX0dldEJ1ZmZlcgAACUhhc2hfSW5pdAAIC0hhc2hfVXBkYXRlAAkKSGFzaF9GaW5hbAAKDUhhc2hfR2V0U3RhdGUACw5IYXNoX0NhbGN1bGF0ZQAMClNUQVRFX1NJWkUDAQr6QQ0FAEGACgvkAwMPfgF/AX4CQCADRQ0AIAApAzAhBCAAKQM4IQUgACkDICEGIAApAyghByAAKQMQIQggACkDGCEJIAApAwAhCiAAKQMIIQsDQCAFIAFBMGopAwAiDHwgAkE4aikDACABQThqKQMAIg2FIgVCIIggBUL/////D4N+fCEFIAcgAUEgaikDACIOfCACQShqKQMAIAFBKGopAwAiD4UiB0IgiCAHQv////8Pg358IQcgCSABQRBqKQMAIhB8IAJBGGopAwAgAUEYaikDACIRhSIJQiCIIAlC/////w+DfnwhCSALIAEpAwAiEnwgAkEIaiITKQMAIAFBCGopAwAiFIUiC0IgiCALQv////8Pg358IQsgAkEwaikDACAMhSIMQiCIIAxC/////w+DfiAEfCANfCEEIAJBIGopAwAgDoUiDEIgiCAMQv////8Pg34gBnwgD3whBiACQRBqKQMAIBCFIgxCIIggDEL/////D4N+IAh8IBF8IQggAikDACAShSIMQiCIIAxC/////w+DfiAKfCAUfCEKIAFBwABqIQEgEyECIANBf2oiAw0ACyAAIAk3AxggACAKNwMAIAAgCzcDCCAAIAc3AyggACAINwMQIAAgBTcDOCAAIAY3AyAgACAENwMwCwveAgIBfwF+AkAgBCACIAEoAgAiB2siAkkNACAAIAMgBSAHQQN0aiACEAEgACAFIAZqIgcpAwAgACkDACIIQi+IhSAIhUKx893xCX43AwAgACAHKQMIIAApAwgiCEIviIUgCIVCsfPd8Ql+NwMIIAAgBykDECAAKQMQIghCL4iFIAiFQrHz3fEJfjcDECAAIAcpAxggACkDGCIIQi+IhSAIhUKx893xCX43AxggACAHKQMgIAApAyAiCEIviIUgCIVCsfPd8Ql+NwMgIAAgBykDKCAAKQMoIghCL4iFIAiFQrHz3fEJfjcDKCAAIAcpAzAgACkDMCIIQi+IhSAIhUKx893xCX43AzAgACAHKQM4IAApAzgiCEIviIUgCIVCsfPd8Ql+NwM4IAAgAyACQQZ0aiAFIAQgAmsiBxABIAEgBzYCAA8LIAAgAyAFIAdBA3RqIAQQASABIAcgBGo2AgALhQEBAX8gAiABhSADpyIEQRh0IARBgP4DcUEIdHIgBEEIdkGA/gNxIARBGHZycq1CIIYgA4V9QQA1AoCMAUIghiAAQfyLAWo1AgCEhSID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gBEL/////D4OEIAdCIIggAyAGfnwgBUIgiHyFfCEDCyABKQNIIAJ9QQApA6iMAYUiBEL/////D4MiBSABKQNAIAJ8QQApA6CMAYUiBkIgiCIHfiIIQv////8PgyAEQiCIIgQgBkL/////D4MiBn58IAUgBn4iBUIgiHwiBkIghiAFQv////8Pg4QgCEIgiCAEIAd+fCAGQiCIfIUgA3wgASkDWCACfSAAQdiLAWopAwCFIgNC/////w+DIgQgASkDUCACfCAAQdCLAWopAwCFIgVCIIgiBn4iB0L/////D4MgA0IgiCIDIAVC/////w+DIgV+fCAEIAV+IgRCIIh8IgVCIIYgBEL/////D4OEIAdCIIggAyAGfnwgBUIgiHyFfCEDCyABKQMoIAJ9QQApA5iMAYUiBEL/////D4MiBSABKQMgIAJ8QQApA5CMAYUiBkIgiCIHfiIIQv////8PgyAEQiCIIgQgBkL/////D4MiBn58IAUgBn4iBUIgiHwiBkIghiAFQv////8Pg4QgCEIgiCAEIAd+fCAGQiCIfIUgA3wgASkDOCACfSAAQeiLAWopAwCFIgNC/////w+DIgQgASkDMCACfCAAQeCLAWopAwCFIgVCIIgiBn4iB0L/////D4MgA0IgiCIDIAVC/////w+DIgV+fCAEIAV+IgRCIIh8IgVCIIYgBEL/////D4OEIAdCIIggAyAGfnwgBUIgiHyFfCEDCyABKQMIIAJ9QQApA4iMAYUiBEL/////D4MiBSABKQMAIAJ8QQApA4CMAYUiBkIgiCIHfiIIQv////8PgyAEQiCIIgQgBkL/////D4MiBn58IAUgBn4iBUIgiHwiBkIghiAFQv////8Pg4QgCEIgiCAEIAd+fCAGQiCIfIUgA3wgASkDGCACfSAAQfiLAWopAwCFIgNC/////w+DIgQgASkDECACfCAAQfCLAWopAwCFIgJCIIgiBX4iBkL/////D4MgA0IgiCIDIAJC/////w+DIgJ+fCAEIAJ+IgJCIIh8IgRCIIYgAkL/////D4OEIAZCIIggAyAFfnwgBEIgiHyFfCICQiWIIAKFQvnz3fGZ8pmrFn4iAkIgiCAChQv8CgQBfwV+An8BfkEAIQMgASkDeCACfUEAKQP4jAGFIgRC/////w+DIgUgASkDcCACfEEAKQPwjAGFIgZCIIgiB34iCEL/////D4MgBEIgiCIEIAZC/////w+DIgZ+fCAFIAZ+IgVCIIh8IgZCIIYgBUL/////D4OEIAhCIIggBCAHfnwgBkIgiHyFIAEpA2ggAn1BACkD6IwBhSIEQv////8PgyIFIAEpA2AgAnxBACkD4IwBhSIGQiCIIgd+IghC/////w+DIARCIIgiBCAGQv////8PgyIGfnwgBSAGfiIFQiCIfCIGQiCGIAVC/////w+DhCAIQiCIIAQgB358IAZCIIh8hSABKQNYIAJ9QQApA9iMAYUiBEL/////D4MiBSABKQNQIAJ8QQApA9CMAYUiBkIgiCIHfiIIQv////8PgyAEQiCIIgQgBkL/////D4MiBn58IAUgBn4iBUIgiHwiBkIghiAFQv////8Pg4QgCEIgiCAEIAd+fCAGQiCIfIUgASkDSCACfUEAKQPIjAGFIgRC/////w+DIgUgASkDQCACfEEAKQPAjAGFIgZCIIgiB34iCEL/////D4MgBEIgiCIEIAZC/////w+DIgZ+fCAFIAZ+IgVCIIh8IgZCIIYgBUL/////D4OEIAhCIIggBCAHfnwgBkIgiHyFIAEpAzggAn1BACkDuIwBhSIEQv////8PgyIFIAEpAzAgAnxBACkDsIwBhSIGQiCIIgd+IghC/////w+DIARCIIgiBCAGQv////8PgyIGfnwgBSAGfiIFQiCIfCIGQiCGIAVC/////w+DhCAIQiCIIAQgB358IAZCIIh8hSABKQMoIAJ9QQApA6iMAYUiBEL/////D4MiBSABKQMgIAJ8QQApA6CMAYUiBkIgiCIHfiIIQv////8PgyAEQiCIIgQgBkL/////D4MiBn58IAUgBn4iBUIgiHwiBkIghiAFQv////8Pg4QgCEIgiCAEIAd+fCAGQiCIfIUgASkDGCACfUEAKQOYjAGFIgRC/////w+DIgUgASkDECACfEEAKQOQjAGFIgZCIIgiB34iCEL/////D4MgBEIgiCIEIAZC/////w+DIgZ+fCAFIAZ+IgVCIIh8IgZCIIYgBUL/////D4OEIAhCIIggBCAHfnwgBkIgiHyFIAEpAwggAn1BACkDiIwBhSIEQv////8PgyIFIAEpAwAgAnxBACkDgIwBhSIGQiCIIgd+IghC/////w+DIARCIIgiBCAGQv////8PgyIGfnwgBSAGfiIFQiCIfCIGQiCGIAVC/////w+DhCAIQiCIIAQgB358IAZCIIh8hSAArUKHla+vmLbem55/fnx8fHx8fHx8IgRCJYggBIVC+fPd8ZnymasWfiIEQiCIIASFIQQCQCAAQZABSA0AIABBBHZBeGohCQNAIAEgA2oiCkELaikDACACfSADQYiNAWopAwCFIgVC/////w+DIgYgCkEDaikDACACfCADQYCNAWopAwCFIgdCIIgiCH4iC0L/////D4MgBUIgiCIFIAdC/////w+DIgd+fCAGIAd+IgZCIIh8IgdCIIYgBkL/////D4OEIAtCIIggBSAIfnwgB0IgiHyFIAR8IQQgA0EQaiEDIAlBf2oiCQ0ACwsgASkDfyACfSAAQfiLAWopAwCFIgVC/////w+DIgYgASkDdyACfCAAQfCLAWopAwCFIgJCIIgiB34iCEL/////D4MgBUIgiCIFIAJC/////w+DIgJ+fCAGIAJ+IgJCIIh8IgZCIIYgAkL/////D4OEIAhCIIggBSAHfnwgBkIgiHyFIAR8IgJCJYggAoVC+fPd8ZnymasWfiICQiCIIAKFC98FAgF+AX8CQAJAQQApA4AKIgBQRQ0AQYAIIQFCACEADAELAkBBACkDoI4BIABSDQBBACEBDAELQQAhAUEAQq+v79e895Kg/gAgAH03A/iLAUEAIABCxZbr+djShYIofDcD8IsBQQBCj/Hjja2P9JhOIAB9NwPoiwFBACAAQqus+MXV79HQfHw3A+CLAUEAQtOt1LKShbW0nn8gAH03A9iLAUEAIABCl5r0jvWWvO3JAHw3A9CLAUEAQsWDgv2v/8SxayAAfTcDyIsBQQAgAELqi7OdyOb09UN8NwPAiwFBAELIv/rLnJveueQAIAB9NwO4iwFBACAAQoqjgd/Ume2sMXw3A7CLAUEAQvm57738+MKnHSAAfTcDqIsBQQAgAEKo9dv7s5ynmj98NwOgiwF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iAg0ACwtBACgCgI4BIABqIQILQQAgAjYCgI4BC/ISBQR/A34BfxV+BX8jACIAIQEgAEGAAWtBQHEiAiQAQQAoArCOASIAQcCKASAAGyEDAkACQEEAKQOQjgEiBELxAVQNACACQQApA4CKATcDACACQQApA4iKATcDCCACQQApA5CKATcDECACQQApA5iKATcDGCACQQApA6CKATcDICACQQApA6iKATcDKCACQQApA7CKASIFNwMwIAJBACkDuIoBIgY3AzgCQAJAQQAoAoCOASIHQcAASQ0AIAJBACgCiI4BNgJAIAIgAkHAAGpBACgCmI4BQYCMASAHQX9qQQZ2IANBACgCnI4BIgAQAiADIABqIgBBeWopAwAhCCAAKQMJIQkgACkDGSEKIAApAykhCyAHQcCLAWopAwAhBSAAKQMBIQwgB0HIiwFqKQMAIQYgB0HQiwFqKQMAIQ0gACkDESEOIAdB2IsBaikDACEPIAdB4IsBaikDACEQIAApAyEhESAHQeiLAWopAwAhEiACKQMAIRMgAikDECEUIAIpAyAhFSACKQMwIRYgAikDCCEXIAIpAxghGCACKQMoIRkgAiACKQM4IAdB8IsBaikDACIafCAAKQMxIAdB+IsBaikDACIbhSIcQiCIIBxC/////w+Dfnw3AzggGSAQfCARIBKFIhFCIIggEUL/////D4N+fCERIBggDXwgDiAPhSIOQiCIIA5C/////w+DfnwhDiAXIAV8IAwgBoUiDEIgiCAMQv////8Pg358IQwgGyAWIAsgGoUiC0IgiCALQv////8Pg358fCELIBIgFSAKIBCFIhBCIIggEEL/////D4N+fHwhECAPIBQgCSANhSINQiCIIA1C/////w+Dfnx8IRIgBiATIAggBYUiBUIgiCAFQv////8Pg358fCEIDAELIAdBwI0BaiEdQcAAIAdrIR4gAkHAAGohAAJAAkACQCAHQThNDQAgHiEfDAELAkACQEE4IAdrQQN2QQFqQQdxIh8NACACQcAAaiEAIB4hHwwBCyACQcAAaiEAIB9BA3QiICEfA0AgACAdKQMANwMAIABBCGohACAdQQhqIR0gH0F4aiIfDQALQcAAIAcgIGprIR8LAkAgBw0AA0AgACAd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IA8gFSAKIA2FIgVCIIggBUL/////D4N+fHwhCAsgAykDQyACKQM4hSIFQv////8PgyIGIAMpAzsgC4UiC0IgiCINfiIPQv////8PgyAFQiCIIgUgC0L/////D4MiC358IAYgC34iBkIgiHwiC0IghiAGQv////8Pg4QgD0IgiCAFIA1+fCALQiCIfIUgAykDMyARhSIFQv////8PgyIGIAMpAysgEIUiC0IgiCINfiIPQv////8PgyAFQiCIIgUgC0L/////D4MiC358IAYgC34iBkIgiHwiC0IghiAGQv////8Pg4QgD0IgiCAFIA1+fCALQiCIfIUgAykDIyAOhSIFQv////8PgyIGIAMpAxsgEoUiC0IgiCINfiIPQv////8PgyAFQiCIIgUgC0L/////D4MiC358IAYgC34iBkIgiHwiC0IghiAGQv////8Pg4QgD0IgiCAFIA1+fCALQiCIfIUgAykDEyAMhSIFQv////8PgyIGIAMpAwsgCIUiC0IgiCINfiIPQv////8PgyAFQiCIIgUgC0L/////D4MiC358IAYgC34iBkIgiHwiC0IghiAGQv////8Pg4QgD0IgiCAFIA1+fCALQiCIfIUgBEKHla+vmLbem55/fnx8fHwiBEIliCAEhUL5893xmfKZqxZ+IgRCIIggBIUhBAwBCyAEpyEAAkBBACkDoI4BIgRQDQACQCAAQRBLDQAgAEGACCAEEAUhBAwCCwJAIABBgAFLDQAgAEGACCAEEAYhBAwCCyAAQYAIIAQQByEEDAELAkAgAEEQSw0AIAAgA0IAEAUhBAwBCwJAIABBgAFLDQAgACADQgAQBiEEDAELIAAgA0IAEAchBAtBACAEQjiGIARCgP4Dg0IohoQgBEKAgPwHg0IYhiAEQoCAgPgPg0IIhoSEIARCCIhCgICA+A+DIARCGIhCgID8B4OEIARCKIhCgP4DgyAEQjiIhISENwOACiABJAALBgBBgIoBCwIACwvMAQEAQYAIC8QBuP5sOSOkS758AYEs9yGtHN7UbemDkJfbckCkpLezZx/LeeZOzMDleIJa0H3M/3IhuAhGdPdDJI7gNZDmgTomTDwoUruRwwDLiNBlixtTLqNxZEiXog35TjgZ70ap3qzYqPp2P+OcND/53LvHxwtPHYpR4EvNtFkxyJ9+ydl4c2TqxayDNNPrw8WBoP/6E2PrFw3dUbfw2knTFlUmKdRonisWvlh9R6H8j/i40XrQMc5FyzqPlRYEKK/X+8q7S0B+QAIAAA==",hash:"5a2fbdbb"};function C(A,I,g,C){return new(g||(g=Promise))((function(Q,i){function B(A){try{E(C.next(A))}catch(A){i(A)}}function e(A){try{E(C.throw(A))}catch(A){i(A)}}function E(A){var I;A.done?Q(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(B,e)}E((C=C.apply(A,I||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Q{constructor(){this.mutex=Promise.resolve()}lock(){let A=()=>{};return this.mutex=this.mutex.then((()=>new Promise(A))),new Promise((I=>{A=I}))}dispatch(A){return C(this,void 0,void 0,(function*(){const I=yield this.lock();try{return yield Promise.resolve(A())}finally{I()}}))}}const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,B=null!==(I=i.Buffer)&&void 0!==I?I:null,e=i.TextEncoder?new i.TextEncoder:null;function E(A,I){return(15&A)+(A>>6|A>>3&8)<<4|(15&I)+(I>>6|I>>3&8)}const t="a".charCodeAt(0)-10,n="0".charCodeAt(0);function D(A,I,g){let C=0;for(let Q=0;Q<g;Q++){let g=I[Q]>>>4;A[C++]=g>9?g+t:g+n,g=15&I[Q],A[C++]=g>9?g+t:g+n}return String.fromCharCode.apply(null,A)}const o=null!==B?A=>{if("string"==typeof A){const I=B.from(A,"utf8");return new Uint8Array(I.buffer,I.byteOffset,I.length)}if(B.isBuffer(A))return new Uint8Array(A.buffer,A.byteOffset,A.length);if(ArrayBuffer.isView(A))return new Uint8Array(A.buffer,A.byteOffset,A.byteLength);throw new Error("Invalid data type!")}:A=>{if("string"==typeof A)return e.encode(A);if(ArrayBuffer.isView(A))return new Uint8Array(A.buffer,A.byteOffset,A.byteLength);throw new Error("Invalid data type!")},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=new Uint8Array(256);for(let A=0;A<f.length;A++)w[f.charCodeAt(A)]=A;function r(A){const I=function(A){let I=Math.floor(.75*A.length);const g=A.length;return"="===A[g-1]&&(I-=1,"="===A[g-2]&&(I-=1)),I}(A),g=A.length,C=new Uint8Array(I);let Q=0;for(let I=0;I<g;I+=4){const g=w[A.charCodeAt(I)],i=w[A.charCodeAt(I+1)],B=w[A.charCodeAt(I+2)],e=w[A.charCodeAt(I+3)];C[Q]=g<<2|i>>4,Q+=1,C[Q]=(15&i)<<4|B>>2,Q+=1,C[Q]=(3&B)<<6|63&e,Q+=1}return C}const h=16384,s=new Q,a=new Map;function c(A,I){return C(this,void 0,void 0,(function*(){let g=null,Q=null,i=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const B=()=>new DataView(g.exports.memory.buffer).getUint32(g.exports.STATE_SIZE,!0),e=s.dispatch((()=>C(this,void 0,void 0,(function*(){if(!a.has(A.name)){const I=r(A.data),g=WebAssembly.compile(I);a.set(A.name,g)}const I=yield a.get(A.name);g=yield WebAssembly.instantiate(I,{})})))),t=(A=null)=>{i=!0,g.exports.Hash_Init(A)},n=A=>{if(!i)throw new Error("update() called before init()");(A=>{let I=0;for(;I<A.length;){const C=A.subarray(I,I+h);I+=C.length,Q.set(C),g.exports.Hash_Update(C.length)}})(o(A))},f=new Uint8Array(2*I),w=(A,C=null)=>{if(!i)throw new Error("digest() called before init()");return i=!1,g.exports.Hash_Final(C),"binary"===A?Q.slice(0,I):D(f,Q,I)},c=A=>"string"==typeof A?A.length<4096:A.byteLength<h;let y=c;switch(A.name){case"argon2":case"scrypt":y=()=>!0;break;case"blake2b":case"blake2s":y=(A,I)=>I<=512&&c(A);break;case"blake3":y=(A,I)=>0===I&&c(A);break;case"xxhash64":case"xxhash3":case"xxhash128":case"crc64":y=()=>!1}return yield(()=>C(this,void 0,void 0,(function*(){g||(yield e);const A=g.exports.Hash_GetBuffer(),I=g.exports.memory.buffer;Q=new Uint8Array(I,A,h)})))(),{getMemory:()=>Q,writeMemory:(A,I=0)=>{Q.set(A,I)},getExports:()=>g.exports,setMemorySize:A=>{g.exports.Hash_SetMemorySize(A);const I=g.exports.Hash_GetBuffer(),C=g.exports.memory.buffer;Q=new Uint8Array(C,I,A)},init:t,update:n,digest:w,save:()=>{if(!i)throw new Error("save() can only be called after init() and before digest()");const I=g.exports.Hash_GetState(),C=B(),Q=g.exports.memory.buffer,e=new Uint8Array(Q,I,C),t=new Uint8Array(4+C);return function(A,I){const g=I.length>>1;for(let C=0;C<g;C++){const g=C<<1;A[C]=E(I.charCodeAt(g),I.charCodeAt(g+1))}}(t,A.hash),t.set(e,4),t},load:I=>{if(!(I instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");const C=g.exports.Hash_GetState(),Q=B(),e=4+Q,t=g.exports.memory.buffer;if(I.length!==e)throw new Error(`Bad state length (expected ${e} bytes, got ${I.length})`);if(!function(A,I){if(A.length!==2*I.length)return!1;for(let g=0;g<I.length;g++){const C=g<<1;if(I[g]!==E(A.charCodeAt(C),A.charCodeAt(C+1)))return!1}return!0}(A.hash,I.subarray(0,4)))throw new Error("This state was written by an incompatible hash implementation");const n=I.subarray(4);new Uint8Array(t,C,Q).set(n),i=!0},calculate:(A,C=null,i=null)=>{if(!y(A,C))return t(C),n(A),w("hex",i);const B=o(A);return Q.set(B),g.exports.Hash_Calculate(B.length,C,i),D(f,Q,I)},hashLength:I}}))}const y=new Q;let k=null;const F=new Uint8Array(8);function M(A){return!Number.isInteger(A)||A<0||A>4294967295?new Error("Seed must be given as two valid 32-bit long unsigned integers (lo + high)."):null}function d(A,I,g){const C=new DataView(A);C.setUint32(0,I,!0),C.setUint32(4,g,!0)}A.createXXHash3=function(A=0,I=0){return M(A)?Promise.reject(M(A)):M(I)?Promise.reject(M(I)):c(g,8).then((g=>{const C=new Uint8Array(8);d(C.buffer,A,I),g.writeMemory(C),g.init();const Q={init:()=>(g.writeMemory(C),g.init(),Q),update:A=>(g.update(A),Q),digest:A=>g.digest(A),save:()=>g.save(),load:A=>(g.load(A),Q),blockSize:512,digestSize:8};return Q}))},A.xxhash3=function(A,I=0,Q=0){if(M(I))return Promise.reject(M(I));if(M(Q))return Promise.reject(M(Q));if(null===k)return function(A,I,g){return C(this,void 0,void 0,(function*(){const C=yield A.lock(),Q=yield c(I,g);return C(),Q}))}(y,g,8).then((g=>(k=g,d(F.buffer,I,Q),k.writeMemory(F),k.calculate(A))));try{d(F.buffer,I,Q),k.writeMemory(F);const g=k.calculate(A);return Promise.resolve(g)}catch(A){return Promise.reject(A)}}}));
|